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.
traceable<Func extends (
args: any[]) => any>(wrappedFunc: Func, config: TraceableConfig<Func>
): TraceableFunction<Func>| Name | Type | Description |
|---|---|---|
wrappedFunc* | Func | Targeted function to be traced |
config | TraceableConfig<Func> | Additional metadata such as name, tags or providing a custom LangSmith client instance |