1 |
- {"ast":null,"code":"import { addLangChainErrorFields } from \"../errors/index.js\";\nimport { _isToolCall } from \"../tools/utils.js\";\nimport { AIMessage, AIMessageChunk } from \"./ai.js\";\nimport { isBaseMessage, _isMessageFieldWithRole } from \"./base.js\";\nimport { ChatMessage, ChatMessageChunk } from \"./chat.js\";\nimport { FunctionMessage, FunctionMessageChunk } from \"./function.js\";\nimport { HumanMessage, HumanMessageChunk } from \"./human.js\";\nimport { SystemMessage, SystemMessageChunk } from \"./system.js\";\nimport { ToolMessage } from \"./tool.js\";\nfunction _coerceToolCall(toolCall) {\n if (_isToolCall(toolCall)) {\n return toolCall;\n } else if (typeof toolCall.id === \"string\" && toolCall.type === \"function\" && typeof toolCall.function === \"object\" && toolCall.function !== null && \"arguments\" in toolCall.function && typeof toolCall.function.arguments === \"string\" && \"name\" in toolCall.function && typeof toolCall.function.name === \"string\") {\n // Handle OpenAI tool call format\n return {\n id: toolCall.id,\n args: JSON.parse(toolCall.function.arguments),\n name: toolCall.function.name,\n type: \"tool_call\"\n };\n } else {\n // TODO: Throw an error?\n return toolCall;\n }\n}\nfunction isSerializedConstructor(x) {\n return typeof x === \"object\" && x != null && x.lc === 1 && Array.isArray(x.id) && x.kwargs != null && typeof x.kwargs === \"object\";\n}\nfunction _constructMessageFromParams(params) {\n let type;\n let rest;\n // Support serialized messages\n if (isSerializedConstructor(params)) {\n const className = params.id.at(-1);\n if (className === \"HumanMessage\" || className === \"HumanMessageChunk\") {\n type = \"user\";\n } else if (className === \"AIMessage\" || className === \"AIMessageChunk\") {\n type = \"assistant\";\n } else if (className === \"SystemMessage\" || className === \"SystemMessageChunk\") {\n type = \"system\";\n } else {\n type = \"unknown\";\n }\n rest = params.kwargs;\n } else {\n const {\n type: extractedType,\n ...otherParams\n } = params;\n type = extractedType;\n rest = otherParams;\n }\n if (type === \"human\" || type === \"user\") {\n return new HumanMessage(rest);\n } else if (type === \"ai\" || type === \"assistant\") {\n const {\n tool_calls: rawToolCalls,\n ...other\n } = rest;\n if (!Array.isArray(rawToolCalls)) {\n return new AIMessage(rest);\n }\n const tool_calls = rawToolCalls.map(_coerceToolCall);\n return new AIMessage({\n ...other,\n tool_calls\n });\n } else if (type === \"system\") {\n return new SystemMessage(rest);\n } else if (type === \"tool\" && \"tool_call_id\" in rest) {\n return new ToolMessage({\n ...rest,\n content: rest.content,\n tool_call_id: rest.tool_call_id,\n name: rest.name\n });\n } else {\n const error = addLangChainErrorFields(new Error(`Unable to coerce message from array: only human, AI, system, or tool message coercion is currently supported.\\n\\nReceived: ${JSON.stringify(params, null, 2)}`), \"MESSAGE_COERCION_FAILURE\");\n throw error;\n }\n}\nexport function coerceMessageLikeToMessage(messageLike) {\n if (typeof messageLike === \"string\") {\n return new HumanMessage(messageLike);\n } else if (isBaseMessage(messageLike)) {\n return messageLike;\n }\n if (Array.isArray(messageLike)) {\n const [type, content] = messageLike;\n return _constructMessageFromParams({\n type,\n content\n });\n } else if (_isMessageFieldWithRole(messageLike)) {\n const {\n role: type,\n ...rest\n } = messageLike;\n return _constructMessageFromParams({\n ...rest,\n type\n });\n } else {\n return _constructMessageFromParams(messageLike);\n }\n}\n/**\n * This function is used by memory classes to get a string representation\n * of the chat message history, based on the message content and role.\n */\nexport function getBufferString(messages, humanPrefix = \"Human\", aiPrefix = \"AI\") {\n const string_messages = [];\n for (const m of messages) {\n let role;\n if (m._getType() === \"human\") {\n role = humanPrefix;\n } else if (m._getType() === \"ai\") {\n role = aiPrefix;\n } else if (m._getType() === \"system\") {\n role = \"System\";\n } else if (m._getType() === \"function\") {\n role = \"Function\";\n } else if (m._getType() === \"tool\") {\n role = \"Tool\";\n } else if (m._getType() === \"generic\") {\n role = m.role;\n } else {\n throw new Error(`Got unsupported message type: ${m._getType()}`);\n }\n const nameStr = m.name ? `${m.name}, ` : \"\";\n const readableContent = typeof m.content === \"string\" ? m.content : JSON.stringify(m.content, null, 2);\n string_messages.push(`${role}: ${nameStr}${readableContent}`);\n }\n return string_messages.join(\"\\n\");\n}\n/**\n * Maps messages from an older format (V1) to the current `StoredMessage`\n * format. If the message is already in the `StoredMessage` format, it is\n * returned as is. Otherwise, it transforms the V1 message into a\n * `StoredMessage`. This function is important for maintaining\n * compatibility with older message formats.\n */\nfunction mapV1MessageToStoredMessage(message) {\n // TODO: Remove this mapper when we deprecate the old message format.\n if (message.data !== undefined) {\n return message;\n } else {\n const v1Message = message;\n return {\n type: v1Message.type,\n data: {\n content: v1Message.text,\n role: v1Message.role,\n name: undefined,\n tool_call_id: undefined\n }\n };\n }\n}\nexport function mapStoredMessageToChatMessage(message) {\n const storedMessage = mapV1MessageToStoredMessage(message);\n switch (storedMessage.type) {\n case \"human\":\n return new HumanMessage(storedMessage.data);\n case \"ai\":\n return new AIMessage(storedMessage.data);\n case \"system\":\n return new SystemMessage(storedMessage.data);\n case \"function\":\n if (storedMessage.data.name === undefined) {\n throw new Error(\"Name must be defined for function messages\");\n }\n return new FunctionMessage(storedMessage.data);\n case \"tool\":\n if (storedMessage.data.tool_call_id === undefined) {\n throw new Error(\"Tool call ID must be defined for tool messages\");\n }\n return new ToolMessage(storedMessage.data);\n case \"generic\":\n {\n if (storedMessage.data.role === undefined) {\n throw new Error(\"Role must be defined for chat messages\");\n }\n return new ChatMessage(storedMessage.data);\n }\n default:\n throw new Error(`Got unexpected type: ${storedMessage.type}`);\n }\n}\n/**\n * Transforms an array of `StoredMessage` instances into an array of\n * `BaseMessage` instances. It uses the `mapV1MessageToStoredMessage`\n * function to ensure all messages are in the `StoredMessage` format, then\n * creates new instances of the appropriate `BaseMessage` subclass based\n * on the type of each message. This function is used to prepare stored\n * messages for use in a chat context.\n */\nexport function mapStoredMessagesToChatMessages(messages) {\n return messages.map(mapStoredMessageToChatMessage);\n}\n/**\n * Transforms an array of `BaseMessage` instances into an array of\n * `StoredMessage` instances. It does this by calling the `toDict` method\n * on each `BaseMessage`, which returns a `StoredMessage`. This function\n * is used to prepare chat messages for storage.\n */\nexport function mapChatMessagesToStoredMessages(messages) {\n return messages.map(message => message.toDict());\n}\nexport function convertToChunk(message) {\n const type = message._getType();\n if (type === \"human\") {\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n return new HumanMessageChunk({\n ...message\n });\n } else if (type === \"ai\") {\n let aiChunkFields = {\n ...message\n };\n if (\"tool_calls\" in aiChunkFields) {\n var _aiChunkFields$tool_c;\n aiChunkFields = {\n ...aiChunkFields,\n tool_call_chunks: (_aiChunkFields$tool_c = aiChunkFields.tool_calls) === null || _aiChunkFields$tool_c === void 0 ? void 0 : _aiChunkFields$tool_c.map(tc => ({\n ...tc,\n type: \"tool_call_chunk\",\n index: undefined,\n args: JSON.stringify(tc.args)\n }))\n };\n }\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n return new AIMessageChunk({\n ...aiChunkFields\n });\n } else if (type === \"system\") {\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n return new SystemMessageChunk({\n ...message\n });\n } else if (type === \"function\") {\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n return new FunctionMessageChunk({\n ...message\n });\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n } else if (ChatMessage.isInstance(message)) {\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n return new ChatMessageChunk({\n ...message\n });\n } else {\n throw new Error(\"Unknown message type.\");\n }\n}","map":{"version":3,"names":["addLangChainErrorFields","_isToolCall","AIMessage","AIMessageChunk","isBaseMessage","_isMessageFieldWithRole","ChatMessage","ChatMessageChunk","FunctionMessage","FunctionMessageChunk","HumanMessage","HumanMessageChunk","SystemMessage","SystemMessageChunk","ToolMessage","_coerceToolCall","toolCall","id","type","function","arguments","name","args","JSON","parse","isSerializedConstructor","x","lc","Array","isArray","kwargs","_constructMessageFromParams","params","rest","className","at","extractedType","otherParams","tool_calls","rawToolCalls","other","map","content","tool_call_id","error","Error","stringify","coerceMessageLikeToMessage","messageLike","role","getBufferString","messages","humanPrefix","aiPrefix","string_messages","m","_getType","nameStr","readableContent","push","join","mapV1MessageToStoredMessage","message","data","undefined","v1Message","text","mapStoredMessageToChatMessage","storedMessage","mapStoredMessagesToChatMessages","mapChatMessagesToStoredMessages","toDict","convertToChunk","aiChunkFields","_aiChunkFields$tool_c","tool_call_chunks","tc","index","isInstance"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@langchain/core/dist/messages/utils.js"],"sourcesContent":["import { addLangChainErrorFields } from \"../errors/index.js\";\nimport { _isToolCall } from \"../tools/utils.js\";\nimport { AIMessage, AIMessageChunk } from \"./ai.js\";\nimport { isBaseMessage, _isMessageFieldWithRole, } from \"./base.js\";\nimport { ChatMessage, ChatMessageChunk, } from \"./chat.js\";\nimport { FunctionMessage, FunctionMessageChunk, } from \"./function.js\";\nimport { HumanMessage, HumanMessageChunk } from \"./human.js\";\nimport { SystemMessage, SystemMessageChunk } from \"./system.js\";\nimport { ToolMessage, } from \"./tool.js\";\nfunction _coerceToolCall(toolCall) {\n if (_isToolCall(toolCall)) {\n return toolCall;\n }\n else if (typeof toolCall.id === \"string\" &&\n toolCall.type === \"function\" &&\n typeof toolCall.function === \"object\" &&\n toolCall.function !== null &&\n \"arguments\" in toolCall.function &&\n typeof toolCall.function.arguments === \"string\" &&\n \"name\" in toolCall.function &&\n typeof toolCall.function.name === \"string\") {\n // Handle OpenAI tool call format\n return {\n id: toolCall.id,\n args: JSON.parse(toolCall.function.arguments),\n name: toolCall.function.name,\n type: \"tool_call\",\n };\n }\n else {\n // TODO: Throw an error?\n return toolCall;\n }\n}\nfunction isSerializedConstructor(x) {\n return (typeof x === \"object\" &&\n x != null &&\n x.lc === 1 &&\n Array.isArray(x.id) &&\n x.kwargs != null &&\n typeof x.kwargs === \"object\");\n}\nfunction _constructMessageFromParams(params) {\n let type;\n let rest;\n // Support serialized messages\n if (isSerializedConstructor(params)) {\n const className = params.id.at(-1);\n if (className === \"HumanMessage\" || className === \"HumanMessageChunk\") {\n type = \"user\";\n }\n else if (className === \"AIMessage\" || className === \"AIMessageChunk\") {\n type = \"assistant\";\n }\n else if (className === \"SystemMessage\" ||\n className === \"SystemMessageChunk\") {\n type = \"system\";\n }\n else {\n type = \"unknown\";\n }\n rest = params.kwargs;\n }\n else {\n const { type: extractedType, ...otherParams } = params;\n type = extractedType;\n rest = otherParams;\n }\n if (type === \"human\" || type === \"user\") {\n return new HumanMessage(rest);\n }\n else if (type === \"ai\" || type === \"assistant\") {\n const { tool_calls: rawToolCalls, ...other } = rest;\n if (!Array.isArray(rawToolCalls)) {\n return new AIMessage(rest);\n }\n const tool_calls = rawToolCalls.map(_coerceToolCall);\n return new AIMessage({ ...other, tool_calls });\n }\n else if (type === \"system\") {\n return new SystemMessage(rest);\n }\n else if (type === \"tool\" && \"tool_call_id\" in rest) {\n return new ToolMessage({\n ...rest,\n content: rest.content,\n tool_call_id: rest.tool_call_id,\n name: rest.name,\n });\n }\n else {\n const error = addLangChainErrorFields(new Error(`Unable to coerce message from array: only human, AI, system, or tool message coercion is currently supported.\\n\\nReceived: ${JSON.stringify(params, null, 2)}`), \"MESSAGE_COERCION_FAILURE\");\n throw error;\n }\n}\nexport function coerceMessageLikeToMessage(messageLike) {\n if (typeof messageLike === \"string\") {\n return new HumanMessage(messageLike);\n }\n else if (isBaseMessage(messageLike)) {\n return messageLike;\n }\n if (Array.isArray(messageLike)) {\n const [type, content] = messageLike;\n return _constructMessageFromParams({ type, content });\n }\n else if (_isMessageFieldWithRole(messageLike)) {\n const { role: type, ...rest } = messageLike;\n return _constructMessageFromParams({ ...rest, type });\n }\n else {\n return _constructMessageFromParams(messageLike);\n }\n}\n/**\n * This function is used by memory classes to get a string representation\n * of the chat message history, based on the message content and role.\n */\nexport function getBufferString(messages, humanPrefix = \"Human\", aiPrefix = \"AI\") {\n const string_messages = [];\n for (const m of messages) {\n let role;\n if (m._getType() === \"human\") {\n role = humanPrefix;\n }\n else if (m._getType() === \"ai\") {\n role = aiPrefix;\n }\n else if (m._getType() === \"system\") {\n role = \"System\";\n }\n else if (m._getType() === \"function\") {\n role = \"Function\";\n }\n else if (m._getType() === \"tool\") {\n role = \"Tool\";\n }\n else if (m._getType() === \"generic\") {\n role = m.role;\n }\n else {\n throw new Error(`Got unsupported message type: ${m._getType()}`);\n }\n const nameStr = m.name ? `${m.name}, ` : \"\";\n const readableContent = typeof m.content === \"string\"\n ? m.content\n : JSON.stringify(m.content, null, 2);\n string_messages.push(`${role}: ${nameStr}${readableContent}`);\n }\n return string_messages.join(\"\\n\");\n}\n/**\n * Maps messages from an older format (V1) to the current `StoredMessage`\n * format. If the message is already in the `StoredMessage` format, it is\n * returned as is. Otherwise, it transforms the V1 message into a\n * `StoredMessage`. This function is important for maintaining\n * compatibility with older message formats.\n */\nfunction mapV1MessageToStoredMessage(message) {\n // TODO: Remove this mapper when we deprecate the old message format.\n if (message.data !== undefined) {\n return message;\n }\n else {\n const v1Message = message;\n return {\n type: v1Message.type,\n data: {\n content: v1Message.text,\n role: v1Message.role,\n name: undefined,\n tool_call_id: undefined,\n },\n };\n }\n}\nexport function mapStoredMessageToChatMessage(message) {\n const storedMessage = mapV1MessageToStoredMessage(message);\n switch (storedMessage.type) {\n case \"human\":\n return new HumanMessage(storedMessage.data);\n case \"ai\":\n return new AIMessage(storedMessage.data);\n case \"system\":\n return new SystemMessage(storedMessage.data);\n case \"function\":\n if (storedMessage.data.name === undefined) {\n throw new Error(\"Name must be defined for function messages\");\n }\n return new FunctionMessage(storedMessage.data);\n case \"tool\":\n if (storedMessage.data.tool_call_id === undefined) {\n throw new Error(\"Tool call ID must be defined for tool messages\");\n }\n return new ToolMessage(storedMessage.data);\n case \"generic\": {\n if (storedMessage.data.role === undefined) {\n throw new Error(\"Role must be defined for chat messages\");\n }\n return new ChatMessage(storedMessage.data);\n }\n default:\n throw new Error(`Got unexpected type: ${storedMessage.type}`);\n }\n}\n/**\n * Transforms an array of `StoredMessage` instances into an array of\n * `BaseMessage` instances. It uses the `mapV1MessageToStoredMessage`\n * function to ensure all messages are in the `StoredMessage` format, then\n * creates new instances of the appropriate `BaseMessage` subclass based\n * on the type of each message. This function is used to prepare stored\n * messages for use in a chat context.\n */\nexport function mapStoredMessagesToChatMessages(messages) {\n return messages.map(mapStoredMessageToChatMessage);\n}\n/**\n * Transforms an array of `BaseMessage` instances into an array of\n * `StoredMessage` instances. It does this by calling the `toDict` method\n * on each `BaseMessage`, which returns a `StoredMessage`. This function\n * is used to prepare chat messages for storage.\n */\nexport function mapChatMessagesToStoredMessages(messages) {\n return messages.map((message) => message.toDict());\n}\nexport function convertToChunk(message) {\n const type = message._getType();\n if (type === \"human\") {\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n return new HumanMessageChunk({ ...message });\n }\n else if (type === \"ai\") {\n let aiChunkFields = {\n ...message,\n };\n if (\"tool_calls\" in aiChunkFields) {\n aiChunkFields = {\n ...aiChunkFields,\n tool_call_chunks: aiChunkFields.tool_calls?.map((tc) => ({\n ...tc,\n type: \"tool_call_chunk\",\n index: undefined,\n args: JSON.stringify(tc.args),\n })),\n };\n }\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n return new AIMessageChunk({ ...aiChunkFields });\n }\n else if (type === \"system\") {\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n return new SystemMessageChunk({ ...message });\n }\n else if (type === \"function\") {\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n return new FunctionMessageChunk({ ...message });\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n }\n else if (ChatMessage.isInstance(message)) {\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n return new ChatMessageChunk({ ...message });\n }\n else {\n throw new Error(\"Unknown message type.\");\n }\n}\n"],"mappings":"AAAA,SAASA,uBAAuB,QAAQ,oBAAoB;AAC5D,SAASC,WAAW,QAAQ,mBAAmB;AAC/C,SAASC,SAAS,EAAEC,cAAc,QAAQ,SAAS;AACnD,SAASC,aAAa,EAAEC,uBAAuB,QAAS,WAAW;AACnE,SAASC,WAAW,EAAEC,gBAAgB,QAAS,WAAW;AAC1D,SAASC,eAAe,EAAEC,oBAAoB,QAAS,eAAe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