@langchain/core 1.1.6 → 1.2.0-dev-1765937705265

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (297) hide show
  1. package/dist/caches/index.d.cts +2 -2
  2. package/dist/caches/index.d.cts.map +1 -1
  3. package/dist/caches/index.d.ts +2 -2
  4. package/dist/caches/index.d.ts.map +1 -1
  5. package/dist/callbacks/base.d.cts +2 -2
  6. package/dist/callbacks/base.d.cts.map +1 -1
  7. package/dist/callbacks/base.d.ts +2 -2
  8. package/dist/callbacks/base.d.ts.map +1 -1
  9. package/dist/messages/ai.cjs +13 -9
  10. package/dist/messages/ai.cjs.map +1 -1
  11. package/dist/messages/ai.d.cts +25 -5
  12. package/dist/messages/ai.d.cts.map +1 -1
  13. package/dist/messages/ai.d.ts +25 -5
  14. package/dist/messages/ai.d.ts.map +1 -1
  15. package/dist/messages/ai.js +13 -9
  16. package/dist/messages/ai.js.map +1 -1
  17. package/dist/messages/base.cjs.map +1 -1
  18. package/dist/messages/base.js.map +1 -1
  19. package/dist/messages/index.d.cts +2 -2
  20. package/dist/messages/index.d.ts +2 -2
  21. package/dist/messages/message.cjs.map +1 -1
  22. package/dist/messages/message.d.cts +62 -6
  23. package/dist/messages/message.d.cts.map +1 -1
  24. package/dist/messages/message.d.ts +62 -6
  25. package/dist/messages/message.d.ts.map +1 -1
  26. package/dist/messages/message.js.map +1 -1
  27. package/dist/messages/tool.cjs.map +1 -1
  28. package/dist/messages/tool.d.cts +10 -0
  29. package/dist/messages/tool.d.cts.map +1 -1
  30. package/dist/messages/tool.d.ts +10 -0
  31. package/dist/messages/tool.d.ts.map +1 -1
  32. package/dist/messages/tool.js.map +1 -1
  33. package/dist/messages/utils.d.cts +3 -3
  34. package/dist/messages/utils.d.cts.map +1 -1
  35. package/dist/messages/utils.d.ts +3 -3
  36. package/dist/messages/utils.d.ts.map +1 -1
  37. package/dist/prompt_values.d.cts +4 -4
  38. package/dist/prompt_values.d.cts.map +1 -1
  39. package/dist/prompt_values.d.ts +4 -4
  40. package/dist/prompt_values.d.ts.map +1 -1
  41. package/dist/prompts/chat.d.cts +2 -2
  42. package/dist/prompts/chat.d.cts.map +1 -1
  43. package/dist/prompts/chat.d.ts +2 -2
  44. package/dist/prompts/chat.d.ts.map +1 -1
  45. package/dist/stores.d.cts.map +1 -1
  46. package/dist/stores.d.ts.map +1 -1
  47. package/dist/tools/index.cjs +2 -1
  48. package/dist/tools/index.cjs.map +1 -1
  49. package/dist/tools/index.d.cts +17 -12
  50. package/dist/tools/index.d.cts.map +1 -1
  51. package/dist/tools/index.d.ts +17 -12
  52. package/dist/tools/index.d.ts.map +1 -1
  53. package/dist/tools/index.js +2 -1
  54. package/dist/tools/index.js.map +1 -1
  55. package/dist/utils/event_source_parse.d.cts.map +1 -1
  56. package/dist/utils/stream.d.cts.map +1 -1
  57. package/dist/utils/testing/chat_models.d.cts +4 -4
  58. package/dist/utils/testing/chat_models.d.cts.map +1 -1
  59. package/dist/utils/testing/chat_models.d.ts +4 -4
  60. package/dist/utils/testing/chat_models.d.ts.map +1 -1
  61. package/package.json +2 -2
  62. package/agents.cjs +0 -1
  63. package/agents.d.cts +0 -1
  64. package/agents.d.ts +0 -1
  65. package/agents.js +0 -1
  66. package/caches.cjs +0 -1
  67. package/caches.d.cts +0 -1
  68. package/caches.d.ts +0 -1
  69. package/caches.js +0 -1
  70. package/callbacks/base.cjs +0 -1
  71. package/callbacks/base.d.cts +0 -1
  72. package/callbacks/base.d.ts +0 -1
  73. package/callbacks/base.js +0 -1
  74. package/callbacks/dispatch/web.cjs +0 -1
  75. package/callbacks/dispatch/web.d.cts +0 -1
  76. package/callbacks/dispatch/web.d.ts +0 -1
  77. package/callbacks/dispatch/web.js +0 -1
  78. package/callbacks/dispatch.cjs +0 -1
  79. package/callbacks/dispatch.d.cts +0 -1
  80. package/callbacks/dispatch.d.ts +0 -1
  81. package/callbacks/dispatch.js +0 -1
  82. package/callbacks/manager.cjs +0 -1
  83. package/callbacks/manager.d.cts +0 -1
  84. package/callbacks/manager.d.ts +0 -1
  85. package/callbacks/manager.js +0 -1
  86. package/callbacks/promises.cjs +0 -1
  87. package/callbacks/promises.d.cts +0 -1
  88. package/callbacks/promises.d.ts +0 -1
  89. package/callbacks/promises.js +0 -1
  90. package/chat_history.cjs +0 -1
  91. package/chat_history.d.cts +0 -1
  92. package/chat_history.d.ts +0 -1
  93. package/chat_history.js +0 -1
  94. package/context.cjs +0 -1
  95. package/context.d.cts +0 -1
  96. package/context.d.ts +0 -1
  97. package/context.js +0 -1
  98. package/document_loaders/base.cjs +0 -1
  99. package/document_loaders/base.d.cts +0 -1
  100. package/document_loaders/base.d.ts +0 -1
  101. package/document_loaders/base.js +0 -1
  102. package/document_loaders/langsmith.cjs +0 -1
  103. package/document_loaders/langsmith.d.cts +0 -1
  104. package/document_loaders/langsmith.d.ts +0 -1
  105. package/document_loaders/langsmith.js +0 -1
  106. package/documents.cjs +0 -1
  107. package/documents.d.cts +0 -1
  108. package/documents.d.ts +0 -1
  109. package/documents.js +0 -1
  110. package/embeddings.cjs +0 -1
  111. package/embeddings.d.cts +0 -1
  112. package/embeddings.d.ts +0 -1
  113. package/embeddings.js +0 -1
  114. package/example_selectors.cjs +0 -1
  115. package/example_selectors.d.cts +0 -1
  116. package/example_selectors.d.ts +0 -1
  117. package/example_selectors.js +0 -1
  118. package/indexing.cjs +0 -1
  119. package/indexing.d.cts +0 -1
  120. package/indexing.d.ts +0 -1
  121. package/indexing.js +0 -1
  122. package/language_models/base.cjs +0 -1
  123. package/language_models/base.d.cts +0 -1
  124. package/language_models/base.d.ts +0 -1
  125. package/language_models/base.js +0 -1
  126. package/language_models/chat_models.cjs +0 -1
  127. package/language_models/chat_models.d.cts +0 -1
  128. package/language_models/chat_models.d.ts +0 -1
  129. package/language_models/chat_models.js +0 -1
  130. package/language_models/llms.cjs +0 -1
  131. package/language_models/llms.d.cts +0 -1
  132. package/language_models/llms.d.ts +0 -1
  133. package/language_models/llms.js +0 -1
  134. package/language_models/profile.cjs +0 -1
  135. package/language_models/profile.d.cts +0 -1
  136. package/language_models/profile.d.ts +0 -1
  137. package/language_models/profile.js +0 -1
  138. package/load/serializable.cjs +0 -1
  139. package/load/serializable.d.cts +0 -1
  140. package/load/serializable.d.ts +0 -1
  141. package/load/serializable.js +0 -1
  142. package/load.cjs +0 -1
  143. package/load.d.cts +0 -1
  144. package/load.d.ts +0 -1
  145. package/load.js +0 -1
  146. package/memory.cjs +0 -1
  147. package/memory.d.cts +0 -1
  148. package/memory.d.ts +0 -1
  149. package/memory.js +0 -1
  150. package/messages/tool.cjs +0 -1
  151. package/messages/tool.d.cts +0 -1
  152. package/messages/tool.d.ts +0 -1
  153. package/messages/tool.js +0 -1
  154. package/messages.cjs +0 -1
  155. package/messages.d.cts +0 -1
  156. package/messages.d.ts +0 -1
  157. package/messages.js +0 -1
  158. package/output_parsers/openai_functions.cjs +0 -1
  159. package/output_parsers/openai_functions.d.cts +0 -1
  160. package/output_parsers/openai_functions.d.ts +0 -1
  161. package/output_parsers/openai_functions.js +0 -1
  162. package/output_parsers/openai_tools.cjs +0 -1
  163. package/output_parsers/openai_tools.d.cts +0 -1
  164. package/output_parsers/openai_tools.d.ts +0 -1
  165. package/output_parsers/openai_tools.js +0 -1
  166. package/output_parsers.cjs +0 -1
  167. package/output_parsers.d.cts +0 -1
  168. package/output_parsers.d.ts +0 -1
  169. package/output_parsers.js +0 -1
  170. package/outputs.cjs +0 -1
  171. package/outputs.d.cts +0 -1
  172. package/outputs.d.ts +0 -1
  173. package/outputs.js +0 -1
  174. package/prompt_values.cjs +0 -1
  175. package/prompt_values.d.cts +0 -1
  176. package/prompt_values.d.ts +0 -1
  177. package/prompt_values.js +0 -1
  178. package/prompts.cjs +0 -1
  179. package/prompts.d.cts +0 -1
  180. package/prompts.d.ts +0 -1
  181. package/prompts.js +0 -1
  182. package/retrievers/document_compressors.cjs +0 -1
  183. package/retrievers/document_compressors.d.cts +0 -1
  184. package/retrievers/document_compressors.d.ts +0 -1
  185. package/retrievers/document_compressors.js +0 -1
  186. package/retrievers.cjs +0 -1
  187. package/retrievers.d.cts +0 -1
  188. package/retrievers.d.ts +0 -1
  189. package/retrievers.js +0 -1
  190. package/runnables/graph.cjs +0 -1
  191. package/runnables/graph.d.cts +0 -1
  192. package/runnables/graph.d.ts +0 -1
  193. package/runnables/graph.js +0 -1
  194. package/runnables.cjs +0 -1
  195. package/runnables.d.cts +0 -1
  196. package/runnables.d.ts +0 -1
  197. package/runnables.js +0 -1
  198. package/singletons.cjs +0 -1
  199. package/singletons.d.cts +0 -1
  200. package/singletons.d.ts +0 -1
  201. package/singletons.js +0 -1
  202. package/stores.cjs +0 -1
  203. package/stores.d.cts +0 -1
  204. package/stores.d.ts +0 -1
  205. package/stores.js +0 -1
  206. package/structured_query.cjs +0 -1
  207. package/structured_query.d.cts +0 -1
  208. package/structured_query.d.ts +0 -1
  209. package/structured_query.js +0 -1
  210. package/tools.cjs +0 -1
  211. package/tools.d.cts +0 -1
  212. package/tools.d.ts +0 -1
  213. package/tools.js +0 -1
  214. package/tracers/base.cjs +0 -1
  215. package/tracers/base.d.cts +0 -1
  216. package/tracers/base.d.ts +0 -1
  217. package/tracers/base.js +0 -1
  218. package/tracers/console.cjs +0 -1
  219. package/tracers/console.d.cts +0 -1
  220. package/tracers/console.d.ts +0 -1
  221. package/tracers/console.js +0 -1
  222. package/tracers/log_stream.cjs +0 -1
  223. package/tracers/log_stream.d.cts +0 -1
  224. package/tracers/log_stream.d.ts +0 -1
  225. package/tracers/log_stream.js +0 -1
  226. package/tracers/run_collector.cjs +0 -1
  227. package/tracers/run_collector.d.cts +0 -1
  228. package/tracers/run_collector.d.ts +0 -1
  229. package/tracers/run_collector.js +0 -1
  230. package/tracers/tracer_langchain.cjs +0 -1
  231. package/tracers/tracer_langchain.d.cts +0 -1
  232. package/tracers/tracer_langchain.d.ts +0 -1
  233. package/tracers/tracer_langchain.js +0 -1
  234. package/types/stream.cjs +0 -1
  235. package/types/stream.d.cts +0 -1
  236. package/types/stream.d.ts +0 -1
  237. package/types/stream.js +0 -1
  238. package/utils/async_caller.cjs +0 -1
  239. package/utils/async_caller.d.cts +0 -1
  240. package/utils/async_caller.d.ts +0 -1
  241. package/utils/async_caller.js +0 -1
  242. package/utils/chunk_array.cjs +0 -1
  243. package/utils/chunk_array.d.cts +0 -1
  244. package/utils/chunk_array.d.ts +0 -1
  245. package/utils/chunk_array.js +0 -1
  246. package/utils/env.cjs +0 -1
  247. package/utils/env.d.cts +0 -1
  248. package/utils/env.d.ts +0 -1
  249. package/utils/env.js +0 -1
  250. package/utils/event_source_parse.cjs +0 -1
  251. package/utils/event_source_parse.d.cts +0 -1
  252. package/utils/event_source_parse.d.ts +0 -1
  253. package/utils/event_source_parse.js +0 -1
  254. package/utils/format.cjs +0 -1
  255. package/utils/format.d.cts +0 -1
  256. package/utils/format.d.ts +0 -1
  257. package/utils/format.js +0 -1
  258. package/utils/function_calling.cjs +0 -1
  259. package/utils/function_calling.d.cts +0 -1
  260. package/utils/function_calling.d.ts +0 -1
  261. package/utils/function_calling.js +0 -1
  262. package/utils/hash.cjs +0 -1
  263. package/utils/hash.d.cts +0 -1
  264. package/utils/hash.d.ts +0 -1
  265. package/utils/hash.js +0 -1
  266. package/utils/json_patch.cjs +0 -1
  267. package/utils/json_patch.d.cts +0 -1
  268. package/utils/json_patch.d.ts +0 -1
  269. package/utils/json_patch.js +0 -1
  270. package/utils/json_schema.cjs +0 -1
  271. package/utils/json_schema.d.cts +0 -1
  272. package/utils/json_schema.d.ts +0 -1
  273. package/utils/json_schema.js +0 -1
  274. package/utils/math.cjs +0 -1
  275. package/utils/math.d.cts +0 -1
  276. package/utils/math.d.ts +0 -1
  277. package/utils/math.js +0 -1
  278. package/utils/stream.cjs +0 -1
  279. package/utils/stream.d.cts +0 -1
  280. package/utils/stream.d.ts +0 -1
  281. package/utils/stream.js +0 -1
  282. package/utils/testing.cjs +0 -1
  283. package/utils/testing.d.cts +0 -1
  284. package/utils/testing.d.ts +0 -1
  285. package/utils/testing.js +0 -1
  286. package/utils/tiktoken.cjs +0 -1
  287. package/utils/tiktoken.d.cts +0 -1
  288. package/utils/tiktoken.d.ts +0 -1
  289. package/utils/tiktoken.js +0 -1
  290. package/utils/types.cjs +0 -1
  291. package/utils/types.d.cts +0 -1
  292. package/utils/types.d.ts +0 -1
  293. package/utils/types.js +0 -1
  294. package/vectorstores.cjs +0 -1
  295. package/vectorstores.d.cts +0 -1
  296. package/vectorstores.d.ts +0 -1
  297. package/vectorstores.js +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"chat.d.ts","names":["BaseCallbackConfig","AIMessage","HumanMessage","SystemMessage","BaseMessage","ChatMessage","BaseMessageLike","MessageContent","ChatPromptValueInterface","InputValues","PartialValues","Runnable","BaseStringPromptTemplate","BasePromptTemplate","BasePromptTemplateInput","TypedPromptInputValues","PromptTemplateInput","ExtractedFStringParams","ImagePromptTemplate","TemplateFormat","DictPromptTemplate","BaseMessagePromptTemplate","RunInput","RunOutput","Extract","Array","Promise","MessagesPlaceholderFields","T","MessagesPlaceholder","MessageStringPromptTemplateFields","BaseMessageStringPromptTemplate","BaseChatPromptTemplate","PartialVariableName","ChatMessagePromptTemplateFields","ChatMessagePromptTemplate","Symbol","_TextTemplateParam","Record","_ImageTemplateParam","MessageClass","ChatMessageClass","_StringImageMessagePromptTemplateOptions","Format","_StringImageMessagePromptTemplate","___messages_message_js7","MessageStructure","MessageType","HumanMessagePromptTemplate","AIMessagePromptTemplate","SystemMessagePromptTemplate","ChatPromptTemplateInput","BaseMessagePromptTemplateLike","ChatPromptTemplate","NewPartialVariableName","Extra","Exclude","Omit"],"sources":["../../src/prompts/chat.d.ts"],"sourcesContent":["import type { BaseCallbackConfig } from \"../callbacks/manager.js\";\nimport { AIMessage, HumanMessage, SystemMessage, BaseMessage, ChatMessage, type BaseMessageLike, MessageContent } from \"../messages/index.js\";\nimport { type ChatPromptValueInterface } from \"../prompt_values.js\";\nimport type { InputValues, PartialValues } from \"../utils/types/index.js\";\nimport { Runnable } from \"../runnables/base.js\";\nimport { BaseStringPromptTemplate } from \"./string.js\";\nimport { BasePromptTemplate, type BasePromptTemplateInput, type TypedPromptInputValues } from \"./base.js\";\nimport { PromptTemplateInput, ExtractedFStringParams } from \"./prompt.js\";\nimport { ImagePromptTemplate } from \"./image.js\";\nimport { TemplateFormat } from \"./template.js\";\nimport { DictPromptTemplate } from \"./dict.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 declare abstract class BaseMessagePromptTemplate<RunInput extends InputValues = any, RunOutput extends BaseMessage[] = BaseMessage[]> extends Runnable<RunInput, RunOutput> {\n lc_namespace: string[];\n lc_serializable: boolean;\n abstract inputVariables: Array<Extract<keyof RunInput, string>>;\n /**\n * Method that takes an object of TypedPromptInputValues and returns a\n * promise that resolves to an array of BaseMessage instances.\n * @param values Object of TypedPromptInputValues\n * @returns Formatted array of BaseMessages\n */\n abstract formatMessages(values: TypedPromptInputValues<RunInput>): Promise<RunOutput>;\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: RunInput, options?: BaseCallbackConfig): Promise<RunOutput>;\n}\n/**\n * Interface for the fields of a MessagePlaceholder.\n */\nexport interface MessagesPlaceholderFields<T extends string> {\n variableName: T;\n optional?: boolean;\n}\n/**\n * Class that represents a placeholder for messages in a chat prompt. It\n * extends the BaseMessagePromptTemplate.\n */\nexport declare class MessagesPlaceholder<RunInput extends InputValues = any> extends BaseMessagePromptTemplate<RunInput> implements MessagesPlaceholderFields<Extract<keyof RunInput, string>> {\n static lc_name(): string;\n variableName: Extract<keyof RunInput, string>;\n optional: boolean;\n constructor(variableName: Extract<keyof RunInput, string>);\n constructor(fields: MessagesPlaceholderFields<Extract<keyof RunInput, string>>);\n get inputVariables(): Extract<keyof RunInput, string>[];\n formatMessages(values: TypedPromptInputValues<RunInput>): Promise<BaseMessage[]>;\n}\n/**\n * Interface for the fields of a MessageStringPromptTemplate.\n */\nexport interface MessageStringPromptTemplateFields<T extends InputValues = any> {\n prompt: BaseStringPromptTemplate<T, string>;\n}\n/**\n * Abstract class that serves as a base for creating message string prompt\n * templates. It extends the BaseMessagePromptTemplate.\n */\nexport declare abstract class BaseMessageStringPromptTemplate<RunInput extends InputValues = any> extends BaseMessagePromptTemplate<RunInput> {\n prompt: BaseStringPromptTemplate<InputValues<Extract<keyof RunInput, string>>, string>;\n constructor(prompt: BaseStringPromptTemplate<InputValues<Extract<keyof RunInput, string>>>);\n constructor(fields: MessageStringPromptTemplateFields<InputValues<Extract<keyof RunInput, string>>>);\n get inputVariables(): Extract<Extract<keyof RunInput, string>, string>[];\n abstract format(values: TypedPromptInputValues<RunInput>): Promise<BaseMessage>;\n formatMessages(values: TypedPromptInputValues<RunInput>): Promise<BaseMessage[]>;\n}\n/**\n * Abstract class that serves as a base for creating chat prompt\n * templates. It extends the BasePromptTemplate.\n */\nexport declare abstract class BaseChatPromptTemplate<RunInput extends InputValues = any, PartialVariableName extends string = any> extends BasePromptTemplate<RunInput, ChatPromptValueInterface, PartialVariableName> {\n constructor(input: BasePromptTemplateInput<RunInput, PartialVariableName>);\n abstract formatMessages(values: TypedPromptInputValues<RunInput>): Promise<BaseMessage[]>;\n format(values: TypedPromptInputValues<RunInput>): Promise<string>;\n formatPromptValue(values: TypedPromptInputValues<RunInput>): Promise<ChatPromptValueInterface>;\n}\n/**\n * Interface for the fields of a ChatMessagePromptTemplate.\n */\nexport interface ChatMessagePromptTemplateFields<T extends InputValues = any> extends MessageStringPromptTemplateFields<T> {\n role: string;\n}\n/**\n * Class that represents a chat message prompt template. It extends the\n * BaseMessageStringPromptTemplate.\n */\nexport declare class ChatMessagePromptTemplate<RunInput extends InputValues = any> extends BaseMessageStringPromptTemplate<RunInput> {\n static lc_name(): string;\n role: string;\n constructor(prompt: BaseStringPromptTemplate<InputValues<Extract<keyof RunInput, string>>>, role: string);\n constructor(fields: ChatMessagePromptTemplateFields<InputValues<Extract<keyof RunInput, string>>>);\n format(values: RunInput): Promise<BaseMessage>;\n static fromTemplate<RunInput extends InputValues = Symbol, T extends string = string>(template: T, role: string, options?: {\n templateFormat?: TemplateFormat;\n }): ChatMessagePromptTemplate<ExtractedFStringParams<T, RunInput>>;\n}\ninterface _TextTemplateParam {\n text?: string | Record<string, any>;\n}\ninterface _ImageTemplateParam {\n image_url?: string | Record<string, any>;\n}\ntype MessageClass = typeof HumanMessage | typeof AIMessage | typeof SystemMessage;\ntype ChatMessageClass = typeof ChatMessage;\ninterface _StringImageMessagePromptTemplateOptions<Format extends TemplateFormat = TemplateFormat> extends Record<string, unknown> {\n templateFormat?: Format;\n}\ndeclare class _StringImageMessagePromptTemplate<RunInput extends InputValues = any, RunOutput extends BaseMessage[] = BaseMessage[]> extends BaseMessagePromptTemplate<RunInput, RunOutput> {\n lc_namespace: string[];\n lc_serializable: boolean;\n inputVariables: Array<Extract<keyof RunInput, string>>;\n additionalOptions: _StringImageMessagePromptTemplateOptions;\n prompt: BaseStringPromptTemplate<InputValues<Extract<keyof RunInput, string>>, string> | Array<BaseStringPromptTemplate<InputValues<Extract<keyof RunInput, string>>, string> | ImagePromptTemplate<InputValues<Extract<keyof RunInput, string>>, string> | MessageStringPromptTemplateFields<InputValues<Extract<keyof RunInput, string>>> | DictPromptTemplate<InputValues<Extract<keyof RunInput, string>>>>;\n protected messageClass?: MessageClass;\n static _messageClass(): MessageClass;\n protected chatMessageClass?: ChatMessageClass;\n constructor(\n /** @TODO When we come up with a better way to type prompt templates, fix this */\n fields: any, additionalOptions?: _StringImageMessagePromptTemplateOptions);\n createMessage(content: MessageContent): any;\n getRoleFromMessageClass(name: string): \"ai\" | \"chat\" | \"human\" | \"system\";\n static fromTemplate(template: string | Array<string | _TextTemplateParam | _ImageTemplateParam | Record<string, unknown>>, additionalOptions?: _StringImageMessagePromptTemplateOptions): _StringImageMessagePromptTemplate<any, BaseMessage<import(\"../messages/message.js\").MessageStructure, import(\"../messages/message.js\").MessageType>[]>;\n format(input: TypedPromptInputValues<RunInput>): Promise<BaseMessage>;\n formatMessages(values: RunInput): Promise<RunOutput>;\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 declare class HumanMessagePromptTemplate<RunInput extends InputValues = any> extends _StringImageMessagePromptTemplate<RunInput> {\n static _messageClass(): typeof HumanMessage;\n static lc_name(): string;\n}\n/**\n * Class that represents an AI message prompt template. It extends the\n * BaseMessageStringPromptTemplate.\n */\nexport declare class AIMessagePromptTemplate<RunInput extends InputValues = any> extends _StringImageMessagePromptTemplate<RunInput> {\n static _messageClass(): typeof AIMessage;\n static lc_name(): string;\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 declare class SystemMessagePromptTemplate<RunInput extends InputValues = any> extends _StringImageMessagePromptTemplate<RunInput> {\n static _messageClass(): typeof SystemMessage;\n static lc_name(): string;\n}\n/**\n * Interface for the input of a ChatPromptTemplate.\n */\nexport interface ChatPromptTemplateInput<RunInput extends InputValues = any, PartialVariableName extends string = any> extends BasePromptTemplateInput<RunInput, PartialVariableName> {\n /**\n * The prompt messages\n */\n promptMessages: Array<BaseMessagePromptTemplate | BaseMessage>;\n /**\n * Whether to try validating the template on initialization\n *\n * @defaultValue `true`\n */\n validateTemplate?: boolean;\n /**\n * The formatting method to use on the prompt.\n * @default \"f-string\"\n */\n templateFormat?: TemplateFormat;\n}\nexport type BaseMessagePromptTemplateLike = BaseMessagePromptTemplate | BaseMessageLike;\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 declare class ChatPromptTemplate<RunInput extends InputValues = any, PartialVariableName extends string = any> extends BaseChatPromptTemplate<RunInput, PartialVariableName> implements ChatPromptTemplateInput<RunInput, PartialVariableName> {\n static lc_name(): string;\n get lc_aliases(): Record<string, string>;\n promptMessages: Array<BaseMessagePromptTemplate | BaseMessage>;\n validateTemplate: boolean;\n templateFormat: TemplateFormat;\n constructor(input: ChatPromptTemplateInput<RunInput, PartialVariableName>);\n _getPromptType(): \"chat\";\n private _parseImagePrompts;\n formatMessages(values: TypedPromptInputValues<RunInput>): Promise<BaseMessage[]>;\n partial<NewPartialVariableName extends string>(values: PartialValues<NewPartialVariableName>): Promise<ChatPromptTemplate<InputValues<Exclude<Extract<keyof RunInput, string>, NewPartialVariableName>>, any>>;\n /**\n * Load prompt template from a template f-string\n */\n static fromTemplate<RunInput extends InputValues = Symbol, T extends string = string>(template: T, options?: Omit<PromptTemplateInput<RunInput, string, \"f-string\">, \"template\" | \"inputVariables\">): ChatPromptTemplate<ExtractedFStringParams<T, RunInput>>;\n static fromTemplate<RunInput extends InputValues = Symbol, T extends string = string>(template: T, options?: Omit<PromptTemplateInput<RunInput, string>, \"template\" | \"inputVariables\">): ChatPromptTemplate<ExtractedFStringParams<T, RunInput>>;\n static fromTemplate<RunInput extends InputValues = Symbol, T extends string = string>(template: T, options?: Omit<PromptTemplateInput<RunInput, string, \"mustache\">, \"template\" | \"inputVariables\">): ChatPromptTemplate<InputValues>;\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<RunInput extends InputValues = any, Extra extends ChatPromptTemplateInput<RunInput> = ChatPromptTemplateInput<RunInput>>(promptMessages: (ChatPromptTemplate<InputValues, string> | BaseMessagePromptTemplateLike)[], extra?: Omit<Extra, \"inputVariables\" | \"promptMessages\" | \"partialVariables\">): ChatPromptTemplate<RunInput>;\n}\nexport {};\n//# sourceMappingURL=chat.d.ts.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;uBAgB8BqB,2CAA2CZ,qCAAqCL,gBAAgBA,uBAAuBO,SAASW,UAAUC;;;EAA1IF,SAAAA,cAAAA,EAGDI,KAH0B,CAGpBD,OAHoBF,CAAAA,MAGNA,QAHMC,EAAAA,MAAA,CAAA,CAAA;EAAkBd;;;;;;EAGtCe,SAAAA,cAAAA,CAAAA,MAAAA,EAOCT,sBAPDS,CAOwBF,QAPxBE,CAAAA,CAAAA,EAOoCE,OAPpCF,CAO4CD,SAP5CC,CAAAA;EAANC;;;;;;EAcSzB,MAAAA,CAAAA,KAAAA,EAApBsB,QAAoBtB,EAAAA,OAAAA,CAAAA,EAAAA,kBAAAA,CAAAA,EAAqB0B,OAArB1B,CAA6BuB,SAA7BvB,CAAAA;;;;AAjBuH;AAsB5I2B,UAAAA,yBAAyBC,CAAAA,UACvB,MAAA,CAAA,CAAA;EAOEC,YAAAA,EAPHD,CAOGC;EAAqCpB,QAAAA,CAAAA,EAAAA,OAAAA;;;;;;AAIda,cAJvBO,mBAIuBP,CAAAA,iBAJcb,WAIda,GAAAA,GAAAA,CAAAA,SAJyCD,yBAIzCC,CAJmEA,QAInEA,CAAAA,YAJwFK,yBAIxFL,CAJkHE,OAIlHF,CAAAA,MA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iHG,QA1CjHH,CAAAA,CAAAA,CAAAA,cAAAA,EAAAA,CA0C6IkC,kBA1C7IlC,CA0CgKV,WA1ChKU,EAAAA,MAAAA,CAAAA,GA0CuLiC,6BA1CvLjC,CAAAA,EAAAA,EAAAA,KAAAA,CAAAA,EA0CiOsC,IA1CjOtC,CA0CsOoC,KA1CtOpC,EAAAA,gBAAAA,GAAAA,gBAAAA,GAAAA,kBAAAA,CAAAA,CAAAA,EA0CySkC,kBA1CzSlC,CA0C4TG,QA1C5TH,CAAAA"}
1
+ {"version":3,"file":"chat.d.ts","names":["BaseCallbackConfig","AIMessage","HumanMessage","SystemMessage","BaseMessage","ChatMessage","BaseMessageLike","MessageContent","ChatPromptValueInterface","InputValues","PartialValues","Runnable","BaseStringPromptTemplate","BasePromptTemplate","BasePromptTemplateInput","TypedPromptInputValues","PromptTemplateInput","ExtractedFStringParams","ImagePromptTemplate","TemplateFormat","DictPromptTemplate","BaseMessagePromptTemplate","RunInput","RunOutput","Extract","Array","Promise","MessagesPlaceholderFields","T","MessagesPlaceholder","MessageStringPromptTemplateFields","BaseMessageStringPromptTemplate","BaseChatPromptTemplate","PartialVariableName","ChatMessagePromptTemplateFields","ChatMessagePromptTemplate","Symbol","_TextTemplateParam","Record","_ImageTemplateParam","MessageClass","ChatMessageClass","_StringImageMessagePromptTemplateOptions","Format","_StringImageMessagePromptTemplate","___messages_message_js14","MessageToolSet","MessageStructure","MessageType","HumanMessagePromptTemplate","AIMessagePromptTemplate","SystemMessagePromptTemplate","ChatPromptTemplateInput","BaseMessagePromptTemplateLike","ChatPromptTemplate","NewPartialVariableName","Extra","Exclude","Omit"],"sources":["../../src/prompts/chat.d.ts"],"sourcesContent":["import type { BaseCallbackConfig } from \"../callbacks/manager.js\";\nimport { AIMessage, HumanMessage, SystemMessage, BaseMessage, ChatMessage, type BaseMessageLike, MessageContent } from \"../messages/index.js\";\nimport { type ChatPromptValueInterface } from \"../prompt_values.js\";\nimport type { InputValues, PartialValues } from \"../utils/types/index.js\";\nimport { Runnable } from \"../runnables/base.js\";\nimport { BaseStringPromptTemplate } from \"./string.js\";\nimport { BasePromptTemplate, type BasePromptTemplateInput, type TypedPromptInputValues } from \"./base.js\";\nimport { PromptTemplateInput, ExtractedFStringParams } from \"./prompt.js\";\nimport { ImagePromptTemplate } from \"./image.js\";\nimport { TemplateFormat } from \"./template.js\";\nimport { DictPromptTemplate } from \"./dict.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 declare abstract class BaseMessagePromptTemplate<RunInput extends InputValues = any, RunOutput extends BaseMessage[] = BaseMessage[]> extends Runnable<RunInput, RunOutput> {\n lc_namespace: string[];\n lc_serializable: boolean;\n abstract inputVariables: Array<Extract<keyof RunInput, string>>;\n /**\n * Method that takes an object of TypedPromptInputValues and returns a\n * promise that resolves to an array of BaseMessage instances.\n * @param values Object of TypedPromptInputValues\n * @returns Formatted array of BaseMessages\n */\n abstract formatMessages(values: TypedPromptInputValues<RunInput>): Promise<RunOutput>;\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: RunInput, options?: BaseCallbackConfig): Promise<RunOutput>;\n}\n/**\n * Interface for the fields of a MessagePlaceholder.\n */\nexport interface MessagesPlaceholderFields<T extends string> {\n variableName: T;\n optional?: boolean;\n}\n/**\n * Class that represents a placeholder for messages in a chat prompt. It\n * extends the BaseMessagePromptTemplate.\n */\nexport declare class MessagesPlaceholder<RunInput extends InputValues = any> extends BaseMessagePromptTemplate<RunInput> implements MessagesPlaceholderFields<Extract<keyof RunInput, string>> {\n static lc_name(): string;\n variableName: Extract<keyof RunInput, string>;\n optional: boolean;\n constructor(variableName: Extract<keyof RunInput, string>);\n constructor(fields: MessagesPlaceholderFields<Extract<keyof RunInput, string>>);\n get inputVariables(): Extract<keyof RunInput, string>[];\n formatMessages(values: TypedPromptInputValues<RunInput>): Promise<BaseMessage[]>;\n}\n/**\n * Interface for the fields of a MessageStringPromptTemplate.\n */\nexport interface MessageStringPromptTemplateFields<T extends InputValues = any> {\n prompt: BaseStringPromptTemplate<T, string>;\n}\n/**\n * Abstract class that serves as a base for creating message string prompt\n * templates. It extends the BaseMessagePromptTemplate.\n */\nexport declare abstract class BaseMessageStringPromptTemplate<RunInput extends InputValues = any> extends BaseMessagePromptTemplate<RunInput> {\n prompt: BaseStringPromptTemplate<InputValues<Extract<keyof RunInput, string>>, string>;\n constructor(prompt: BaseStringPromptTemplate<InputValues<Extract<keyof RunInput, string>>>);\n constructor(fields: MessageStringPromptTemplateFields<InputValues<Extract<keyof RunInput, string>>>);\n get inputVariables(): Extract<Extract<keyof RunInput, string>, string>[];\n abstract format(values: TypedPromptInputValues<RunInput>): Promise<BaseMessage>;\n formatMessages(values: TypedPromptInputValues<RunInput>): Promise<BaseMessage[]>;\n}\n/**\n * Abstract class that serves as a base for creating chat prompt\n * templates. It extends the BasePromptTemplate.\n */\nexport declare abstract class BaseChatPromptTemplate<RunInput extends InputValues = any, PartialVariableName extends string = any> extends BasePromptTemplate<RunInput, ChatPromptValueInterface, PartialVariableName> {\n constructor(input: BasePromptTemplateInput<RunInput, PartialVariableName>);\n abstract formatMessages(values: TypedPromptInputValues<RunInput>): Promise<BaseMessage[]>;\n format(values: TypedPromptInputValues<RunInput>): Promise<string>;\n formatPromptValue(values: TypedPromptInputValues<RunInput>): Promise<ChatPromptValueInterface>;\n}\n/**\n * Interface for the fields of a ChatMessagePromptTemplate.\n */\nexport interface ChatMessagePromptTemplateFields<T extends InputValues = any> extends MessageStringPromptTemplateFields<T> {\n role: string;\n}\n/**\n * Class that represents a chat message prompt template. It extends the\n * BaseMessageStringPromptTemplate.\n */\nexport declare class ChatMessagePromptTemplate<RunInput extends InputValues = any> extends BaseMessageStringPromptTemplate<RunInput> {\n static lc_name(): string;\n role: string;\n constructor(prompt: BaseStringPromptTemplate<InputValues<Extract<keyof RunInput, string>>>, role: string);\n constructor(fields: ChatMessagePromptTemplateFields<InputValues<Extract<keyof RunInput, string>>>);\n format(values: RunInput): Promise<BaseMessage>;\n static fromTemplate<RunInput extends InputValues = Symbol, T extends string = string>(template: T, role: string, options?: {\n templateFormat?: TemplateFormat;\n }): ChatMessagePromptTemplate<ExtractedFStringParams<T, RunInput>>;\n}\ninterface _TextTemplateParam {\n text?: string | Record<string, any>;\n}\ninterface _ImageTemplateParam {\n image_url?: string | Record<string, any>;\n}\ntype MessageClass = typeof HumanMessage | typeof AIMessage | typeof SystemMessage;\ntype ChatMessageClass = typeof ChatMessage;\ninterface _StringImageMessagePromptTemplateOptions<Format extends TemplateFormat = TemplateFormat> extends Record<string, unknown> {\n templateFormat?: Format;\n}\ndeclare class _StringImageMessagePromptTemplate<RunInput extends InputValues = any, RunOutput extends BaseMessage[] = BaseMessage[]> extends BaseMessagePromptTemplate<RunInput, RunOutput> {\n lc_namespace: string[];\n lc_serializable: boolean;\n inputVariables: Array<Extract<keyof RunInput, string>>;\n additionalOptions: _StringImageMessagePromptTemplateOptions;\n prompt: BaseStringPromptTemplate<InputValues<Extract<keyof RunInput, string>>, string> | Array<BaseStringPromptTemplate<InputValues<Extract<keyof RunInput, string>>, string> | ImagePromptTemplate<InputValues<Extract<keyof RunInput, string>>, string> | MessageStringPromptTemplateFields<InputValues<Extract<keyof RunInput, string>>> | DictPromptTemplate<InputValues<Extract<keyof RunInput, string>>>>;\n protected messageClass?: MessageClass;\n static _messageClass(): MessageClass;\n protected chatMessageClass?: ChatMessageClass;\n constructor(\n /** @TODO When we come up with a better way to type prompt templates, fix this */\n fields: any, additionalOptions?: _StringImageMessagePromptTemplateOptions);\n createMessage(content: MessageContent): any;\n getRoleFromMessageClass(name: string): \"ai\" | \"chat\" | \"human\" | \"system\";\n static fromTemplate(template: string | Array<string | _TextTemplateParam | _ImageTemplateParam | Record<string, unknown>>, additionalOptions?: _StringImageMessagePromptTemplateOptions): _StringImageMessagePromptTemplate<any, BaseMessage<import(\"../messages/message.js\").MessageStructure<import(\"../messages/message.js\").MessageToolSet>, import(\"../messages/message.js\").MessageType>[]>;\n format(input: TypedPromptInputValues<RunInput>): Promise<BaseMessage>;\n formatMessages(values: RunInput): Promise<RunOutput>;\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 declare class HumanMessagePromptTemplate<RunInput extends InputValues = any> extends _StringImageMessagePromptTemplate<RunInput> {\n static _messageClass(): typeof HumanMessage;\n static lc_name(): string;\n}\n/**\n * Class that represents an AI message prompt template. It extends the\n * BaseMessageStringPromptTemplate.\n */\nexport declare class AIMessagePromptTemplate<RunInput extends InputValues = any> extends _StringImageMessagePromptTemplate<RunInput> {\n static _messageClass(): typeof AIMessage;\n static lc_name(): string;\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 declare class SystemMessagePromptTemplate<RunInput extends InputValues = any> extends _StringImageMessagePromptTemplate<RunInput> {\n static _messageClass(): typeof SystemMessage;\n static lc_name(): string;\n}\n/**\n * Interface for the input of a ChatPromptTemplate.\n */\nexport interface ChatPromptTemplateInput<RunInput extends InputValues = any, PartialVariableName extends string = any> extends BasePromptTemplateInput<RunInput, PartialVariableName> {\n /**\n * The prompt messages\n */\n promptMessages: Array<BaseMessagePromptTemplate | BaseMessage>;\n /**\n * Whether to try validating the template on initialization\n *\n * @defaultValue `true`\n */\n validateTemplate?: boolean;\n /**\n * The formatting method to use on the prompt.\n * @default \"f-string\"\n */\n templateFormat?: TemplateFormat;\n}\nexport type BaseMessagePromptTemplateLike = BaseMessagePromptTemplate | BaseMessageLike;\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 declare class ChatPromptTemplate<RunInput extends InputValues = any, PartialVariableName extends string = any> extends BaseChatPromptTemplate<RunInput, PartialVariableName> implements ChatPromptTemplateInput<RunInput, PartialVariableName> {\n static lc_name(): string;\n get lc_aliases(): Record<string, string>;\n promptMessages: Array<BaseMessagePromptTemplate | BaseMessage>;\n validateTemplate: boolean;\n templateFormat: TemplateFormat;\n constructor(input: ChatPromptTemplateInput<RunInput, PartialVariableName>);\n _getPromptType(): \"chat\";\n private _parseImagePrompts;\n formatMessages(values: TypedPromptInputValues<RunInput>): Promise<BaseMessage[]>;\n partial<NewPartialVariableName extends string>(values: PartialValues<NewPartialVariableName>): Promise<ChatPromptTemplate<InputValues<Exclude<Extract<keyof RunInput, string>, NewPartialVariableName>>, any>>;\n /**\n * Load prompt template from a template f-string\n */\n static fromTemplate<RunInput extends InputValues = Symbol, T extends string = string>(template: T, options?: Omit<PromptTemplateInput<RunInput, string, \"f-string\">, \"template\" | \"inputVariables\">): ChatPromptTemplate<ExtractedFStringParams<T, RunInput>>;\n static fromTemplate<RunInput extends InputValues = Symbol, T extends string = string>(template: T, options?: Omit<PromptTemplateInput<RunInput, string>, \"template\" | \"inputVariables\">): ChatPromptTemplate<ExtractedFStringParams<T, RunInput>>;\n static fromTemplate<RunInput extends InputValues = Symbol, T extends string = string>(template: T, options?: Omit<PromptTemplateInput<RunInput, string, \"mustache\">, \"template\" | \"inputVariables\">): ChatPromptTemplate<InputValues>;\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<RunInput extends InputValues = any, Extra extends ChatPromptTemplateInput<RunInput> = ChatPromptTemplateInput<RunInput>>(promptMessages: (ChatPromptTemplate<InputValues, string> | BaseMessagePromptTemplateLike)[], extra?: Omit<Extra, \"inputVariables\" | \"promptMessages\" | \"partialVariables\">): ChatPromptTemplate<RunInput>;\n}\nexport {};\n//# sourceMappingURL=chat.d.ts.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;uBAgB8BqB,2CAA2CZ,qCAAqCL,gBAAgBA,uBAAuBO,SAASW,UAAUC;;;EAA1IF,SAAAA,cAAAA,EAGDI,KAH0B,CAGpBD,OAHoBF,CAAAA,MAGNA,QAHMC,EAAAA,MAAA,CAAA,CAAA;EAAkBd;;;;;;EAGtCe,SAAAA,cAAAA,CAAAA,MAAAA,EAOCT,sBAPDS,CAOwBF,QAPxBE,CAAAA,CAAAA,EAOoCE,OAPpCF,CAO4CD,SAP5CC,CAAAA;EAANC;;;;;;EAcSzB,MAAAA,CAAAA,KAAAA,EAApBsB,QAAoBtB,EAAAA,OAAAA,CAAAA,EAAAA,kBAAAA,CAAAA,EAAqB0B,OAArB1B,CAA6BuB,SAA7BvB,CAAAA;;;;AAjBuH;AAsB5I2B,UAAAA,yBAAyBC,CAAAA,UACvB,MAAA,CAAA,CAAA;EAOEC,YAAAA,EAPHD,CAOGC;EAAqCpB,QAAAA,CAAAA,EAAAA,OAAAA;;;;;;AAIda,cAJvBO,mBAIuBP,CAAAA,iBAJcb,WAIda,GAAAA,GAAAA,CAAAA,SAJyCD,yBAIzCC,CAJmEA,QAInEA,CAAAA,YAJwFK,yBAIxFL,CAJkHE,OAIlHF,CAAAA,MA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DtD3B,CAqD8EH,QArD9EG,CAAAA,GAqD0F2B,uBArD1F3B,CAqDkHH,QArDlHG,CAAAA,CAAAA,CAAAA,cAAAA,EAAAA,CAqD8I6B,kBArD9I7B,CAqDiKhB,WArDjKgB,EAAAA,MAAAA,CAAAA,GAqDwL4B,6BArDxL5B,CAAAA,EAAAA,EAAAA,KAAAA,CAAAA,EAqDkOiC,IArDlOjC,CAqDuO+B,KArDvO/B,EAAAA,gBAAAA,GAAAA,gBAAAA,GAAAA,kBAAAA,CAAAA,CAAAA,EAqD0S6B,kBArD1S7B,CAqD6TH,QArD7TG,CAAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"stores.d.cts","names":["Serializable","BaseStore","K","V","Promise","AsyncGenerator","InMemoryStore","T","Record"],"sources":["../src/stores.d.ts"],"sourcesContent":["import { Serializable } from \"./load/serializable.js\";\n/**\n * Abstract interface for a key-value store.\n */\nexport declare abstract class BaseStore<K, V> extends Serializable {\n /**\n * Abstract method to get multiple values for a set of keys.\n * @param {K[]} keys - An array of keys.\n * @returns {Promise<(V | undefined)[]>} - A Promise that resolves with array of values or undefined if key not found.\n */\n abstract mget(keys: K[]): Promise<(V | undefined)[]>;\n /**\n * Abstract method to set a value for multiple keys.\n * @param {[K, V][]} keyValuePairs - An array of key-value pairs.\n * @returns {Promise<void>} - A Promise that resolves when the operation is complete.\n */\n abstract mset(keyValuePairs: [K, V][]): Promise<void>;\n /**\n * Abstract method to delete multiple keys.\n * @param {K[]} keys - An array of keys to delete.\n * @returns {Promise<void>} - A Promise that resolves when the operation is complete.\n */\n abstract mdelete(keys: K[]): Promise<void>;\n /**\n * Abstract method to yield keys optionally based on a prefix.\n * @param {string} prefix - Optional prefix to filter keys.\n * @returns {AsyncGenerator<K | string>} - An asynchronous generator that yields keys on iteration.\n */\n abstract yieldKeys(prefix?: string): AsyncGenerator<K | string>;\n}\n/**\n * In-memory implementation of the BaseStore using a dictionary. Used for\n * storing key-value pairs in memory.\n * @example\n * ```typescript\n * const store = new InMemoryStore<BaseMessage>();\n * await store.mset(\n * Array.from({ length: 5 }).map((_, index) => [\n * `message:id:${index}`,\n * index % 2 === 0\n * ? new AIMessage(\"ai stuff...\")\n * : new HumanMessage(\"human stuff...\"),\n * ]),\n * );\n *\n * const retrievedMessages = await store.mget([\"message:id:0\", \"message:id:1\"]);\n * await store.mdelete(await store.yieldKeys(\"message:id:\").toArray());\n * ```\n */\nexport declare class InMemoryStore<T = any> extends BaseStore<string, T> {\n lc_namespace: string[];\n protected store: Record<string, T>;\n /**\n * Retrieves the values associated with the given keys from the store.\n * @param keys Keys to retrieve values for.\n * @returns Array of values associated with the given keys.\n */\n mget(keys: string[]): Promise<T[]>;\n /**\n * Sets the values for the given keys in the store.\n * @param keyValuePairs Array of key-value pairs to set in the store.\n * @returns Promise that resolves when all key-value pairs have been set.\n */\n mset(keyValuePairs: [string, T][]): Promise<void>;\n /**\n * Deletes the given keys and their associated values from the store.\n * @param keys Keys to delete from the store.\n * @returns Promise that resolves when all keys have been deleted.\n */\n mdelete(keys: string[]): Promise<void>;\n /**\n * Asynchronous generator that yields keys from the store. If a prefix is\n * provided, it only yields keys that start with the prefix.\n * @param prefix Optional prefix to filter keys.\n * @returns AsyncGenerator that yields keys from the store.\n */\n yieldKeys(prefix?: string | undefined): AsyncGenerator<string>;\n}\n//# sourceMappingURL=stores.d.ts.map"],"mappings":";;;;;;AAIA;AAMwBE,uBANMD,SAMNC,CAAAA,CAAAA,EAAAA,CAAAA,CAAAA,SAN8BF,YAAAA,CAM9BE;EAAeC;;;;;EAYZD,SAAAA,IAAAA,CAAAA,IAAAA,EAZHA,CAYGA,EAAAA,CAAAA,EAZGE,OAYHF,CAAAA,CAZYC,CAYZD,GAAAA,SAAAA,CAAAA,EAAAA,CAAAA;EAAME;;;;AAlBiC;EA6C7CE,SAAAA,IAAAA,CAAAA,aAAaC,EAAA,CAjCAL,CAiCA,EAjCGC,CAiCH,CAAA,EAAA,CAAA,EAjCUC,OAiCV,CAAA,IAAA,CAAA;EAAoCG;;;;;EAcrCA,SAAAA,OAAAA,CAAAA,IAAAA,EAzCNL,CAyCMK,EAAAA,CAAAA,EAzCAH,OAyCAG,CAAAA,IAAAA,CAAAA;EAAOH;;;;AAdqB;uCArBpBC,eAAeH;;;;;;;;;;;;;;;;;;;;;cAqBnCI,+BAA+BL,kBAAkBM;;mBAEjDC,eAAeD;;;;;;wBAMVH,QAAQG;;;;;;+BAMDA,OAAOH;;;;;;2BAMXA;;;;;;;0CAOeC"}
1
+ {"version":3,"file":"stores.d.cts","names":["Serializable","BaseStore","K","V","Promise","AsyncGenerator","InMemoryStore","T","Record"],"sources":["../src/stores.d.ts"],"sourcesContent":["import { Serializable } from \"./load/serializable.js\";\n/**\n * Abstract interface for a key-value store.\n */\nexport declare abstract class BaseStore<K, V> extends Serializable {\n /**\n * Abstract method to get multiple values for a set of keys.\n * @param {K[]} keys - An array of keys.\n * @returns {Promise<(V | undefined)[]>} - A Promise that resolves with array of values or undefined if key not found.\n */\n abstract mget(keys: K[]): Promise<(V | undefined)[]>;\n /**\n * Abstract method to set a value for multiple keys.\n * @param {[K, V][]} keyValuePairs - An array of key-value pairs.\n * @returns {Promise<void>} - A Promise that resolves when the operation is complete.\n */\n abstract mset(keyValuePairs: [K, V][]): Promise<void>;\n /**\n * Abstract method to delete multiple keys.\n * @param {K[]} keys - An array of keys to delete.\n * @returns {Promise<void>} - A Promise that resolves when the operation is complete.\n */\n abstract mdelete(keys: K[]): Promise<void>;\n /**\n * Abstract method to yield keys optionally based on a prefix.\n * @param {string} prefix - Optional prefix to filter keys.\n * @returns {AsyncGenerator<K | string>} - An asynchronous generator that yields keys on iteration.\n */\n abstract yieldKeys(prefix?: string): AsyncGenerator<K | string>;\n}\n/**\n * In-memory implementation of the BaseStore using a dictionary. Used for\n * storing key-value pairs in memory.\n * @example\n * ```typescript\n * const store = new InMemoryStore<BaseMessage>();\n * await store.mset(\n * Array.from({ length: 5 }).map((_, index) => [\n * `message:id:${index}`,\n * index % 2 === 0\n * ? new AIMessage(\"ai stuff...\")\n * : new HumanMessage(\"human stuff...\"),\n * ]),\n * );\n *\n * const retrievedMessages = await store.mget([\"message:id:0\", \"message:id:1\"]);\n * await store.mdelete(await store.yieldKeys(\"message:id:\").toArray());\n * ```\n */\nexport declare class InMemoryStore<T = any> extends BaseStore<string, T> {\n lc_namespace: string[];\n protected store: Record<string, T>;\n /**\n * Retrieves the values associated with the given keys from the store.\n * @param keys Keys to retrieve values for.\n * @returns Array of values associated with the given keys.\n */\n mget(keys: string[]): Promise<T[]>;\n /**\n * Sets the values for the given keys in the store.\n * @param keyValuePairs Array of key-value pairs to set in the store.\n * @returns Promise that resolves when all key-value pairs have been set.\n */\n mset(keyValuePairs: [string, T][]): Promise<void>;\n /**\n * Deletes the given keys and their associated values from the store.\n * @param keys Keys to delete from the store.\n * @returns Promise that resolves when all keys have been deleted.\n */\n mdelete(keys: string[]): Promise<void>;\n /**\n * Asynchronous generator that yields keys from the store. If a prefix is\n * provided, it only yields keys that start with the prefix.\n * @param prefix Optional prefix to filter keys.\n * @returns AsyncGenerator that yields keys from the store.\n */\n yieldKeys(prefix?: string | undefined): AsyncGenerator<string>;\n}\n//# sourceMappingURL=stores.d.ts.map"],"mappings":";;;;;;AAIA;AAMwBE,uBANMD,SAMNC,CAAAA,CAAAA,EAAAA,CAAAA,CAAAA,SAN8BF,YAAAA,CAM9BE;EAAeC;;;;;EAYZD,SAAAA,IAAAA,CAAAA,IAAAA,EAZHA,CAYGA,EAAAA,CAAAA,EAZGE,OAYHF,CAAAA,CAZYC,CAYZD,GAAAA,SAAAA,CAAAA,EAAAA,CAAAA;EAAME;;;;AAlBiC;EA6C7CE,SAAAA,IAAAA,CAAAA,aAAa,EAAA,CAjCAJ,CAiCA,EAjCGC,CAiCH,CAAA,EAAA,CAAA,EAjCUC,OAiCV,CAAA,IAAA,CAAA;EAAoCG;;;;;EAcrCA,SAAAA,OAAAA,CAAAA,IAAAA,EAzCNL,CAyCMK,EAAAA,CAAAA,EAzCAH,OAyCAG,CAAAA,IAAAA,CAAAA;EAAOH;;;;AAdqB;uCArBpBC,eAAeH;;;;;;;;;;;;;;;;;;;;;cAqBnCI,+BAA+BL,kBAAkBM;;mBAEjDC,eAAeD;;;;;;wBAMVH,QAAQG;;;;;;+BAMDA,OAAOH;;;;;;2BAMXA;;;;;;;0CAOeC"}
@@ -1 +1 @@
1
- {"version":3,"file":"stores.d.ts","names":["Serializable","BaseStore","K","V","Promise","AsyncGenerator","InMemoryStore","T","Record"],"sources":["../src/stores.d.ts"],"sourcesContent":["import { Serializable } from \"./load/serializable.js\";\n/**\n * Abstract interface for a key-value store.\n */\nexport declare abstract class BaseStore<K, V> extends Serializable {\n /**\n * Abstract method to get multiple values for a set of keys.\n * @param {K[]} keys - An array of keys.\n * @returns {Promise<(V | undefined)[]>} - A Promise that resolves with array of values or undefined if key not found.\n */\n abstract mget(keys: K[]): Promise<(V | undefined)[]>;\n /**\n * Abstract method to set a value for multiple keys.\n * @param {[K, V][]} keyValuePairs - An array of key-value pairs.\n * @returns {Promise<void>} - A Promise that resolves when the operation is complete.\n */\n abstract mset(keyValuePairs: [K, V][]): Promise<void>;\n /**\n * Abstract method to delete multiple keys.\n * @param {K[]} keys - An array of keys to delete.\n * @returns {Promise<void>} - A Promise that resolves when the operation is complete.\n */\n abstract mdelete(keys: K[]): Promise<void>;\n /**\n * Abstract method to yield keys optionally based on a prefix.\n * @param {string} prefix - Optional prefix to filter keys.\n * @returns {AsyncGenerator<K | string>} - An asynchronous generator that yields keys on iteration.\n */\n abstract yieldKeys(prefix?: string): AsyncGenerator<K | string>;\n}\n/**\n * In-memory implementation of the BaseStore using a dictionary. Used for\n * storing key-value pairs in memory.\n * @example\n * ```typescript\n * const store = new InMemoryStore<BaseMessage>();\n * await store.mset(\n * Array.from({ length: 5 }).map((_, index) => [\n * `message:id:${index}`,\n * index % 2 === 0\n * ? new AIMessage(\"ai stuff...\")\n * : new HumanMessage(\"human stuff...\"),\n * ]),\n * );\n *\n * const retrievedMessages = await store.mget([\"message:id:0\", \"message:id:1\"]);\n * await store.mdelete(await store.yieldKeys(\"message:id:\").toArray());\n * ```\n */\nexport declare class InMemoryStore<T = any> extends BaseStore<string, T> {\n lc_namespace: string[];\n protected store: Record<string, T>;\n /**\n * Retrieves the values associated with the given keys from the store.\n * @param keys Keys to retrieve values for.\n * @returns Array of values associated with the given keys.\n */\n mget(keys: string[]): Promise<T[]>;\n /**\n * Sets the values for the given keys in the store.\n * @param keyValuePairs Array of key-value pairs to set in the store.\n * @returns Promise that resolves when all key-value pairs have been set.\n */\n mset(keyValuePairs: [string, T][]): Promise<void>;\n /**\n * Deletes the given keys and their associated values from the store.\n * @param keys Keys to delete from the store.\n * @returns Promise that resolves when all keys have been deleted.\n */\n mdelete(keys: string[]): Promise<void>;\n /**\n * Asynchronous generator that yields keys from the store. If a prefix is\n * provided, it only yields keys that start with the prefix.\n * @param prefix Optional prefix to filter keys.\n * @returns AsyncGenerator that yields keys from the store.\n */\n yieldKeys(prefix?: string | undefined): AsyncGenerator<string>;\n}\n//# sourceMappingURL=stores.d.ts.map"],"mappings":";;;;;;AAIA;AAMwBE,uBANMD,SAMNC,CAAAA,CAAAA,EAAAA,CAAAA,CAAAA,SAN8BF,YAAAA,CAM9BE;EAAeC;;;;;EAYZD,SAAAA,IAAAA,CAAAA,IAAAA,EAZHA,CAYGA,EAAAA,CAAAA,EAZGE,OAYHF,CAAAA,CAZYC,CAYZD,GAAAA,SAAAA,CAAAA,EAAAA,CAAAA;EAAME;;;;AAlBiC;EA6C7CE,SAAAA,IAAAA,CAAAA,aAAaC,EAAA,CAjCAL,CAiCA,EAjCGC,CAiCH,CAAA,EAAA,CAAA,EAjCUC,OAiCV,CAAA,IAAA,CAAA;EAAoCG;;;;;EAcrCA,SAAAA,OAAAA,CAAAA,IAAAA,EAzCNL,CAyCMK,EAAAA,CAAAA,EAzCAH,OAyCAG,CAAAA,IAAAA,CAAAA;EAAOH;;;;AAdqB;uCArBpBC,eAAeH;;;;;;;;;;;;;;;;;;;;;cAqBnCI,+BAA+BL,kBAAkBM;;mBAEjDC,eAAeD;;;;;;wBAMVH,QAAQG;;;;;;+BAMDA,OAAOH;;;;;;2BAMXA;;;;;;;0CAOeC"}
1
+ {"version":3,"file":"stores.d.ts","names":["Serializable","BaseStore","K","V","Promise","AsyncGenerator","InMemoryStore","T","Record"],"sources":["../src/stores.d.ts"],"sourcesContent":["import { Serializable } from \"./load/serializable.js\";\n/**\n * Abstract interface for a key-value store.\n */\nexport declare abstract class BaseStore<K, V> extends Serializable {\n /**\n * Abstract method to get multiple values for a set of keys.\n * @param {K[]} keys - An array of keys.\n * @returns {Promise<(V | undefined)[]>} - A Promise that resolves with array of values or undefined if key not found.\n */\n abstract mget(keys: K[]): Promise<(V | undefined)[]>;\n /**\n * Abstract method to set a value for multiple keys.\n * @param {[K, V][]} keyValuePairs - An array of key-value pairs.\n * @returns {Promise<void>} - A Promise that resolves when the operation is complete.\n */\n abstract mset(keyValuePairs: [K, V][]): Promise<void>;\n /**\n * Abstract method to delete multiple keys.\n * @param {K[]} keys - An array of keys to delete.\n * @returns {Promise<void>} - A Promise that resolves when the operation is complete.\n */\n abstract mdelete(keys: K[]): Promise<void>;\n /**\n * Abstract method to yield keys optionally based on a prefix.\n * @param {string} prefix - Optional prefix to filter keys.\n * @returns {AsyncGenerator<K | string>} - An asynchronous generator that yields keys on iteration.\n */\n abstract yieldKeys(prefix?: string): AsyncGenerator<K | string>;\n}\n/**\n * In-memory implementation of the BaseStore using a dictionary. Used for\n * storing key-value pairs in memory.\n * @example\n * ```typescript\n * const store = new InMemoryStore<BaseMessage>();\n * await store.mset(\n * Array.from({ length: 5 }).map((_, index) => [\n * `message:id:${index}`,\n * index % 2 === 0\n * ? new AIMessage(\"ai stuff...\")\n * : new HumanMessage(\"human stuff...\"),\n * ]),\n * );\n *\n * const retrievedMessages = await store.mget([\"message:id:0\", \"message:id:1\"]);\n * await store.mdelete(await store.yieldKeys(\"message:id:\").toArray());\n * ```\n */\nexport declare class InMemoryStore<T = any> extends BaseStore<string, T> {\n lc_namespace: string[];\n protected store: Record<string, T>;\n /**\n * Retrieves the values associated with the given keys from the store.\n * @param keys Keys to retrieve values for.\n * @returns Array of values associated with the given keys.\n */\n mget(keys: string[]): Promise<T[]>;\n /**\n * Sets the values for the given keys in the store.\n * @param keyValuePairs Array of key-value pairs to set in the store.\n * @returns Promise that resolves when all key-value pairs have been set.\n */\n mset(keyValuePairs: [string, T][]): Promise<void>;\n /**\n * Deletes the given keys and their associated values from the store.\n * @param keys Keys to delete from the store.\n * @returns Promise that resolves when all keys have been deleted.\n */\n mdelete(keys: string[]): Promise<void>;\n /**\n * Asynchronous generator that yields keys from the store. If a prefix is\n * provided, it only yields keys that start with the prefix.\n * @param prefix Optional prefix to filter keys.\n * @returns AsyncGenerator that yields keys from the store.\n */\n yieldKeys(prefix?: string | undefined): AsyncGenerator<string>;\n}\n//# sourceMappingURL=stores.d.ts.map"],"mappings":";;;;;;AAIA;AAMwBE,uBANMD,SAMNC,CAAAA,CAAAA,EAAAA,CAAAA,CAAAA,SAN8BF,YAAAA,CAM9BE;EAAeC;;;;;EAYZD,SAAAA,IAAAA,CAAAA,IAAAA,EAZHA,CAYGA,EAAAA,CAAAA,EAZGE,OAYHF,CAAAA,CAZYC,CAYZD,GAAAA,SAAAA,CAAAA,EAAAA,CAAAA;EAAME;;;;AAlBiC;EA6C7CE,SAAAA,IAAAA,CAAAA,aAAa,EAAA,CAjCAJ,CAiCA,EAjCGC,CAiCH,CAAA,EAAA,CAAA,EAjCUC,OAiCV,CAAA,IAAA,CAAA;EAAoCG;;;;;EAcrCA,SAAAA,OAAAA,CAAAA,IAAAA,EAzCNL,CAyCMK,EAAAA,CAAAA,EAzCAH,OAyCAG,CAAAA,IAAAA,CAAAA;EAAOH;;;;AAdqB;uCArBpBC,eAAeH;;;;;;;;;;;;;;;;;;;;;cAqBnCI,+BAA+BL,kBAAkBM;;mBAEjDC,eAAeD;;;;;;wBAMVH,QAAQG;;;;;;+BAMDA,OAAOH;;;;;;2BAMXA;;;;;;;0CAOeC"}
@@ -212,12 +212,13 @@ var DynamicTool = class extends Tool {
212
212
  *
213
213
  * Schema can be passed as Zod or JSON schema. The tool will not validate
214
214
  * input if JSON schema is passed.
215
+ *
216
+ * @template NameT The literal type of the tool name (for discriminated union support)
215
217
  */
216
218
  var DynamicStructuredTool = class extends StructuredTool {
217
219
  static lc_name() {
218
220
  return "DynamicStructuredTool";
219
221
  }
220
- name;
221
222
  description;
222
223
  func;
223
224
  schema;
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["BaseLangChain","fields?: ToolParams","input: TInput","config?: TConfig","toolInput: Exclude<\n StructuredToolCallInput<SchemaT, SchemaInputT>,\n ToolCall\n >","enrichedConfig: ToolRunnableConfig","ensureConfig","mergeConfigs","_isToolCall","arg: TArg","configArg?: TConfig","tags?: string[]","parsed: SchemaOutputT","isInteropZodSchema","interopParseAsync","isInteropZodError","z4","ToolInputParsingException","result","parseCallbackConfigArg","CallbackManager","toolCallId: string | undefined","_configHasToolCallId","z","callbacks?: TConfig","fields: DynamicToolInput<ToolOutputT>","input: string","runManager?: CallbackManagerForToolRun","parentConfig?: ToolRunnableConfig","fields: DynamicStructuredToolInput<SchemaT, SchemaOutputT, ToolOutputT>","arg: Parameters<\n DynamicStructuredToolInput<SchemaT, SchemaOutputT>[\"func\"]\n >[0]","parentConfig?: RunnableConfig","func: (\n input: SchemaOutputT,\n runtime: ToolRuntime<TState, TContext>\n ) => ToolOutputT | Promise<ToolOutputT>","fields: ToolWrapperParams<SchemaT>","isSimpleStringZodSchema","validatesOnlyStrings","patchConfig","AsyncLocalStorageProviderSingleton","pickRunnableConfigKeys","listener: (() => void) | undefined","getAbortSignalError","params: {\n content: TOutput;\n name: string;\n artifact?: unknown;\n toolCallId?: string;\n metadata?: Record<string, unknown>;\n}","isDirectToolOutput","ToolMessage","content: unknown"],"sources":["../../src/tools/index.ts"],"sourcesContent":["import { z } from \"zod/v3\";\nimport { z as z4, ZodError } from \"zod/v4\";\nimport {\n validate,\n type Schema as ValidationSchema,\n} from \"@cfworker/json-schema\";\nimport {\n CallbackManager,\n CallbackManagerForToolRun,\n parseCallbackConfigArg,\n} from \"../callbacks/manager.js\";\nimport { BaseLangChain } from \"../language_models/base.js\";\nimport {\n mergeConfigs,\n ensureConfig,\n patchConfig,\n pickRunnableConfigKeys,\n type RunnableConfig,\n} from \"../runnables/config.js\";\nimport type { RunnableFunc } from \"../runnables/base.js\";\nimport { isDirectToolOutput, ToolCall, ToolMessage } from \"../messages/tool.js\";\nimport { AsyncLocalStorageProviderSingleton } from \"../singletons/index.js\";\nimport type { RunnableToolLike } from \"../runnables/base.js\";\nimport {\n _configHasToolCallId,\n _isToolCall,\n ToolInputParsingException,\n} from \"./utils.js\";\nimport {\n type InferInteropZodInput,\n type InferInteropZodOutput,\n type InteropZodObject,\n type InteropZodType,\n interopParseAsync,\n isSimpleStringZodSchema,\n isInteropZodError,\n isInteropZodSchema,\n type ZodStringV3,\n type ZodStringV4,\n type ZodObjectV3,\n type ZodObjectV4,\n} from \"../utils/types/zod.js\";\nimport { getAbortSignalError } from \"../utils/signal.js\";\nimport type {\n StructuredToolCallInput,\n ToolInputSchemaBase,\n ToolReturnType,\n ResponseFormat,\n ToolInputSchemaInputType,\n ToolInputSchemaOutputType,\n ToolParams,\n ToolRunnableConfig,\n StructuredToolInterface,\n DynamicToolInput,\n DynamicStructuredToolInput,\n StringInputToolSchema,\n ToolInterface,\n ToolOutputType,\n ToolRuntime,\n} from \"./types.js\";\nimport { type JSONSchema, validatesOnlyStrings } from \"../utils/json_schema.js\";\n\nexport type {\n BaseDynamicToolInput,\n ContentAndArtifact,\n DynamicToolInput,\n DynamicStructuredToolInput,\n ResponseFormat,\n StructuredToolCallInput,\n StructuredToolInterface,\n StructuredToolParams,\n ToolInterface,\n ToolParams,\n ToolReturnType,\n ToolRunnableConfig,\n ToolInputSchemaBase as ToolSchemaBase,\n} from \"./types.js\";\n\nexport {\n isLangChainTool,\n isRunnableToolLike,\n isStructuredTool,\n isStructuredToolParams,\n type ToolRuntime,\n} from \"./types.js\";\n\nexport { ToolInputParsingException };\n/**\n * Base class for Tools that accept input of any shape defined by a Zod schema.\n */\nexport abstract class StructuredTool<\n SchemaT = ToolInputSchemaBase,\n SchemaOutputT = ToolInputSchemaOutputType<SchemaT>,\n SchemaInputT = ToolInputSchemaInputType<SchemaT>,\n ToolOutputT = ToolOutputType\n >\n extends BaseLangChain<\n StructuredToolCallInput<SchemaT, SchemaInputT>,\n ToolOutputT | ToolMessage\n >\n implements StructuredToolInterface<SchemaT, SchemaInputT, ToolOutputT>\n{\n abstract name: string;\n\n abstract description: string;\n\n abstract schema: SchemaT;\n\n /**\n * Optional provider-specific extra fields for the tool.\n *\n * This is used to pass provider-specific configuration that doesn't fit into\n * standard tool fields.\n */\n extras?: Record<string, unknown>;\n\n /**\n * Whether to return the tool's output directly.\n *\n * Setting this to true means that after the tool is called,\n * an agent should stop looping.\n */\n returnDirect = false;\n\n verboseParsingErrors = false;\n\n get lc_namespace() {\n return [\"langchain\", \"tools\"];\n }\n\n /**\n * The tool response format.\n *\n * If \"content\" then the output of the tool is interpreted as the contents of a\n * ToolMessage. If \"content_and_artifact\" then the output is expected to be a\n * two-tuple corresponding to the (content, artifact) of a ToolMessage.\n *\n * @default \"content\"\n */\n responseFormat?: ResponseFormat = \"content\";\n\n /**\n * Default config object for the tool runnable.\n */\n defaultConfig?: ToolRunnableConfig;\n\n constructor(fields?: ToolParams) {\n super(fields ?? {});\n\n this.verboseParsingErrors =\n fields?.verboseParsingErrors ?? this.verboseParsingErrors;\n this.responseFormat = fields?.responseFormat ?? this.responseFormat;\n this.defaultConfig = fields?.defaultConfig ?? this.defaultConfig;\n this.metadata = fields?.metadata ?? this.metadata;\n this.extras = fields?.extras ?? this.extras;\n }\n\n protected abstract _call(\n arg: SchemaOutputT,\n runManager?: CallbackManagerForToolRun,\n parentConfig?: ToolRunnableConfig\n ): Promise<ToolOutputT>;\n\n /**\n * Invokes the tool with the provided input and configuration.\n * @param input The input for the tool.\n * @param config Optional configuration for the tool.\n * @returns A Promise that resolves with the tool's output.\n */\n async invoke<\n TInput extends StructuredToolCallInput<SchemaT, SchemaInputT>,\n TConfig extends ToolRunnableConfig | undefined\n >(\n input: TInput,\n config?: TConfig\n ): Promise<ToolReturnType<TInput, TConfig, ToolOutputT>> {\n let toolInput: Exclude<\n StructuredToolCallInput<SchemaT, SchemaInputT>,\n ToolCall\n >;\n\n let enrichedConfig: ToolRunnableConfig = ensureConfig(\n mergeConfigs(this.defaultConfig, config)\n );\n if (_isToolCall(input)) {\n toolInput = input.args as Exclude<\n StructuredToolCallInput<SchemaT, SchemaInputT>,\n ToolCall\n >;\n enrichedConfig = {\n ...enrichedConfig,\n toolCall: input,\n };\n } else {\n toolInput = input as Exclude<\n StructuredToolCallInput<SchemaT, SchemaInputT>,\n ToolCall\n >;\n }\n\n return this.call(toolInput, enrichedConfig) as Promise<\n ToolReturnType<TInput, TConfig, ToolOutputT>\n >;\n }\n\n /**\n * @deprecated Use .invoke() instead. Will be removed in 0.3.0.\n *\n * Calls the tool with the provided argument, configuration, and tags. It\n * parses the input according to the schema, handles any errors, and\n * manages callbacks.\n * @param arg The input argument for the tool.\n * @param configArg Optional configuration or callbacks for the tool.\n * @param tags Optional tags for the tool.\n * @returns A Promise that resolves with a string.\n */\n async call<\n TArg extends StructuredToolCallInput<SchemaT, SchemaInputT>,\n TConfig extends ToolRunnableConfig | undefined\n >(\n arg: TArg,\n configArg?: TConfig,\n /** @deprecated */\n tags?: string[]\n ): Promise<ToolReturnType<TArg, TConfig, ToolOutputT>> {\n // Determine the actual input that needs parsing/validation.\n // If arg is a ToolCall, use its args; otherwise, use arg directly.\n const inputForValidation = _isToolCall(arg) ? arg.args : arg;\n\n let parsed: SchemaOutputT; // This will hold the successfully parsed input of the expected output type.\n if (isInteropZodSchema(this.schema)) {\n try {\n // Validate the inputForValidation - TS needs help here as it can't exclude ToolCall based on the check\n parsed = await interopParseAsync(\n this.schema as InteropZodType,\n inputForValidation as Exclude<TArg, ToolCall>\n );\n } catch (e) {\n let message = `Received tool input did not match expected schema`;\n if (this.verboseParsingErrors) {\n message = `${message}\\nDetails: ${(e as Error).message}`;\n }\n if (isInteropZodError(e)) {\n message = `${message}\\n\\n${z4.prettifyError(e as ZodError)}`;\n }\n // Pass the original raw input arg to the exception\n throw new ToolInputParsingException(message, JSON.stringify(arg));\n }\n } else {\n const result = validate(\n inputForValidation,\n this.schema as ValidationSchema\n );\n if (!result.valid) {\n let message = `Received tool input did not match expected schema`;\n if (this.verboseParsingErrors) {\n message = `${message}\\nDetails: ${result.errors\n .map((e) => `${e.keywordLocation}: ${e.error}`)\n .join(\"\\n\")}`;\n }\n // Pass the original raw input arg to the exception\n throw new ToolInputParsingException(message, JSON.stringify(arg));\n }\n // Assign the validated input to parsed\n // We cast here because validate() doesn't narrow the type sufficiently for TS, but we know it's valid.\n parsed = inputForValidation as SchemaOutputT;\n }\n\n const config = parseCallbackConfigArg(configArg);\n const callbackManager_ = CallbackManager.configure(\n config.callbacks,\n this.callbacks,\n config.tags || tags,\n this.tags,\n config.metadata,\n this.metadata,\n { verbose: this.verbose }\n );\n const runManager = await callbackManager_?.handleToolStart(\n this.toJSON(),\n // Log the original raw input arg\n typeof arg === \"string\" ? arg : JSON.stringify(arg),\n config.runId,\n undefined,\n undefined,\n undefined,\n config.runName\n );\n delete config.runId;\n let result;\n try {\n // Pass the correctly typed parsed input to _call\n result = await this._call(parsed, runManager, config);\n } catch (e) {\n await runManager?.handleToolError(e);\n throw e;\n }\n let content;\n let artifact;\n if (this.responseFormat === \"content_and_artifact\") {\n if (Array.isArray(result) && result.length === 2) {\n [content, artifact] = result;\n } else {\n throw new Error(\n `Tool response format is \"content_and_artifact\" but the output was not a two-tuple.\\nResult: ${JSON.stringify(\n result\n )}`\n );\n }\n } else {\n content = result;\n }\n\n let toolCallId: string | undefined;\n // Extract toolCallId ONLY if the original arg was a ToolCall\n if (_isToolCall(arg)) {\n toolCallId = arg.id;\n }\n // Or if it was provided in the config's toolCall property\n if (!toolCallId && _configHasToolCallId(config)) {\n toolCallId = config.toolCall.id;\n }\n\n const formattedOutput = _formatToolOutput<ToolOutputT>({\n content,\n artifact,\n toolCallId,\n name: this.name,\n metadata: this.metadata,\n });\n await runManager?.handleToolEnd(formattedOutput);\n return formattedOutput as ToolReturnType<TArg, TConfig, ToolOutputT>;\n }\n}\n\n/**\n * Base class for Tools that accept input as a string.\n */\nexport abstract class Tool<ToolOutputT = ToolOutputType>\n extends StructuredTool<\n StringInputToolSchema,\n ToolInputSchemaOutputType<StringInputToolSchema>,\n ToolInputSchemaInputType<StringInputToolSchema>,\n ToolOutputT\n >\n implements\n ToolInterface<\n StringInputToolSchema,\n ToolInputSchemaInputType<StringInputToolSchema>,\n ToolOutputT\n >\n{\n schema = z\n .object({ input: z.string().optional() })\n .transform((obj) => obj.input);\n\n constructor(fields?: ToolParams) {\n super(fields);\n }\n\n /**\n * @deprecated Use .invoke() instead. Will be removed in 0.3.0.\n *\n * Calls the tool with the provided argument and callbacks. It handles\n * string inputs specifically.\n * @param arg The input argument for the tool, which can be a string, undefined, or an input of the tool's schema.\n * @param callbacks Optional callbacks for the tool.\n * @returns A Promise that resolves with a string.\n */\n // Match the base class signature including the generics and conditional return type\n call<\n TArg extends string | undefined | z.input<this[\"schema\"]> | ToolCall,\n TConfig extends ToolRunnableConfig | undefined\n >(\n arg: TArg,\n callbacks?: TConfig\n ): Promise<ToolReturnType<NonNullable<TArg>, TConfig, ToolOutputT>> {\n // Prepare the input for the base class call method.\n // If arg is string or undefined, wrap it; otherwise, pass ToolCall or { input: ... } directly.\n const structuredArg =\n typeof arg === \"string\" || arg == null ? { input: arg } : arg;\n\n // Ensure TConfig is passed to super.call\n return super.call(structuredArg, callbacks);\n }\n}\n\n/**\n * A tool that can be created dynamically from a function, name, and description.\n */\nexport class DynamicTool<\n ToolOutputT = ToolOutputType\n> extends Tool<ToolOutputT> {\n static lc_name() {\n return \"DynamicTool\";\n }\n\n name: string;\n\n description: string;\n\n func: DynamicToolInput<ToolOutputT>[\"func\"];\n\n constructor(fields: DynamicToolInput<ToolOutputT>) {\n super(fields);\n this.name = fields.name;\n this.description = fields.description;\n this.func = fields.func;\n this.returnDirect = fields.returnDirect ?? this.returnDirect;\n }\n\n /**\n * @deprecated Use .invoke() instead. Will be removed in 0.3.0.\n */\n async call<\n TArg extends string | undefined | z.input<this[\"schema\"]> | ToolCall,\n TConfig extends ToolRunnableConfig | undefined\n >(\n arg: TArg,\n configArg?: TConfig\n ): Promise<ToolReturnType<NonNullable<TArg>, TConfig, ToolOutputT>> {\n const config = parseCallbackConfigArg(configArg);\n if (config.runName === undefined) {\n config.runName = this.name;\n }\n // Call the Tool class's call method, passing generics through\n // Cast config to TConfig to satisfy the super.call signature\n return super.call<TArg, TConfig>(arg, config as TConfig);\n }\n\n /** @ignore */\n async _call(\n input: string, // DynamicTool's _call specifically expects a string after schema transformation\n runManager?: CallbackManagerForToolRun,\n parentConfig?: ToolRunnableConfig\n ): Promise<ToolOutputT> {\n return this.func(input, runManager, parentConfig);\n }\n}\n\n/**\n * A tool that can be created dynamically from a function, name, and\n * description, designed to work with structured data. It extends the\n * StructuredTool class and overrides the _call method to execute the\n * provided function when the tool is called.\n *\n * Schema can be passed as Zod or JSON schema. The tool will not validate\n * input if JSON schema is passed.\n */\nexport class DynamicStructuredTool<\n SchemaT = ToolInputSchemaBase,\n SchemaOutputT = ToolInputSchemaOutputType<SchemaT>,\n SchemaInputT = ToolInputSchemaInputType<SchemaT>,\n ToolOutputT = ToolOutputType\n> extends StructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT> {\n static lc_name() {\n return \"DynamicStructuredTool\";\n }\n\n name: string;\n\n description: string;\n\n func: DynamicStructuredToolInput<SchemaT, SchemaOutputT, ToolOutputT>[\"func\"];\n\n schema: SchemaT;\n\n constructor(\n fields: DynamicStructuredToolInput<SchemaT, SchemaOutputT, ToolOutputT>\n ) {\n super(fields);\n this.name = fields.name;\n this.description = fields.description;\n this.func = fields.func;\n this.returnDirect = fields.returnDirect ?? this.returnDirect;\n this.schema = fields.schema;\n }\n\n /**\n * @deprecated Use .invoke() instead. Will be removed in 0.3.0.\n */\n // Match the base class signature\n async call<\n TArg extends StructuredToolCallInput<SchemaT, SchemaInputT>,\n TConfig extends ToolRunnableConfig | undefined\n >(\n arg: TArg,\n configArg?: TConfig,\n /** @deprecated */\n tags?: string[]\n ): Promise<ToolReturnType<NonNullable<TArg>, TConfig, ToolOutputT>> {\n const config = parseCallbackConfigArg(configArg);\n if (config.runName === undefined) {\n config.runName = this.name;\n }\n\n // Call the base class method, passing generics through\n // Cast config to TConfig to satisfy the super.call signature\n return super.call<TArg, TConfig>(arg, config as TConfig, tags);\n }\n\n protected _call(\n arg: Parameters<\n DynamicStructuredToolInput<SchemaT, SchemaOutputT>[\"func\"]\n >[0],\n runManager?: CallbackManagerForToolRun,\n parentConfig?: RunnableConfig\n ): Promise<ToolOutputT> {\n return this.func(arg, runManager, parentConfig);\n }\n}\n\n/**\n * Abstract base class for toolkits in LangChain. Toolkits are collections\n * of tools that agents can use. Subclasses must implement the `tools`\n * property to provide the specific tools for the toolkit.\n */\nexport abstract class BaseToolkit {\n abstract tools: StructuredToolInterface[];\n\n getTools(): StructuredToolInterface[] {\n return this.tools;\n }\n}\n\n/**\n * Parameters for the tool function.\n * Schema can be provided as Zod or JSON schema.\n * Both schema types will be validated.\n * @template {ToolInputSchemaBase} RunInput The input schema for the tool.\n */\ninterface ToolWrapperParams<RunInput = ToolInputSchemaBase | undefined>\n extends ToolParams {\n /**\n * The name of the tool. If using with an LLM, this\n * will be passed as the tool name.\n */\n name: string;\n /**\n * The description of the tool.\n * @default `${fields.name} tool`\n */\n description?: string;\n /**\n * The input schema for the tool. If using an LLM, this\n * will be passed as the tool schema to generate arguments\n * for.\n */\n schema?: RunInput;\n /**\n * The tool response format.\n *\n * If \"content\" then the output of the tool is interpreted as the contents of a\n * ToolMessage. If \"content_and_artifact\" then the output is expected to be a\n * two-tuple corresponding to the (content, artifact) of a ToolMessage.\n *\n * @default \"content\"\n */\n responseFormat?: ResponseFormat;\n /**\n * Whether to return the tool's output directly.\n *\n * Setting this to true means that after the tool is called,\n * an agent should stop looping.\n */\n returnDirect?: boolean;\n}\n\n/**\n * Creates a new StructuredTool instance with the provided function, name, description, and schema.\n *\n * Schema can be provided as Zod or JSON schema, and both will be validated.\n *\n * @function\n * @template {ToolInputSchemaBase} SchemaT The input schema for the tool.\n * @template {ToolReturnType} ToolOutputT The output type of the tool.\n *\n * @param {RunnableFunc<z.output<SchemaT>, ToolOutputT>} func - The function to invoke when the tool is called.\n * @param {ToolWrapperParams<SchemaT>} fields - An object containing the following properties:\n * @param {string} fields.name The name of the tool.\n * @param {string | undefined} fields.description The description of the tool. Defaults to either the description on the Zod schema, or `${fields.name} tool`.\n * @param {z.AnyZodObject | z.ZodString | undefined} fields.schema The Zod schema defining the input for the tool. If undefined, it will default to a Zod string schema.\n *\n * @returns {DynamicStructuredTool<SchemaT>} A new StructuredTool instance.\n */\nexport function tool<SchemaT extends ZodStringV3, ToolOutputT = ToolOutputType>(\n func: RunnableFunc<\n InferInteropZodOutput<SchemaT>,\n ToolOutputT,\n ToolRunnableConfig\n >,\n fields: ToolWrapperParams<SchemaT>\n): DynamicTool<ToolOutputT>;\n\nexport function tool<SchemaT extends ZodStringV4, ToolOutputT = ToolOutputType>(\n func: RunnableFunc<\n InferInteropZodOutput<SchemaT>,\n ToolOutputT,\n ToolRunnableConfig\n >,\n fields: ToolWrapperParams<SchemaT>\n): DynamicTool<ToolOutputT>;\n\nexport function tool<\n SchemaT extends ZodObjectV3,\n SchemaOutputT = InferInteropZodOutput<SchemaT>,\n SchemaInputT = InferInteropZodInput<SchemaT>,\n ToolOutputT = ToolOutputType\n>(\n func: RunnableFunc<SchemaOutputT, ToolOutputT, ToolRunnableConfig>,\n fields: ToolWrapperParams<SchemaT>\n): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>;\n\nexport function tool<\n SchemaT extends ZodObjectV4,\n SchemaOutputT = InferInteropZodOutput<SchemaT>,\n SchemaInputT = InferInteropZodInput<SchemaT>,\n ToolOutputT = ToolOutputType\n>(\n func: RunnableFunc<SchemaOutputT, ToolOutputT, ToolRunnableConfig>,\n fields: ToolWrapperParams<SchemaT>\n): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>;\n\nexport function tool<\n SchemaT extends JSONSchema,\n SchemaOutputT = ToolInputSchemaOutputType<SchemaT>,\n SchemaInputT = ToolInputSchemaInputType<SchemaT>,\n ToolOutputT = ToolOutputType\n>(\n func: RunnableFunc<\n Parameters<DynamicStructuredToolInput<SchemaT>[\"func\"]>[0],\n ToolOutputT,\n ToolRunnableConfig\n >,\n fields: ToolWrapperParams<SchemaT>\n): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>;\n\nexport function tool<\n SchemaT extends\n | InteropZodObject\n | InteropZodType<string>\n | JSONSchema = InteropZodObject,\n SchemaOutputT = ToolInputSchemaOutputType<SchemaT>,\n SchemaInputT = ToolInputSchemaInputType<SchemaT>,\n ToolOutputT = ToolOutputType\n>(\n func: RunnableFunc<SchemaOutputT, ToolOutputT, ToolRunnableConfig>,\n fields: ToolWrapperParams<SchemaT>\n):\n | DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>\n | DynamicTool<ToolOutputT>;\n\n// Overloads with ToolRuntime as CallOptions\nexport function tool<\n SchemaT extends ZodStringV3,\n ToolOutputT = ToolOutputType,\n TState = unknown,\n TContext = unknown\n>(\n func: (\n input: InferInteropZodOutput<SchemaT>,\n runtime: ToolRuntime<TState, TContext>\n ) => ToolOutputT | Promise<ToolOutputT>,\n fields: ToolWrapperParams<SchemaT>\n): DynamicTool<ToolOutputT>;\n\nexport function tool<\n SchemaT extends ZodStringV4,\n ToolOutputT = ToolOutputType,\n TState = unknown,\n TContext = unknown\n>(\n func: (\n input: InferInteropZodOutput<SchemaT>,\n runtime: ToolRuntime<TState, TContext>\n ) => ToolOutputT | Promise<ToolOutputT>,\n fields: ToolWrapperParams<SchemaT>\n): DynamicTool<ToolOutputT>;\n\nexport function tool<\n SchemaT extends ZodObjectV3,\n SchemaOutputT = InferInteropZodOutput<SchemaT>,\n SchemaInputT = InferInteropZodInput<SchemaT>,\n ToolOutputT = ToolOutputType,\n TState = unknown,\n TContext = unknown\n>(\n func: (\n input: SchemaOutputT,\n runtime: ToolRuntime<TState, TContext>\n ) => ToolOutputT | Promise<ToolOutputT>,\n fields: ToolWrapperParams<SchemaT>\n): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>;\n\nexport function tool<\n SchemaT extends ZodObjectV4,\n SchemaOutputT = InferInteropZodOutput<SchemaT>,\n SchemaInputT = InferInteropZodInput<SchemaT>,\n ToolOutputT = ToolOutputType,\n TState = unknown,\n TContext = unknown\n>(\n func: (\n input: SchemaOutputT,\n runtime: ToolRuntime<TState, TContext>\n ) => ToolOutputT | Promise<ToolOutputT>,\n fields: ToolWrapperParams<SchemaT>\n): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>;\n\nexport function tool<\n SchemaT extends JSONSchema,\n SchemaOutputT = ToolInputSchemaOutputType<SchemaT>,\n SchemaInputT = ToolInputSchemaInputType<SchemaT>,\n ToolOutputT = ToolOutputType,\n TState = unknown,\n TContext = unknown\n>(\n func: (\n input: Parameters<DynamicStructuredToolInput<SchemaT>[\"func\"]>[0],\n runtime: ToolRuntime<TState, TContext>\n ) => ToolOutputT | Promise<ToolOutputT>,\n fields: ToolWrapperParams<SchemaT>\n): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>;\n\nexport function tool<\n SchemaT extends\n | InteropZodObject\n | InteropZodType<string>\n | JSONSchema = InteropZodObject,\n SchemaOutputT = ToolInputSchemaOutputType<SchemaT>,\n SchemaInputT = ToolInputSchemaInputType<SchemaT>,\n ToolOutputT = ToolOutputType,\n TState = unknown,\n TContext = unknown\n>(\n func: (\n input: SchemaOutputT,\n runtime: ToolRuntime<TState, TContext>\n ) => ToolOutputT | Promise<ToolOutputT>,\n fields: ToolWrapperParams<SchemaT>\n):\n | DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>\n | DynamicTool<ToolOutputT> {\n const isSimpleStringSchema = isSimpleStringZodSchema(fields.schema);\n const isStringJSONSchema = validatesOnlyStrings(fields.schema);\n\n // If the schema is not provided, or it's a simple string schema, create a DynamicTool\n if (!fields.schema || isSimpleStringSchema || isStringJSONSchema) {\n return new DynamicTool<ToolOutputT>({\n ...fields,\n description:\n fields.description ??\n (fields.schema as { description?: string } | undefined)?.description ??\n `${fields.name} tool`,\n func: async (input, runManager, config) => {\n return new Promise<ToolOutputT>((resolve, reject) => {\n const childConfig = patchConfig(config, {\n callbacks: runManager?.getChild(),\n });\n // eslint-disable-next-line no-void\n void AsyncLocalStorageProviderSingleton.runWithConfig(\n pickRunnableConfigKeys(childConfig),\n async () => {\n try {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n resolve(func(input as any, childConfig as any));\n } catch (e) {\n reject(e);\n }\n }\n );\n });\n },\n });\n }\n\n const schema = fields.schema as InteropZodObject | JSONSchema;\n\n const description =\n fields.description ??\n (fields.schema as { description?: string }).description ??\n `${fields.name} tool`;\n\n return new DynamicStructuredTool<\n typeof schema,\n SchemaOutputT,\n SchemaInputT,\n ToolOutputT\n >({\n ...fields,\n description,\n schema,\n func: async (input, runManager, config) => {\n return new Promise<ToolOutputT>((resolve, reject) => {\n let listener: (() => void) | undefined;\n const cleanup = () => {\n if (config?.signal && listener) {\n config.signal.removeEventListener(\"abort\", listener);\n }\n };\n\n if (config?.signal) {\n listener = () => {\n cleanup();\n reject(getAbortSignalError(config.signal));\n };\n config.signal.addEventListener(\"abort\", listener);\n }\n\n const childConfig = patchConfig(config, {\n callbacks: runManager?.getChild(),\n });\n // eslint-disable-next-line no-void\n void AsyncLocalStorageProviderSingleton.runWithConfig(\n pickRunnableConfigKeys(childConfig),\n async () => {\n try {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const result = await func(input as any, childConfig as any);\n\n /**\n * If the signal is aborted, we don't want to resolve the promise\n * as the promise is already rejected.\n */\n if (config?.signal?.aborted) {\n cleanup();\n return;\n }\n\n cleanup();\n resolve(result);\n } catch (e) {\n cleanup();\n reject(e);\n }\n }\n );\n });\n },\n }) as DynamicStructuredTool<\n SchemaT,\n SchemaOutputT,\n SchemaInputT,\n ToolOutputT\n >;\n}\n\nfunction _formatToolOutput<TOutput extends ToolOutputType>(params: {\n content: TOutput;\n name: string;\n artifact?: unknown;\n toolCallId?: string;\n metadata?: Record<string, unknown>;\n}): ToolMessage | TOutput {\n const { content, artifact, toolCallId, metadata } = params;\n if (toolCallId && !isDirectToolOutput(content)) {\n if (\n typeof content === \"string\" ||\n (Array.isArray(content) &&\n content.every((item) => typeof item === \"object\"))\n ) {\n return new ToolMessage({\n status: \"success\",\n content,\n artifact,\n tool_call_id: toolCallId,\n name: params.name,\n metadata,\n });\n } else {\n return new ToolMessage({\n status: \"success\",\n content: _stringify(content),\n artifact,\n tool_call_id: toolCallId,\n name: params.name,\n metadata,\n });\n }\n } else {\n return content;\n }\n}\n\nfunction _stringify(content: unknown): string {\n try {\n return JSON.stringify(content, null, 2) ?? \"\";\n } catch (_noOp) {\n return `${content}`;\n }\n}\n\nexport type ServerTool = Record<string, unknown>;\nexport type ClientTool =\n | StructuredToolInterface\n | DynamicTool\n | RunnableToolLike;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0FA,IAAsB,iBAAtB,cAMUA,2CAKV;;;;;;;CAaE;;;;;;;CAQA,eAAe;CAEf,uBAAuB;CAEvB,IAAI,eAAe;AACjB,SAAO,CAAC,aAAa,OAAQ;CAC9B;;;;;;;;;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;IAEGC,iDAAmC,cACtCC,sCAAuB,YAAY,EACnC,YAAY;AACV,SAAI;MAEF,MAAM,SAAS,MAAM,KAAK,OAAc,YAAmB;;;;;AAM3D,UAAI,QAAQ,QAAQ,SAAS;OAC3B,SAAS;AACT;MACD;MAED,SAAS;MACT,QAAQ,OAAO;KAChB,SAAQ,GAAG;MACV,SAAS;MACT,OAAO,EAAE;KACV;IACF,EACF;GACF;EACF;CACF;AAMF;AAED,SAAS,kBAAkDG,QAMjC;CACxB,MAAM,EAAE,SAAS,UAAU,YAAY,UAAU,GAAG;AACpD,KAAI,cAAc,CAACC,yCAAmB,QAAQ,CAC5C,KACE,OAAO,YAAY,YAClB,MAAM,QAAQ,QAAQ,IACrB,QAAQ,MAAM,CAAC,SAAS,OAAO,SAAS,SAAS,CAEnD,QAAO,IAAIC,kCAAY;EACrB,QAAQ;EACR;EACA;EACA,cAAc;EACd,MAAM,OAAO;EACb;CACD;KAED,QAAO,IAAIA,kCAAY;EACrB,QAAQ;EACR,SAAS,WAAW,QAAQ;EAC5B;EACA,cAAc;EACd,MAAM,OAAO;EACb;CACD;KAGH,QAAO;AAEV;AAED,SAAS,WAAWC,SAA0B;AAC5C,KAAI;AACF,SAAO,KAAK,UAAU,SAAS,MAAM,EAAE,IAAI;CAC5C,SAAQ,OAAO;AACd,SAAO,GAAG,SAAS;CACpB;AACF"}
1
+ {"version":3,"file":"index.cjs","names":["BaseLangChain","fields?: ToolParams","input: TInput","config?: TConfig","toolInput: Exclude<\n StructuredToolCallInput<SchemaT, SchemaInputT>,\n ToolCall\n >","enrichedConfig: ToolRunnableConfig","ensureConfig","mergeConfigs","_isToolCall","arg: TArg","configArg?: TConfig","tags?: string[]","parsed: SchemaOutputT","isInteropZodSchema","interopParseAsync","isInteropZodError","z4","ToolInputParsingException","result","parseCallbackConfigArg","CallbackManager","toolCallId: string | undefined","_configHasToolCallId","z","callbacks?: TConfig","fields: DynamicToolInput<ToolOutputT>","input: string","runManager?: CallbackManagerForToolRun","parentConfig?: ToolRunnableConfig","fields: DynamicStructuredToolInput<SchemaT, SchemaOutputT, ToolOutputT> & {\n name: NameT;\n }","arg: Parameters<\n DynamicStructuredToolInput<SchemaT, SchemaOutputT>[\"func\"]\n >[0]","parentConfig?: RunnableConfig","func: (\n input: SchemaOutputT,\n runtime: ToolRuntime<TState, TContext>\n ) => ToolOutputT | Promise<ToolOutputT>","fields: ToolWrapperParams<SchemaT, NameT>","isSimpleStringZodSchema","validatesOnlyStrings","patchConfig","AsyncLocalStorageProviderSingleton","pickRunnableConfigKeys","listener: (() => void) | undefined","getAbortSignalError","params: {\n content: TOutput;\n name: string;\n artifact?: unknown;\n toolCallId?: string;\n metadata?: Record<string, unknown>;\n}","isDirectToolOutput","ToolMessage","content: unknown"],"sources":["../../src/tools/index.ts"],"sourcesContent":["import { z } from \"zod/v3\";\nimport { z as z4, ZodError } from \"zod/v4\";\nimport {\n validate,\n type Schema as ValidationSchema,\n} from \"@cfworker/json-schema\";\nimport {\n CallbackManager,\n CallbackManagerForToolRun,\n parseCallbackConfigArg,\n} from \"../callbacks/manager.js\";\nimport { BaseLangChain } from \"../language_models/base.js\";\nimport {\n mergeConfigs,\n ensureConfig,\n patchConfig,\n pickRunnableConfigKeys,\n type RunnableConfig,\n} from \"../runnables/config.js\";\nimport type { RunnableFunc } from \"../runnables/base.js\";\nimport { isDirectToolOutput, ToolCall, ToolMessage } from \"../messages/tool.js\";\nimport { AsyncLocalStorageProviderSingleton } from \"../singletons/index.js\";\nimport type { RunnableToolLike } from \"../runnables/base.js\";\nimport {\n _configHasToolCallId,\n _isToolCall,\n ToolInputParsingException,\n} from \"./utils.js\";\nimport {\n type InferInteropZodInput,\n type InferInteropZodOutput,\n type InteropZodObject,\n type InteropZodType,\n interopParseAsync,\n isSimpleStringZodSchema,\n isInteropZodError,\n isInteropZodSchema,\n type ZodStringV3,\n type ZodStringV4,\n type ZodObjectV3,\n type ZodObjectV4,\n} from \"../utils/types/zod.js\";\nimport { getAbortSignalError } from \"../utils/signal.js\";\nimport type {\n StructuredToolCallInput,\n ToolInputSchemaBase,\n ToolReturnType,\n ResponseFormat,\n ToolInputSchemaInputType,\n ToolInputSchemaOutputType,\n ToolParams,\n ToolRunnableConfig,\n StructuredToolInterface,\n DynamicToolInput,\n DynamicStructuredToolInput,\n StringInputToolSchema,\n ToolInterface,\n ToolOutputType,\n ToolRuntime,\n} from \"./types.js\";\nimport { type JSONSchema, validatesOnlyStrings } from \"../utils/json_schema.js\";\n\nexport type {\n BaseDynamicToolInput,\n ContentAndArtifact,\n DynamicToolInput,\n DynamicStructuredToolInput,\n ResponseFormat,\n StructuredToolCallInput,\n StructuredToolInterface,\n StructuredToolParams,\n ToolInterface,\n ToolParams,\n ToolReturnType,\n ToolRunnableConfig,\n ToolInputSchemaBase as ToolSchemaBase,\n} from \"./types.js\";\n\nexport {\n isLangChainTool,\n isRunnableToolLike,\n isStructuredTool,\n isStructuredToolParams,\n type ToolRuntime,\n} from \"./types.js\";\n\nexport { ToolInputParsingException };\n/**\n * Base class for Tools that accept input of any shape defined by a Zod schema.\n */\nexport abstract class StructuredTool<\n SchemaT = ToolInputSchemaBase,\n SchemaOutputT = ToolInputSchemaOutputType<SchemaT>,\n SchemaInputT = ToolInputSchemaInputType<SchemaT>,\n ToolOutputT = ToolOutputType\n >\n extends BaseLangChain<\n StructuredToolCallInput<SchemaT, SchemaInputT>,\n ToolOutputT | ToolMessage\n >\n implements StructuredToolInterface<SchemaT, SchemaInputT, ToolOutputT>\n{\n abstract name: string;\n\n abstract description: string;\n\n abstract schema: SchemaT;\n\n /**\n * Optional provider-specific extra fields for the tool.\n *\n * This is used to pass provider-specific configuration that doesn't fit into\n * standard tool fields.\n */\n extras?: Record<string, unknown>;\n\n /**\n * Whether to return the tool's output directly.\n *\n * Setting this to true means that after the tool is called,\n * an agent should stop looping.\n */\n returnDirect = false;\n\n verboseParsingErrors = false;\n\n get lc_namespace() {\n return [\"langchain\", \"tools\"];\n }\n\n /**\n * The tool response format.\n *\n * If \"content\" then the output of the tool is interpreted as the contents of a\n * ToolMessage. If \"content_and_artifact\" then the output is expected to be a\n * two-tuple corresponding to the (content, artifact) of a ToolMessage.\n *\n * @default \"content\"\n */\n responseFormat?: ResponseFormat = \"content\";\n\n /**\n * Default config object for the tool runnable.\n */\n defaultConfig?: ToolRunnableConfig;\n\n constructor(fields?: ToolParams) {\n super(fields ?? {});\n\n this.verboseParsingErrors =\n fields?.verboseParsingErrors ?? this.verboseParsingErrors;\n this.responseFormat = fields?.responseFormat ?? this.responseFormat;\n this.defaultConfig = fields?.defaultConfig ?? this.defaultConfig;\n this.metadata = fields?.metadata ?? this.metadata;\n this.extras = fields?.extras ?? this.extras;\n }\n\n protected abstract _call(\n arg: SchemaOutputT,\n runManager?: CallbackManagerForToolRun,\n parentConfig?: ToolRunnableConfig\n ): Promise<ToolOutputT>;\n\n /**\n * Invokes the tool with the provided input and configuration.\n * @param input The input for the tool.\n * @param config Optional configuration for the tool.\n * @returns A Promise that resolves with the tool's output.\n */\n async invoke<\n TInput extends StructuredToolCallInput<SchemaT, SchemaInputT>,\n TConfig extends ToolRunnableConfig | undefined\n >(\n input: TInput,\n config?: TConfig\n ): Promise<ToolReturnType<TInput, TConfig, ToolOutputT>> {\n let toolInput: Exclude<\n StructuredToolCallInput<SchemaT, SchemaInputT>,\n ToolCall\n >;\n\n let enrichedConfig: ToolRunnableConfig = ensureConfig(\n mergeConfigs(this.defaultConfig, config)\n );\n if (_isToolCall(input)) {\n toolInput = input.args as Exclude<\n StructuredToolCallInput<SchemaT, SchemaInputT>,\n ToolCall\n >;\n enrichedConfig = {\n ...enrichedConfig,\n toolCall: input,\n };\n } else {\n toolInput = input as Exclude<\n StructuredToolCallInput<SchemaT, SchemaInputT>,\n ToolCall\n >;\n }\n\n return this.call(toolInput, enrichedConfig) as Promise<\n ToolReturnType<TInput, TConfig, ToolOutputT>\n >;\n }\n\n /**\n * @deprecated Use .invoke() instead. Will be removed in 0.3.0.\n *\n * Calls the tool with the provided argument, configuration, and tags. It\n * parses the input according to the schema, handles any errors, and\n * manages callbacks.\n * @param arg The input argument for the tool.\n * @param configArg Optional configuration or callbacks for the tool.\n * @param tags Optional tags for the tool.\n * @returns A Promise that resolves with a string.\n */\n async call<\n TArg extends StructuredToolCallInput<SchemaT, SchemaInputT>,\n TConfig extends ToolRunnableConfig | undefined\n >(\n arg: TArg,\n configArg?: TConfig,\n /** @deprecated */\n tags?: string[]\n ): Promise<ToolReturnType<TArg, TConfig, ToolOutputT>> {\n // Determine the actual input that needs parsing/validation.\n // If arg is a ToolCall, use its args; otherwise, use arg directly.\n const inputForValidation = _isToolCall(arg) ? arg.args : arg;\n\n let parsed: SchemaOutputT; // This will hold the successfully parsed input of the expected output type.\n if (isInteropZodSchema(this.schema)) {\n try {\n // Validate the inputForValidation - TS needs help here as it can't exclude ToolCall based on the check\n parsed = await interopParseAsync(\n this.schema as InteropZodType,\n inputForValidation as Exclude<TArg, ToolCall>\n );\n } catch (e) {\n let message = `Received tool input did not match expected schema`;\n if (this.verboseParsingErrors) {\n message = `${message}\\nDetails: ${(e as Error).message}`;\n }\n if (isInteropZodError(e)) {\n message = `${message}\\n\\n${z4.prettifyError(e as ZodError)}`;\n }\n // Pass the original raw input arg to the exception\n throw new ToolInputParsingException(message, JSON.stringify(arg));\n }\n } else {\n const result = validate(\n inputForValidation,\n this.schema as ValidationSchema\n );\n if (!result.valid) {\n let message = `Received tool input did not match expected schema`;\n if (this.verboseParsingErrors) {\n message = `${message}\\nDetails: ${result.errors\n .map((e) => `${e.keywordLocation}: ${e.error}`)\n .join(\"\\n\")}`;\n }\n // Pass the original raw input arg to the exception\n throw new ToolInputParsingException(message, JSON.stringify(arg));\n }\n // Assign the validated input to parsed\n // We cast here because validate() doesn't narrow the type sufficiently for TS, but we know it's valid.\n parsed = inputForValidation as SchemaOutputT;\n }\n\n const config = parseCallbackConfigArg(configArg);\n const callbackManager_ = CallbackManager.configure(\n config.callbacks,\n this.callbacks,\n config.tags || tags,\n this.tags,\n config.metadata,\n this.metadata,\n { verbose: this.verbose }\n );\n const runManager = await callbackManager_?.handleToolStart(\n this.toJSON(),\n // Log the original raw input arg\n typeof arg === \"string\" ? arg : JSON.stringify(arg),\n config.runId,\n undefined,\n undefined,\n undefined,\n config.runName\n );\n delete config.runId;\n let result;\n try {\n // Pass the correctly typed parsed input to _call\n result = await this._call(parsed, runManager, config);\n } catch (e) {\n await runManager?.handleToolError(e);\n throw e;\n }\n let content;\n let artifact;\n if (this.responseFormat === \"content_and_artifact\") {\n if (Array.isArray(result) && result.length === 2) {\n [content, artifact] = result;\n } else {\n throw new Error(\n `Tool response format is \"content_and_artifact\" but the output was not a two-tuple.\\nResult: ${JSON.stringify(\n result\n )}`\n );\n }\n } else {\n content = result;\n }\n\n let toolCallId: string | undefined;\n // Extract toolCallId ONLY if the original arg was a ToolCall\n if (_isToolCall(arg)) {\n toolCallId = arg.id;\n }\n // Or if it was provided in the config's toolCall property\n if (!toolCallId && _configHasToolCallId(config)) {\n toolCallId = config.toolCall.id;\n }\n\n const formattedOutput = _formatToolOutput<ToolOutputT>({\n content,\n artifact,\n toolCallId,\n name: this.name,\n metadata: this.metadata,\n });\n await runManager?.handleToolEnd(formattedOutput);\n return formattedOutput as ToolReturnType<TArg, TConfig, ToolOutputT>;\n }\n}\n\n/**\n * Base class for Tools that accept input as a string.\n */\nexport abstract class Tool<ToolOutputT = ToolOutputType>\n extends StructuredTool<\n StringInputToolSchema,\n ToolInputSchemaOutputType<StringInputToolSchema>,\n ToolInputSchemaInputType<StringInputToolSchema>,\n ToolOutputT\n >\n implements\n ToolInterface<\n StringInputToolSchema,\n ToolInputSchemaInputType<StringInputToolSchema>,\n ToolOutputT\n >\n{\n schema = z\n .object({ input: z.string().optional() })\n .transform((obj) => obj.input);\n\n constructor(fields?: ToolParams) {\n super(fields);\n }\n\n /**\n * @deprecated Use .invoke() instead. Will be removed in 0.3.0.\n *\n * Calls the tool with the provided argument and callbacks. It handles\n * string inputs specifically.\n * @param arg The input argument for the tool, which can be a string, undefined, or an input of the tool's schema.\n * @param callbacks Optional callbacks for the tool.\n * @returns A Promise that resolves with a string.\n */\n // Match the base class signature including the generics and conditional return type\n call<\n TArg extends string | undefined | z.input<this[\"schema\"]> | ToolCall,\n TConfig extends ToolRunnableConfig | undefined\n >(\n arg: TArg,\n callbacks?: TConfig\n ): Promise<ToolReturnType<NonNullable<TArg>, TConfig, ToolOutputT>> {\n // Prepare the input for the base class call method.\n // If arg is string or undefined, wrap it; otherwise, pass ToolCall or { input: ... } directly.\n const structuredArg =\n typeof arg === \"string\" || arg == null ? { input: arg } : arg;\n\n // Ensure TConfig is passed to super.call\n return super.call(structuredArg, callbacks);\n }\n}\n\n/**\n * A tool that can be created dynamically from a function, name, and description.\n */\nexport class DynamicTool<\n ToolOutputT = ToolOutputType\n> extends Tool<ToolOutputT> {\n static lc_name() {\n return \"DynamicTool\";\n }\n\n name: string;\n\n description: string;\n\n func: DynamicToolInput<ToolOutputT>[\"func\"];\n\n constructor(fields: DynamicToolInput<ToolOutputT>) {\n super(fields);\n this.name = fields.name;\n this.description = fields.description;\n this.func = fields.func;\n this.returnDirect = fields.returnDirect ?? this.returnDirect;\n }\n\n /**\n * @deprecated Use .invoke() instead. Will be removed in 0.3.0.\n */\n async call<\n TArg extends string | undefined | z.input<this[\"schema\"]> | ToolCall,\n TConfig extends ToolRunnableConfig | undefined\n >(\n arg: TArg,\n configArg?: TConfig\n ): Promise<ToolReturnType<NonNullable<TArg>, TConfig, ToolOutputT>> {\n const config = parseCallbackConfigArg(configArg);\n if (config.runName === undefined) {\n config.runName = this.name;\n }\n // Call the Tool class's call method, passing generics through\n // Cast config to TConfig to satisfy the super.call signature\n return super.call<TArg, TConfig>(arg, config as TConfig);\n }\n\n /** @ignore */\n async _call(\n input: string, // DynamicTool's _call specifically expects a string after schema transformation\n runManager?: CallbackManagerForToolRun,\n parentConfig?: ToolRunnableConfig\n ): Promise<ToolOutputT> {\n return this.func(input, runManager, parentConfig);\n }\n}\n\n/**\n * A tool that can be created dynamically from a function, name, and\n * description, designed to work with structured data. It extends the\n * StructuredTool class and overrides the _call method to execute the\n * provided function when the tool is called.\n *\n * Schema can be passed as Zod or JSON schema. The tool will not validate\n * input if JSON schema is passed.\n *\n * @template NameT The literal type of the tool name (for discriminated union support)\n */\nexport class DynamicStructuredTool<\n SchemaT = ToolInputSchemaBase,\n SchemaOutputT = ToolInputSchemaOutputType<SchemaT>,\n SchemaInputT = ToolInputSchemaInputType<SchemaT>,\n ToolOutputT = ToolOutputType,\n NameT extends string = string\n> extends StructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT> {\n static lc_name() {\n return \"DynamicStructuredTool\";\n }\n\n declare name: NameT;\n\n description: string;\n\n func: DynamicStructuredToolInput<SchemaT, SchemaOutputT, ToolOutputT>[\"func\"];\n\n schema: SchemaT;\n\n constructor(\n fields: DynamicStructuredToolInput<SchemaT, SchemaOutputT, ToolOutputT> & {\n name: NameT;\n }\n ) {\n super(fields);\n this.name = fields.name;\n this.description = fields.description;\n this.func = fields.func;\n this.returnDirect = fields.returnDirect ?? this.returnDirect;\n this.schema = fields.schema;\n }\n\n /**\n * @deprecated Use .invoke() instead. Will be removed in 0.3.0.\n */\n // Match the base class signature\n async call<\n TArg extends StructuredToolCallInput<SchemaT, SchemaInputT>,\n TConfig extends ToolRunnableConfig | undefined\n >(\n arg: TArg,\n configArg?: TConfig,\n /** @deprecated */\n tags?: string[]\n ): Promise<ToolReturnType<NonNullable<TArg>, TConfig, ToolOutputT>> {\n const config = parseCallbackConfigArg(configArg);\n if (config.runName === undefined) {\n config.runName = this.name;\n }\n\n // Call the base class method, passing generics through\n // Cast config to TConfig to satisfy the super.call signature\n return super.call<TArg, TConfig>(arg, config as TConfig, tags);\n }\n\n protected _call(\n arg: Parameters<\n DynamicStructuredToolInput<SchemaT, SchemaOutputT>[\"func\"]\n >[0],\n runManager?: CallbackManagerForToolRun,\n parentConfig?: RunnableConfig\n ): Promise<ToolOutputT> {\n return this.func(arg, runManager, parentConfig);\n }\n}\n\n/**\n * Abstract base class for toolkits in LangChain. Toolkits are collections\n * of tools that agents can use. Subclasses must implement the `tools`\n * property to provide the specific tools for the toolkit.\n */\nexport abstract class BaseToolkit {\n abstract tools: StructuredToolInterface[];\n\n getTools(): StructuredToolInterface[] {\n return this.tools;\n }\n}\n\n/**\n * Parameters for the tool function.\n * Schema can be provided as Zod or JSON schema.\n * Both schema types will be validated.\n * @template {ToolInputSchemaBase} RunInput The input schema for the tool.\n * @template {string} NameT The literal name type for discriminated union support.\n */\ninterface ToolWrapperParams<\n RunInput = ToolInputSchemaBase | undefined,\n NameT extends string = string\n> extends ToolParams {\n /**\n * The name of the tool. If using with an LLM, this\n * will be passed as the tool name.\n */\n name: NameT;\n /**\n * The description of the tool.\n * @default `${fields.name} tool`\n */\n description?: string;\n /**\n * The input schema for the tool. If using an LLM, this\n * will be passed as the tool schema to generate arguments\n * for.\n */\n schema?: RunInput;\n /**\n * The tool response format.\n *\n * If \"content\" then the output of the tool is interpreted as the contents of a\n * ToolMessage. If \"content_and_artifact\" then the output is expected to be a\n * two-tuple corresponding to the (content, artifact) of a ToolMessage.\n *\n * @default \"content\"\n */\n responseFormat?: ResponseFormat;\n /**\n * Whether to return the tool's output directly.\n *\n * Setting this to true means that after the tool is called,\n * an agent should stop looping.\n */\n returnDirect?: boolean;\n}\n\n/**\n * Creates a new StructuredTool instance with the provided function, name, description, and schema.\n *\n * Schema can be provided as Zod or JSON schema, and both will be validated.\n *\n * @function\n * @template {ToolInputSchemaBase} SchemaT The input schema for the tool.\n * @template {ToolReturnType} ToolOutputT The output type of the tool.\n *\n * @param {RunnableFunc<z.output<SchemaT>, ToolOutputT>} func - The function to invoke when the tool is called.\n * @param {ToolWrapperParams<SchemaT>} fields - An object containing the following properties:\n * @param {string} fields.name The name of the tool.\n * @param {string | undefined} fields.description The description of the tool. Defaults to either the description on the Zod schema, or `${fields.name} tool`.\n * @param {z.AnyZodObject | z.ZodString | undefined} fields.schema The Zod schema defining the input for the tool. If undefined, it will default to a Zod string schema.\n *\n * @returns {DynamicStructuredTool<SchemaT>} A new StructuredTool instance.\n */\nexport function tool<SchemaT extends ZodStringV3, ToolOutputT = ToolOutputType>(\n func: RunnableFunc<\n InferInteropZodOutput<SchemaT>,\n ToolOutputT,\n ToolRunnableConfig\n >,\n fields: ToolWrapperParams<SchemaT>\n): DynamicTool<ToolOutputT>;\n\nexport function tool<SchemaT extends ZodStringV4, ToolOutputT = ToolOutputType>(\n func: RunnableFunc<\n InferInteropZodOutput<SchemaT>,\n ToolOutputT,\n ToolRunnableConfig\n >,\n fields: ToolWrapperParams<SchemaT>\n): DynamicTool<ToolOutputT>;\n\nexport function tool<\n SchemaT extends ZodObjectV3,\n NameT extends string,\n SchemaOutputT = InferInteropZodOutput<SchemaT>,\n SchemaInputT = InferInteropZodInput<SchemaT>,\n ToolOutputT = ToolOutputType\n>(\n func: RunnableFunc<SchemaOutputT, ToolOutputT, ToolRunnableConfig>,\n fields: ToolWrapperParams<SchemaT, NameT>\n): DynamicStructuredTool<\n SchemaT,\n SchemaOutputT,\n SchemaInputT,\n ToolOutputT,\n NameT\n>;\n\nexport function tool<\n SchemaT extends ZodObjectV4,\n NameT extends string,\n SchemaOutputT = InferInteropZodOutput<SchemaT>,\n SchemaInputT = InferInteropZodInput<SchemaT>,\n ToolOutputT = ToolOutputType\n>(\n func: RunnableFunc<SchemaOutputT, ToolOutputT, ToolRunnableConfig>,\n fields: ToolWrapperParams<SchemaT, NameT>\n): DynamicStructuredTool<\n SchemaT,\n SchemaOutputT,\n SchemaInputT,\n ToolOutputT,\n NameT\n>;\n\nexport function tool<\n SchemaT extends JSONSchema,\n NameT extends string,\n SchemaOutputT = ToolInputSchemaOutputType<SchemaT>,\n SchemaInputT = ToolInputSchemaInputType<SchemaT>,\n ToolOutputT = ToolOutputType\n>(\n func: RunnableFunc<\n Parameters<DynamicStructuredToolInput<SchemaT>[\"func\"]>[0],\n ToolOutputT,\n ToolRunnableConfig\n >,\n fields: ToolWrapperParams<SchemaT, NameT>\n): DynamicStructuredTool<\n SchemaT,\n SchemaOutputT,\n SchemaInputT,\n ToolOutputT,\n NameT\n>;\n\nexport function tool<\n SchemaT extends\n | InteropZodObject\n | InteropZodType<string>\n | JSONSchema = InteropZodObject,\n NameT extends string = string,\n SchemaOutputT = ToolInputSchemaOutputType<SchemaT>,\n SchemaInputT = ToolInputSchemaInputType<SchemaT>,\n ToolOutputT = ToolOutputType\n>(\n func: RunnableFunc<SchemaOutputT, ToolOutputT, ToolRunnableConfig>,\n fields: ToolWrapperParams<SchemaT, NameT>\n):\n | DynamicStructuredTool<\n SchemaT,\n SchemaOutputT,\n SchemaInputT,\n ToolOutputT,\n NameT\n >\n | DynamicTool<ToolOutputT>;\n\n// Overloads with ToolRuntime as CallOptions\nexport function tool<\n SchemaT extends ZodStringV3,\n ToolOutputT = ToolOutputType,\n TState = unknown,\n TContext = unknown\n>(\n func: (\n input: InferInteropZodOutput<SchemaT>,\n runtime: ToolRuntime<TState, TContext>\n ) => ToolOutputT | Promise<ToolOutputT>,\n fields: ToolWrapperParams<SchemaT>\n): DynamicTool<ToolOutputT>;\n\nexport function tool<\n SchemaT extends ZodStringV4,\n ToolOutputT = ToolOutputType,\n TState = unknown,\n TContext = unknown\n>(\n func: (\n input: InferInteropZodOutput<SchemaT>,\n runtime: ToolRuntime<TState, TContext>\n ) => ToolOutputT | Promise<ToolOutputT>,\n fields: ToolWrapperParams<SchemaT>\n): DynamicTool<ToolOutputT>;\n\nexport function tool<\n SchemaT extends ZodObjectV3,\n NameT extends string,\n SchemaOutputT = InferInteropZodOutput<SchemaT>,\n SchemaInputT = InferInteropZodInput<SchemaT>,\n ToolOutputT = ToolOutputType,\n TState = unknown,\n TContext = unknown\n>(\n func: (\n input: SchemaOutputT,\n runtime: ToolRuntime<TState, TContext>\n ) => ToolOutputT | Promise<ToolOutputT>,\n fields: ToolWrapperParams<SchemaT, NameT>\n): DynamicStructuredTool<\n SchemaT,\n SchemaOutputT,\n SchemaInputT,\n ToolOutputT,\n NameT\n>;\n\nexport function tool<\n SchemaT extends ZodObjectV4,\n NameT extends string,\n SchemaOutputT = InferInteropZodOutput<SchemaT>,\n SchemaInputT = InferInteropZodInput<SchemaT>,\n ToolOutputT = ToolOutputType,\n TState = unknown,\n TContext = unknown\n>(\n func: (\n input: SchemaOutputT,\n runtime: ToolRuntime<TState, TContext>\n ) => ToolOutputT | Promise<ToolOutputT>,\n fields: ToolWrapperParams<SchemaT, NameT>\n): DynamicStructuredTool<\n SchemaT,\n SchemaOutputT,\n SchemaInputT,\n ToolOutputT,\n NameT\n>;\n\nexport function tool<\n SchemaT extends JSONSchema,\n NameT extends string,\n SchemaOutputT = ToolInputSchemaOutputType<SchemaT>,\n SchemaInputT = ToolInputSchemaInputType<SchemaT>,\n ToolOutputT = ToolOutputType,\n TState = unknown,\n TContext = unknown\n>(\n func: (\n input: Parameters<DynamicStructuredToolInput<SchemaT>[\"func\"]>[0],\n runtime: ToolRuntime<TState, TContext>\n ) => ToolOutputT | Promise<ToolOutputT>,\n fields: ToolWrapperParams<SchemaT, NameT>\n): DynamicStructuredTool<\n SchemaT,\n SchemaOutputT,\n SchemaInputT,\n ToolOutputT,\n NameT\n>;\n\nexport function tool<\n SchemaT extends\n | InteropZodObject\n | InteropZodType<string>\n | JSONSchema = InteropZodObject,\n NameT extends string = string,\n SchemaOutputT = ToolInputSchemaOutputType<SchemaT>,\n SchemaInputT = ToolInputSchemaInputType<SchemaT>,\n ToolOutputT = ToolOutputType,\n TState = unknown,\n TContext = unknown\n>(\n func: (\n input: SchemaOutputT,\n runtime: ToolRuntime<TState, TContext>\n ) => ToolOutputT | Promise<ToolOutputT>,\n fields: ToolWrapperParams<SchemaT, NameT>\n):\n | DynamicStructuredTool<\n SchemaT,\n SchemaOutputT,\n SchemaInputT,\n ToolOutputT,\n NameT\n >\n | DynamicTool<ToolOutputT> {\n const isSimpleStringSchema = isSimpleStringZodSchema(fields.schema);\n const isStringJSONSchema = validatesOnlyStrings(fields.schema);\n\n // If the schema is not provided, or it's a simple string schema, create a DynamicTool\n if (!fields.schema || isSimpleStringSchema || isStringJSONSchema) {\n return new DynamicTool<ToolOutputT>({\n ...fields,\n description:\n fields.description ??\n (fields.schema as { description?: string } | undefined)?.description ??\n `${fields.name} tool`,\n func: async (input, runManager, config) => {\n return new Promise<ToolOutputT>((resolve, reject) => {\n const childConfig = patchConfig(config, {\n callbacks: runManager?.getChild(),\n });\n // eslint-disable-next-line no-void\n void AsyncLocalStorageProviderSingleton.runWithConfig(\n pickRunnableConfigKeys(childConfig),\n async () => {\n try {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n resolve(func(input as any, childConfig as any));\n } catch (e) {\n reject(e);\n }\n }\n );\n });\n },\n });\n }\n\n const schema = fields.schema as InteropZodObject | JSONSchema;\n\n const description =\n fields.description ??\n (fields.schema as { description?: string }).description ??\n `${fields.name} tool`;\n\n return new DynamicStructuredTool<\n typeof schema,\n SchemaOutputT,\n SchemaInputT,\n ToolOutputT,\n NameT\n >({\n ...fields,\n description,\n schema,\n func: async (input, runManager, config) => {\n return new Promise<ToolOutputT>((resolve, reject) => {\n let listener: (() => void) | undefined;\n const cleanup = () => {\n if (config?.signal && listener) {\n config.signal.removeEventListener(\"abort\", listener);\n }\n };\n\n if (config?.signal) {\n listener = () => {\n cleanup();\n reject(getAbortSignalError(config.signal));\n };\n config.signal.addEventListener(\"abort\", listener);\n }\n\n const childConfig = patchConfig(config, {\n callbacks: runManager?.getChild(),\n });\n // eslint-disable-next-line no-void\n void AsyncLocalStorageProviderSingleton.runWithConfig(\n pickRunnableConfigKeys(childConfig),\n async () => {\n try {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const result = await func(input as any, childConfig as any);\n\n /**\n * If the signal is aborted, we don't want to resolve the promise\n * as the promise is already rejected.\n */\n if (config?.signal?.aborted) {\n cleanup();\n return;\n }\n\n cleanup();\n resolve(result);\n } catch (e) {\n cleanup();\n reject(e);\n }\n }\n );\n });\n },\n }) as DynamicStructuredTool<\n SchemaT,\n SchemaOutputT,\n SchemaInputT,\n ToolOutputT,\n NameT\n >;\n}\n\nfunction _formatToolOutput<TOutput extends ToolOutputType>(params: {\n content: TOutput;\n name: string;\n artifact?: unknown;\n toolCallId?: string;\n metadata?: Record<string, unknown>;\n}): ToolMessage | TOutput {\n const { content, artifact, toolCallId, metadata } = params;\n if (toolCallId && !isDirectToolOutput(content)) {\n if (\n typeof content === \"string\" ||\n (Array.isArray(content) &&\n content.every((item) => typeof item === \"object\"))\n ) {\n return new ToolMessage({\n status: \"success\",\n content,\n artifact,\n tool_call_id: toolCallId,\n name: params.name,\n metadata,\n });\n } else {\n return new ToolMessage({\n status: \"success\",\n content: _stringify(content),\n artifact,\n tool_call_id: toolCallId,\n name: params.name,\n metadata,\n });\n }\n } else {\n return content;\n }\n}\n\nfunction _stringify(content: unknown): string {\n try {\n return JSON.stringify(content, null, 2) ?? \"\";\n } catch (_noOp) {\n return `${content}`;\n }\n}\n\nexport type ServerTool = Record<string, unknown>;\nexport type ClientTool =\n | StructuredToolInterface\n | DynamicTool\n | RunnableToolLike;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0FA,IAAsB,iBAAtB,cAMUA,2CAKV;;;;;;;CAaE;;;;;;;CAQA,eAAe;CAEf,uBAAuB;CAEvB,IAAI,eAAe;AACjB,SAAO,CAAC,aAAa,OAAQ;CAC9B;;;;;;;;;;CAWD,iBAAkC;;;;CAKlC;CAEA,YAAYC,QAAqB;EAC/B,MAAM,UAAU,CAAE,EAAC;EAEnB,KAAK,uBACH,QAAQ,wBAAwB,KAAK;EACvC,KAAK,iBAAiB,QAAQ,kBAAkB,KAAK;EACrD,KAAK,gBAAgB,QAAQ,iBAAiB,KAAK;EACnD,KAAK,WAAW,QAAQ,YAAY,KAAK;EACzC,KAAK,SAAS,QAAQ,UAAU,KAAK;CACtC;;;;;;;CAcD,MAAM,OAIJC,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AM,EAAE,SAAS,UAAU,YAAY,UAAU,GAAG;AACpD,KAAI,cAAc,CAACC,yCAAmB,QAAQ,CAC5C,KACE,OAAO,YAAY,YAClB,MAAM,QAAQ,QAAQ,IACrB,QAAQ,MAAM,CAAC,SAAS,OAAO,SAAS,SAAS,CAEnD,QAAO,IAAIC,kCAAY;EACrB,QAAQ;EACR;EACA;EACA,cAAc;EACd,MAAM,OAAO;EACb;CACD;KAED,QAAO,IAAIA,kCAAY;EACrB,QAAQ;EACR,SAAS,WAAW,QAAQ;EAC5B;EACA,cAAc;EACd,MAAM,OAAO;EACb;CACD;KAGH,QAAO;AAEV;AAED,SAAS,WAAWC,SAA0B;AAC5C,KAAI;AACF,SAAO,KAAK,UAAU,SAAS,MAAM,EAAE,IAAI;CAC5C,SAAQ,OAAO;AACd,SAAO,GAAG,SAAS;CACpB;AACF"}
@@ -120,14 +120,18 @@ declare class DynamicTool<ToolOutputT = ToolOutputType> extends Tool<ToolOutputT
120
120
  *
121
121
  * Schema can be passed as Zod or JSON schema. The tool will not validate
122
122
  * input if JSON schema is passed.
123
+ *
124
+ * @template NameT The literal type of the tool name (for discriminated union support)
123
125
  */
124
- declare class DynamicStructuredTool<SchemaT = ToolInputSchemaBase, SchemaOutputT = ToolInputSchemaOutputType<SchemaT>, SchemaInputT = ToolInputSchemaInputType<SchemaT>, ToolOutputT = ToolOutputType> extends StructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT> {
126
+ declare class DynamicStructuredTool<SchemaT = ToolInputSchemaBase, SchemaOutputT = ToolInputSchemaOutputType<SchemaT>, SchemaInputT = ToolInputSchemaInputType<SchemaT>, ToolOutputT = ToolOutputType, NameT extends string = string> extends StructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT> {
125
127
  static lc_name(): string;
126
- name: string;
128
+ name: NameT;
127
129
  description: string;
128
130
  func: DynamicStructuredToolInput<SchemaT, SchemaOutputT, ToolOutputT>["func"];
129
131
  schema: SchemaT;
130
- constructor(fields: DynamicStructuredToolInput<SchemaT, SchemaOutputT, ToolOutputT>);
132
+ constructor(fields: DynamicStructuredToolInput<SchemaT, SchemaOutputT, ToolOutputT> & {
133
+ name: NameT;
134
+ });
131
135
  /**
132
136
  * @deprecated Use .invoke() instead. Will be removed in 0.3.0.
133
137
  */
@@ -149,13 +153,14 @@ declare abstract class BaseToolkit {
149
153
  * Schema can be provided as Zod or JSON schema.
150
154
  * Both schema types will be validated.
151
155
  * @template {ToolInputSchemaBase} RunInput The input schema for the tool.
156
+ * @template {string} NameT The literal name type for discriminated union support.
152
157
  */
153
- interface ToolWrapperParams<RunInput = ToolInputSchemaBase | undefined> extends ToolParams {
158
+ interface ToolWrapperParams<RunInput = ToolInputSchemaBase | undefined, NameT extends string = string> extends ToolParams {
154
159
  /**
155
160
  * The name of the tool. If using with an LLM, this
156
161
  * will be passed as the tool name.
157
162
  */
158
- name: string;
163
+ name: NameT;
159
164
  /**
160
165
  * The description of the tool.
161
166
  * @default `${fields.name} tool`
@@ -204,15 +209,15 @@ interface ToolWrapperParams<RunInput = ToolInputSchemaBase | undefined> extends
204
209
  */
205
210
  declare function tool<SchemaT extends ZodStringV3, ToolOutputT = ToolOutputType>(func: RunnableFunc<InferInteropZodOutput<SchemaT>, ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT>): DynamicTool<ToolOutputT>;
206
211
  declare function tool<SchemaT extends ZodStringV4, ToolOutputT = ToolOutputType>(func: RunnableFunc<InferInteropZodOutput<SchemaT>, ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT>): DynamicTool<ToolOutputT>;
207
- declare function tool<SchemaT extends ZodObjectV3, SchemaOutputT = InferInteropZodOutput<SchemaT>, SchemaInputT = InferInteropZodInput<SchemaT>, ToolOutputT = ToolOutputType>(func: RunnableFunc<SchemaOutputT, ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>;
208
- declare function tool<SchemaT extends ZodObjectV4, SchemaOutputT = InferInteropZodOutput<SchemaT>, SchemaInputT = InferInteropZodInput<SchemaT>, ToolOutputT = ToolOutputType>(func: RunnableFunc<SchemaOutputT, ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>;
209
- declare function tool<SchemaT extends JsonSchema7Type, SchemaOutputT = ToolInputSchemaOutputType<SchemaT>, SchemaInputT = ToolInputSchemaInputType<SchemaT>, ToolOutputT = ToolOutputType>(func: RunnableFunc<Parameters<DynamicStructuredToolInput<SchemaT>["func"]>[0], ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>;
210
- declare function tool<SchemaT extends InteropZodObject | InteropZodType<string> | JsonSchema7Type = InteropZodObject, SchemaOutputT = ToolInputSchemaOutputType<SchemaT>, SchemaInputT = ToolInputSchemaInputType<SchemaT>, ToolOutputT = ToolOutputType>(func: RunnableFunc<SchemaOutputT, ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT> | DynamicTool<ToolOutputT>;
212
+ declare function tool<SchemaT extends ZodObjectV3, NameT extends string, SchemaOutputT = InferInteropZodOutput<SchemaT>, SchemaInputT = InferInteropZodInput<SchemaT>, ToolOutputT = ToolOutputType>(func: RunnableFunc<SchemaOutputT, ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT, NameT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT, NameT>;
213
+ declare function tool<SchemaT extends ZodObjectV4, NameT extends string, SchemaOutputT = InferInteropZodOutput<SchemaT>, SchemaInputT = InferInteropZodInput<SchemaT>, ToolOutputT = ToolOutputType>(func: RunnableFunc<SchemaOutputT, ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT, NameT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT, NameT>;
214
+ declare function tool<SchemaT extends JsonSchema7Type, NameT extends string, SchemaOutputT = ToolInputSchemaOutputType<SchemaT>, SchemaInputT = ToolInputSchemaInputType<SchemaT>, ToolOutputT = ToolOutputType>(func: RunnableFunc<Parameters<DynamicStructuredToolInput<SchemaT>["func"]>[0], ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT, NameT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT, NameT>;
215
+ declare function tool<SchemaT extends InteropZodObject | InteropZodType<string> | JsonSchema7Type = InteropZodObject, NameT extends string = string, SchemaOutputT = ToolInputSchemaOutputType<SchemaT>, SchemaInputT = ToolInputSchemaInputType<SchemaT>, ToolOutputT = ToolOutputType>(func: RunnableFunc<SchemaOutputT, ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT, NameT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT, NameT> | DynamicTool<ToolOutputT>;
211
216
  declare function tool<SchemaT extends ZodStringV3, ToolOutputT = ToolOutputType, TState = unknown, TContext = unknown>(func: (input: InferInteropZodOutput<SchemaT>, runtime: ToolRuntime<TState, TContext>) => ToolOutputT | Promise<ToolOutputT>, fields: ToolWrapperParams<SchemaT>): DynamicTool<ToolOutputT>;
212
217
  declare function tool<SchemaT extends ZodStringV4, ToolOutputT = ToolOutputType, TState = unknown, TContext = unknown>(func: (input: InferInteropZodOutput<SchemaT>, runtime: ToolRuntime<TState, TContext>) => ToolOutputT | Promise<ToolOutputT>, fields: ToolWrapperParams<SchemaT>): DynamicTool<ToolOutputT>;
213
- declare function tool<SchemaT extends ZodObjectV3, SchemaOutputT = InferInteropZodOutput<SchemaT>, SchemaInputT = InferInteropZodInput<SchemaT>, ToolOutputT = ToolOutputType, TState = unknown, TContext = unknown>(func: (input: SchemaOutputT, runtime: ToolRuntime<TState, TContext>) => ToolOutputT | Promise<ToolOutputT>, fields: ToolWrapperParams<SchemaT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>;
214
- declare function tool<SchemaT extends ZodObjectV4, SchemaOutputT = InferInteropZodOutput<SchemaT>, SchemaInputT = InferInteropZodInput<SchemaT>, ToolOutputT = ToolOutputType, TState = unknown, TContext = unknown>(func: (input: SchemaOutputT, runtime: ToolRuntime<TState, TContext>) => ToolOutputT | Promise<ToolOutputT>, fields: ToolWrapperParams<SchemaT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>;
215
- declare function tool<SchemaT extends JsonSchema7Type, SchemaOutputT = ToolInputSchemaOutputType<SchemaT>, SchemaInputT = ToolInputSchemaInputType<SchemaT>, ToolOutputT = ToolOutputType, TState = unknown, TContext = unknown>(func: (input: Parameters<DynamicStructuredToolInput<SchemaT>["func"]>[0], runtime: ToolRuntime<TState, TContext>) => ToolOutputT | Promise<ToolOutputT>, fields: ToolWrapperParams<SchemaT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>;
218
+ declare function tool<SchemaT extends ZodObjectV3, NameT extends string, SchemaOutputT = InferInteropZodOutput<SchemaT>, SchemaInputT = InferInteropZodInput<SchemaT>, ToolOutputT = ToolOutputType, TState = unknown, TContext = unknown>(func: (input: SchemaOutputT, runtime: ToolRuntime<TState, TContext>) => ToolOutputT | Promise<ToolOutputT>, fields: ToolWrapperParams<SchemaT, NameT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT, NameT>;
219
+ declare function tool<SchemaT extends ZodObjectV4, NameT extends string, SchemaOutputT = InferInteropZodOutput<SchemaT>, SchemaInputT = InferInteropZodInput<SchemaT>, ToolOutputT = ToolOutputType, TState = unknown, TContext = unknown>(func: (input: SchemaOutputT, runtime: ToolRuntime<TState, TContext>) => ToolOutputT | Promise<ToolOutputT>, fields: ToolWrapperParams<SchemaT, NameT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT, NameT>;
220
+ declare function tool<SchemaT extends JsonSchema7Type, NameT extends string, SchemaOutputT = ToolInputSchemaOutputType<SchemaT>, SchemaInputT = ToolInputSchemaInputType<SchemaT>, ToolOutputT = ToolOutputType, TState = unknown, TContext = unknown>(func: (input: Parameters<DynamicStructuredToolInput<SchemaT>["func"]>[0], runtime: ToolRuntime<TState, TContext>) => ToolOutputT | Promise<ToolOutputT>, fields: ToolWrapperParams<SchemaT, NameT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT, NameT>;
216
221
  type ServerTool = Record<string, unknown>;
217
222
  type ClientTool = StructuredToolInterface | DynamicTool | RunnableToolLike;
218
223
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":["z","CallbackManagerForToolRun","BaseLangChain","RunnableConfig","RunnableFunc","ToolCall","ToolMessage","RunnableToolLike","ToolInputParsingException","InferInteropZodInput","InferInteropZodOutput","InteropZodObject","InteropZodType","ZodStringV3","ZodStringV4","ZodObjectV3","ZodObjectV4","StructuredToolCallInput","ToolInputSchemaBase","ToolReturnType","ResponseFormat","ToolInputSchemaInputType","ToolInputSchemaOutputType","ToolParams","ToolRunnableConfig","StructuredToolInterface","DynamicToolInput","DynamicStructuredToolInput","StringInputToolSchema","ToolInterface","ToolOutputType","ToolRuntime","JSONSchema","BaseDynamicToolInput","ContentAndArtifact","StructuredToolParams","ToolSchemaBase","isLangChainTool","isRunnableToolLike","isStructuredTool","isStructuredToolParams","StructuredTool","TInput","TConfig","TArg","SchemaT","SchemaOutputT","SchemaInputT","ToolOutputT","Record","Promise","Tool","ZodString","ZodOptional","ZodTypeAny","ZodObject","ZodEffects","input","NonNullable","DynamicTool","DynamicStructuredTool","Parameters","BaseToolkit","ToolWrapperParams","RunInput","tool","TState","TContext","ServerTool","ClientTool"],"sources":["../../src/tools/index.d.ts"],"sourcesContent":["import { z } from \"zod/v3\";\nimport { CallbackManagerForToolRun } from \"../callbacks/manager.js\";\nimport { BaseLangChain } from \"../language_models/base.js\";\nimport { type RunnableConfig } from \"../runnables/config.js\";\nimport type { RunnableFunc } from \"../runnables/base.js\";\nimport { ToolCall, ToolMessage } from \"../messages/tool.js\";\nimport type { RunnableToolLike } from \"../runnables/base.js\";\nimport { ToolInputParsingException } from \"./utils.js\";\nimport { type InferInteropZodInput, type InferInteropZodOutput, type InteropZodObject, type InteropZodType, type ZodStringV3, type ZodStringV4, type ZodObjectV3, type ZodObjectV4 } from \"../utils/types/zod.js\";\nimport type { StructuredToolCallInput, ToolInputSchemaBase, ToolReturnType, ResponseFormat, ToolInputSchemaInputType, ToolInputSchemaOutputType, ToolParams, ToolRunnableConfig, StructuredToolInterface, DynamicToolInput, DynamicStructuredToolInput, StringInputToolSchema, ToolInterface, ToolOutputType, ToolRuntime } from \"./types.js\";\nimport { type JSONSchema } from \"../utils/json_schema.js\";\nexport type { BaseDynamicToolInput, ContentAndArtifact, DynamicToolInput, DynamicStructuredToolInput, ResponseFormat, StructuredToolCallInput, StructuredToolInterface, StructuredToolParams, ToolInterface, ToolParams, ToolReturnType, ToolRunnableConfig, ToolInputSchemaBase as ToolSchemaBase, } from \"./types.js\";\nexport { isLangChainTool, isRunnableToolLike, isStructuredTool, isStructuredToolParams, type ToolRuntime, } from \"./types.js\";\nexport { ToolInputParsingException };\n/**\n * Base class for Tools that accept input of any shape defined by a Zod schema.\n */\nexport declare abstract class StructuredTool<SchemaT = ToolInputSchemaBase, SchemaOutputT = ToolInputSchemaOutputType<SchemaT>, SchemaInputT = ToolInputSchemaInputType<SchemaT>, ToolOutputT = ToolOutputType> extends BaseLangChain<StructuredToolCallInput<SchemaT, SchemaInputT>, ToolOutputT | ToolMessage> implements StructuredToolInterface<SchemaT, SchemaInputT, ToolOutputT> {\n abstract name: string;\n abstract description: string;\n abstract schema: SchemaT;\n /**\n * Optional provider-specific extra fields for the tool.\n *\n * This is used to pass provider-specific configuration that doesn't fit into\n * standard tool fields.\n */\n extras?: Record<string, unknown>;\n /**\n * Whether to return the tool's output directly.\n *\n * Setting this to true means that after the tool is called,\n * an agent should stop looping.\n */\n returnDirect: boolean;\n verboseParsingErrors: boolean;\n get lc_namespace(): string[];\n /**\n * The tool response format.\n *\n * If \"content\" then the output of the tool is interpreted as the contents of a\n * ToolMessage. If \"content_and_artifact\" then the output is expected to be a\n * two-tuple corresponding to the (content, artifact) of a ToolMessage.\n *\n * @default \"content\"\n */\n responseFormat?: ResponseFormat;\n /**\n * Default config object for the tool runnable.\n */\n defaultConfig?: ToolRunnableConfig;\n constructor(fields?: ToolParams);\n protected abstract _call(arg: SchemaOutputT, runManager?: CallbackManagerForToolRun, parentConfig?: ToolRunnableConfig): Promise<ToolOutputT>;\n /**\n * Invokes the tool with the provided input and configuration.\n * @param input The input for the tool.\n * @param config Optional configuration for the tool.\n * @returns A Promise that resolves with the tool's output.\n */\n invoke<TInput extends StructuredToolCallInput<SchemaT, SchemaInputT>, TConfig extends ToolRunnableConfig | undefined>(input: TInput, config?: TConfig): Promise<ToolReturnType<TInput, TConfig, ToolOutputT>>;\n /**\n * @deprecated Use .invoke() instead. Will be removed in 0.3.0.\n *\n * Calls the tool with the provided argument, configuration, and tags. It\n * parses the input according to the schema, handles any errors, and\n * manages callbacks.\n * @param arg The input argument for the tool.\n * @param configArg Optional configuration or callbacks for the tool.\n * @param tags Optional tags for the tool.\n * @returns A Promise that resolves with a string.\n */\n call<TArg extends StructuredToolCallInput<SchemaT, SchemaInputT>, TConfig extends ToolRunnableConfig | undefined>(arg: TArg, configArg?: TConfig, \n /** @deprecated */\n tags?: string[]): Promise<ToolReturnType<TArg, TConfig, ToolOutputT>>;\n}\n/**\n * Base class for Tools that accept input as a string.\n */\nexport declare abstract class Tool<ToolOutputT = ToolOutputType> extends StructuredTool<StringInputToolSchema, ToolInputSchemaOutputType<StringInputToolSchema>, ToolInputSchemaInputType<StringInputToolSchema>, ToolOutputT> implements ToolInterface<StringInputToolSchema, ToolInputSchemaInputType<StringInputToolSchema>, ToolOutputT> {\n schema: z.ZodEffects<z.ZodObject<{\n input: z.ZodOptional<z.ZodString>;\n }, \"strip\", z.ZodTypeAny, {\n input?: string | undefined;\n }, {\n input?: string | undefined;\n }>, string | undefined, {\n input?: string | undefined;\n }>;\n constructor(fields?: ToolParams);\n /**\n * @deprecated Use .invoke() instead. Will be removed in 0.3.0.\n *\n * Calls the tool with the provided argument and callbacks. It handles\n * string inputs specifically.\n * @param arg The input argument for the tool, which can be a string, undefined, or an input of the tool's schema.\n * @param callbacks Optional callbacks for the tool.\n * @returns A Promise that resolves with a string.\n */\n call<TArg extends string | undefined | z.input<this[\"schema\"]> | ToolCall, TConfig extends ToolRunnableConfig | undefined>(arg: TArg, callbacks?: TConfig): Promise<ToolReturnType<NonNullable<TArg>, TConfig, ToolOutputT>>;\n}\n/**\n * A tool that can be created dynamically from a function, name, and description.\n */\nexport declare class DynamicTool<ToolOutputT = ToolOutputType> extends Tool<ToolOutputT> {\n static lc_name(): string;\n name: string;\n description: string;\n func: DynamicToolInput<ToolOutputT>[\"func\"];\n constructor(fields: DynamicToolInput<ToolOutputT>);\n /**\n * @deprecated Use .invoke() instead. Will be removed in 0.3.0.\n */\n call<TArg extends string | undefined | z.input<this[\"schema\"]> | ToolCall, TConfig extends ToolRunnableConfig | undefined>(arg: TArg, configArg?: TConfig): Promise<ToolReturnType<NonNullable<TArg>, TConfig, ToolOutputT>>;\n /** @ignore */\n _call(input: string, runManager?: CallbackManagerForToolRun, parentConfig?: ToolRunnableConfig): Promise<ToolOutputT>;\n}\n/**\n * A tool that can be created dynamically from a function, name, and\n * description, designed to work with structured data. It extends the\n * StructuredTool class and overrides the _call method to execute the\n * provided function when the tool is called.\n *\n * Schema can be passed as Zod or JSON schema. The tool will not validate\n * input if JSON schema is passed.\n */\nexport declare class DynamicStructuredTool<SchemaT = ToolInputSchemaBase, SchemaOutputT = ToolInputSchemaOutputType<SchemaT>, SchemaInputT = ToolInputSchemaInputType<SchemaT>, ToolOutputT = ToolOutputType> extends StructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT> {\n static lc_name(): string;\n name: string;\n description: string;\n func: DynamicStructuredToolInput<SchemaT, SchemaOutputT, ToolOutputT>[\"func\"];\n schema: SchemaT;\n constructor(fields: DynamicStructuredToolInput<SchemaT, SchemaOutputT, ToolOutputT>);\n /**\n * @deprecated Use .invoke() instead. Will be removed in 0.3.0.\n */\n call<TArg extends StructuredToolCallInput<SchemaT, SchemaInputT>, TConfig extends ToolRunnableConfig | undefined>(arg: TArg, configArg?: TConfig, \n /** @deprecated */\n tags?: string[]): Promise<ToolReturnType<NonNullable<TArg>, TConfig, ToolOutputT>>;\n protected _call(arg: Parameters<DynamicStructuredToolInput<SchemaT, SchemaOutputT>[\"func\"]>[0], runManager?: CallbackManagerForToolRun, parentConfig?: RunnableConfig): Promise<ToolOutputT>;\n}\n/**\n * Abstract base class for toolkits in LangChain. Toolkits are collections\n * of tools that agents can use. Subclasses must implement the `tools`\n * property to provide the specific tools for the toolkit.\n */\nexport declare abstract class BaseToolkit {\n abstract tools: StructuredToolInterface[];\n getTools(): StructuredToolInterface[];\n}\n/**\n * Parameters for the tool function.\n * Schema can be provided as Zod or JSON schema.\n * Both schema types will be validated.\n * @template {ToolInputSchemaBase} RunInput The input schema for the tool.\n */\ninterface ToolWrapperParams<RunInput = ToolInputSchemaBase | undefined> extends ToolParams {\n /**\n * The name of the tool. If using with an LLM, this\n * will be passed as the tool name.\n */\n name: string;\n /**\n * The description of the tool.\n * @default `${fields.name} tool`\n */\n description?: string;\n /**\n * The input schema for the tool. If using an LLM, this\n * will be passed as the tool schema to generate arguments\n * for.\n */\n schema?: RunInput;\n /**\n * The tool response format.\n *\n * If \"content\" then the output of the tool is interpreted as the contents of a\n * ToolMessage. If \"content_and_artifact\" then the output is expected to be a\n * two-tuple corresponding to the (content, artifact) of a ToolMessage.\n *\n * @default \"content\"\n */\n responseFormat?: ResponseFormat;\n /**\n * Whether to return the tool's output directly.\n *\n * Setting this to true means that after the tool is called,\n * an agent should stop looping.\n */\n returnDirect?: boolean;\n}\n/**\n * Creates a new StructuredTool instance with the provided function, name, description, and schema.\n *\n * Schema can be provided as Zod or JSON schema, and both will be validated.\n *\n * @function\n * @template {ToolInputSchemaBase} SchemaT The input schema for the tool.\n * @template {ToolReturnType} ToolOutputT The output type of the tool.\n *\n * @param {RunnableFunc<z.output<SchemaT>, ToolOutputT>} func - The function to invoke when the tool is called.\n * @param {ToolWrapperParams<SchemaT>} fields - An object containing the following properties:\n * @param {string} fields.name The name of the tool.\n * @param {string | undefined} fields.description The description of the tool. Defaults to either the description on the Zod schema, or `${fields.name} tool`.\n * @param {z.AnyZodObject | z.ZodString | undefined} fields.schema The Zod schema defining the input for the tool. If undefined, it will default to a Zod string schema.\n *\n * @returns {DynamicStructuredTool<SchemaT>} A new StructuredTool instance.\n */\nexport declare function tool<SchemaT extends ZodStringV3, ToolOutputT = ToolOutputType>(func: RunnableFunc<InferInteropZodOutput<SchemaT>, ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT>): DynamicTool<ToolOutputT>;\nexport declare function tool<SchemaT extends ZodStringV4, ToolOutputT = ToolOutputType>(func: RunnableFunc<InferInteropZodOutput<SchemaT>, ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT>): DynamicTool<ToolOutputT>;\nexport declare function tool<SchemaT extends ZodObjectV3, SchemaOutputT = InferInteropZodOutput<SchemaT>, SchemaInputT = InferInteropZodInput<SchemaT>, ToolOutputT = ToolOutputType>(func: RunnableFunc<SchemaOutputT, ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>;\nexport declare function tool<SchemaT extends ZodObjectV4, SchemaOutputT = InferInteropZodOutput<SchemaT>, SchemaInputT = InferInteropZodInput<SchemaT>, ToolOutputT = ToolOutputType>(func: RunnableFunc<SchemaOutputT, ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>;\nexport declare function tool<SchemaT extends JSONSchema, SchemaOutputT = ToolInputSchemaOutputType<SchemaT>, SchemaInputT = ToolInputSchemaInputType<SchemaT>, ToolOutputT = ToolOutputType>(func: RunnableFunc<Parameters<DynamicStructuredToolInput<SchemaT>[\"func\"]>[0], ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>;\nexport declare function tool<SchemaT extends InteropZodObject | InteropZodType<string> | JSONSchema = InteropZodObject, SchemaOutputT = ToolInputSchemaOutputType<SchemaT>, SchemaInputT = ToolInputSchemaInputType<SchemaT>, ToolOutputT = ToolOutputType>(func: RunnableFunc<SchemaOutputT, ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT> | DynamicTool<ToolOutputT>;\nexport declare function tool<SchemaT extends ZodStringV3, ToolOutputT = ToolOutputType, TState = unknown, TContext = unknown>(func: (input: InferInteropZodOutput<SchemaT>, runtime: ToolRuntime<TState, TContext>) => ToolOutputT | Promise<ToolOutputT>, fields: ToolWrapperParams<SchemaT>): DynamicTool<ToolOutputT>;\nexport declare function tool<SchemaT extends ZodStringV4, ToolOutputT = ToolOutputType, TState = unknown, TContext = unknown>(func: (input: InferInteropZodOutput<SchemaT>, runtime: ToolRuntime<TState, TContext>) => ToolOutputT | Promise<ToolOutputT>, fields: ToolWrapperParams<SchemaT>): DynamicTool<ToolOutputT>;\nexport declare function tool<SchemaT extends ZodObjectV3, SchemaOutputT = InferInteropZodOutput<SchemaT>, SchemaInputT = InferInteropZodInput<SchemaT>, ToolOutputT = ToolOutputType, TState = unknown, TContext = unknown>(func: (input: SchemaOutputT, runtime: ToolRuntime<TState, TContext>) => ToolOutputT | Promise<ToolOutputT>, fields: ToolWrapperParams<SchemaT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>;\nexport declare function tool<SchemaT extends ZodObjectV4, SchemaOutputT = InferInteropZodOutput<SchemaT>, SchemaInputT = InferInteropZodInput<SchemaT>, ToolOutputT = ToolOutputType, TState = unknown, TContext = unknown>(func: (input: SchemaOutputT, runtime: ToolRuntime<TState, TContext>) => ToolOutputT | Promise<ToolOutputT>, fields: ToolWrapperParams<SchemaT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>;\nexport declare function tool<SchemaT extends JSONSchema, SchemaOutputT = ToolInputSchemaOutputType<SchemaT>, SchemaInputT = ToolInputSchemaInputType<SchemaT>, ToolOutputT = ToolOutputType, TState = unknown, TContext = unknown>(func: (input: Parameters<DynamicStructuredToolInput<SchemaT>[\"func\"]>[0], runtime: ToolRuntime<TState, TContext>) => ToolOutputT | Promise<ToolOutputT>, fields: ToolWrapperParams<SchemaT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>;\nexport type ServerTool = Record<string, unknown>;\nexport type ClientTool = StructuredToolInterface | DynamicTool | RunnableToolLike;\n//# sourceMappingURL=index.d.ts.map"],"mappings":";;;;;;;;;;;;;;;;AAiB+IqB,uBAAjHoB,cAAiHpB,CAAAA,UAAxFH,mBAAwFG,EAAAA,gBAAnDC,yBAAmDD,CAAzBwB,OAAyBxB,CAAAA,EAAAA,eAAAA,wBAAAA,CAAyBwB,OAAzBxB,CAAAA,EAAAA,cAAiDS,cAAjDT,CAAAA,SAAyEnB,aAAzEmB,CAAuFJ,uBAAvFI,CAA+GwB,OAA/GxB,EAAwH0B,YAAxH1B,CAAAA,EAAuI2B,WAAvI3B,GAAqJf,WAArJe,CAAAA,YAA6KI,uBAA7KJ,CAAqMwB,OAArMxB,EAA8M0B,YAA9M1B,EAA4N2B,WAA5N3B,CAAAA,CAAAA;EAAiDS,S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,GAAa5C,uBATgLqB,GAStJa,WATsJb,GASxIvC,gBATwIuC"}
1
+ {"version":3,"file":"index.d.cts","names":["z","CallbackManagerForToolRun","BaseLangChain","RunnableConfig","RunnableFunc","ToolCall","ToolMessage","RunnableToolLike","ToolInputParsingException","InferInteropZodInput","InferInteropZodOutput","InteropZodObject","InteropZodType","ZodStringV3","ZodStringV4","ZodObjectV3","ZodObjectV4","StructuredToolCallInput","ToolInputSchemaBase","ToolReturnType","ResponseFormat","ToolInputSchemaInputType","ToolInputSchemaOutputType","ToolParams","ToolRunnableConfig","StructuredToolInterface","DynamicToolInput","DynamicStructuredToolInput","StringInputToolSchema","ToolInterface","ToolOutputType","ToolRuntime","JSONSchema","BaseDynamicToolInput","ContentAndArtifact","StructuredToolParams","ToolSchemaBase","isLangChainTool","isRunnableToolLike","isStructuredTool","isStructuredToolParams","StructuredTool","TInput","TConfig","TArg","SchemaT","SchemaOutputT","SchemaInputT","ToolOutputT","Record","Promise","Tool","ZodString","ZodOptional","ZodTypeAny","ZodObject","ZodEffects","input","NonNullable","DynamicTool","DynamicStructuredTool","NameT","Parameters","BaseToolkit","ToolWrapperParams","RunInput","tool","TState","TContext","ServerTool","ClientTool"],"sources":["../../src/tools/index.d.ts"],"sourcesContent":["import { z } from \"zod/v3\";\nimport { CallbackManagerForToolRun } from \"../callbacks/manager.js\";\nimport { BaseLangChain } from \"../language_models/base.js\";\nimport { type RunnableConfig } from \"../runnables/config.js\";\nimport type { RunnableFunc } from \"../runnables/base.js\";\nimport { ToolCall, ToolMessage } from \"../messages/tool.js\";\nimport type { RunnableToolLike } from \"../runnables/base.js\";\nimport { ToolInputParsingException } from \"./utils.js\";\nimport { type InferInteropZodInput, type InferInteropZodOutput, type InteropZodObject, type InteropZodType, type ZodStringV3, type ZodStringV4, type ZodObjectV3, type ZodObjectV4 } from \"../utils/types/zod.js\";\nimport type { StructuredToolCallInput, ToolInputSchemaBase, ToolReturnType, ResponseFormat, ToolInputSchemaInputType, ToolInputSchemaOutputType, ToolParams, ToolRunnableConfig, StructuredToolInterface, DynamicToolInput, DynamicStructuredToolInput, StringInputToolSchema, ToolInterface, ToolOutputType, ToolRuntime } from \"./types.js\";\nimport { type JSONSchema } from \"../utils/json_schema.js\";\nexport type { BaseDynamicToolInput, ContentAndArtifact, DynamicToolInput, DynamicStructuredToolInput, ResponseFormat, StructuredToolCallInput, StructuredToolInterface, StructuredToolParams, ToolInterface, ToolParams, ToolReturnType, ToolRunnableConfig, ToolInputSchemaBase as ToolSchemaBase, } from \"./types.js\";\nexport { isLangChainTool, isRunnableToolLike, isStructuredTool, isStructuredToolParams, type ToolRuntime, } from \"./types.js\";\nexport { ToolInputParsingException };\n/**\n * Base class for Tools that accept input of any shape defined by a Zod schema.\n */\nexport declare abstract class StructuredTool<SchemaT = ToolInputSchemaBase, SchemaOutputT = ToolInputSchemaOutputType<SchemaT>, SchemaInputT = ToolInputSchemaInputType<SchemaT>, ToolOutputT = ToolOutputType> extends BaseLangChain<StructuredToolCallInput<SchemaT, SchemaInputT>, ToolOutputT | ToolMessage> implements StructuredToolInterface<SchemaT, SchemaInputT, ToolOutputT> {\n abstract name: string;\n abstract description: string;\n abstract schema: SchemaT;\n /**\n * Optional provider-specific extra fields for the tool.\n *\n * This is used to pass provider-specific configuration that doesn't fit into\n * standard tool fields.\n */\n extras?: Record<string, unknown>;\n /**\n * Whether to return the tool's output directly.\n *\n * Setting this to true means that after the tool is called,\n * an agent should stop looping.\n */\n returnDirect: boolean;\n verboseParsingErrors: boolean;\n get lc_namespace(): string[];\n /**\n * The tool response format.\n *\n * If \"content\" then the output of the tool is interpreted as the contents of a\n * ToolMessage. If \"content_and_artifact\" then the output is expected to be a\n * two-tuple corresponding to the (content, artifact) of a ToolMessage.\n *\n * @default \"content\"\n */\n responseFormat?: ResponseFormat;\n /**\n * Default config object for the tool runnable.\n */\n defaultConfig?: ToolRunnableConfig;\n constructor(fields?: ToolParams);\n protected abstract _call(arg: SchemaOutputT, runManager?: CallbackManagerForToolRun, parentConfig?: ToolRunnableConfig): Promise<ToolOutputT>;\n /**\n * Invokes the tool with the provided input and configuration.\n * @param input The input for the tool.\n * @param config Optional configuration for the tool.\n * @returns A Promise that resolves with the tool's output.\n */\n invoke<TInput extends StructuredToolCallInput<SchemaT, SchemaInputT>, TConfig extends ToolRunnableConfig | undefined>(input: TInput, config?: TConfig): Promise<ToolReturnType<TInput, TConfig, ToolOutputT>>;\n /**\n * @deprecated Use .invoke() instead. Will be removed in 0.3.0.\n *\n * Calls the tool with the provided argument, configuration, and tags. It\n * parses the input according to the schema, handles any errors, and\n * manages callbacks.\n * @param arg The input argument for the tool.\n * @param configArg Optional configuration or callbacks for the tool.\n * @param tags Optional tags for the tool.\n * @returns A Promise that resolves with a string.\n */\n call<TArg extends StructuredToolCallInput<SchemaT, SchemaInputT>, TConfig extends ToolRunnableConfig | undefined>(arg: TArg, configArg?: TConfig, \n /** @deprecated */\n tags?: string[]): Promise<ToolReturnType<TArg, TConfig, ToolOutputT>>;\n}\n/**\n * Base class for Tools that accept input as a string.\n */\nexport declare abstract class Tool<ToolOutputT = ToolOutputType> extends StructuredTool<StringInputToolSchema, ToolInputSchemaOutputType<StringInputToolSchema>, ToolInputSchemaInputType<StringInputToolSchema>, ToolOutputT> implements ToolInterface<StringInputToolSchema, ToolInputSchemaInputType<StringInputToolSchema>, ToolOutputT> {\n schema: z.ZodEffects<z.ZodObject<{\n input: z.ZodOptional<z.ZodString>;\n }, \"strip\", z.ZodTypeAny, {\n input?: string | undefined;\n }, {\n input?: string | undefined;\n }>, string | undefined, {\n input?: string | undefined;\n }>;\n constructor(fields?: ToolParams);\n /**\n * @deprecated Use .invoke() instead. Will be removed in 0.3.0.\n *\n * Calls the tool with the provided argument and callbacks. It handles\n * string inputs specifically.\n * @param arg The input argument for the tool, which can be a string, undefined, or an input of the tool's schema.\n * @param callbacks Optional callbacks for the tool.\n * @returns A Promise that resolves with a string.\n */\n call<TArg extends string | undefined | z.input<this[\"schema\"]> | ToolCall, TConfig extends ToolRunnableConfig | undefined>(arg: TArg, callbacks?: TConfig): Promise<ToolReturnType<NonNullable<TArg>, TConfig, ToolOutputT>>;\n}\n/**\n * A tool that can be created dynamically from a function, name, and description.\n */\nexport declare class DynamicTool<ToolOutputT = ToolOutputType> extends Tool<ToolOutputT> {\n static lc_name(): string;\n name: string;\n description: string;\n func: DynamicToolInput<ToolOutputT>[\"func\"];\n constructor(fields: DynamicToolInput<ToolOutputT>);\n /**\n * @deprecated Use .invoke() instead. Will be removed in 0.3.0.\n */\n call<TArg extends string | undefined | z.input<this[\"schema\"]> | ToolCall, TConfig extends ToolRunnableConfig | undefined>(arg: TArg, configArg?: TConfig): Promise<ToolReturnType<NonNullable<TArg>, TConfig, ToolOutputT>>;\n /** @ignore */\n _call(input: string, runManager?: CallbackManagerForToolRun, parentConfig?: ToolRunnableConfig): Promise<ToolOutputT>;\n}\n/**\n * A tool that can be created dynamically from a function, name, and\n * description, designed to work with structured data. It extends the\n * StructuredTool class and overrides the _call method to execute the\n * provided function when the tool is called.\n *\n * Schema can be passed as Zod or JSON schema. The tool will not validate\n * input if JSON schema is passed.\n *\n * @template NameT The literal type of the tool name (for discriminated union support)\n */\nexport declare class DynamicStructuredTool<SchemaT = ToolInputSchemaBase, SchemaOutputT = ToolInputSchemaOutputType<SchemaT>, SchemaInputT = ToolInputSchemaInputType<SchemaT>, ToolOutputT = ToolOutputType, NameT extends string = string> extends StructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT> {\n static lc_name(): string;\n name: NameT;\n description: string;\n func: DynamicStructuredToolInput<SchemaT, SchemaOutputT, ToolOutputT>[\"func\"];\n schema: SchemaT;\n constructor(fields: DynamicStructuredToolInput<SchemaT, SchemaOutputT, ToolOutputT> & {\n name: NameT;\n });\n /**\n * @deprecated Use .invoke() instead. Will be removed in 0.3.0.\n */\n call<TArg extends StructuredToolCallInput<SchemaT, SchemaInputT>, TConfig extends ToolRunnableConfig | undefined>(arg: TArg, configArg?: TConfig, \n /** @deprecated */\n tags?: string[]): Promise<ToolReturnType<NonNullable<TArg>, TConfig, ToolOutputT>>;\n protected _call(arg: Parameters<DynamicStructuredToolInput<SchemaT, SchemaOutputT>[\"func\"]>[0], runManager?: CallbackManagerForToolRun, parentConfig?: RunnableConfig): Promise<ToolOutputT>;\n}\n/**\n * Abstract base class for toolkits in LangChain. Toolkits are collections\n * of tools that agents can use. Subclasses must implement the `tools`\n * property to provide the specific tools for the toolkit.\n */\nexport declare abstract class BaseToolkit {\n abstract tools: StructuredToolInterface[];\n getTools(): StructuredToolInterface[];\n}\n/**\n * Parameters for the tool function.\n * Schema can be provided as Zod or JSON schema.\n * Both schema types will be validated.\n * @template {ToolInputSchemaBase} RunInput The input schema for the tool.\n * @template {string} NameT The literal name type for discriminated union support.\n */\ninterface ToolWrapperParams<RunInput = ToolInputSchemaBase | undefined, NameT extends string = string> extends ToolParams {\n /**\n * The name of the tool. If using with an LLM, this\n * will be passed as the tool name.\n */\n name: NameT;\n /**\n * The description of the tool.\n * @default `${fields.name} tool`\n */\n description?: string;\n /**\n * The input schema for the tool. If using an LLM, this\n * will be passed as the tool schema to generate arguments\n * for.\n */\n schema?: RunInput;\n /**\n * The tool response format.\n *\n * If \"content\" then the output of the tool is interpreted as the contents of a\n * ToolMessage. If \"content_and_artifact\" then the output is expected to be a\n * two-tuple corresponding to the (content, artifact) of a ToolMessage.\n *\n * @default \"content\"\n */\n responseFormat?: ResponseFormat;\n /**\n * Whether to return the tool's output directly.\n *\n * Setting this to true means that after the tool is called,\n * an agent should stop looping.\n */\n returnDirect?: boolean;\n}\n/**\n * Creates a new StructuredTool instance with the provided function, name, description, and schema.\n *\n * Schema can be provided as Zod or JSON schema, and both will be validated.\n *\n * @function\n * @template {ToolInputSchemaBase} SchemaT The input schema for the tool.\n * @template {ToolReturnType} ToolOutputT The output type of the tool.\n *\n * @param {RunnableFunc<z.output<SchemaT>, ToolOutputT>} func - The function to invoke when the tool is called.\n * @param {ToolWrapperParams<SchemaT>} fields - An object containing the following properties:\n * @param {string} fields.name The name of the tool.\n * @param {string | undefined} fields.description The description of the tool. Defaults to either the description on the Zod schema, or `${fields.name} tool`.\n * @param {z.AnyZodObject | z.ZodString | undefined} fields.schema The Zod schema defining the input for the tool. If undefined, it will default to a Zod string schema.\n *\n * @returns {DynamicStructuredTool<SchemaT>} A new StructuredTool instance.\n */\nexport declare function tool<SchemaT extends ZodStringV3, ToolOutputT = ToolOutputType>(func: RunnableFunc<InferInteropZodOutput<SchemaT>, ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT>): DynamicTool<ToolOutputT>;\nexport declare function tool<SchemaT extends ZodStringV4, ToolOutputT = ToolOutputType>(func: RunnableFunc<InferInteropZodOutput<SchemaT>, ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT>): DynamicTool<ToolOutputT>;\nexport declare function tool<SchemaT extends ZodObjectV3, NameT extends string, SchemaOutputT = InferInteropZodOutput<SchemaT>, SchemaInputT = InferInteropZodInput<SchemaT>, ToolOutputT = ToolOutputType>(func: RunnableFunc<SchemaOutputT, ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT, NameT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT, NameT>;\nexport declare function tool<SchemaT extends ZodObjectV4, NameT extends string, SchemaOutputT = InferInteropZodOutput<SchemaT>, SchemaInputT = InferInteropZodInput<SchemaT>, ToolOutputT = ToolOutputType>(func: RunnableFunc<SchemaOutputT, ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT, NameT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT, NameT>;\nexport declare function tool<SchemaT extends JSONSchema, NameT extends string, SchemaOutputT = ToolInputSchemaOutputType<SchemaT>, SchemaInputT = ToolInputSchemaInputType<SchemaT>, ToolOutputT = ToolOutputType>(func: RunnableFunc<Parameters<DynamicStructuredToolInput<SchemaT>[\"func\"]>[0], ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT, NameT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT, NameT>;\nexport declare function tool<SchemaT extends InteropZodObject | InteropZodType<string> | JSONSchema = InteropZodObject, NameT extends string = string, SchemaOutputT = ToolInputSchemaOutputType<SchemaT>, SchemaInputT = ToolInputSchemaInputType<SchemaT>, ToolOutputT = ToolOutputType>(func: RunnableFunc<SchemaOutputT, ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT, NameT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT, NameT> | DynamicTool<ToolOutputT>;\nexport declare function tool<SchemaT extends ZodStringV3, ToolOutputT = ToolOutputType, TState = unknown, TContext = unknown>(func: (input: InferInteropZodOutput<SchemaT>, runtime: ToolRuntime<TState, TContext>) => ToolOutputT | Promise<ToolOutputT>, fields: ToolWrapperParams<SchemaT>): DynamicTool<ToolOutputT>;\nexport declare function tool<SchemaT extends ZodStringV4, ToolOutputT = ToolOutputType, TState = unknown, TContext = unknown>(func: (input: InferInteropZodOutput<SchemaT>, runtime: ToolRuntime<TState, TContext>) => ToolOutputT | Promise<ToolOutputT>, fields: ToolWrapperParams<SchemaT>): DynamicTool<ToolOutputT>;\nexport declare function tool<SchemaT extends ZodObjectV3, NameT extends string, SchemaOutputT = InferInteropZodOutput<SchemaT>, SchemaInputT = InferInteropZodInput<SchemaT>, ToolOutputT = ToolOutputType, TState = unknown, TContext = unknown>(func: (input: SchemaOutputT, runtime: ToolRuntime<TState, TContext>) => ToolOutputT | Promise<ToolOutputT>, fields: ToolWrapperParams<SchemaT, NameT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT, NameT>;\nexport declare function tool<SchemaT extends ZodObjectV4, NameT extends string, SchemaOutputT = InferInteropZodOutput<SchemaT>, SchemaInputT = InferInteropZodInput<SchemaT>, ToolOutputT = ToolOutputType, TState = unknown, TContext = unknown>(func: (input: SchemaOutputT, runtime: ToolRuntime<TState, TContext>) => ToolOutputT | Promise<ToolOutputT>, fields: ToolWrapperParams<SchemaT, NameT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT, NameT>;\nexport declare function tool<SchemaT extends JSONSchema, NameT extends string, SchemaOutputT = ToolInputSchemaOutputType<SchemaT>, SchemaInputT = ToolInputSchemaInputType<SchemaT>, ToolOutputT = ToolOutputType, TState = unknown, TContext = unknown>(func: (input: Parameters<DynamicStructuredToolInput<SchemaT>[\"func\"]>[0], runtime: ToolRuntime<TState, TContext>) => ToolOutputT | Promise<ToolOutputT>, fields: ToolWrapperParams<SchemaT, NameT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT, NameT>;\nexport type ServerTool = Record<string, unknown>;\nexport type ClientTool = StructuredToolInterface | DynamicTool | RunnableToolLike;\n//# sourceMappingURL=index.d.ts.map"],"mappings":";;;;;;;;;;;;;;;;AAiB+IqB,uBAAjHoB,cAAiHpB,CAAAA,UAAxFH,mBAAwFG,EAAAA,gBAAnDC,yBAAmDD,CAAzBwB,OAAyBxB,CAAAA,EAAAA,eAAAA,wBAAAA,CAAyBwB,OAAzBxB,CAAAA,EAAAA,cAAiDS,cAAjDT,CAAAA,SAAyEnB,aAAzEmB,CAAuFJ,uBAAvFI,CAA+GwB,OAA/GxB,EAAwH0B,YAAxH1B,CAAAA,EAAuI2B,WAAvI3B,GAAqJf,WAArJe,CAAAA,YAA6KI,uBAA7KJ,CAAqMwB,OAArMxB,EAA8M0B,YAA9M1B,EAA4N2B,WAA5N3B,CAAAA,CAAAA;EAAiDS,SAAAA,IAAAA,EAAAA,MAAAA;EAA8De,SAAAA,WAAAA,EAAAA,MAAAA;EAASE,SAAAA,MAAAA,EAGlPF,OAHkPE;EAAjC9B;;;;;;EAGjN4B,MAAAA,CAAAA,EAORI,MAPQJ,CAAAA,MAAAA,EAAAA,OAAAA,CAAAA;EAORI;;;;;;EAyB2FzB,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