UNPKG

@langchain/core

Version:
1 lines • 1.14 kB
{"version":3,"file":"trace_policy.cjs","names":[],"sources":["../../src/tracers/trace_policy.ts"],"sourcesContent":["import type { KVMap } from \"langsmith/schemas\";\n\n/**\n * Transforms what `LangChainTracer` sends to LangSmith for a run. Execution\n * values and every other callback handler (including `streamEvents`) still\n * see the raw inputs and outputs. Processors receive the recorded values by\n * reference and must not mutate them.\n */\nexport interface TracePolicy {\n processInputs?: (inputs: KVMap) => KVMap;\n processOutputs?: (outputs: KVMap) => KVMap;\n}\n\n/**\n * Key a run's `extra` carries its policy under. A symbol, so the policy is\n * never serialized with the run.\n * @internal\n */\nexport const TRACE_POLICY_KEY = Symbol.for(\"langchain.trace_policy\");\n\n/**\n * Records an empty payload while keeping the run, its timing, and its children.\n * Use as `processInputs` and/or `processOutputs` in a {@link TracePolicy}.\n */\nexport function omitPayload(_payload: KVMap): KVMap {\n return {};\n}\n"],"mappings":";;;;;;AAkBA,MAAa,mBAAmB,OAAO,IAAI,wBAAwB;;;;;AAMnE,SAAgB,YAAY,UAAwB;CAClD,OAAO,CAAC;AACV"}