c64c8fcfd4ff03eb55ec3045635958357624d596a2a35b184b843bfb77600cba.json 62 KB

1
  1. {"ast":null,"code":"import _asyncToGenerator from \"F:/workspace/202226701027/huinongbao-app/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js\";\nimport * as uuid from \"uuid\";\nimport { getEnvironmentVariable, getRuntimeEnvironment } from \"./utils/env.js\";\nimport { Client } from \"./client.js\";\nimport { isTracingEnabled } from \"./env.js\";\nimport { warnOnce } from \"./utils/warn.js\";\nimport { _LC_CONTEXT_VARIABLES_KEY } from \"./singletons/constants.js\";\nfunction stripNonAlphanumeric(input) {\n return input.replace(/[-:.]/g, \"\");\n}\nexport function convertToDottedOrderFormat(epoch, runId, executionOrder = 1) {\n // Date only has millisecond precision, so we use the microseconds to break\n // possible ties, avoiding incorrect run order\n const paddedOrder = executionOrder.toFixed(0).slice(0, 3).padStart(3, \"0\");\n return stripNonAlphanumeric(`${new Date(epoch).toISOString().slice(0, -1)}${paddedOrder}Z`) + runId;\n}\n/**\n * Baggage header information\n */\nclass Baggage {\n constructor(metadata, tags) {\n Object.defineProperty(this, \"metadata\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"tags\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this.metadata = metadata;\n this.tags = tags;\n }\n static fromHeader(value) {\n const items = value.split(\",\");\n let metadata = {};\n let tags = [];\n for (const item of items) {\n const [key, uriValue] = item.split(\"=\");\n const value = decodeURIComponent(uriValue);\n if (key === \"langsmith-metadata\") {\n metadata = JSON.parse(value);\n } else if (key === \"langsmith-tags\") {\n tags = value.split(\",\");\n }\n }\n return new Baggage(metadata, tags);\n }\n toHeader() {\n const items = [];\n if (this.metadata && Object.keys(this.metadata).length > 0) {\n items.push(`langsmith-metadata=${encodeURIComponent(JSON.stringify(this.metadata))}`);\n }\n if (this.tags && this.tags.length > 0) {\n items.push(`langsmith-tags=${encodeURIComponent(this.tags.join(\",\"))}`);\n }\n return items.join(\",\");\n }\n}\nexport class RunTree {\n constructor(originalConfig) {\n var _config$client, _config$extra, _this$execution_order, _this$child_execution;\n Object.defineProperty(this, \"id\", {\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: void 0\n });\n Object.defineProperty(this, \"run_type\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"project_name\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"parent_run\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"child_runs\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"start_time\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"end_time\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"extra\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"tags\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"error\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"serialized\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"inputs\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"outputs\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"reference_example_id\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"client\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"events\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"trace_id\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"dotted_order\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"tracingEnabled\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"execution_order\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"child_execution_order\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n /**\n * Attachments associated with the run.\n * Each entry is a tuple of [mime_type, bytes]\n */\n Object.defineProperty(this, \"attachments\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n // If you pass in a run tree directly, return a shallow clone\n if (isRunTree(originalConfig)) {\n Object.assign(this, {\n ...originalConfig\n });\n return;\n }\n const defaultConfig = RunTree.getDefaultConfig();\n const {\n metadata,\n ...config\n } = originalConfig;\n const client = (_config$client = config.client) !== null && _config$client !== void 0 ? _config$client : RunTree.getSharedClient();\n const dedupedMetadata = {\n ...metadata,\n ...(config === null || config === void 0 || (_config$extra = config.extra) === null || _config$extra === void 0 ? void 0 : _config$extra.metadata)\n };\n config.extra = {\n ...config.extra,\n metadata: dedupedMetadata\n };\n Object.assign(this, {\n ...defaultConfig,\n ...config,\n client\n });\n if (!this.trace_id) {\n if (this.parent_run) {\n var _this$parent_run$trac;\n this.trace_id = (_this$parent_run$trac = this.parent_run.trace_id) !== null && _this$parent_run$trac !== void 0 ? _this$parent_run$trac : this.id;\n } else {\n this.trace_id = this.id;\n }\n }\n (_this$execution_order = this.execution_order) !== null && _this$execution_order !== void 0 ? _this$execution_order : this.execution_order = 1;\n (_this$child_execution = this.child_execution_order) !== null && _this$child_execution !== void 0 ? _this$child_execution : this.child_execution_order = 1;\n if (!this.dotted_order) {\n const currentDottedOrder = convertToDottedOrderFormat(this.start_time, this.id, this.execution_order);\n if (this.parent_run) {\n this.dotted_order = this.parent_run.dotted_order + \".\" + currentDottedOrder;\n } else {\n this.dotted_order = currentDottedOrder;\n }\n }\n }\n static getDefaultConfig() {\n var _ref, _getEnvironmentVariab, _getEnvironmentVariab2;\n return {\n id: uuid.v4(),\n run_type: \"chain\",\n project_name: (_ref = (_getEnvironmentVariab = getEnvironmentVariable(\"LANGCHAIN_PROJECT\")) !== null && _getEnvironmentVariab !== void 0 ? _getEnvironmentVariab : getEnvironmentVariable(\"LANGCHAIN_SESSION\")) !== null && _ref !== void 0 ? _ref :\n // TODO: Deprecate\n \"default\",\n child_runs: [],\n api_url: (_getEnvironmentVariab2 = getEnvironmentVariable(\"LANGCHAIN_ENDPOINT\")) !== null && _getEnvironmentVariab2 !== void 0 ? _getEnvironmentVariab2 : \"http://localhost:1984\",\n api_key: getEnvironmentVariable(\"LANGCHAIN_API_KEY\"),\n caller_options: {},\n start_time: Date.now(),\n serialized: {},\n inputs: {},\n extra: {}\n };\n }\n static getSharedClient() {\n if (!RunTree.sharedClient) {\n RunTree.sharedClient = new Client();\n }\n return RunTree.sharedClient;\n }\n createChild(config) {\n var _config$extra$LC_CHIL, _config$extra2;\n const child_execution_order = this.child_execution_order + 1;\n const child = new RunTree({\n ...config,\n parent_run: this,\n project_name: this.project_name,\n client: this.client,\n tracingEnabled: this.tracingEnabled,\n execution_order: child_execution_order,\n child_execution_order: child_execution_order\n });\n // Copy context vars over into the new run tree.\n if (_LC_CONTEXT_VARIABLES_KEY in this) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n child[_LC_CONTEXT_VARIABLES_KEY] = this[_LC_CONTEXT_VARIABLES_KEY];\n }\n const LC_CHILD = Symbol.for(\"lc:child_config\");\n const presentConfig = (_config$extra$LC_CHIL = (_config$extra2 = config.extra) === null || _config$extra2 === void 0 ? void 0 : _config$extra2[LC_CHILD]) !== null && _config$extra$LC_CHIL !== void 0 ? _config$extra$LC_CHIL : this.extra[LC_CHILD];\n // tracing for LangChain is defined by the _parentRunId and runMap of the tracer\n if (isRunnableConfigLike(presentConfig)) {\n var _newConfig$callbacks$, _newConfig$callbacks;\n const newConfig = {\n ...presentConfig\n };\n const callbacks = isCallbackManagerLike(newConfig.callbacks) ? (_newConfig$callbacks$ = (_newConfig$callbacks = newConfig.callbacks).copy) === null || _newConfig$callbacks$ === void 0 ? void 0 : _newConfig$callbacks$.call(_newConfig$callbacks) : undefined;\n if (callbacks) {\n var _callbacks$handlers, _callbacks$handlers$u;\n // update the parent run id\n Object.assign(callbacks, {\n _parentRunId: child.id\n });\n // only populate if we're in a newer LC.JS version\n (_callbacks$handlers = callbacks.handlers) === null || _callbacks$handlers === void 0 || (_callbacks$handlers = _callbacks$handlers.find(isLangChainTracerLike)) === null || _callbacks$handlers === void 0 || (_callbacks$handlers$u = _callbacks$handlers.updateFromRunTree) === null || _callbacks$handlers$u === void 0 || _callbacks$handlers$u.call(_callbacks$handlers, child);\n newConfig.callbacks = callbacks;\n }\n child.extra[LC_CHILD] = newConfig;\n }\n // propagate child_execution_order upwards\n const visited = new Set();\n let current = this;\n while (current != null && !visited.has(current.id)) {\n visited.add(current.id);\n current.child_execution_order = Math.max(current.child_execution_order, child_execution_order);\n current = current.parent_run;\n }\n this.child_runs.push(child);\n return child;\n }\n end(outputs, error, endTime = Date.now(), metadata) {\n var _this = this;\n return _asyncToGenerator(function* () {\n var _this$outputs, _this$error, _this$end_time;\n _this.outputs = (_this$outputs = _this.outputs) !== null && _this$outputs !== void 0 ? _this$outputs : outputs;\n _this.error = (_this$error = _this.error) !== null && _this$error !== void 0 ? _this$error : error;\n _this.end_time = (_this$end_time = _this.end_time) !== null && _this$end_time !== void 0 ? _this$end_time : endTime;\n if (metadata && Object.keys(metadata).length > 0) {\n _this.extra = _this.extra ? {\n ..._this.extra,\n metadata: {\n ..._this.extra.metadata,\n ...metadata\n }\n } : {\n metadata\n };\n }\n })();\n }\n _convertToCreate(run, runtimeEnv, excludeChildRuns = true) {\n var _run$extra;\n const runExtra = (_run$extra = run.extra) !== null && _run$extra !== void 0 ? _run$extra : {};\n if (!runExtra.runtime) {\n runExtra.runtime = {};\n }\n if (runtimeEnv) {\n for (const [k, v] of Object.entries(runtimeEnv)) {\n if (!runExtra.runtime[k]) {\n runExtra.runtime[k] = v;\n }\n }\n }\n let child_runs;\n let parent_run_id;\n if (!excludeChildRuns) {\n child_runs = run.child_runs.map(child_run => this._convertToCreate(child_run, runtimeEnv, excludeChildRuns));\n parent_run_id = undefined;\n } else {\n var _run$parent_run;\n parent_run_id = (_run$parent_run = run.parent_run) === null || _run$parent_run === void 0 ? void 0 : _run$parent_run.id;\n child_runs = [];\n }\n const persistedRun = {\n id: run.id,\n name: run.name,\n start_time: run.start_time,\n end_time: run.end_time,\n run_type: run.run_type,\n reference_example_id: run.reference_example_id,\n extra: runExtra,\n serialized: run.serialized,\n error: run.error,\n inputs: run.inputs,\n outputs: run.outputs,\n session_name: run.project_name,\n child_runs: child_runs,\n parent_run_id: parent_run_id,\n trace_id: run.trace_id,\n dotted_order: run.dotted_order,\n tags: run.tags,\n attachments: run.attachments\n };\n return persistedRun;\n }\n postRun(excludeChildRuns = true) {\n var _this2 = this;\n return _asyncToGenerator(function* () {\n try {\n const runtimeEnv = getRuntimeEnvironment();\n const runCreate = yield _this2._convertToCreate(_this2, runtimeEnv, true);\n yield _this2.client.createRun(runCreate);\n if (!excludeChildRuns) {\n warnOnce(\"Posting with excludeChildRuns=false is deprecated and will be removed in a future version.\");\n for (const childRun of _this2.child_runs) {\n yield childRun.postRun(false);\n }\n }\n } catch (error) {\n console.error(`Error in postRun for run ${_this2.id}:`, error);\n }\n })();\n }\n patchRun() {\n var _this3 = this;\n return _asyncToGenerator(function* () {\n try {\n var _this3$parent_run;\n const runUpdate = {\n end_time: _this3.end_time,\n error: _this3.error,\n inputs: _this3.inputs,\n outputs: _this3.outputs,\n parent_run_id: (_this3$parent_run = _this3.parent_run) === null || _this3$parent_run === void 0 ? void 0 : _this3$parent_run.id,\n reference_example_id: _this3.reference_example_id,\n extra: _this3.extra,\n events: _this3.events,\n dotted_order: _this3.dotted_order,\n trace_id: _this3.trace_id,\n tags: _this3.tags,\n attachments: _this3.attachments\n };\n yield _this3.client.updateRun(_this3.id, runUpdate);\n } catch (error) {\n console.error(`Error in patchRun for run ${_this3.id}`, error);\n }\n })();\n }\n toJSON() {\n return this._convertToCreate(this, undefined, false);\n }\n static fromRunnableConfig(parentConfig, props) {\n var _parentRun$tags, _parentRun, _parentConfig$tags, _parentRun2;\n // We only handle the callback manager case for now\n const callbackManager = parentConfig === null || parentConfig === void 0 ? void 0 : parentConfig.callbacks;\n let parentRun;\n let projectName;\n let client;\n let tracingEnabled = isTracingEnabled();\n if (callbackManager) {\n var _callbackManager$getP, _callbackManager$getP2, _callbackManager$hand, _langChainTracer$getR;\n const parentRunId = (_callbackManager$getP = callbackManager === null || callbackManager === void 0 || (_callbackManager$getP2 = callbackManager.getParentRunId) === null || _callbackManager$getP2 === void 0 ? void 0 : _callbackManager$getP2.call(callbackManager)) !== null && _callbackManager$getP !== void 0 ? _callbackManager$getP : \"\";\n const langChainTracer = callbackManager === null || callbackManager === void 0 || (_callbackManager$hand = callbackManager.handlers) === null || _callbackManager$hand === void 0 ? void 0 : _callbackManager$hand.find(handler => (handler === null || handler === void 0 ? void 0 : handler.name) == \"langchain_tracer\");\n parentRun = langChainTracer === null || langChainTracer === void 0 || (_langChainTracer$getR = langChainTracer.getRun) === null || _langChainTracer$getR === void 0 ? void 0 : _langChainTracer$getR.call(langChainTracer, parentRunId);\n projectName = langChainTracer === null || langChainTracer === void 0 ? void 0 : langChainTracer.projectName;\n client = langChainTracer === null || langChainTracer === void 0 ? void 0 : langChainTracer.client;\n tracingEnabled = tracingEnabled || !!langChainTracer;\n }\n if (!parentRun) {\n return new RunTree({\n ...props,\n client,\n tracingEnabled,\n project_name: projectName\n });\n }\n const parentRunTree = new RunTree({\n name: parentRun.name,\n id: parentRun.id,\n trace_id: parentRun.trace_id,\n dotted_order: parentRun.dotted_order,\n client,\n tracingEnabled,\n project_name: projectName,\n tags: [...new Set(((_parentRun$tags = (_parentRun = parentRun) === null || _parentRun === void 0 ? void 0 : _parentRun.tags) !== null && _parentRun$tags !== void 0 ? _parentRun$tags : []).concat((_parentConfig$tags = parentConfig === null || parentConfig === void 0 ? void 0 : parentConfig.tags) !== null && _parentConfig$tags !== void 0 ? _parentConfig$tags : []))],\n extra: {\n metadata: {\n ...((_parentRun2 = parentRun) === null || _parentRun2 === void 0 || (_parentRun2 = _parentRun2.extra) === null || _parentRun2 === void 0 ? void 0 : _parentRun2.metadata),\n ...(parentConfig === null || parentConfig === void 0 ? void 0 : parentConfig.metadata)\n }\n }\n });\n return parentRunTree.createChild(props);\n }\n static fromDottedOrder(dottedOrder) {\n return this.fromHeaders({\n \"langsmith-trace\": dottedOrder\n });\n }\n static fromHeaders(headers, inheritArgs) {\n var _inheritArgs$name, _inheritArgs$run_type, _inheritArgs$start_ti, _parsedDottedOrder$at;\n const rawHeaders = \"get\" in headers && typeof headers.get === \"function\" ? {\n \"langsmith-trace\": headers.get(\"langsmith-trace\"),\n baggage: headers.get(\"baggage\")\n } : headers;\n const headerTrace = rawHeaders[\"langsmith-trace\"];\n if (!headerTrace || typeof headerTrace !== \"string\") return undefined;\n const parentDottedOrder = headerTrace.trim();\n const parsedDottedOrder = parentDottedOrder.split(\".\").map(part => {\n const [strTime, uuid] = part.split(\"Z\");\n return {\n strTime,\n time: Date.parse(strTime + \"Z\"),\n uuid\n };\n });\n const traceId = parsedDottedOrder[0].uuid;\n const config = {\n ...inheritArgs,\n name: (_inheritArgs$name = inheritArgs === null || inheritArgs === void 0 ? void 0 : inheritArgs[\"name\"]) !== null && _inheritArgs$name !== void 0 ? _inheritArgs$name : \"parent\",\n run_type: (_inheritArgs$run_type = inheritArgs === null || inheritArgs === void 0 ? void 0 : inheritArgs[\"run_type\"]) !== null && _inheritArgs$run_type !== void 0 ? _inheritArgs$run_type : \"chain\",\n start_time: (_inheritArgs$start_ti = inheritArgs === null || inheritArgs === void 0 ? void 0 : inheritArgs[\"start_time\"]) !== null && _inheritArgs$start_ti !== void 0 ? _inheritArgs$start_ti : Date.now(),\n id: (_parsedDottedOrder$at = parsedDottedOrder.at(-1)) === null || _parsedDottedOrder$at === void 0 ? void 0 : _parsedDottedOrder$at.uuid,\n trace_id: traceId,\n dotted_order: parentDottedOrder\n };\n if (rawHeaders[\"baggage\"] && typeof rawHeaders[\"baggage\"] === \"string\") {\n const baggage = Baggage.fromHeader(rawHeaders[\"baggage\"]);\n config.metadata = baggage.metadata;\n config.tags = baggage.tags;\n }\n return new RunTree(config);\n }\n toHeaders(headers) {\n var _this$extra;\n const result = {\n \"langsmith-trace\": this.dotted_order,\n baggage: new Baggage((_this$extra = this.extra) === null || _this$extra === void 0 ? void 0 : _this$extra.metadata, this.tags).toHeader()\n };\n if (headers) {\n for (const [key, value] of Object.entries(result)) {\n headers.set(key, value);\n }\n }\n return result;\n }\n}\nObject.defineProperty(RunTree, \"sharedClient\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: null\n});\nexport function isRunTree(x) {\n return x !== undefined && typeof x.createChild === \"function\" && typeof x.postRun === \"function\";\n}\nfunction isLangChainTracerLike(x) {\n return typeof x === \"object\" && x != null && typeof x.name === \"string\" && x.name === \"langchain_tracer\";\n}\nfunction containsLangChainTracerLike(x) {\n return Array.isArray(x) && x.some(callback => isLangChainTracerLike(callback));\n}\nfunction isCallbackManagerLike(x) {\n return typeof x === \"object\" && x != null && Array.isArray(x.handlers);\n}\nexport function isRunnableConfigLike(x) {\n var _x$callbacks;\n // Check that it's an object with a callbacks arg\n // that has either a CallbackManagerLike object with a langchain tracer within it\n // or an array with a LangChainTracerLike object within it\n return x !== undefined && typeof x.callbacks === \"object\" && (\n // Callback manager with a langchain tracer\n containsLangChainTracerLike((_x$callbacks = x.callbacks) === null || _x$callbacks === void 0 ? void 0 : _x$callbacks.handlers) ||\n // Or it's an array with a LangChainTracerLike object within it\n containsLangChainTracerLike(x.callbacks));\n}","map":{"version":3,"names":["uuid","getEnvironmentVariable","getRuntimeEnvironment","Client","isTracingEnabled","warnOnce","_LC_CONTEXT_VARIABLES_KEY","stripNonAlphanumeric","input","replace","convertToDottedOrderFormat","epoch","runId","executionOrder","paddedOrder","toFixed","slice","padStart","Date","toISOString","Baggage","constructor","metadata","tags","Object","defineProperty","enumerable","configurable","writable","value","fromHeader","items","split","item","key","uriValue","decodeURIComponent","JSON","parse","toHeader","keys","length","push","encodeURIComponent","stringify","join","RunTree","originalConfig","_config$client","_config$extra","_this$execution_order","_this$child_execution","isRunTree","assign","defaultConfig","getDefaultConfig","config","client","getSharedClient","dedupedMetadata","extra","trace_id","parent_run","_this$parent_run$trac","id","execution_order","child_execution_order","dotted_order","currentDottedOrder","start_time","_ref","_getEnvironmentVariab","_getEnvironmentVariab2","v4","run_type","project_name","child_runs","api_url","api_key","caller_options","now","serialized","inputs","sharedClient","createChild","_config$extra$LC_CHIL","_config$extra2","child","tracingEnabled","LC_CHILD","Symbol","for","presentConfig","isRunnableConfigLike","_newConfig$callbacks$","_newConfig$callbacks","newConfig","callbacks","isCallbackManagerLike","copy","call","undefined","_callbacks$handlers","_callbacks$handlers$u","_parentRunId","handlers","find","isLangChainTracerLike","updateFromRunTree","visited","Set","current","has","add","Math","max","end","outputs","error","endTime","_this","_asyncToGenerator","_this$outputs","_this$error","_this$end_time","end_time","_convertToCreate","run","runtimeEnv","excludeChildRuns","_run$extra","runExtra","runtime","k","v","entries","parent_run_id","map","child_run","_run$parent_run","persistedRun","name","reference_example_id","session_name","attachments","postRun","_this2","runCreate","createRun","childRun","console","patchRun","_this3","_this3$parent_run","runUpdate","events","updateRun","toJSON","fromRunnableConfig","parentConfig","props","_parentRun$tags","_parentRun","_parentConfig$tags","_parentRun2","callbackManager","parentRun","projectName","_callbackManager$getP","_callbackManager$getP2","_callbackManager$hand","_langChainTracer$getR","parentRunId","getParentRunId","langChainTracer","handler","getRun","parentRunTree","concat","fromDottedOrder","dottedOrder","fromHeaders","headers","inheritArgs","_inheritArgs$name","_inheritArgs$run_type","_inheritArgs$start_ti","_parsedDottedOrder$at","rawHeaders","get","baggage","headerTrace","parentDottedOrder","trim","parsedDottedOrder","part","strTime","time","traceId","at","toHeaders","_this$extra","result","set","x","containsLangChainTracerLike","Array","isArray","some","callback","_x$callbacks"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/langsmith/dist/run_trees.js"],"sourcesContent":["import * as uuid from \"uuid\";\nimport { getEnvironmentVariable, getRuntimeEnvironment, } from \"./utils/env.js\";\nimport { Client } from \"./client.js\";\nimport { isTracingEnabled } from \"./env.js\";\nimport { warnOnce } from \"./utils/warn.js\";\nimport { _LC_CONTEXT_VARIABLES_KEY } from \"./singletons/constants.js\";\nfunction stripNonAlphanumeric(input) {\n return input.replace(/[-:.]/g, \"\");\n}\nexport function convertToDottedOrderFormat(epoch, runId, executionOrder = 1) {\n // Date only has millisecond precision, so we use the microseconds to break\n // possible ties, avoiding incorrect run order\n const paddedOrder = executionOrder.toFixed(0).slice(0, 3).padStart(3, \"0\");\n return (stripNonAlphanumeric(`${new Date(epoch).toISOString().slice(0, -1)}${paddedOrder}Z`) + runId);\n}\n/**\n * Baggage header information\n */\nclass Baggage {\n constructor(metadata, tags) {\n Object.defineProperty(this, \"metadata\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"tags\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this.metadata = metadata;\n this.tags = tags;\n }\n static fromHeader(value) {\n const items = value.split(\",\");\n let metadata = {};\n let tags = [];\n for (const item of items) {\n const [key, uriValue] = item.split(\"=\");\n const value = decodeURIComponent(uriValue);\n if (key === \"langsmith-metadata\") {\n metadata = JSON.parse(value);\n }\n else if (key === \"langsmith-tags\") {\n tags = value.split(\",\");\n }\n }\n return new Baggage(metadata, tags);\n }\n toHeader() {\n const items = [];\n if (this.metadata && Object.keys(this.metadata).length > 0) {\n items.push(`langsmith-metadata=${encodeURIComponent(JSON.stringify(this.metadata))}`);\n }\n if (this.tags && this.tags.length > 0) {\n items.push(`langsmith-tags=${encodeURIComponent(this.tags.join(\",\"))}`);\n }\n return items.join(\",\");\n }\n}\nexport class RunTree {\n constructor(originalConfig) {\n Object.defineProperty(this, \"id\", {\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: void 0\n });\n Object.defineProperty(this, \"run_type\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"project_name\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"parent_run\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"child_runs\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"start_time\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"end_time\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"extra\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"tags\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"error\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"serialized\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"inputs\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"outputs\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"reference_example_id\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"client\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"events\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"trace_id\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"dotted_order\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"tracingEnabled\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"execution_order\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"child_execution_order\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n /**\n * Attachments associated with the run.\n * Each entry is a tuple of [mime_type, bytes]\n */\n Object.defineProperty(this, \"attachments\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n // If you pass in a run tree directly, return a shallow clone\n if (isRunTree(originalConfig)) {\n Object.assign(this, { ...originalConfig });\n return;\n }\n const defaultConfig = RunTree.getDefaultConfig();\n const { metadata, ...config } = originalConfig;\n const client = config.client ?? RunTree.getSharedClient();\n const dedupedMetadata = {\n ...metadata,\n ...config?.extra?.metadata,\n };\n config.extra = { ...config.extra, metadata: dedupedMetadata };\n Object.assign(this, { ...defaultConfig, ...config, client });\n if (!this.trace_id) {\n if (this.parent_run) {\n this.trace_id = this.parent_run.trace_id ?? this.id;\n }\n else {\n this.trace_id = this.id;\n }\n }\n this.execution_order ??= 1;\n this.child_execution_order ??= 1;\n if (!this.dotted_order) {\n const currentDottedOrder = convertToDottedOrderFormat(this.start_time, this.id, this.execution_order);\n if (this.parent_run) {\n this.dotted_order =\n this.parent_run.dotted_order + \".\" + currentDottedOrder;\n }\n else {\n this.dotted_order = currentDottedOrder;\n }\n }\n }\n static getDefaultConfig() {\n return {\n id: uuid.v4(),\n run_type: \"chain\",\n project_name: getEnvironmentVariable(\"LANGCHAIN_PROJECT\") ??\n getEnvironmentVariable(\"LANGCHAIN_SESSION\") ?? // TODO: Deprecate\n \"default\",\n child_runs: [],\n api_url: getEnvironmentVariable(\"LANGCHAIN_ENDPOINT\") ?? \"http://localhost:1984\",\n api_key: getEnvironmentVariable(\"LANGCHAIN_API_KEY\"),\n caller_options: {},\n start_time: Date.now(),\n serialized: {},\n inputs: {},\n extra: {},\n };\n }\n static getSharedClient() {\n if (!RunTree.sharedClient) {\n RunTree.sharedClient = new Client();\n }\n return RunTree.sharedClient;\n }\n createChild(config) {\n const child_execution_order = this.child_execution_order + 1;\n const child = new RunTree({\n ...config,\n parent_run: this,\n project_name: this.project_name,\n client: this.client,\n tracingEnabled: this.tracingEnabled,\n execution_order: child_execution_order,\n child_execution_order: child_execution_order,\n });\n // Copy context vars over into the new run tree.\n if (_LC_CONTEXT_VARIABLES_KEY in this) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n child[_LC_CONTEXT_VARIABLES_KEY] =\n this[_LC_CONTEXT_VARIABLES_KEY];\n }\n const LC_CHILD = Symbol.for(\"lc:child_config\");\n const presentConfig = config.extra?.[LC_CHILD] ??\n this.extra[LC_CHILD];\n // tracing for LangChain is defined by the _parentRunId and runMap of the tracer\n if (isRunnableConfigLike(presentConfig)) {\n const newConfig = { ...presentConfig };\n const callbacks = isCallbackManagerLike(newConfig.callbacks)\n ? newConfig.callbacks.copy?.()\n : undefined;\n if (callbacks) {\n // update the parent run id\n Object.assign(callbacks, { _parentRunId: child.id });\n // only populate if we're in a newer LC.JS version\n callbacks.handlers\n ?.find(isLangChainTracerLike)\n ?.updateFromRunTree?.(child);\n newConfig.callbacks = callbacks;\n }\n child.extra[LC_CHILD] = newConfig;\n }\n // propagate child_execution_order upwards\n const visited = new Set();\n let current = this;\n while (current != null && !visited.has(current.id)) {\n visited.add(current.id);\n current.child_execution_order = Math.max(current.child_execution_order, child_execution_order);\n current = current.parent_run;\n }\n this.child_runs.push(child);\n return child;\n }\n async end(outputs, error, endTime = Date.now(), metadata) {\n this.outputs = this.outputs ?? outputs;\n this.error = this.error ?? error;\n this.end_time = this.end_time ?? endTime;\n if (metadata && Object.keys(metadata).length > 0) {\n this.extra = this.extra\n ? { ...this.extra, metadata: { ...this.extra.metadata, ...metadata } }\n : { metadata };\n }\n }\n _convertToCreate(run, runtimeEnv, excludeChildRuns = true) {\n const runExtra = run.extra ?? {};\n if (!runExtra.runtime) {\n runExtra.runtime = {};\n }\n if (runtimeEnv) {\n for (const [k, v] of Object.entries(runtimeEnv)) {\n if (!runExtra.runtime[k]) {\n runExtra.runtime[k] = v;\n }\n }\n }\n let child_runs;\n let parent_run_id;\n if (!excludeChildRuns) {\n child_runs = run.child_runs.map((child_run) => this._convertToCreate(child_run, runtimeEnv, excludeChildRuns));\n parent_run_id = undefined;\n }\n else {\n parent_run_id = run.parent_run?.id;\n child_runs = [];\n }\n const persistedRun = {\n id: run.id,\n name: run.name,\n start_time: run.start_time,\n end_time: run.end_time,\n run_type: run.run_type,\n reference_example_id: run.reference_example_id,\n extra: runExtra,\n serialized: run.serialized,\n error: run.error,\n inputs: run.inputs,\n outputs: run.outputs,\n session_name: run.project_name,\n child_runs: child_runs,\n parent_run_id: parent_run_id,\n trace_id: run.trace_id,\n dotted_order: run.dotted_order,\n tags: run.tags,\n attachments: run.attachments,\n };\n return persistedRun;\n }\n async postRun(excludeChildRuns = true) {\n try {\n const runtimeEnv = getRuntimeEnvironment();\n const runCreate = await this._convertToCreate(this, runtimeEnv, true);\n await this.client.createRun(runCreate);\n if (!excludeChildRuns) {\n warnOnce(\"Posting with excludeChildRuns=false is deprecated and will be removed in a future version.\");\n for (const childRun of this.child_runs) {\n await childRun.postRun(false);\n }\n }\n }\n catch (error) {\n console.error(`Error in postRun for run ${this.id}:`, error);\n }\n }\n async patchRun() {\n try {\n const runUpdate = {\n end_time: this.end_time,\n error: this.error,\n inputs: this.inputs,\n outputs: this.outputs,\n parent_run_id: this.parent_run?.id,\n reference_example_id: this.reference_example_id,\n extra: this.extra,\n events: this.events,\n dotted_order: this.dotted_order,\n trace_id: this.trace_id,\n tags: this.tags,\n attachments: this.attachments,\n };\n await this.client.updateRun(this.id, runUpdate);\n }\n catch (error) {\n console.error(`Error in patchRun for run ${this.id}`, error);\n }\n }\n toJSON() {\n return this._convertToCreate(this, undefined, false);\n }\n static fromRunnableConfig(parentConfig, props) {\n // We only handle the callback manager case for now\n const callbackManager = parentConfig?.callbacks;\n let parentRun;\n let projectName;\n let client;\n let tracingEnabled = isTracingEnabled();\n if (callbackManager) {\n const parentRunId = callbackManager?.getParentRunId?.() ?? \"\";\n const langChainTracer = callbackManager?.handlers?.find((handler) => handler?.name == \"langchain_tracer\");\n parentRun = langChainTracer?.getRun?.(parentRunId);\n projectName = langChainTracer?.projectName;\n client = langChainTracer?.client;\n tracingEnabled = tracingEnabled || !!langChainTracer;\n }\n if (!parentRun) {\n return new RunTree({\n ...props,\n client,\n tracingEnabled,\n project_name: projectName,\n });\n }\n const parentRunTree = new RunTree({\n name: parentRun.name,\n id: parentRun.id,\n trace_id: parentRun.trace_id,\n dotted_order: parentRun.dotted_order,\n client,\n tracingEnabled,\n project_name: projectName,\n tags: [\n ...new Set((parentRun?.tags ?? []).concat(parentConfig?.tags ?? [])),\n ],\n extra: {\n metadata: {\n ...parentRun?.extra?.metadata,\n ...parentConfig?.metadata,\n },\n },\n });\n return parentRunTree.createChild(props);\n }\n static fromDottedOrder(dottedOrder) {\n return this.fromHeaders({ \"langsmith-trace\": dottedOrder });\n }\n static fromHeaders(headers, inheritArgs) {\n const rawHeaders = \"get\" in headers && typeof headers.get === \"function\"\n ? {\n \"langsmith-trace\": headers.get(\"langsmith-trace\"),\n baggage: headers.get(\"baggage\"),\n }\n : headers;\n const headerTrace = rawHeaders[\"langsmith-trace\"];\n if (!headerTrace || typeof headerTrace !== \"string\")\n return undefined;\n const parentDottedOrder = headerTrace.trim();\n const parsedDottedOrder = parentDottedOrder.split(\".\").map((part) => {\n const [strTime, uuid] = part.split(\"Z\");\n return { strTime, time: Date.parse(strTime + \"Z\"), uuid };\n });\n const traceId = parsedDottedOrder[0].uuid;\n const config = {\n ...inheritArgs,\n name: inheritArgs?.[\"name\"] ?? \"parent\",\n run_type: inheritArgs?.[\"run_type\"] ?? \"chain\",\n start_time: inheritArgs?.[\"start_time\"] ?? Date.now(),\n id: parsedDottedOrder.at(-1)?.uuid,\n trace_id: traceId,\n dotted_order: parentDottedOrder,\n };\n if (rawHeaders[\"baggage\"] && typeof rawHeaders[\"baggage\"] === \"string\") {\n const baggage = Baggage.fromHeader(rawHeaders[\"baggage\"]);\n config.metadata = baggage.metadata;\n config.tags = baggage.tags;\n }\n return new RunTree(config);\n }\n toHeaders(headers) {\n const result = {\n \"langsmith-trace\": this.dotted_order,\n baggage: new Baggage(this.extra?.metadata, this.tags).toHeader(),\n };\n if (headers) {\n for (const [key, value] of Object.entries(result)) {\n headers.set(key, value);\n }\n }\n return result;\n }\n}\nObject.defineProperty(RunTree, \"sharedClient\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: null\n});\nexport function isRunTree(x) {\n return (x !== undefined &&\n typeof x.createChild === \"function\" &&\n typeof x.postRun === \"function\");\n}\nfunction isLangChainTracerLike(x) {\n return (typeof x === \"object\" &&\n x != null &&\n typeof x.name === \"string\" &&\n x.name === \"langchain_tracer\");\n}\nfunction containsLangChainTracerLike(x) {\n return (Array.isArray(x) && x.some((callback) => isLangChainTracerLike(callback)));\n}\nfunction isCallbackManagerLike(x) {\n return (typeof x === \"object\" &&\n x != null &&\n Array.isArray(x.handlers));\n}\nexport function isRunnableConfigLike(x) {\n // Check that it's an object with a callbacks arg\n // that has either a CallbackManagerLike object with a langchain tracer within it\n // or an array with a LangChainTracerLike object within it\n return (x !== undefined &&\n typeof x.callbacks === \"object\" &&\n // Callback manager with a langchain tracer\n (containsLangChainTracerLike(x.callbacks?.handlers) ||\n // Or it's an array with a LangChainTracerLike object within it\n containsLangChainTracerLike(x.callbacks)));\n}\n"],"mappings":";AAAA,OAAO,KAAKA,IAAI,MAAM,MAAM;AAC5B,SAASC,sBAAsB,EAAEC,qBAAqB,QAAS,gBAAgB;AAC/E,SAASC,MAAM,QAAQ,aAAa;AACpC,S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