1 |
- {"ast":null,"code":"import _asyncToGenerator from \"F:/workspace/202226701027/huinongbao-app/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js\";\nimport _awaitAsyncGenerator from \"F:/workspace/202226701027/huinongbao-app/node_modules/@babel/runtime/helpers/esm/awaitAsyncGenerator.js\";\nimport _wrapAsyncGenerator from \"F:/workspace/202226701027/huinongbao-app/node_modules/@babel/runtime/helpers/esm/wrapAsyncGenerator.js\";\nimport _asyncIterator from \"F:/workspace/202226701027/huinongbao-app/node_modules/@babel/runtime/helpers/esm/asyncIterator.js\";\nimport { applyPatch } from \"../utils/fast-json-patch/index.js\";\nimport { BaseTracer } from \"./base.js\";\nimport { IterableReadableStream } from \"../utils/stream.js\";\nimport { AIMessageChunk } from \"../messages/ai.js\";\n/**\n * List of jsonpatch JSONPatchOperations, which describe how to create the run state\n * from an empty dict. This is the minimal representation of the log, designed to\n * be serialized as JSON and sent over the wire to reconstruct the log on the other\n * side. Reconstruction of the state can be done with any jsonpatch-compliant library,\n * see https://jsonpatch.com for more information.\n */\nexport class RunLogPatch {\n constructor(fields) {\n var _fields$ops;\n Object.defineProperty(this, \"ops\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this.ops = (_fields$ops = fields.ops) !== null && _fields$ops !== void 0 ? _fields$ops : [];\n }\n concat(other) {\n const ops = this.ops.concat(other.ops);\n const states = applyPatch({}, ops);\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n return new RunLog({\n ops,\n state: states[states.length - 1].newDocument\n });\n }\n}\nexport class RunLog extends RunLogPatch {\n constructor(fields) {\n super(fields);\n Object.defineProperty(this, \"state\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this.state = fields.state;\n }\n concat(other) {\n const ops = this.ops.concat(other.ops);\n const states = applyPatch(this.state, other.ops);\n return new RunLog({\n ops,\n state: states[states.length - 1].newDocument\n });\n }\n static fromRunLogPatch(patch) {\n const states = applyPatch({}, patch.ops);\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n return new RunLog({\n ops: patch.ops,\n state: states[states.length - 1].newDocument\n });\n }\n}\nexport const isLogStreamHandler = handler => handler.name === \"log_stream_tracer\";\n/**\n * Extract standardized inputs from a run.\n *\n * Standardizes the inputs based on the type of the runnable used.\n *\n * @param run - Run object\n * @param schemaFormat - The schema format to use.\n *\n * @returns Valid inputs are only dict. By conventions, inputs always represented\n * invocation using named arguments.\n * A null means that the input is not yet known!\n */\nfunction _getStandardizedInputs(_x, _x2) {\n return _getStandardizedInputs2.apply(this, arguments);\n}\nfunction _getStandardizedInputs2() {\n _getStandardizedInputs2 = _asyncToGenerator(function* (run, schemaFormat) {\n if (schemaFormat === \"original\") {\n throw new Error(\"Do not assign inputs with original schema drop the key for now. \" + \"When inputs are added to streamLog they should be added with \" + \"standardized schema for streaming events.\");\n }\n const {\n inputs\n } = run;\n if ([\"retriever\", \"llm\", \"prompt\"].includes(run.run_type)) {\n return inputs;\n }\n if (Object.keys(inputs).length === 1 && (inputs === null || inputs === void 0 ? void 0 : inputs.input) === \"\") {\n return undefined;\n }\n // new style chains\n // These nest an additional 'input' key inside the 'inputs' to make sure\n // the input is always a dict. We need to unpack and user the inner value.\n // We should try to fix this in Runnables and callbacks/tracers\n // Runnables should be using a null type here not a placeholder\n // dict.\n return inputs.input;\n });\n return _getStandardizedInputs2.apply(this, arguments);\n}\nfunction _getStandardizedOutputs(_x3, _x4) {\n return _getStandardizedOutputs2.apply(this, arguments);\n}\nfunction _getStandardizedOutputs2() {\n _getStandardizedOutputs2 = _asyncToGenerator(function* (run, schemaFormat) {\n const {\n outputs\n } = run;\n if (schemaFormat === \"original\") {\n // Return the old schema, without standardizing anything\n return outputs;\n }\n if ([\"retriever\", \"llm\", \"prompt\"].includes(run.run_type)) {\n return outputs;\n }\n // TODO: Remove this hacky check\n if (outputs !== undefined && Object.keys(outputs).length === 1 && (outputs === null || outputs === void 0 ? void 0 : outputs.output) !== undefined) {\n return outputs.output;\n }\n return outputs;\n });\n return _getStandardizedOutputs2.apply(this, arguments);\n}\nfunction isChatGenerationChunk(x) {\n return x !== undefined && x.message !== undefined;\n}\n/**\n * Class that extends the `BaseTracer` class from the\n * `langchain.callbacks.tracers.base` module. It represents a callback\n * handler that logs the execution of runs and emits `RunLog` instances to a\n * `RunLogStream`.\n */\nexport class LogStreamCallbackHandler extends BaseTracer {\n constructor(fields) {\n var _fields$autoClose, _fields$_schemaFormat;\n super({\n _awaitHandler: true,\n ...fields\n });\n Object.defineProperty(this, \"autoClose\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: true\n });\n Object.defineProperty(this, \"includeNames\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"includeTypes\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"includeTags\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"excludeNames\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"excludeTypes\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"excludeTags\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_schemaFormat\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: \"original\"\n });\n Object.defineProperty(this, \"rootId\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"keyMapByRunId\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: {}\n });\n Object.defineProperty(this, \"counterMapByRunName\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: {}\n });\n Object.defineProperty(this, \"transformStream\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"writer\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"receiveStream\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"name\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: \"log_stream_tracer\"\n });\n this.autoClose = (_fields$autoClose = fields === null || fields === void 0 ? void 0 : fields.autoClose) !== null && _fields$autoClose !== void 0 ? _fields$autoClose : true;\n this.includeNames = fields === null || fields === void 0 ? void 0 : fields.includeNames;\n this.includeTypes = fields === null || fields === void 0 ? void 0 : fields.includeTypes;\n this.includeTags = fields === null || fields === void 0 ? void 0 : fields.includeTags;\n this.excludeNames = fields === null || fields === void 0 ? void 0 : fields.excludeNames;\n this.excludeTypes = fields === null || fields === void 0 ? void 0 : fields.excludeTypes;\n this.excludeTags = fields === null || fields === void 0 ? void 0 : fields.excludeTags;\n this._schemaFormat = (_fields$_schemaFormat = fields === null || fields === void 0 ? void 0 : fields._schemaFormat) !== null && _fields$_schemaFormat !== void 0 ? _fields$_schemaFormat : this._schemaFormat;\n this.transformStream = new TransformStream();\n this.writer = this.transformStream.writable.getWriter();\n this.receiveStream = IterableReadableStream.fromReadableStream(this.transformStream.readable);\n }\n [Symbol.asyncIterator]() {\n return this.receiveStream;\n }\n persistRun(_run) {\n return _asyncToGenerator(function* () {})();\n } // This is a legacy method only called once for an entire run tree\n // and is therefore not useful here\n _includeRun(run) {\n var _run$tags;\n if (run.id === this.rootId) {\n return false;\n }\n const runTags = (_run$tags = run.tags) !== null && _run$tags !== void 0 ? _run$tags : [];\n let include = this.includeNames === undefined && this.includeTags === undefined && this.includeTypes === undefined;\n if (this.includeNames !== undefined) {\n include = include || this.includeNames.includes(run.name);\n }\n if (this.includeTypes !== undefined) {\n include = include || this.includeTypes.includes(run.run_type);\n }\n if (this.includeTags !== undefined) {\n include = include || runTags.find(tag => {\n var _this$includeTags;\n return (_this$includeTags = this.includeTags) === null || _this$includeTags === void 0 ? void 0 : _this$includeTags.includes(tag);\n }) !== undefined;\n }\n if (this.excludeNames !== undefined) {\n include = include && !this.excludeNames.includes(run.name);\n }\n if (this.excludeTypes !== undefined) {\n include = include && !this.excludeTypes.includes(run.run_type);\n }\n if (this.excludeTags !== undefined) {\n include = include && runTags.every(tag => {\n var _this$excludeTags;\n return !((_this$excludeTags = this.excludeTags) !== null && _this$excludeTags !== void 0 && _this$excludeTags.includes(tag));\n });\n }\n return include;\n }\n tapOutputIterable(runId, output) {\n var _this = this;\n return _wrapAsyncGenerator(function* () {\n // Tap an output async iterator to stream its values to the log.\n var _iteratorAbruptCompletion = false;\n var _didIteratorError = false;\n var _iteratorError;\n try {\n for (var _iterator = _asyncIterator(output), _step; _iteratorAbruptCompletion = !(_step = yield _awaitAsyncGenerator(_iterator.next())).done; _iteratorAbruptCompletion = false) {\n const chunk = _step.value;\n {\n // root run is handled in .streamLog()\n if (runId !== _this.rootId) {\n // if we can't find the run silently ignore\n // eg. because this run wasn't included in the log\n const key = _this.keyMapByRunId[runId];\n if (key) {\n yield _awaitAsyncGenerator(_this.writer.write(new RunLogPatch({\n ops: [{\n op: \"add\",\n path: `/logs/${key}/streamed_output/-`,\n value: chunk\n }]\n })));\n }\n }\n yield chunk;\n }\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (_iteratorAbruptCompletion && _iterator.return != null) {\n yield _awaitAsyncGenerator(_iterator.return());\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n })();\n }\n onRunCreate(run) {\n var _this2 = this;\n return _asyncToGenerator(function* () {\n var _run$tags2, _run$extra$metadata, _run$extra;\n if (_this2.rootId === undefined) {\n _this2.rootId = run.id;\n yield _this2.writer.write(new RunLogPatch({\n ops: [{\n op: \"replace\",\n path: \"\",\n value: {\n id: run.id,\n name: run.name,\n type: run.run_type,\n streamed_output: [],\n final_output: undefined,\n logs: {}\n }\n }]\n }));\n }\n if (!_this2._includeRun(run)) {\n return;\n }\n if (_this2.counterMapByRunName[run.name] === undefined) {\n _this2.counterMapByRunName[run.name] = 0;\n }\n _this2.counterMapByRunName[run.name] += 1;\n const count = _this2.counterMapByRunName[run.name];\n _this2.keyMapByRunId[run.id] = count === 1 ? run.name : `${run.name}:${count}`;\n const logEntry = {\n id: run.id,\n name: run.name,\n type: run.run_type,\n tags: (_run$tags2 = run.tags) !== null && _run$tags2 !== void 0 ? _run$tags2 : [],\n metadata: (_run$extra$metadata = (_run$extra = run.extra) === null || _run$extra === void 0 ? void 0 : _run$extra.metadata) !== null && _run$extra$metadata !== void 0 ? _run$extra$metadata : {},\n start_time: new Date(run.start_time).toISOString(),\n streamed_output: [],\n streamed_output_str: [],\n final_output: undefined,\n end_time: undefined\n };\n if (_this2._schemaFormat === \"streaming_events\") {\n logEntry.inputs = yield _getStandardizedInputs(run, _this2._schemaFormat);\n }\n yield _this2.writer.write(new RunLogPatch({\n ops: [{\n op: \"add\",\n path: `/logs/${_this2.keyMapByRunId[run.id]}`,\n value: logEntry\n }]\n }));\n })();\n }\n onRunUpdate(run) {\n var _this3 = this;\n return _asyncToGenerator(function* () {\n try {\n const runName = _this3.keyMapByRunId[run.id];\n if (runName === undefined) {\n return;\n }\n const ops = [];\n if (_this3._schemaFormat === \"streaming_events\") {\n ops.push({\n op: \"replace\",\n path: `/logs/${runName}/inputs`,\n value: yield _getStandardizedInputs(run, _this3._schemaFormat)\n });\n }\n ops.push({\n op: \"add\",\n path: `/logs/${runName}/final_output`,\n value: yield _getStandardizedOutputs(run, _this3._schemaFormat)\n });\n if (run.end_time !== undefined) {\n ops.push({\n op: \"add\",\n path: `/logs/${runName}/end_time`,\n value: new Date(run.end_time).toISOString()\n });\n }\n const patch = new RunLogPatch({\n ops\n });\n yield _this3.writer.write(patch);\n } finally {\n if (run.id === _this3.rootId) {\n const patch = new RunLogPatch({\n ops: [{\n op: \"replace\",\n path: \"/final_output\",\n value: yield _getStandardizedOutputs(run, _this3._schemaFormat)\n }]\n });\n yield _this3.writer.write(patch);\n if (_this3.autoClose) {\n yield _this3.writer.close();\n }\n }\n }\n })();\n }\n onLLMNewToken(run, token, kwargs) {\n var _this4 = this;\n return _asyncToGenerator(function* () {\n const runName = _this4.keyMapByRunId[run.id];\n if (runName === undefined) {\n return;\n }\n // TODO: Remove hack\n const isChatModel = run.inputs.messages !== undefined;\n let streamedOutputValue;\n if (isChatModel) {\n if (isChatGenerationChunk(kwargs === null || kwargs === void 0 ? void 0 : kwargs.chunk)) {\n streamedOutputValue = kwargs === null || kwargs === void 0 ? void 0 : kwargs.chunk;\n } else {\n streamedOutputValue = new AIMessageChunk({\n id: `run-${run.id}`,\n content: token\n });\n }\n } else {\n streamedOutputValue = token;\n }\n const patch = new RunLogPatch({\n ops: [{\n op: \"add\",\n path: `/logs/${runName}/streamed_output_str/-`,\n value: token\n }, {\n op: \"add\",\n path: `/logs/${runName}/streamed_output/-`,\n value: streamedOutputValue\n }]\n });\n yield _this4.writer.write(patch);\n })();\n }\n}","map":{"version":3,"names":["applyPatch","BaseTracer","IterableReadableStream","AIMessageChunk","RunLogPatch","constructor","fields","_fields$ops","Object","defineProperty","enumerable","configurable","writable","value","ops","concat","other","states","RunLog","state","length","newDocument","fromRunLogPatch","patch","isLogStreamHandler","handler","name","_getStandardizedInputs","_x","_x2","_getStandardizedInputs2","apply","arguments","_asyncToGenerator","run","schemaFormat","Error","inputs","includes","run_type","keys","input","undefined","_getStandardizedOutputs","_x3","_x4","_getStandardizedOutputs2","outputs","output","isChatGenerationChunk","x","message","LogStreamCallbackHandler","_fields$autoClose","_fields$_schemaFormat","_awaitHandler","autoClose","includeNames","includeTypes","includeTags","excludeNames","excludeTypes","excludeTags","_schemaFormat","transformStream","TransformStream","writer","getWriter","receiveStream","fromReadableStream","readable","Symbol","asyncIterator","persistRun","_run","_includeRun","_run$tags","id","rootId","runTags","tags","include","find","tag","_this$includeTags","every","_this$excludeTags","tapOutputIterable","runId","_this","_wrapAsyncGenerator","_iteratorAbruptCompletion","_didIteratorError","_iteratorError","_iterator","_asyncIterator","_step","_awaitAsyncGenerator","next","done","chunk","key","keyMapByRunId","write","op","path","err","return","onRunCreate","_this2","_run$tags2","_run$extra$metadata","_run$extra","type","streamed_output","final_output","logs","counterMapByRunName","count","logEntry","metadata","extra","start_time","Date","toISOString","streamed_output_str","end_time","onRunUpdate","_this3","runName","push","close","onLLMNewToken","token","kwargs","_this4","isChatModel","messages","streamedOutputValue","content"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@langchain/core/dist/tracers/log_stream.js"],"sourcesContent":["import { applyPatch, } from \"../utils/fast-json-patch/index.js\";\nimport { BaseTracer } from \"./base.js\";\nimport { IterableReadableStream } from \"../utils/stream.js\";\nimport { AIMessageChunk } from \"../messages/ai.js\";\n/**\n * List of jsonpatch JSONPatchOperations, which describe how to create the run state\n * from an empty dict. This is the minimal representation of the log, designed to\n * be serialized as JSON and sent over the wire to reconstruct the log on the other\n * side. Reconstruction of the state can be done with any jsonpatch-compliant library,\n * see https://jsonpatch.com for more information.\n */\nexport class RunLogPatch {\n constructor(fields) {\n Object.defineProperty(this, \"ops\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this.ops = fields.ops ?? [];\n }\n concat(other) {\n const ops = this.ops.concat(other.ops);\n const states = applyPatch({}, ops);\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n return new RunLog({\n ops,\n state: states[states.length - 1].newDocument,\n });\n }\n}\nexport class RunLog extends RunLogPatch {\n constructor(fields) {\n super(fields);\n Object.defineProperty(this, \"state\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this.state = fields.state;\n }\n concat(other) {\n const ops = this.ops.concat(other.ops);\n const states = applyPatch(this.state, other.ops);\n return new RunLog({ ops, state: states[states.length - 1].newDocument });\n }\n static fromRunLogPatch(patch) {\n const states = applyPatch({}, patch.ops);\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n return new RunLog({\n ops: patch.ops,\n state: states[states.length - 1].newDocument,\n });\n }\n}\nexport const isLogStreamHandler = (handler) => handler.name === \"log_stream_tracer\";\n/**\n * Extract standardized inputs from a run.\n *\n * Standardizes the inputs based on the type of the runnable used.\n *\n * @param run - Run object\n * @param schemaFormat - The schema format to use.\n *\n * @returns Valid inputs are only dict. By conventions, inputs always represented\n * invocation using named arguments.\n * A null means that the input is not yet known!\n */\nasync function _getStandardizedInputs(run, schemaFormat) {\n if (schemaFormat === \"original\") {\n throw new Error(\"Do not assign inputs with original schema drop the key for now. \" +\n \"When inputs are added to streamLog they should be added with \" +\n \"standardized schema for streaming events.\");\n }\n const { inputs } = run;\n if ([\"retriever\", \"llm\", \"prompt\"].includes(run.run_type)) {\n return inputs;\n }\n if (Object.keys(inputs).length === 1 && inputs?.input === \"\") {\n return undefined;\n }\n // new style chains\n // These nest an additional 'input' key inside the 'inputs' to make sure\n // the input is always a dict. We need to unpack and user the inner value.\n // We should try to fix this in Runnables and callbacks/tracers\n // Runnables should be using a null type here not a placeholder\n // dict.\n return inputs.input;\n}\nasync function _getStandardizedOutputs(run, schemaFormat) {\n const { outputs } = run;\n if (schemaFormat === \"original\") {\n // Return the old schema, without standardizing anything\n return outputs;\n }\n if ([\"retriever\", \"llm\", \"prompt\"].includes(run.run_type)) {\n return outputs;\n }\n // TODO: Remove this hacky check\n if (outputs !== undefined &&\n Object.keys(outputs).length === 1 &&\n outputs?.output !== undefined) {\n return outputs.output;\n }\n return outputs;\n}\nfunction isChatGenerationChunk(x) {\n return x !== undefined && x.message !== undefined;\n}\n/**\n * Class that extends the `BaseTracer` class from the\n * `langchain.callbacks.tracers.base` module. It represents a callback\n * handler that logs the execution of runs and emits `RunLog` instances to a\n * `RunLogStream`.\n */\nexport class LogStreamCallbackHandler extends BaseTracer {\n constructor(fields) {\n super({ _awaitHandler: true, ...fields });\n Object.defineProperty(this, \"autoClose\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: true\n });\n Object.defineProperty(this, \"includeNames\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"includeTypes\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"includeTags\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"excludeNames\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"excludeTypes\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"excludeTags\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_schemaFormat\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: \"original\"\n });\n Object.defineProperty(this, \"rootId\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"keyMapByRunId\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: {}\n });\n Object.defineProperty(this, \"counterMapByRunName\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: {}\n });\n Object.defineProperty(this, \"transformStream\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"writer\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"receiveStream\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"name\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: \"log_stream_tracer\"\n });\n this.autoClose = fields?.autoClose ?? true;\n this.includeNames = fields?.includeNames;\n this.includeTypes = fields?.includeTypes;\n this.includeTags = fields?.includeTags;\n this.excludeNames = fields?.excludeNames;\n this.excludeTypes = fields?.excludeTypes;\n this.excludeTags = fields?.excludeTags;\n this._schemaFormat = fields?._schemaFormat ?? this._schemaFormat;\n this.transformStream = new TransformStream();\n this.writer = this.transformStream.writable.getWriter();\n this.receiveStream = IterableReadableStream.fromReadableStream(this.transformStream.readable);\n }\n [Symbol.asyncIterator]() {\n return this.receiveStream;\n }\n async persistRun(_run) {\n // This is a legacy method only called once for an entire run tree\n // and is therefore not useful here\n }\n _includeRun(run) {\n if (run.id === this.rootId) {\n return false;\n }\n const runTags = run.tags ?? [];\n let include = this.includeNames === undefined &&\n this.includeTags === undefined &&\n this.includeTypes === undefined;\n if (this.includeNames !== undefined) {\n include = include || this.includeNames.includes(run.name);\n }\n if (this.includeTypes !== undefined) {\n include = include || this.includeTypes.includes(run.run_type);\n }\n if (this.includeTags !== undefined) {\n include =\n include ||\n runTags.find((tag) => this.includeTags?.includes(tag)) !== undefined;\n }\n if (this.excludeNames !== undefined) {\n include = include && !this.excludeNames.includes(run.name);\n }\n if (this.excludeTypes !== undefined) {\n include = include && !this.excludeTypes.includes(run.run_type);\n }\n if (this.excludeTags !== undefined) {\n include =\n include && runTags.every((tag) => !this.excludeTags?.includes(tag));\n }\n return include;\n }\n async *tapOutputIterable(runId, output) {\n // Tap an output async iterator to stream its values to the log.\n for await (const chunk of output) {\n // root run is handled in .streamLog()\n if (runId !== this.rootId) {\n // if we can't find the run silently ignore\n // eg. because this run wasn't included in the log\n const key = this.keyMapByRunId[runId];\n if (key) {\n await this.writer.write(new RunLogPatch({\n ops: [\n {\n op: \"add\",\n path: `/logs/${key}/streamed_output/-`,\n value: chunk,\n },\n ],\n }));\n }\n }\n yield chunk;\n }\n }\n async onRunCreate(run) {\n if (this.rootId === undefined) {\n this.rootId = run.id;\n await this.writer.write(new RunLogPatch({\n ops: [\n {\n op: \"replace\",\n path: \"\",\n value: {\n id: run.id,\n name: run.name,\n type: run.run_type,\n streamed_output: [],\n final_output: undefined,\n logs: {},\n },\n },\n ],\n }));\n }\n if (!this._includeRun(run)) {\n return;\n }\n if (this.counterMapByRunName[run.name] === undefined) {\n this.counterMapByRunName[run.name] = 0;\n }\n this.counterMapByRunName[run.name] += 1;\n const count = this.counterMapByRunName[run.name];\n this.keyMapByRunId[run.id] =\n count === 1 ? run.name : `${run.name}:${count}`;\n const logEntry = {\n id: run.id,\n name: run.name,\n type: run.run_type,\n tags: run.tags ?? [],\n metadata: run.extra?.metadata ?? {},\n start_time: new Date(run.start_time).toISOString(),\n streamed_output: [],\n streamed_output_str: [],\n final_output: undefined,\n end_time: undefined,\n };\n if (this._schemaFormat === \"streaming_events\") {\n logEntry.inputs = await _getStandardizedInputs(run, this._schemaFormat);\n }\n await this.writer.write(new RunLogPatch({\n ops: [\n {\n op: \"add\",\n path: `/logs/${this.keyMapByRunId[run.id]}`,\n value: logEntry,\n },\n ],\n }));\n }\n async onRunUpdate(run) {\n try {\n const runName = this.keyMapByRunId[run.id];\n if (runName === undefined) {\n return;\n }\n const ops = [];\n if (this._schemaFormat === \"streaming_events\") {\n ops.push({\n op: \"replace\",\n path: `/logs/${runName}/inputs`,\n value: await _getStandardizedInputs(run, this._schemaFormat),\n });\n }\n ops.push({\n op: \"add\",\n path: `/logs/${runName}/final_output`,\n value: await _getStandardizedOutputs(run, this._schemaFormat),\n });\n if (run.end_time !== undefined) {\n ops.push({\n op: \"add\",\n path: `/logs/${runName}/end_time`,\n value: new Date(run.end_time).toISOString(),\n });\n }\n const patch = new RunLogPatch({ ops });\n await this.writer.write(patch);\n }\n finally {\n if (run.id === this.rootId) {\n const patch = new RunLogPatch({\n ops: [\n {\n op: \"replace\",\n path: \"/final_output\",\n value: await _getStandardizedOutputs(run, this._schemaFormat),\n },\n ],\n });\n await this.writer.write(patch);\n if (this.autoClose) {\n await this.writer.close();\n }\n }\n }\n }\n async onLLMNewToken(run, token, kwargs) {\n const runName = this.keyMapByRunId[run.id];\n if (runName === undefined) {\n return;\n }\n // TODO: Remove hack\n const isChatModel = run.inputs.messages !== undefined;\n let streamedOutputValue;\n if (isChatModel) {\n if (isChatGenerationChunk(kwargs?.chunk)) {\n streamedOutputValue = kwargs?.chunk;\n }\n else {\n streamedOutputValue = new AIMessageChunk({\n id: `run-${run.id}`,\n content: token,\n });\n }\n }\n else {\n streamedOutputValue = token;\n }\n const patch = new RunLogPatch({\n ops: [\n {\n op: \"add\",\n path: `/logs/${runName}/streamed_output_str/-`,\n value: token,\n },\n {\n op: \"add\",\n path: `/logs/${runName}/streamed_output/-`,\n value: streamedOutputValue,\n },\n ],\n });\n await this.writer.write(patch);\n }\n}\n"],"mappings":";;;;AAAA,SAASA,UAAU,QAAS,mCAAmC;AAC/D,SAASC,UAAU,QAAQ,WAAW;AACtC,SAASC,sBAAsB,QAAQ,oBAAoB;AAC3D,SAASC,cAAc,QAAQ,mBAAmB;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,WAAW,CAAC;EACrBC,WAAWA,CAACC,MAAM,EAAE;IAAA,IAAAC,WAAA;IAChBC,MAAM,CAACC,cAAc,CAAC,IAAI,EAAE,KAAK,EAAE;MAC/BC,UAAU,EAAE,IAAI;MAChBC,YAAY,EAAE,IAAI;MAClBC,QAAQ,EAAE,IAAI;MACdC,KAAK,EAAE,KAAK;IAChB,CAAC,CAAC;IACF,IAAI,CAACC,GAAG,IAAAP,WAAA,GAAGD,MAAM,CAACQ,GAAG,cAAAP,WAAA,cAAAA,WAAA,GAAI,EAAE;EAC/B;EACAQ,MAAMA,CAACC,KAAK,EAAE;IACV,MAAMF,GAAG,GAAG,IAAI,CAACA,GAAG,CAACC,MAAM,CAACC,KAAK,CAACF,GAAG,CAAC;IACtC,MAAMG,MAAM,GAAGjB,UAAU,CAAC,CAAC,CAAC,EAAEc,GAAG,CAAC;IAClC;IACA,OAAO,IAAII,MAAM,CAAC;MACdJ,GAAG;MACHK,KAAK,EAAEF,MAAM,CAACA,MAAM,CAACG,MAAM,GAAG,CAAC,CAAC,CAACC;IACrC,CAAC,CAAC;EACN;AACJ;AACA,OAAO,MAAMH,MAAM,SAASd,WAAW,CAAC;EACpCC,WAAWA,CAACC,MAAM,EAAE;IAChB,KAAK,CAACA,MAAM,CAAC;IACbE,MAAM,CAACC,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE;MACjCC,UAAU,EAAE,IAAI;MAChBC,YAAY,EAAE,IAAI;MAClBC,QAAQ,EAAE,IAAI;MACdC,KAAK,EAAE,KAAK;IAChB,CAAC,CAAC;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