Function traceable

  • 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.

    Type Parameters

    • Func extends (...args: any[]) => any

    Parameters

    • wrappedFunc: Func

      Targeted function to be traced

    • Optionalconfig: TraceableConfig<Func>

      Additional metadata such as name, tags or providing a custom LangSmith client instance

    Returns TraceableFunction<Func>