langchain.js
    Preparing search index...

    Type Alias TraceableConfig<Func>

    TraceableConfig: Partial<Omit<RunTreeConfig, "inputs" | "outputs">> & {
        __finalTracedIteratorKey?: string;
        aggregator?: (args: any[]) => any;
        argsConfigPath?: [number] | [number, string];
        extractAttachments?: (
            ...args: Parameters<Func>,
        ) => [Attachments | undefined, KVMap];
        getInvocationParams?: (
            ...args: Parameters<Func>,
        ) => InvocationParamsSchema | undefined;
        processInputs?: (
            inputs: Readonly<ProcessInputs<Parameters<Func>>>,
        ) => KVMap;
        processOutputs?: (
            outputs: Readonly<ProcessOutputs<Awaited<ReturnType<Func>>>>,
        ) => KVMap | Promise<KVMap>;
        tracer?: OTELTracer;
    }

    Type Parameters

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

    Type Declaration

    • Optional__finalTracedIteratorKey?: string
    • Optionalaggregator?: (args: any[]) => any
    • OptionalargsConfigPath?: [number] | [number, string]
    • OptionalextractAttachments?: (...args: Parameters<Func>) => [Attachments | undefined, KVMap]

      Extract attachments from args and return remaining args.

    • OptionalgetInvocationParams?: (...args: Parameters<Func>) => InvocationParamsSchema | undefined

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

    • OptionalprocessInputs?: (inputs: Readonly<ProcessInputs<Parameters<Func>>>) => KVMap

      Apply transformations to the inputs before logging. This function should NOT mutate the inputs. processInputs is not inherited by nested traceable functions.

      The input to this function is determined as follows based on the arguments passed to the wrapped function:

      • If called with one argument that is an object, it will be the unchanged argument
      • If called with one argument that is not an object, it will be { input: arg }
      • If called with multiple arguments, it will be { args: [...arguments] }
      • If called with no arguments, it will be an empty object {}
    • OptionalprocessOutputs?: (
          outputs: Readonly<ProcessOutputs<Awaited<ReturnType<Func>>>>,
      ) => KVMap | Promise<KVMap>

      Apply transformations to the outputs before logging. This function should NOT mutate the outputs. processOutputs is not inherited by nested traceable functions.

      The input to this function is determined as follows based on the return value of the wrapped function:

      • If the return value is an object, it will be the unchanged return value
      • If the return value is not an object, it will wrapped as { outputs: returnValue }
    • Optionaltracer?: OTELTracer