d57f52a51ae6c2682db750332eeb4bc8b6de063e4fb280c339003480ee9ec0b5.json 80 KB

1
  1. {"ast":null,"code":"import _asyncToGenerator from \"F:/workspace/202226701027/huinongbao-app/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js\";\n// Default generic \"any\" values are for backwards compatibility.\n// Replace with \"string\" when we are comfortable with a breaking change.\nimport { AIMessage, HumanMessage, SystemMessage, BaseMessage, ChatMessage, coerceMessageLikeToMessage, isBaseMessage } from \"../messages/index.js\";\nimport { ChatPromptValue } from \"../prompt_values.js\";\nimport { Runnable } from \"../runnables/base.js\";\nimport { BaseStringPromptTemplate } from \"./string.js\";\nimport { BasePromptTemplate } from \"./base.js\";\nimport { PromptTemplate } from \"./prompt.js\";\nimport { ImagePromptTemplate } from \"./image.js\";\nimport { parseFString, parseMustache } from \"./template.js\";\nimport { addLangChainErrorFields } from \"../errors/index.js\";\n/**\n * Abstract class that serves as a base for creating message prompt\n * templates. It defines how to format messages for different roles in a\n * conversation.\n */\nexport class BaseMessagePromptTemplate extends Runnable {\n constructor() {\n super(...arguments);\n Object.defineProperty(this, \"lc_namespace\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: [\"langchain_core\", \"prompts\", \"chat\"]\n });\n Object.defineProperty(this, \"lc_serializable\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: true\n });\n }\n /**\n * Calls the formatMessages method with the provided input and options.\n * @param input Input for the formatMessages method\n * @param options Optional BaseCallbackConfig\n * @returns Formatted output messages\n */\n invoke(input, options) {\n var _this = this;\n return _asyncToGenerator(function* () {\n return _this._callWithConfig(input => _this.formatMessages(input), input, {\n ...options,\n runType: \"prompt\"\n });\n })();\n }\n}\n/**\n * Class that represents a placeholder for messages in a chat prompt. It\n * extends the BaseMessagePromptTemplate.\n */\nexport class MessagesPlaceholder extends BaseMessagePromptTemplate {\n static lc_name() {\n return \"MessagesPlaceholder\";\n }\n constructor(fields) {\n var _fields$optional;\n if (typeof fields === \"string\") {\n // eslint-disable-next-line no-param-reassign\n fields = {\n variableName: fields\n };\n }\n super(fields);\n Object.defineProperty(this, \"variableName\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"optional\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this.variableName = fields.variableName;\n this.optional = (_fields$optional = fields.optional) !== null && _fields$optional !== void 0 ? _fields$optional : false;\n }\n get inputVariables() {\n return [this.variableName];\n }\n formatMessages(values) {\n var _this2 = this;\n return _asyncToGenerator(function* () {\n const input = values[_this2.variableName];\n if (_this2.optional && !input) {\n return [];\n } else if (!input) {\n const error = new Error(`Field \"${_this2.variableName}\" in prompt uses a MessagesPlaceholder, which expects an array of BaseMessages as an input value. Received: undefined`);\n error.name = \"InputFormatError\";\n throw error;\n }\n let formattedMessages;\n try {\n if (Array.isArray(input)) {\n formattedMessages = input.map(coerceMessageLikeToMessage);\n } else {\n formattedMessages = [coerceMessageLikeToMessage(input)];\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (e) {\n const readableInput = typeof input === \"string\" ? input : JSON.stringify(input, null, 2);\n const error = new Error([`Field \"${_this2.variableName}\" in prompt uses a MessagesPlaceholder, which expects an array of BaseMessages or coerceable values as input.`, `Received value: ${readableInput}`, `Additional message: ${e.message}`].join(\"\\n\\n\"));\n error.name = \"InputFormatError\";\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n error.lc_error_code = e.lc_error_code;\n throw error;\n }\n return formattedMessages;\n })();\n }\n}\n/**\n * Abstract class that serves as a base for creating message string prompt\n * templates. It extends the BaseMessagePromptTemplate.\n */\nexport class BaseMessageStringPromptTemplate extends BaseMessagePromptTemplate {\n constructor(fields) {\n if (!(\"prompt\" in fields)) {\n // eslint-disable-next-line no-param-reassign\n fields = {\n prompt: fields\n };\n }\n super(fields);\n Object.defineProperty(this, \"prompt\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this.prompt = fields.prompt;\n }\n get inputVariables() {\n return this.prompt.inputVariables;\n }\n formatMessages(values) {\n var _this3 = this;\n return _asyncToGenerator(function* () {\n return [yield _this3.format(values)];\n })();\n }\n}\n/**\n * Abstract class that serves as a base for creating chat prompt\n * templates. It extends the BasePromptTemplate.\n */\nexport class BaseChatPromptTemplate extends BasePromptTemplate {\n constructor(input) {\n super(input);\n }\n format(values) {\n var _this4 = this;\n return _asyncToGenerator(function* () {\n return (yield _this4.formatPromptValue(values)).toString();\n })();\n }\n formatPromptValue(values) {\n var _this5 = this;\n return _asyncToGenerator(function* () {\n const resultMessages = yield _this5.formatMessages(values);\n return new ChatPromptValue(resultMessages);\n })();\n }\n}\n/**\n * Class that represents a chat message prompt template. It extends the\n * BaseMessageStringPromptTemplate.\n */\nexport class ChatMessagePromptTemplate extends BaseMessageStringPromptTemplate {\n static lc_name() {\n return \"ChatMessagePromptTemplate\";\n }\n constructor(fields, role) {\n if (!(\"prompt\" in fields)) {\n // eslint-disable-next-line no-param-reassign, @typescript-eslint/no-non-null-assertion\n fields = {\n prompt: fields,\n role: role\n };\n }\n super(fields);\n Object.defineProperty(this, \"role\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this.role = fields.role;\n }\n format(values) {\n var _this6 = this;\n return _asyncToGenerator(function* () {\n return new ChatMessage(yield _this6.prompt.format(values), _this6.role);\n })();\n }\n static fromTemplate(template, role, options) {\n return new this(PromptTemplate.fromTemplate(template, {\n templateFormat: options === null || options === void 0 ? void 0 : options.templateFormat\n }), role);\n }\n}\nclass _StringImageMessagePromptTemplate extends BaseMessagePromptTemplate {\n static _messageClass() {\n throw new Error(\"Can not invoke _messageClass from inside _StringImageMessagePromptTemplate\");\n }\n constructor( /** @TODO When we come up with a better way to type prompt templates, fix this */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n fields, additionalOptions) {\n if (!(\"prompt\" in fields)) {\n // eslint-disable-next-line no-param-reassign\n fields = {\n prompt: fields\n };\n }\n super(fields);\n Object.defineProperty(this, \"lc_namespace\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: [\"langchain_core\", \"prompts\", \"chat\"]\n });\n Object.defineProperty(this, \"lc_serializable\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: true\n });\n Object.defineProperty(this, \"inputVariables\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: []\n });\n Object.defineProperty(this, \"additionalOptions\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: {}\n });\n Object.defineProperty(this, \"prompt\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"messageClass\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n // ChatMessage contains role field, others don't.\n // Because of this, we have a separate class property for ChatMessage.\n Object.defineProperty(this, \"chatMessageClass\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this.prompt = fields.prompt;\n if (Array.isArray(this.prompt)) {\n let inputVariables = [];\n this.prompt.forEach(prompt => {\n if (\"inputVariables\" in prompt) {\n inputVariables = inputVariables.concat(prompt.inputVariables);\n }\n });\n this.inputVariables = inputVariables;\n } else {\n this.inputVariables = this.prompt.inputVariables;\n }\n this.additionalOptions = additionalOptions !== null && additionalOptions !== void 0 ? additionalOptions : this.additionalOptions;\n }\n createMessage(content) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const constructor = this.constructor;\n if (constructor._messageClass()) {\n const MsgClass = constructor._messageClass();\n return new MsgClass({\n content\n });\n } else if (constructor.chatMessageClass) {\n const MsgClass = constructor.chatMessageClass();\n // Assuming ChatMessage constructor also takes a content argument\n return new MsgClass({\n content,\n role: this.getRoleFromMessageClass(MsgClass.lc_name())\n });\n } else {\n throw new Error(\"No message class defined\");\n }\n }\n getRoleFromMessageClass(name) {\n switch (name) {\n case \"HumanMessage\":\n return \"human\";\n case \"AIMessage\":\n return \"ai\";\n case \"SystemMessage\":\n return \"system\";\n case \"ChatMessage\":\n return \"chat\";\n default:\n throw new Error(\"Invalid message class name\");\n }\n }\n static fromTemplate(template, additionalOptions) {\n if (typeof template === \"string\") {\n return new this(PromptTemplate.fromTemplate(template, additionalOptions));\n }\n const prompt = [];\n for (const item of template) {\n if (typeof item === \"string\" || typeof item === \"object\" && \"text\" in item) {\n let text = \"\";\n if (typeof item === \"string\") {\n text = item;\n } else if (typeof item.text === \"string\") {\n var _item$text;\n text = (_item$text = item.text) !== null && _item$text !== void 0 ? _item$text : \"\";\n }\n const options = {\n ...additionalOptions,\n ...(typeof item !== \"string\" ? {\n additionalContentFields: item\n } : {})\n };\n prompt.push(PromptTemplate.fromTemplate(text, options));\n } else if (typeof item === \"object\" && \"image_url\" in item) {\n var _item$image_url;\n let imgTemplate = (_item$image_url = item.image_url) !== null && _item$image_url !== void 0 ? _item$image_url : \"\";\n let imgTemplateObject;\n let inputVariables = [];\n if (typeof imgTemplate === \"string\") {\n var _variables$length;\n let parsedTemplate;\n if ((additionalOptions === null || additionalOptions === void 0 ? void 0 : additionalOptions.templateFormat) === \"mustache\") {\n parsedTemplate = parseMustache(imgTemplate);\n } else {\n parsedTemplate = parseFString(imgTemplate);\n }\n const variables = parsedTemplate.flatMap(item => item.type === \"variable\" ? [item.name] : []);\n if (((_variables$length = variables === null || variables === void 0 ? void 0 : variables.length) !== null && _variables$length !== void 0 ? _variables$length : 0) > 0) {\n if (variables.length > 1) {\n throw new Error(`Only one format variable allowed per image template.\\nGot: ${variables}\\nFrom: ${imgTemplate}`);\n }\n inputVariables = [variables[0]];\n } else {\n inputVariables = [];\n }\n imgTemplate = {\n url: imgTemplate\n };\n imgTemplateObject = new ImagePromptTemplate({\n template: imgTemplate,\n inputVariables,\n templateFormat: additionalOptions === null || additionalOptions === void 0 ? void 0 : additionalOptions.templateFormat,\n additionalContentFields: item\n });\n } else if (typeof imgTemplate === \"object\") {\n if (\"url\" in imgTemplate) {\n let parsedTemplate;\n if ((additionalOptions === null || additionalOptions === void 0 ? void 0 : additionalOptions.templateFormat) === \"mustache\") {\n parsedTemplate = parseMustache(imgTemplate.url);\n } else {\n parsedTemplate = parseFString(imgTemplate.url);\n }\n inputVariables = parsedTemplate.flatMap(item => item.type === \"variable\" ? [item.name] : []);\n } else {\n inputVariables = [];\n }\n imgTemplateObject = new ImagePromptTemplate({\n template: imgTemplate,\n inputVariables,\n templateFormat: additionalOptions === null || additionalOptions === void 0 ? void 0 : additionalOptions.templateFormat,\n additionalContentFields: item\n });\n } else {\n throw new Error(\"Invalid image template\");\n }\n prompt.push(imgTemplateObject);\n }\n }\n return new this({\n prompt,\n additionalOptions\n });\n }\n format(input) {\n var _this7 = this;\n return _asyncToGenerator(function* () {\n // eslint-disable-next-line no-instanceof/no-instanceof\n if (_this7.prompt instanceof BaseStringPromptTemplate) {\n const text = yield _this7.prompt.format(input);\n return _this7.createMessage(text);\n } else {\n const content = [];\n for (const prompt of _this7.prompt) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let inputs = {};\n if (!(\"inputVariables\" in prompt)) {\n throw new Error(`Prompt ${prompt} does not have inputVariables defined.`);\n }\n for (const item of prompt.inputVariables) {\n if (!inputs) {\n inputs = {\n [item]: input[item]\n };\n }\n inputs = {\n ...inputs,\n [item]: input[item]\n };\n }\n // eslint-disable-next-line no-instanceof/no-instanceof\n if (prompt instanceof BaseStringPromptTemplate) {\n const formatted = yield prompt.format(inputs);\n let additionalContentFields;\n if (\"additionalContentFields\" in prompt) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n additionalContentFields = prompt.additionalContentFields;\n }\n content.push({\n ...additionalContentFields,\n type: \"text\",\n text: formatted\n });\n /** @TODO replace this */\n // eslint-disable-next-line no-instanceof/no-instanceof\n } else if (prompt instanceof ImagePromptTemplate) {\n const formatted = yield prompt.format(inputs);\n let additionalContentFields;\n if (\"additionalContentFields\" in prompt) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n additionalContentFields = prompt.additionalContentFields;\n }\n content.push({\n ...additionalContentFields,\n type: \"image_url\",\n image_url: formatted\n });\n }\n }\n return _this7.createMessage(content);\n }\n })();\n }\n formatMessages(values) {\n var _this8 = this;\n return _asyncToGenerator(function* () {\n return [yield _this8.format(values)];\n })();\n }\n}\n/**\n * Class that represents a human message prompt template. It extends the\n * BaseMessageStringPromptTemplate.\n * @example\n * ```typescript\n * const message = HumanMessagePromptTemplate.fromTemplate(\"{text}\");\n * const formatted = await message.format({ text: \"Hello world!\" });\n *\n * const chatPrompt = ChatPromptTemplate.fromMessages([message]);\n * const formattedChatPrompt = await chatPrompt.invoke({\n * text: \"Hello world!\",\n * });\n * ```\n */\nexport class HumanMessagePromptTemplate extends _StringImageMessagePromptTemplate {\n static _messageClass() {\n return HumanMessage;\n }\n static lc_name() {\n return \"HumanMessagePromptTemplate\";\n }\n}\n/**\n * Class that represents an AI message prompt template. It extends the\n * BaseMessageStringPromptTemplate.\n */\nexport class AIMessagePromptTemplate extends _StringImageMessagePromptTemplate {\n static _messageClass() {\n return AIMessage;\n }\n static lc_name() {\n return \"AIMessagePromptTemplate\";\n }\n}\n/**\n * Class that represents a system message prompt template. It extends the\n * BaseMessageStringPromptTemplate.\n * @example\n * ```typescript\n * const message = SystemMessagePromptTemplate.fromTemplate(\"{text}\");\n * const formatted = await message.format({ text: \"Hello world!\" });\n *\n * const chatPrompt = ChatPromptTemplate.fromMessages([message]);\n * const formattedChatPrompt = await chatPrompt.invoke({\n * text: \"Hello world!\",\n * });\n * ```\n */\nexport class SystemMessagePromptTemplate extends _StringImageMessagePromptTemplate {\n static _messageClass() {\n return SystemMessage;\n }\n static lc_name() {\n return \"SystemMessagePromptTemplate\";\n }\n}\nfunction _isBaseMessagePromptTemplate(baseMessagePromptTemplateLike) {\n return typeof baseMessagePromptTemplateLike.formatMessages === \"function\";\n}\nfunction _coerceMessagePromptTemplateLike(messagePromptTemplateLike, extra) {\n if (_isBaseMessagePromptTemplate(messagePromptTemplateLike) || isBaseMessage(messagePromptTemplateLike)) {\n return messagePromptTemplateLike;\n }\n if (Array.isArray(messagePromptTemplateLike) && messagePromptTemplateLike[0] === \"placeholder\") {\n const messageContent = messagePromptTemplateLike[1];\n if (typeof messageContent !== \"string\" || messageContent[0] !== \"{\" || messageContent[messageContent.length - 1] !== \"}\") {\n throw new Error(`Invalid placeholder template: \"${messagePromptTemplateLike[1]}\". Expected a variable name surrounded by curly braces.`);\n }\n const variableName = messageContent.slice(1, -1);\n return new MessagesPlaceholder({\n variableName,\n optional: true\n });\n }\n const message = coerceMessageLikeToMessage(messagePromptTemplateLike);\n let templateData;\n if (typeof message.content === \"string\") {\n templateData = message.content;\n } else {\n // Assuming message.content is an array of complex objects, transform it.\n templateData = message.content.map(item => {\n if (\"text\" in item) {\n return {\n ...item,\n text: item.text\n };\n } else if (\"image_url\" in item) {\n return {\n ...item,\n image_url: item.image_url\n };\n } else {\n return item;\n }\n });\n }\n if (message._getType() === \"human\") {\n return HumanMessagePromptTemplate.fromTemplate(templateData, extra);\n } else if (message._getType() === \"ai\") {\n return AIMessagePromptTemplate.fromTemplate(templateData, extra);\n } else if (message._getType() === \"system\") {\n return SystemMessagePromptTemplate.fromTemplate(templateData, extra);\n } else if (ChatMessage.isInstance(message)) {\n return ChatMessagePromptTemplate.fromTemplate(message.content, message.role, extra);\n } else {\n throw new Error(`Could not coerce message prompt template from input. Received message type: \"${message._getType()}\".`);\n }\n}\nfunction isMessagesPlaceholder(x) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return x.constructor.lc_name() === \"MessagesPlaceholder\";\n}\n/**\n * Class that represents a chat prompt. It extends the\n * BaseChatPromptTemplate and uses an array of BaseMessagePromptTemplate\n * instances to format a series of messages for a conversation.\n * @example\n * ```typescript\n * const message = SystemMessagePromptTemplate.fromTemplate(\"{text}\");\n * const chatPrompt = ChatPromptTemplate.fromMessages([\n * [\"ai\", \"You are a helpful assistant.\"],\n * message,\n * ]);\n * const formattedChatPrompt = await chatPrompt.invoke({\n * text: \"Hello world!\",\n * });\n * ```\n */\nexport class ChatPromptTemplate extends BaseChatPromptTemplate {\n static lc_name() {\n return \"ChatPromptTemplate\";\n }\n get lc_aliases() {\n return {\n promptMessages: \"messages\"\n };\n }\n constructor(input) {\n super(input);\n Object.defineProperty(this, \"promptMessages\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"validateTemplate\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: true\n });\n Object.defineProperty(this, \"templateFormat\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: \"f-string\"\n });\n // If input is mustache and validateTemplate is not defined, set it to false\n if (input.templateFormat === \"mustache\" && input.validateTemplate === undefined) {\n this.validateTemplate = false;\n }\n Object.assign(this, input);\n if (this.validateTemplate) {\n const inputVariablesMessages = new Set();\n for (const promptMessage of this.promptMessages) {\n // eslint-disable-next-line no-instanceof/no-instanceof\n if (promptMessage instanceof BaseMessage) continue;\n for (const inputVariable of promptMessage.inputVariables) {\n inputVariablesMessages.add(inputVariable);\n }\n }\n const totalInputVariables = this.inputVariables;\n const inputVariablesInstance = new Set(this.partialVariables ? totalInputVariables.concat(Object.keys(this.partialVariables)) : totalInputVariables);\n const difference = new Set([...inputVariablesInstance].filter(x => !inputVariablesMessages.has(x)));\n if (difference.size > 0) {\n throw new Error(`Input variables \\`${[...difference]}\\` are not used in any of the prompt messages.`);\n }\n const otherDifference = new Set([...inputVariablesMessages].filter(x => !inputVariablesInstance.has(x)));\n if (otherDifference.size > 0) {\n throw new Error(`Input variables \\`${[...otherDifference]}\\` are used in prompt messages but not in the prompt template.`);\n }\n }\n }\n _getPromptType() {\n return \"chat\";\n }\n _parseImagePrompts(message, inputValues) {\n var _this9 = this;\n return _asyncToGenerator(function* () {\n if (typeof message.content === \"string\") {\n return message;\n }\n const formattedMessageContent = yield Promise.all(message.content.map( /*#__PURE__*/function () {\n var _ref = _asyncToGenerator(function* (item) {\n if (item.type !== \"image_url\") {\n return item;\n }\n let imageUrl = \"\";\n if (typeof item.image_url === \"string\") {\n imageUrl = item.image_url;\n } else {\n imageUrl = item.image_url.url;\n }\n const promptTemplatePlaceholder = PromptTemplate.fromTemplate(imageUrl, {\n templateFormat: _this9.templateFormat\n });\n const formattedUrl = yield promptTemplatePlaceholder.format(inputValues);\n if (typeof item.image_url !== \"string\" && \"url\" in item.image_url) {\n // eslint-disable-next-line no-param-reassign\n item.image_url.url = formattedUrl;\n } else {\n // eslint-disable-next-line no-param-reassign\n item.image_url = formattedUrl;\n }\n return item;\n });\n return function (_x) {\n return _ref.apply(this, arguments);\n };\n }()));\n // eslint-disable-next-line no-param-reassign\n message.content = formattedMessageContent;\n return message;\n })();\n }\n formatMessages(values) {\n var _this10 = this;\n return _asyncToGenerator(function* () {\n const allValues = yield _this10.mergePartialAndUserVariables(values);\n let resultMessages = [];\n for (const promptMessage of _this10.promptMessages) {\n // eslint-disable-next-line no-instanceof/no-instanceof\n if (promptMessage instanceof BaseMessage) {\n resultMessages.push(yield _this10._parseImagePrompts(promptMessage, allValues));\n } else {\n const inputValues = promptMessage.inputVariables.reduce((acc, inputVariable) => {\n if (!(inputVariable in allValues) && !(isMessagesPlaceholder(promptMessage) && promptMessage.optional)) {\n const error = addLangChainErrorFields(new Error(`Missing value for input variable \\`${inputVariable.toString()}\\``), \"INVALID_PROMPT_INPUT\");\n throw error;\n }\n acc[inputVariable] = allValues[inputVariable];\n return acc;\n }, {});\n const message = yield promptMessage.formatMessages(inputValues);\n resultMessages = resultMessages.concat(message);\n }\n }\n return resultMessages;\n })();\n }\n partial(values) {\n var _this11 = this;\n return _asyncToGenerator(function* () {\n var _this11$partialVariab;\n // This is implemented in a way it doesn't require making\n // BaseMessagePromptTemplate aware of .partial()\n const newInputVariables = _this11.inputVariables.filter(iv => !(iv in values));\n const newPartialVariables = {\n ...((_this11$partialVariab = _this11.partialVariables) !== null && _this11$partialVariab !== void 0 ? _this11$partialVariab : {}),\n ...values\n };\n const promptDict = {\n ..._this11,\n inputVariables: newInputVariables,\n partialVariables: newPartialVariables\n };\n return new ChatPromptTemplate(promptDict);\n })();\n }\n static fromTemplate(template, options) {\n const prompt = PromptTemplate.fromTemplate(template, options);\n const humanTemplate = new HumanMessagePromptTemplate({\n prompt\n });\n return this.fromMessages([humanTemplate]);\n }\n /**\n * Create a chat model-specific prompt from individual chat messages\n * or message-like tuples.\n * @param promptMessages Messages to be passed to the chat model\n * @returns A new ChatPromptTemplate\n */\n static fromMessages(promptMessages, extra) {\n const flattenedMessages = promptMessages.reduce((acc, promptMessage) => acc.concat(\n // eslint-disable-next-line no-instanceof/no-instanceof\n promptMessage instanceof ChatPromptTemplate ? promptMessage.promptMessages : [_coerceMessagePromptTemplateLike(promptMessage, extra)]), []);\n const flattenedPartialVariables = promptMessages.reduce((acc, promptMessage) =>\n // eslint-disable-next-line no-instanceof/no-instanceof\n promptMessage instanceof ChatPromptTemplate ? Object.assign(acc, promptMessage.partialVariables) : acc, Object.create(null));\n const inputVariables = new Set();\n for (const promptMessage of flattenedMessages) {\n // eslint-disable-next-line no-instanceof/no-instanceof\n if (promptMessage instanceof BaseMessage) continue;\n for (const inputVariable of promptMessage.inputVariables) {\n if (inputVariable in flattenedPartialVariables) {\n continue;\n }\n inputVariables.add(inputVariable);\n }\n }\n return new this({\n ...extra,\n inputVariables: [...inputVariables],\n promptMessages: flattenedMessages,\n partialVariables: flattenedPartialVariables,\n templateFormat: extra === null || extra === void 0 ? void 0 : extra.templateFormat\n });\n }\n /** @deprecated Renamed to .fromMessages */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n static fromPromptMessages(promptMessages) {\n return this.fromMessages(promptMessages);\n }\n}","map":{"version":3,"names":["AIMessage","HumanMessage","SystemMessage","BaseMessage","ChatMessage","coerceMessageLikeToMessage","isBaseMessage","ChatPromptValue","Runnable","BaseStringPromptTemplate","BasePromptTemplate","PromptTemplate","ImagePromptTemplate","parseFString","parseMustache","addLangChainErrorFields","BaseMessagePromptTemplate","constructor","arguments","Object","defineProperty","enumerable","configurable","writable","value","invoke","input","options","_this","_asyncToGenerator","_callWithConfig","formatMessages","runType","MessagesPlaceholder","lc_name","fields","_fields$optional","variableName","optional","inputVariables","values","_this2","error","Error","name","formattedMessages","Array","isArray","map","e","readableInput","JSON","stringify","message","join","lc_error_code","BaseMessageStringPromptTemplate","prompt","_this3","format","BaseChatPromptTemplate","_this4","formatPromptValue","toString","_this5","resultMessages","ChatMessagePromptTemplate","role","_this6","fromTemplate","template","templateFormat","_StringImageMessagePromptTemplate","_messageClass","additionalOptions","forEach","concat","createMessage","content","MsgClass","chatMessageClass","getRoleFromMessageClass","item","text","_item$text","additionalContentFields","push","_item$image_url","imgTemplate","image_url","imgTemplateObject","_variables$length","parsedTemplate","variables","flatMap","type","length","url","_this7","inputs","formatted","_this8","HumanMessagePromptTemplate","AIMessagePromptTemplate","SystemMessagePromptTemplate","_isBaseMessagePromptTemplate","baseMessagePromptTemplateLike","_coerceMessagePromptTemplateLike","messagePromptTemplateLike","extra","messageContent","slice","templateData","_getType","isInstance","isMessagesPlaceholder","x","ChatPromptTemplate","lc_aliases","promptMessages","validateTemplate","undefined","assign","inputVariablesMessages","Set","promptMessage","inputVariable","add","totalInputVariables","inputVariablesInstance","partialVariables","keys","difference","filter","has","size","otherDifference","_getPromptType","_parseImagePrompts","inputValues","_this9","formattedMessageContent","Promise","all","_ref","imageUrl","promptTemplatePlaceholder","formattedUrl","_x","apply","_this10","allValues","mergePartialAndUserVariables","reduce","acc","partial","_this11","_this11$partialVariab","newInputVariables","iv","newPartialVariables","promptDict","humanTemplate","fromMessages","flattenedMessages","flattenedPartialVariables","create","fromPromptMessages"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@langchain/core/dist/prompts/chat.js"],"sourcesContent":["// Default generic \"any\" values are for backwards compatibility.\n// Replace with \"string\" when we are comfortable with a breaking change.\nimport { AIMessage, HumanMessage, SystemMessage, BaseMessage, ChatMessage, coerceMessageLikeToMessage, isBaseMessage, } from \"../messages/index.js\";\nimport { ChatPromptValue, } from \"../prompt_values.js\";\nimport { Runnable } from \"../runnables/base.js\";\nimport { BaseStringPromptTemplate } from \"./string.js\";\nimport { BasePromptTemplate, } from \"./base.js\";\nimport { PromptTemplate, } from \"./prompt.js\";\nimport { ImagePromptTemplate } from \"./image.js\";\nimport { parseFString, parseMustache, } from \"./template.js\";\nimport { addLangChainErrorFields } from \"../errors/index.js\";\n/**\n * Abstract class that serves as a base for creating message prompt\n * templates. It defines how to format messages for different roles in a\n * conversation.\n */\nexport class BaseMessagePromptTemplate extends Runnable {\n constructor() {\n super(...arguments);\n Object.defineProperty(this, \"lc_namespace\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: [\"langchain_core\", \"prompts\", \"chat\"]\n });\n Object.defineProperty(this, \"lc_serializable\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: true\n });\n }\n /**\n * Calls the formatMessages method with the provided input and options.\n * @param input Input for the formatMessages method\n * @param options Optional BaseCallbackConfig\n * @returns Formatted output messages\n */\n async invoke(input, options) {\n return this._callWithConfig((input) => this.formatMessages(input), input, { ...options, runType: \"prompt\" });\n }\n}\n/**\n * Class that represents a placeholder for messages in a chat prompt. It\n * extends the BaseMessagePromptTemplate.\n */\nexport class MessagesPlaceholder extends BaseMessagePromptTemplate {\n static lc_name() {\n return \"MessagesPlaceholder\";\n }\n constructor(fields) {\n if (typeof fields === \"string\") {\n // eslint-disable-next-line no-param-reassign\n fields = { variableName: fields };\n }\n super(fields);\n Object.defineProperty(this, \"variableName\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"optional\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this.variableName = fields.variableName;\n this.optional = fields.optional ?? false;\n }\n get inputVariables() {\n return [this.variableName];\n }\n async formatMessages(values) {\n const input = values[this.variableName];\n if (this.optional && !input) {\n return [];\n }\n else if (!input) {\n const error = new Error(`Field \"${this.variableName}\" in prompt uses a MessagesPlaceholder, which expects an array of BaseMessages as an input value. Received: undefined`);\n error.name = \"InputFormatError\";\n throw error;\n }\n let formattedMessages;\n try {\n if (Array.isArray(input)) {\n formattedMessages = input.map(coerceMessageLikeToMessage);\n }\n else {\n formattedMessages = [coerceMessageLikeToMessage(input)];\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n }\n catch (e) {\n const readableInput = typeof input === \"string\" ? input : JSON.stringify(input, null, 2);\n const error = new Error([\n `Field \"${this.variableName}\" in prompt uses a MessagesPlaceholder, which expects an array of BaseMessages or coerceable values as input.`,\n `Received value: ${readableInput}`,\n `Additional message: ${e.message}`,\n ].join(\"\\n\\n\"));\n error.name = \"InputFormatError\";\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n error.lc_error_code = e.lc_error_code;\n throw error;\n }\n return formattedMessages;\n }\n}\n/**\n * Abstract class that serves as a base for creating message string prompt\n * templates. It extends the BaseMessagePromptTemplate.\n */\nexport class BaseMessageStringPromptTemplate extends BaseMessagePromptTemplate {\n constructor(fields) {\n if (!(\"prompt\" in fields)) {\n // eslint-disable-next-line no-param-reassign\n fields = { prompt: fields };\n }\n super(fields);\n Object.defineProperty(this, \"prompt\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this.prompt = fields.prompt;\n }\n get inputVariables() {\n return this.prompt.inputVariables;\n }\n async formatMessages(values) {\n return [await this.format(values)];\n }\n}\n/**\n * Abstract class that serves as a base for creating chat prompt\n * templates. It extends the BasePromptTemplate.\n */\nexport class BaseChatPromptTemplate extends BasePromptTemplate {\n constructor(input) {\n super(input);\n }\n async format(values) {\n return (await this.formatPromptValue(values)).toString();\n }\n async formatPromptValue(values) {\n const resultMessages = await this.formatMessages(values);\n return new ChatPromptValue(resultMessages);\n }\n}\n/**\n * Class that represents a chat message prompt template. It extends the\n * BaseMessageStringPromptTemplate.\n */\nexport class ChatMessagePromptTemplate extends BaseMessageStringPromptTemplate {\n static lc_name() {\n return \"ChatMessagePromptTemplate\";\n }\n constructor(fields, role) {\n if (!(\"prompt\" in fields)) {\n // eslint-disable-next-line no-param-reassign, @typescript-eslint/no-non-null-assertion\n fields = { prompt: fields, role: role };\n }\n super(fields);\n Object.defineProperty(this, \"role\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this.role = fields.role;\n }\n async format(values) {\n return new ChatMessage(await this.prompt.format(values), this.role);\n }\n static fromTemplate(template, role, options) {\n return new this(PromptTemplate.fromTemplate(template, {\n templateFormat: options?.templateFormat,\n }), role);\n }\n}\nclass _StringImageMessagePromptTemplate extends BaseMessagePromptTemplate {\n static _messageClass() {\n throw new Error(\"Can not invoke _messageClass from inside _StringImageMessagePromptTemplate\");\n }\n constructor(\n /** @TODO When we come up with a better way to type prompt templates, fix this */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n fields, additionalOptions) {\n if (!(\"prompt\" in fields)) {\n // eslint-disable-next-line no-param-reassign\n fields = { prompt: fields };\n }\n super(fields);\n Object.defineProperty(this, \"lc_namespace\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: [\"langchain_core\", \"prompts\", \"chat\"]\n });\n Object.defineProperty(this, \"lc_serializable\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: true\n });\n Object.defineProperty(this, \"inputVariables\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: []\n });\n Object.defineProperty(this, \"additionalOptions\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: {}\n });\n Object.defineProperty(this, \"prompt\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"messageClass\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n // ChatMessage contains role field, others don't.\n // Because of this, we have a separate class property for ChatMessage.\n Object.defineProperty(this, \"chatMessageClass\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this.prompt = fields.prompt;\n if (Array.isArray(this.prompt)) {\n let inputVariables = [];\n this.prompt.forEach((prompt) => {\n if (\"inputVariables\" in prompt) {\n inputVariables = inputVariables.concat(prompt.inputVariables);\n }\n });\n this.inputVariables = inputVariables;\n }\n else {\n this.inputVariables = this.prompt.inputVariables;\n }\n this.additionalOptions = additionalOptions ?? this.additionalOptions;\n }\n createMessage(content) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const constructor = this.constructor;\n if (constructor._messageClass()) {\n const MsgClass = constructor._messageClass();\n return new MsgClass({ content });\n }\n else if (constructor.chatMessageClass) {\n const MsgClass = constructor.chatMessageClass();\n // Assuming ChatMessage constructor also takes a content argument\n return new MsgClass({\n content,\n role: this.getRoleFromMessageClass(MsgClass.lc_name()),\n });\n }\n else {\n throw new Error(\"No message class defined\");\n }\n }\n getRoleFromMessageClass(name) {\n switch (name) {\n case \"HumanMessage\":\n return \"human\";\n case \"AIMessage\":\n return \"ai\";\n case \"SystemMessage\":\n return \"system\";\n case \"ChatMessage\":\n return \"chat\";\n default:\n throw new Error(\"Invalid message class name\");\n }\n }\n static fromTemplate(template, additionalOptions) {\n if (typeof template === \"string\") {\n return new this(PromptTemplate.fromTemplate(template, additionalOptions));\n }\n const prompt = [];\n for (const item of template) {\n if (typeof item === \"string\" ||\n (typeof item === \"object\" && \"text\" in item)) {\n let text = \"\";\n if (typeof item === \"string\") {\n text = item;\n }\n else if (typeof item.text === \"string\") {\n text = item.text ?? \"\";\n }\n const options = {\n ...additionalOptions,\n ...(typeof item !== \"string\"\n ? { additionalContentFields: item }\n : {}),\n };\n prompt.push(PromptTemplate.fromTemplate(text, options));\n }\n else if (typeof item === \"object\" && \"image_url\" in item) {\n let imgTemplate = item.image_url ?? \"\";\n let imgTemplateObject;\n let inputVariables = [];\n if (typeof imgTemplate === \"string\") {\n let parsedTemplate;\n if (additionalOptions?.templateFormat === \"mustache\") {\n parsedTemplate = parseMustache(imgTemplate);\n }\n else {\n parsedTemplate = parseFString(imgTemplate);\n }\n const variables = parsedTemplate.flatMap((item) => item.type === \"variable\" ? [item.name] : []);\n if ((variables?.length ?? 0) > 0) {\n if (variables.length > 1) {\n throw new Error(`Only one format variable allowed per image template.\\nGot: ${variables}\\nFrom: ${imgTemplate}`);\n }\n inputVariables = [variables[0]];\n }\n else {\n inputVariables = [];\n }\n imgTemplate = { url: imgTemplate };\n imgTemplateObject = new ImagePromptTemplate({\n template: imgTemplate,\n inputVariables,\n templateFormat: additionalOptions?.templateFormat,\n additionalContentFields: item,\n });\n }\n else if (typeof imgTemplate === \"object\") {\n if (\"url\" in imgTemplate) {\n let parsedTemplate;\n if (additionalOptions?.templateFormat === \"mustache\") {\n parsedTemplate = parseMustache(imgTemplate.url);\n }\n else {\n parsedTemplate = parseFString(imgTemplate.url);\n }\n inputVariables = parsedTemplate.flatMap((item) => item.type === \"variable\" ? [item.name] : []);\n }\n else {\n inputVariables = [];\n }\n imgTemplateObject = new ImagePromptTemplate({\n template: imgTemplate,\n inputVariables,\n templateFormat: additionalOptions?.templateFormat,\n additionalContentFields: item,\n });\n }\n else {\n throw new Error(\"Invalid image template\");\n }\n prompt.push(imgTemplateObject);\n }\n }\n return new this({ prompt, additionalOptions });\n }\n async format(input) {\n // eslint-disable-next-line no-instanceof/no-instanceof\n if (this.prompt instanceof BaseStringPromptTemplate) {\n const text = await this.prompt.format(input);\n return this.createMessage(text);\n }\n else {\n const content = [];\n for (const prompt of this.prompt) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let inputs = {};\n if (!(\"inputVariables\" in prompt)) {\n throw new Error(`Prompt ${prompt} does not have inputVariables defined.`);\n }\n for (const item of prompt.inputVariables) {\n if (!inputs) {\n inputs = { [item]: input[item] };\n }\n inputs = { ...inputs, [item]: input[item] };\n }\n // eslint-disable-next-line no-instanceof/no-instanceof\n if (prompt instanceof BaseStringPromptTemplate) {\n const formatted = await prompt.format(inputs);\n let additionalContentFields;\n if (\"additionalContentFields\" in prompt) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n additionalContentFields = prompt.additionalContentFields;\n }\n content.push({\n ...additionalContentFields,\n type: \"text\",\n text: formatted,\n });\n /** @TODO replace this */\n // eslint-disable-next-line no-instanceof/no-instanceof\n }\n else if (prompt instanceof ImagePromptTemplate) {\n const formatted = await prompt.format(inputs);\n let additionalContentFields;\n if (\"additionalContentFields\" in prompt) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n additionalContentFields = prompt.additionalContentFields;\n }\n content.push({\n ...additionalContentFields,\n type: \"image_url\",\n image_url: formatted,\n });\n }\n }\n return this.createMessage(content);\n }\n }\n async formatMessages(values) {\n return [await this.format(values)];\n }\n}\n/**\n * Class that represents a human message prompt template. It extends the\n * BaseMessageStringPromptTemplate.\n * @example\n * ```typescript\n * const message = HumanMessagePromptTemplate.fromTemplate(\"{text}\");\n * const formatted = await message.format({ text: \"Hello world!\" });\n *\n * const chatPrompt = ChatPromptTemplate.fromMessages([message]);\n * const formattedChatPrompt = await chatPrompt.invoke({\n * text: \"Hello world!\",\n * });\n * ```\n */\nexport class HumanMessagePromptTemplate extends _StringImageMessagePromptTemplate {\n static _messageClass() {\n return HumanMessage;\n }\n static lc_name() {\n return \"HumanMessagePromptTemplate\";\n }\n}\n/**\n * Class that represents an AI message prompt template. It extends the\n * BaseMessageStringPromptTemplate.\n */\nexport class AIMessagePromptTemplate extends _StringImageMessagePromptTemplate {\n static _messageClass() {\n return AIMessage;\n }\n static lc_name() {\n return \"AIMessagePromptTemplate\";\n }\n}\n/**\n * Class that represents a system message prompt template. It extends the\n * BaseMessageStringPromptTemplate.\n * @example\n * ```typescript\n * const message = SystemMessagePromptTemplate.fromTemplate(\"{text}\");\n * const formatted = await message.format({ text: \"Hello world!\" });\n *\n * const chatPrompt = ChatPromptTemplate.fromMessages([message]);\n * const formattedChatPrompt = await chatPrompt.invoke({\n * text: \"Hello world!\",\n * });\n * ```\n */\nexport class SystemMessagePromptTemplate extends _StringImageMessagePromptTemplate {\n static _messageClass() {\n return SystemMessage;\n }\n static lc_name() {\n return \"SystemMessagePromptTemplate\";\n }\n}\nfunction _isBaseMessagePromptTemplate(baseMessagePromptTemplateLike) {\n return (typeof baseMessagePromptTemplateLike\n .formatMessages === \"function\");\n}\nfunction _coerceMessagePromptTemplateLike(messagePromptTemplateLike, extra) {\n if (_isBaseMessagePromptTemplate(messagePromptTemplateLike) ||\n isBaseMessage(messagePromptTemplateLike)) {\n return messagePromptTemplateLike;\n }\n if (Array.isArray(messagePromptTemplateLike) &&\n messagePromptTemplateLike[0] === \"placeholder\") {\n const messageContent = messagePromptTemplateLike[1];\n if (typeof messageContent !== \"string\" ||\n messageContent[0] !== \"{\" ||\n messageContent[messageContent.length - 1] !== \"}\") {\n throw new Error(`Invalid placeholder template: \"${messagePromptTemplateLike[1]}\". Expected a variable name surrounded by curly braces.`);\n }\n const variableName = messageContent.slice(1, -1);\n return new MessagesPlaceholder({ variableName, optional: true });\n }\n const message = coerceMessageLikeToMessage(messagePromptTemplateLike);\n let templateData;\n if (typeof message.content === \"string\") {\n templateData = message.content;\n }\n else {\n // Assuming message.content is an array of complex objects, transform it.\n templateData = message.content.map((item) => {\n if (\"text\" in item) {\n return { ...item, text: item.text };\n }\n else if (\"image_url\" in item) {\n return { ...item, image_url: item.image_url };\n }\n else {\n return item;\n }\n });\n }\n if (message._getType() === \"human\") {\n return HumanMessagePromptTemplate.fromTemplate(templateData, extra);\n }\n else if (message._getType() === \"ai\") {\n return AIMessagePromptTemplate.fromTemplate(templateData, extra);\n }\n else if (message._getType() === \"system\") {\n return SystemMessagePromptTemplate.fromTemplate(templateData, extra);\n }\n else if (ChatMessage.isInstance(message)) {\n return ChatMessagePromptTemplate.fromTemplate(message.content, message.role, extra);\n }\n else {\n throw new Error(`Could not coerce message prompt template from input. Received message type: \"${message._getType()}\".`);\n }\n}\nfunction isMessagesPlaceholder(x) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return x.constructor.lc_name() === \"MessagesPlaceholder\";\n}\n/**\n * Class that represents a chat prompt. It extends the\n * BaseChatPromptTemplate and uses an array of BaseMessagePromptTemplate\n * instances to format a series of messages for a conversation.\n * @example\n * ```typescript\n * const message = SystemMessagePromptTemplate.fromTemplate(\"{text}\");\n * const chatPrompt = ChatPromptTemplate.fromMessages([\n * [\"ai\", \"You are a helpful assistant.\"],\n * message,\n * ]);\n * const formattedChatPrompt = await chatPrompt.invoke({\n * text: \"Hello world!\",\n * });\n * ```\n */\nexport class ChatPromptTemplate extends BaseChatPromptTemplate {\n static lc_name() {\n return \"ChatPromptTemplate\";\n }\n get lc_aliases() {\n return {\n promptMessages: \"messages\",\n };\n }\n constructor(input) {\n super(input);\n Object.defineProperty(this, \"promptMessages\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"validateTemplate\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: true\n });\n Object.defineProperty(this, \"templateFormat\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: \"f-string\"\n });\n // If input is mustache and validateTemplate is not defined, set it to false\n if (input.templateFormat === \"mustache\" &&\n input.validateTemplate === undefined) {\n this.validateTemplate = false;\n }\n Object.assign(this, input);\n if (this.validateTemplate) {\n const inputVariablesMessages = new Set();\n for (const promptMessage of this.promptMessages) {\n // eslint-disable-next-line no-instanceof/no-instanceof\n if (promptMessage instanceof BaseMessage)\n continue;\n for (const inputVariable of promptMessage.inputVariables) {\n inputVariablesMessages.add(inputVariable);\n }\n }\n const totalInputVariables = this.inputVariables;\n const inputVariablesInstance = new Set(this.partialVariables\n ? totalInputVariables.concat(Object.keys(this.partialVariables))\n : totalInputVariables);\n const difference = new Set([...inputVariablesInstance].filter((x) => !inputVariablesMessages.has(x)));\n if (difference.size > 0) {\n throw new Error(`Input variables \\`${[\n ...difference,\n ]}\\` are not used in any of the prompt messages.`);\n }\n const otherDifference = new Set([...inputVariablesMessages].filter((x) => !inputVariablesInstance.has(x)));\n if (otherDifference.size > 0) {\n throw new Error(`Input variables \\`${[\n ...otherDifference,\n ]}\\` are used in prompt messages but not in the prompt template.`);\n }\n }\n }\n _getPromptType() {\n return \"chat\";\n }\n async _parseImagePrompts(message, inputValues) {\n if (typeof message.content === \"string\") {\n return message;\n }\n const formattedMessageContent = await Promise.all(message.content.map(async (item) => {\n if (item.type !== \"image_url\") {\n return item;\n }\n let imageUrl = \"\";\n if (typeof item.image_url === \"string\") {\n imageUrl = item.image_url;\n }\n else {\n imageUrl = item.image_url.url;\n }\n const promptTemplatePlaceholder = PromptTemplate.fromTemplate(imageUrl, {\n templateFormat: this.templateFormat,\n });\n const formattedUrl = await promptTemplatePlaceholder.format(inputValues);\n if (typeof item.image_url !== \"string\" && \"url\" in item.image_url) {\n // eslint-disable-next-line no-param-reassign\n item.image_url.url = formattedUrl;\n }\n else {\n // eslint-disable-next-line no-param-reassign\n item.image_url = formattedUrl;\n }\n return item;\n }));\n // eslint-disable-next-line no-param-reassign\n message.content = formattedMessageContent;\n return message;\n }\n async formatMessages(values) {\n const allValues = await this.mergePartialAndUserVariables(values);\n let resultMessages = [];\n for (const promptMessage of this.promptMessages) {\n // eslint-disable-next-line no-instanceof/no-instanceof\n if (promptMessage instanceof BaseMessage) {\n resultMessages.push(await this._parseImagePrompts(promptMessage, allValues));\n }\n else {\n const inputValues = promptMessage.inputVariables.reduce((acc, inputVariable) => {\n if (!(inputVariable in allValues) &&\n !(isMessagesPlaceholder(promptMessage) && promptMessage.optional)) {\n const error = addLangChainErrorFields(new Error(`Missing value for input variable \\`${inputVariable.toString()}\\``), \"INVALID_PROMPT_INPUT\");\n throw error;\n }\n acc[inputVariable] = allValues[inputVariable];\n return acc;\n }, {});\n const message = await promptMessage.formatMessages(inputValues);\n resultMessages = resultMessages.concat(message);\n }\n }\n return resultMessages;\n }\n async partial(values) {\n // This is implemented in a way it doesn't require making\n // BaseMessagePromptTemplate aware of .partial()\n const newInputVariables = this.inputVariables.filter((iv) => !(iv in values));\n const newPartialVariables = {\n ...(this.partialVariables ?? {}),\n ...values,\n };\n const promptDict = {\n ...this,\n inputVariables: newInputVariables,\n partialVariables: newPartialVariables,\n };\n return new ChatPromptTemplate(promptDict);\n }\n static fromTemplate(template, options) {\n const prompt = PromptTemplate.fromTemplate(template, options);\n const humanTemplate = new HumanMessagePromptTemplate({ prompt });\n return this.fromMessages([humanTemplate]);\n }\n /**\n * Create a chat model-specific prompt from individual chat messages\n * or message-like tuples.\n * @param promptMessages Messages to be passed to the chat model\n * @returns A new ChatPromptTemplate\n */\n static fromMessages(promptMessages, extra) {\n const flattenedMessages = promptMessages.reduce((acc, promptMessage) => acc.concat(\n // eslint-disable-next-line no-instanceof/no-instanceof\n promptMessage instanceof ChatPromptTemplate\n ? promptMessage.promptMessages\n : [\n _coerceMessagePromptTemplateLike(promptMessage, extra),\n ]), []);\n const flattenedPartialVariables = promptMessages.reduce((acc, promptMessage) => \n // eslint-disable-next-line no-instanceof/no-instanceof\n promptMessage instanceof ChatPromptTemplate\n ? Object.assign(acc, promptMessage.partialVariables)\n : acc, Object.create(null));\n const inputVariables = new Set();\n for (const promptMessage of flattenedMessages) {\n // eslint-disable-next-line no-instanceof/no-instanceof\n if (promptMessage instanceof BaseMessage)\n continue;\n for (const inputVariable of promptMessage.inputVariables) {\n if (inputVariable in flattenedPartialVariables) {\n continue;\n }\n inputVariables.add(inputVariable);\n }\n }\n return new this({\n ...extra,\n inputVariables: [...inputVariables],\n promptMessages: flattenedMessages,\n partialVariables: flattenedPartialVariables,\n templateFormat: extra?.templateFormat,\n });\n }\n /** @deprecated Renamed to .fromMessages */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n static fromPromptMessages(promptMessages) {\n return this.fromMessages(promptMessages);\n }\n}\n"],"mappings":";AAAA;AACA;AACA,SAASA,SAAS,EAAEC,YAAY,EAAEC,aAAa,EAAEC,WAAW,EAAEC,WAAW,EAAEC,0BAA0B,EAAEC,aAAa,QAAS,sBAAsB;AACnJ,SAASC,eAAe,QAAS,qBAAqB;AACtD,SAASC,QAAQ,QAAQ,sBAAsB;AAC/C,SAASC,wBAAwB,QAAQ,aAAa;AACtD,SAASC,kBAAkB,QAAS,WAAW;AAC/C,SAASC,cAAc,QAAS,aAAa;AAC7C,SAASC,mBAAmB,QAAQ,YA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