Targeted function to be traced
Optional
config: Partial<RunTreeConfig> & {Additional metadata such as name, tags or providing a custom LangSmith client instance
Optional
aggregator?: (args: any[]) => anyOptional
argsConfigPath?: [number] | [number, string]Optional
extractAttachments?: (...args: Parameters<Func>) => [undefined | Attachments, KVMap]Extract attachments from args and return remaining args.
Optional
getInvocationParams?: (...args: Parameters<Func>) => undefined | InvocationParamsSchemaExtract invocation parameters from the arguments of the traced function. This is useful for LangSmith to properly track common metadata like provider, model name and temperature.
Optional
processInputs?: (inputs: Readonly<KVMap>) => KVMapApply transformations to the inputs before logging.
This function should NOT mutate the inputs.
processInputs
is not inherited by nested traceable functions.
Optional
processOutputs?: (outputs: Readonly<KVMap>) => KVMapApply transformations to the outputs before logging.
This function should NOT mutate the outputs.
processOutputs
is not inherited by nested traceable functions.
Higher-order function that takes function as input and returns a "TraceableFunction" - a wrapped version of the input that automatically handles tracing. If the returned traceable function calls any traceable functions, those are automatically traced as well.
The returned TraceableFunction can accept a run tree or run tree config as its first argument. If omitted, it will default to the caller's run tree, or will be treated as a root run.