@langchain/core 1.0.0-alpha.3 → 1.0.0-alpha.4

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 (486) hide show
  1. package/README.md +3 -19
  2. package/dist/caches/base.cjs +2 -2
  3. package/dist/caches/base.cjs.map +1 -1
  4. package/dist/callbacks/base.d.ts.map +1 -1
  5. package/dist/document_loaders/langsmith.cjs +1 -1
  6. package/dist/document_loaders/langsmith.cjs.map +1 -1
  7. package/dist/document_loaders/langsmith.js +1 -1
  8. package/dist/document_loaders/langsmith.js.map +1 -1
  9. package/dist/embeddings.cjs.map +1 -1
  10. package/dist/embeddings.d.cts +6 -6
  11. package/dist/embeddings.d.cts.map +1 -1
  12. package/dist/embeddings.d.ts +6 -6
  13. package/dist/embeddings.d.ts.map +1 -1
  14. package/dist/embeddings.js.map +1 -1
  15. package/dist/errors/index.cjs.map +1 -1
  16. package/dist/errors/index.js.map +1 -1
  17. package/dist/indexing/base.cjs +2 -2
  18. package/dist/indexing/base.cjs.map +1 -1
  19. package/dist/indexing/base.d.cts +0 -3
  20. package/dist/indexing/base.d.cts.map +1 -1
  21. package/dist/indexing/base.d.ts +0 -3
  22. package/dist/indexing/base.d.ts.map +1 -1
  23. package/dist/indexing/base.js +2 -2
  24. package/dist/indexing/base.js.map +1 -1
  25. package/dist/language_models/base.cjs +1 -1
  26. package/dist/language_models/base.cjs.map +1 -1
  27. package/dist/language_models/base.d.cts +3 -3
  28. package/dist/language_models/base.d.cts.map +1 -1
  29. package/dist/language_models/base.d.ts +3 -3
  30. package/dist/language_models/base.d.ts.map +1 -1
  31. package/dist/language_models/base.js +1 -1
  32. package/dist/language_models/base.js.map +1 -1
  33. package/dist/language_models/chat_models.cjs.map +1 -1
  34. package/dist/language_models/chat_models.d.ts.map +1 -1
  35. package/dist/language_models/chat_models.js.map +1 -1
  36. package/dist/language_models/llms.cjs.map +1 -1
  37. package/dist/language_models/llms.js.map +1 -1
  38. package/dist/load/import_map.cjs +1 -5
  39. package/dist/load/import_map.cjs.map +1 -1
  40. package/dist/load/import_map.js +3 -7
  41. package/dist/load/import_map.js.map +1 -1
  42. package/dist/load/index.cjs.map +1 -1
  43. package/dist/load/index.js.map +1 -1
  44. package/dist/load/serializable.cjs.map +1 -1
  45. package/dist/load/serializable.d.cts +1 -3
  46. package/dist/load/serializable.d.cts.map +1 -1
  47. package/dist/load/serializable.d.ts +1 -3
  48. package/dist/load/serializable.d.ts.map +1 -1
  49. package/dist/load/serializable.js.map +1 -1
  50. package/dist/messages/ai.cjs +2 -2
  51. package/dist/messages/ai.cjs.map +1 -1
  52. package/dist/messages/ai.js +2 -2
  53. package/dist/messages/ai.js.map +1 -1
  54. package/dist/messages/base.cjs +5 -5
  55. package/dist/messages/base.cjs.map +1 -1
  56. package/dist/messages/base.d.cts +1 -2
  57. package/dist/messages/base.d.cts.map +1 -1
  58. package/dist/messages/base.d.ts +1 -2
  59. package/dist/messages/base.d.ts.map +1 -1
  60. package/dist/messages/base.js +5 -5
  61. package/dist/messages/base.js.map +1 -1
  62. package/dist/messages/block_translators/utils.cjs +1 -1
  63. package/dist/messages/block_translators/utils.cjs.map +1 -1
  64. package/dist/messages/block_translators/utils.js +1 -1
  65. package/dist/messages/block_translators/utils.js.map +1 -1
  66. package/dist/messages/index.cjs +1 -1
  67. package/dist/messages/index.js +1 -1
  68. package/dist/messages/modifier.cjs +4 -1
  69. package/dist/messages/modifier.cjs.map +1 -1
  70. package/dist/messages/modifier.js +4 -1
  71. package/dist/messages/modifier.js.map +1 -1
  72. package/dist/messages/tool.cjs +7 -7
  73. package/dist/messages/tool.cjs.map +1 -1
  74. package/dist/messages/tool.js +7 -7
  75. package/dist/messages/tool.js.map +1 -1
  76. package/dist/messages/transformers.cjs +2 -2
  77. package/dist/messages/transformers.cjs.map +1 -1
  78. package/dist/messages/transformers.js +2 -2
  79. package/dist/messages/transformers.js.map +1 -1
  80. package/dist/messages/utils.cjs +5 -0
  81. package/dist/messages/utils.cjs.map +1 -1
  82. package/dist/messages/utils.js +5 -0
  83. package/dist/messages/utils.js.map +1 -1
  84. package/dist/output_parsers/list.cjs +1 -1
  85. package/dist/output_parsers/list.cjs.map +1 -1
  86. package/dist/output_parsers/list.js +1 -1
  87. package/dist/output_parsers/list.js.map +1 -1
  88. package/dist/output_parsers/openai_functions/json_output_functions_parsers.d.cts +1 -1
  89. package/dist/output_parsers/openai_functions/json_output_functions_parsers.d.ts +1 -1
  90. package/dist/output_parsers/openai_tools/json_output_tools_parsers.cjs +1 -1
  91. package/dist/output_parsers/openai_tools/json_output_tools_parsers.cjs.map +1 -1
  92. package/dist/output_parsers/openai_tools/json_output_tools_parsers.js +1 -1
  93. package/dist/output_parsers/openai_tools/json_output_tools_parsers.js.map +1 -1
  94. package/dist/output_parsers/structured.cjs +2 -1
  95. package/dist/output_parsers/structured.cjs.map +1 -1
  96. package/dist/output_parsers/structured.js +2 -1
  97. package/dist/output_parsers/structured.js.map +1 -1
  98. package/dist/prompts/chat.cjs +3 -1
  99. package/dist/prompts/chat.cjs.map +1 -1
  100. package/dist/prompts/chat.d.cts +4 -12
  101. package/dist/prompts/chat.d.cts.map +1 -1
  102. package/dist/prompts/chat.d.ts +4 -12
  103. package/dist/prompts/chat.d.ts.map +1 -1
  104. package/dist/prompts/chat.js +3 -1
  105. package/dist/prompts/chat.js.map +1 -1
  106. package/dist/prompts/image.cjs.map +1 -1
  107. package/dist/prompts/image.d.cts +0 -2
  108. package/dist/prompts/image.d.cts.map +1 -1
  109. package/dist/prompts/image.d.ts +0 -2
  110. package/dist/prompts/image.d.ts.map +1 -1
  111. package/dist/prompts/image.js.map +1 -1
  112. package/dist/prompts/pipeline.cjs.map +1 -1
  113. package/dist/prompts/pipeline.js.map +1 -1
  114. package/dist/prompts/prompt.cjs.map +1 -1
  115. package/dist/prompts/prompt.d.cts +4 -16
  116. package/dist/prompts/prompt.d.cts.map +1 -1
  117. package/dist/prompts/prompt.d.ts +4 -16
  118. package/dist/prompts/prompt.d.ts.map +1 -1
  119. package/dist/prompts/prompt.js.map +1 -1
  120. package/dist/prompts/structured.cjs.map +1 -1
  121. package/dist/prompts/structured.js.map +1 -1
  122. package/dist/prompts/template.cjs +4 -2
  123. package/dist/prompts/template.cjs.map +1 -1
  124. package/dist/prompts/template.js +4 -2
  125. package/dist/prompts/template.js.map +1 -1
  126. package/dist/runnables/base.cjs +6 -6
  127. package/dist/runnables/base.cjs.map +1 -1
  128. package/dist/runnables/base.d.cts +0 -3
  129. package/dist/runnables/base.d.cts.map +1 -1
  130. package/dist/runnables/base.d.ts +0 -3
  131. package/dist/runnables/base.d.ts.map +1 -1
  132. package/dist/runnables/base.js +6 -6
  133. package/dist/runnables/base.js.map +1 -1
  134. package/dist/runnables/branch.cjs +2 -2
  135. package/dist/runnables/branch.cjs.map +1 -1
  136. package/dist/runnables/branch.js +2 -2
  137. package/dist/runnables/branch.js.map +1 -1
  138. package/dist/runnables/config.cjs.map +1 -1
  139. package/dist/runnables/config.js.map +1 -1
  140. package/dist/runnables/graph.cjs +1 -1
  141. package/dist/runnables/graph.cjs.map +1 -1
  142. package/dist/runnables/graph.js +1 -1
  143. package/dist/runnables/graph.js.map +1 -1
  144. package/dist/runnables/graph_mermaid.cjs +26 -3
  145. package/dist/runnables/graph_mermaid.cjs.map +1 -1
  146. package/dist/runnables/graph_mermaid.js +26 -3
  147. package/dist/runnables/graph_mermaid.js.map +1 -1
  148. package/dist/runnables/remote.cjs.map +1 -1
  149. package/dist/runnables/remote.js.map +1 -1
  150. package/dist/runnables/types.d.cts +0 -1
  151. package/dist/runnables/types.d.cts.map +1 -1
  152. package/dist/runnables/types.d.ts +0 -1
  153. package/dist/runnables/types.d.ts.map +1 -1
  154. package/dist/singletons/async_local_storage/context.cjs.map +1 -1
  155. package/dist/singletons/async_local_storage/context.d.cts +0 -1
  156. package/dist/singletons/async_local_storage/context.d.cts.map +1 -1
  157. package/dist/singletons/async_local_storage/context.d.ts +0 -1
  158. package/dist/singletons/async_local_storage/context.d.ts.map +1 -1
  159. package/dist/singletons/async_local_storage/context.js.map +1 -1
  160. package/dist/singletons/callbacks.cjs.map +1 -1
  161. package/dist/singletons/callbacks.js.map +1 -1
  162. package/dist/tools/index.cjs.map +1 -1
  163. package/dist/tools/index.d.cts +2 -2
  164. package/dist/tools/index.d.cts.map +1 -1
  165. package/dist/tools/index.d.ts +2 -2
  166. package/dist/tools/index.d.ts.map +1 -1
  167. package/dist/tools/index.js.map +1 -1
  168. package/dist/tools/types.d.cts +5 -5
  169. package/dist/tools/types.d.cts.map +1 -1
  170. package/dist/tools/types.d.ts +5 -5
  171. package/dist/tools/types.d.ts.map +1 -1
  172. package/dist/tracers/base.cjs.map +1 -1
  173. package/dist/tracers/base.js.map +1 -1
  174. package/dist/tracers/console.cjs +1 -1
  175. package/dist/tracers/console.cjs.map +1 -1
  176. package/dist/tracers/console.js +1 -1
  177. package/dist/tracers/console.js.map +1 -1
  178. package/dist/tracers/event_stream.cjs +1 -1
  179. package/dist/tracers/event_stream.cjs.map +1 -1
  180. package/dist/tracers/event_stream.d.cts +0 -1
  181. package/dist/tracers/event_stream.d.cts.map +1 -1
  182. package/dist/tracers/event_stream.d.ts +0 -1
  183. package/dist/tracers/event_stream.d.ts.map +1 -1
  184. package/dist/tracers/event_stream.js +1 -1
  185. package/dist/tracers/event_stream.js.map +1 -1
  186. package/dist/tracers/log_stream.cjs.map +1 -1
  187. package/dist/tracers/log_stream.js.map +1 -1
  188. package/dist/tracers/tracer_langchain.cjs.map +1 -1
  189. package/dist/tracers/tracer_langchain.js.map +1 -1
  190. package/dist/utils/chunk_array.cjs.map +1 -1
  191. package/dist/utils/chunk_array.js.map +1 -1
  192. package/dist/utils/env.cjs +1 -1
  193. package/dist/utils/env.cjs.map +1 -1
  194. package/dist/utils/env.js +1 -1
  195. package/dist/utils/env.js.map +1 -1
  196. package/dist/utils/event_source_parse.cjs.map +1 -1
  197. package/dist/utils/event_source_parse.d.cts.map +1 -1
  198. package/dist/utils/event_source_parse.d.ts.map +1 -1
  199. package/dist/utils/event_source_parse.js.map +1 -1
  200. package/dist/utils/hash.cjs +3 -8
  201. package/dist/utils/hash.cjs.map +1 -1
  202. package/dist/utils/hash.d.cts +1 -2
  203. package/dist/utils/hash.d.cts.map +1 -1
  204. package/dist/utils/hash.d.ts +1 -2
  205. package/dist/utils/hash.d.ts.map +1 -1
  206. package/dist/utils/hash.js +2 -6
  207. package/dist/utils/hash.js.map +1 -1
  208. package/dist/utils/js-sha256/hash.cjs +0 -9
  209. package/dist/utils/js-sha256/hash.cjs.map +1 -1
  210. package/dist/utils/js-sha256/hash.js +1 -5
  211. package/dist/utils/js-sha256/hash.js.map +1 -1
  212. package/dist/utils/json.cjs +2 -2
  213. package/dist/utils/json.cjs.map +1 -1
  214. package/dist/utils/json.js +2 -2
  215. package/dist/utils/json.js.map +1 -1
  216. package/dist/utils/json_schema.cjs +3 -2
  217. package/dist/utils/json_schema.cjs.map +1 -1
  218. package/dist/utils/json_schema.d.cts +8 -4
  219. package/dist/utils/json_schema.d.cts.map +1 -1
  220. package/dist/utils/json_schema.d.ts +8 -4
  221. package/dist/utils/json_schema.d.ts.map +1 -1
  222. package/dist/utils/json_schema.js +2 -1
  223. package/dist/utils/json_schema.js.map +1 -1
  224. package/dist/utils/stream.cjs.map +1 -1
  225. package/dist/utils/stream.js.map +1 -1
  226. package/dist/utils/testing/index.cjs.map +1 -1
  227. package/dist/utils/testing/index.d.cts +4 -9
  228. package/dist/utils/testing/index.d.cts.map +1 -1
  229. package/dist/utils/testing/index.d.ts +4 -9
  230. package/dist/utils/testing/index.d.ts.map +1 -1
  231. package/dist/utils/testing/index.js.map +1 -1
  232. package/dist/utils/zod-to-json-schema/Options.cjs +40 -0
  233. package/dist/utils/zod-to-json-schema/Options.cjs.map +1 -0
  234. package/dist/utils/zod-to-json-schema/Options.js +37 -0
  235. package/dist/utils/zod-to-json-schema/Options.js.map +1 -0
  236. package/dist/utils/zod-to-json-schema/Refs.cjs +30 -0
  237. package/dist/utils/zod-to-json-schema/Refs.cjs.map +1 -0
  238. package/dist/utils/zod-to-json-schema/Refs.js +30 -0
  239. package/dist/utils/zod-to-json-schema/Refs.js.map +1 -0
  240. package/dist/utils/zod-to-json-schema/errorMessages.cjs +18 -0
  241. package/dist/utils/zod-to-json-schema/errorMessages.cjs.map +1 -0
  242. package/dist/utils/zod-to-json-schema/errorMessages.d.cts +11 -0
  243. package/dist/utils/zod-to-json-schema/errorMessages.d.cts.map +1 -0
  244. package/dist/utils/zod-to-json-schema/errorMessages.d.ts +11 -0
  245. package/dist/utils/zod-to-json-schema/errorMessages.d.ts.map +1 -0
  246. package/dist/utils/zod-to-json-schema/errorMessages.js +16 -0
  247. package/dist/utils/zod-to-json-schema/errorMessages.js.map +1 -0
  248. package/dist/utils/zod-to-json-schema/getRelativePath.cjs +11 -0
  249. package/dist/utils/zod-to-json-schema/getRelativePath.cjs.map +1 -0
  250. package/dist/utils/zod-to-json-schema/getRelativePath.js +10 -0
  251. package/dist/utils/zod-to-json-schema/getRelativePath.js.map +1 -0
  252. package/dist/utils/zod-to-json-schema/index.cjs +37 -0
  253. package/dist/utils/zod-to-json-schema/index.js +37 -0
  254. package/dist/utils/zod-to-json-schema/parseDef.cjs +57 -0
  255. package/dist/utils/zod-to-json-schema/parseDef.cjs.map +1 -0
  256. package/dist/utils/zod-to-json-schema/parseDef.js +57 -0
  257. package/dist/utils/zod-to-json-schema/parseDef.js.map +1 -0
  258. package/dist/utils/zod-to-json-schema/parseTypes.d.cts +38 -0
  259. package/dist/utils/zod-to-json-schema/parseTypes.d.cts.map +1 -0
  260. package/dist/utils/zod-to-json-schema/parseTypes.d.ts +38 -0
  261. package/dist/utils/zod-to-json-schema/parseTypes.d.ts.map +1 -0
  262. package/dist/utils/zod-to-json-schema/parsers/any.cjs +17 -0
  263. package/dist/utils/zod-to-json-schema/parsers/any.cjs.map +1 -0
  264. package/dist/utils/zod-to-json-schema/parsers/any.d.cts +7 -0
  265. package/dist/utils/zod-to-json-schema/parsers/any.d.cts.map +1 -0
  266. package/dist/utils/zod-to-json-schema/parsers/any.d.ts +7 -0
  267. package/dist/utils/zod-to-json-schema/parsers/any.d.ts.map +1 -0
  268. package/dist/utils/zod-to-json-schema/parsers/any.js +17 -0
  269. package/dist/utils/zod-to-json-schema/parsers/any.js.map +1 -0
  270. package/dist/utils/zod-to-json-schema/parsers/array.cjs +24 -0
  271. package/dist/utils/zod-to-json-schema/parsers/array.cjs.map +1 -0
  272. package/dist/utils/zod-to-json-schema/parsers/array.d.cts +14 -0
  273. package/dist/utils/zod-to-json-schema/parsers/array.d.cts.map +1 -0
  274. package/dist/utils/zod-to-json-schema/parsers/array.d.ts +15 -0
  275. package/dist/utils/zod-to-json-schema/parsers/array.d.ts.map +1 -0
  276. package/dist/utils/zod-to-json-schema/parsers/array.js +23 -0
  277. package/dist/utils/zod-to-json-schema/parsers/array.js.map +1 -0
  278. package/dist/utils/zod-to-json-schema/parsers/bigint.cjs +36 -0
  279. package/dist/utils/zod-to-json-schema/parsers/bigint.cjs.map +1 -0
  280. package/dist/utils/zod-to-json-schema/parsers/bigint.d.cts +16 -0
  281. package/dist/utils/zod-to-json-schema/parsers/bigint.d.cts.map +1 -0
  282. package/dist/utils/zod-to-json-schema/parsers/bigint.d.ts +17 -0
  283. package/dist/utils/zod-to-json-schema/parsers/bigint.d.ts.map +1 -0
  284. package/dist/utils/zod-to-json-schema/parsers/bigint.js +36 -0
  285. package/dist/utils/zod-to-json-schema/parsers/bigint.js.map +1 -0
  286. package/dist/utils/zod-to-json-schema/parsers/boolean.cjs +9 -0
  287. package/dist/utils/zod-to-json-schema/parsers/boolean.cjs.map +1 -0
  288. package/dist/utils/zod-to-json-schema/parsers/boolean.d.cts +7 -0
  289. package/dist/utils/zod-to-json-schema/parsers/boolean.d.cts.map +1 -0
  290. package/dist/utils/zod-to-json-schema/parsers/boolean.d.ts +7 -0
  291. package/dist/utils/zod-to-json-schema/parsers/boolean.d.ts.map +1 -0
  292. package/dist/utils/zod-to-json-schema/parsers/boolean.js +8 -0
  293. package/dist/utils/zod-to-json-schema/parsers/boolean.js.map +1 -0
  294. package/dist/utils/zod-to-json-schema/parsers/branded.cjs +10 -0
  295. package/dist/utils/zod-to-json-schema/parsers/branded.cjs.map +1 -0
  296. package/dist/utils/zod-to-json-schema/parsers/branded.js +10 -0
  297. package/dist/utils/zod-to-json-schema/parsers/branded.js.map +1 -0
  298. package/dist/utils/zod-to-json-schema/parsers/catch.cjs +10 -0
  299. package/dist/utils/zod-to-json-schema/parsers/catch.cjs.map +1 -0
  300. package/dist/utils/zod-to-json-schema/parsers/catch.js +10 -0
  301. package/dist/utils/zod-to-json-schema/parsers/catch.js.map +1 -0
  302. package/dist/utils/zod-to-json-schema/parsers/date.cjs +39 -0
  303. package/dist/utils/zod-to-json-schema/parsers/date.cjs.map +1 -0
  304. package/dist/utils/zod-to-json-schema/parsers/date.d.cts +17 -0
  305. package/dist/utils/zod-to-json-schema/parsers/date.d.cts.map +1 -0
  306. package/dist/utils/zod-to-json-schema/parsers/date.d.ts +17 -0
  307. package/dist/utils/zod-to-json-schema/parsers/date.d.ts.map +1 -0
  308. package/dist/utils/zod-to-json-schema/parsers/date.js +39 -0
  309. package/dist/utils/zod-to-json-schema/parsers/date.js.map +1 -0
  310. package/dist/utils/zod-to-json-schema/parsers/default.cjs +13 -0
  311. package/dist/utils/zod-to-json-schema/parsers/default.cjs.map +1 -0
  312. package/dist/utils/zod-to-json-schema/parsers/default.js +13 -0
  313. package/dist/utils/zod-to-json-schema/parsers/default.js.map +1 -0
  314. package/dist/utils/zod-to-json-schema/parsers/effects.cjs +11 -0
  315. package/dist/utils/zod-to-json-schema/parsers/effects.cjs.map +1 -0
  316. package/dist/utils/zod-to-json-schema/parsers/effects.js +11 -0
  317. package/dist/utils/zod-to-json-schema/parsers/effects.js.map +1 -0
  318. package/dist/utils/zod-to-json-schema/parsers/enum.cjs +12 -0
  319. package/dist/utils/zod-to-json-schema/parsers/enum.cjs.map +1 -0
  320. package/dist/utils/zod-to-json-schema/parsers/enum.d.cts +8 -0
  321. package/dist/utils/zod-to-json-schema/parsers/enum.d.cts.map +1 -0
  322. package/dist/utils/zod-to-json-schema/parsers/enum.d.ts +10 -0
  323. package/dist/utils/zod-to-json-schema/parsers/enum.d.ts.map +1 -0
  324. package/dist/utils/zod-to-json-schema/parsers/enum.js +11 -0
  325. package/dist/utils/zod-to-json-schema/parsers/enum.js.map +1 -0
  326. package/dist/utils/zod-to-json-schema/parsers/intersection.cjs +47 -0
  327. package/dist/utils/zod-to-json-schema/parsers/intersection.cjs.map +1 -0
  328. package/dist/utils/zod-to-json-schema/parsers/intersection.d.cts +10 -0
  329. package/dist/utils/zod-to-json-schema/parsers/intersection.d.cts.map +1 -0
  330. package/dist/utils/zod-to-json-schema/parsers/intersection.d.ts +11 -0
  331. package/dist/utils/zod-to-json-schema/parsers/intersection.d.ts.map +1 -0
  332. package/dist/utils/zod-to-json-schema/parsers/intersection.js +47 -0
  333. package/dist/utils/zod-to-json-schema/parsers/intersection.js.map +1 -0
  334. package/dist/utils/zod-to-json-schema/parsers/literal.cjs +18 -0
  335. package/dist/utils/zod-to-json-schema/parsers/literal.cjs.map +1 -0
  336. package/dist/utils/zod-to-json-schema/parsers/literal.d.cts +11 -0
  337. package/dist/utils/zod-to-json-schema/parsers/literal.d.cts.map +1 -0
  338. package/dist/utils/zod-to-json-schema/parsers/literal.d.ts +12 -0
  339. package/dist/utils/zod-to-json-schema/parsers/literal.d.ts.map +1 -0
  340. package/dist/utils/zod-to-json-schema/parsers/literal.js +17 -0
  341. package/dist/utils/zod-to-json-schema/parsers/literal.js.map +1 -0
  342. package/dist/utils/zod-to-json-schema/parsers/map.cjs +40 -0
  343. package/dist/utils/zod-to-json-schema/parsers/map.cjs.map +1 -0
  344. package/dist/utils/zod-to-json-schema/parsers/map.d.cts +17 -0
  345. package/dist/utils/zod-to-json-schema/parsers/map.d.cts.map +1 -0
  346. package/dist/utils/zod-to-json-schema/parsers/map.d.ts +17 -0
  347. package/dist/utils/zod-to-json-schema/parsers/map.d.ts.map +1 -0
  348. package/dist/utils/zod-to-json-schema/parsers/map.js +40 -0
  349. package/dist/utils/zod-to-json-schema/parsers/map.js.map +1 -0
  350. package/dist/utils/zod-to-json-schema/parsers/nativeEnum.cjs +18 -0
  351. package/dist/utils/zod-to-json-schema/parsers/nativeEnum.cjs.map +1 -0
  352. package/dist/utils/zod-to-json-schema/parsers/nativeEnum.d.cts +8 -0
  353. package/dist/utils/zod-to-json-schema/parsers/nativeEnum.d.cts.map +1 -0
  354. package/dist/utils/zod-to-json-schema/parsers/nativeEnum.d.ts +10 -0
  355. package/dist/utils/zod-to-json-schema/parsers/nativeEnum.d.ts.map +1 -0
  356. package/dist/utils/zod-to-json-schema/parsers/nativeEnum.js +17 -0
  357. package/dist/utils/zod-to-json-schema/parsers/nativeEnum.js.map +1 -0
  358. package/dist/utils/zod-to-json-schema/parsers/never.cjs +13 -0
  359. package/dist/utils/zod-to-json-schema/parsers/never.cjs.map +1 -0
  360. package/dist/utils/zod-to-json-schema/parsers/never.d.cts +9 -0
  361. package/dist/utils/zod-to-json-schema/parsers/never.d.cts.map +1 -0
  362. package/dist/utils/zod-to-json-schema/parsers/never.d.ts +9 -0
  363. package/dist/utils/zod-to-json-schema/parsers/never.d.ts.map +1 -0
  364. package/dist/utils/zod-to-json-schema/parsers/never.js +13 -0
  365. package/dist/utils/zod-to-json-schema/parsers/never.js.map +1 -0
  366. package/dist/utils/zod-to-json-schema/parsers/null.cjs +12 -0
  367. package/dist/utils/zod-to-json-schema/parsers/null.cjs.map +1 -0
  368. package/dist/utils/zod-to-json-schema/parsers/null.d.cts +7 -0
  369. package/dist/utils/zod-to-json-schema/parsers/null.d.cts.map +1 -0
  370. package/dist/utils/zod-to-json-schema/parsers/null.d.ts +7 -0
  371. package/dist/utils/zod-to-json-schema/parsers/null.d.ts.map +1 -0
  372. package/dist/utils/zod-to-json-schema/parsers/null.js +11 -0
  373. package/dist/utils/zod-to-json-schema/parsers/null.js.map +1 -0
  374. package/dist/utils/zod-to-json-schema/parsers/nullable.cjs +46 -0
  375. package/dist/utils/zod-to-json-schema/parsers/nullable.cjs.map +1 -0
  376. package/dist/utils/zod-to-json-schema/parsers/nullable.d.cts +12 -0
  377. package/dist/utils/zod-to-json-schema/parsers/nullable.d.cts.map +1 -0
  378. package/dist/utils/zod-to-json-schema/parsers/nullable.d.ts +13 -0
  379. package/dist/utils/zod-to-json-schema/parsers/nullable.d.ts.map +1 -0
  380. package/dist/utils/zod-to-json-schema/parsers/nullable.js +46 -0
  381. package/dist/utils/zod-to-json-schema/parsers/nullable.js.map +1 -0
  382. package/dist/utils/zod-to-json-schema/parsers/number.cjs +37 -0
  383. package/dist/utils/zod-to-json-schema/parsers/number.cjs.map +1 -0
  384. package/dist/utils/zod-to-json-schema/parsers/number.d.cts +15 -0
  385. package/dist/utils/zod-to-json-schema/parsers/number.d.cts.map +1 -0
  386. package/dist/utils/zod-to-json-schema/parsers/number.d.ts +16 -0
  387. package/dist/utils/zod-to-json-schema/parsers/number.d.ts.map +1 -0
  388. package/dist/utils/zod-to-json-schema/parsers/number.js +37 -0
  389. package/dist/utils/zod-to-json-schema/parsers/number.js.map +1 -0
  390. package/dist/utils/zod-to-json-schema/parsers/object.cjs +64 -0
  391. package/dist/utils/zod-to-json-schema/parsers/object.cjs.map +1 -0
  392. package/dist/utils/zod-to-json-schema/parsers/object.d.cts +12 -0
  393. package/dist/utils/zod-to-json-schema/parsers/object.d.cts.map +1 -0
  394. package/dist/utils/zod-to-json-schema/parsers/object.d.ts +13 -0
  395. package/dist/utils/zod-to-json-schema/parsers/object.d.ts.map +1 -0
  396. package/dist/utils/zod-to-json-schema/parsers/object.js +64 -0
  397. package/dist/utils/zod-to-json-schema/parsers/object.js.map +1 -0
  398. package/dist/utils/zod-to-json-schema/parsers/optional.cjs +20 -0
  399. package/dist/utils/zod-to-json-schema/parsers/optional.cjs.map +1 -0
  400. package/dist/utils/zod-to-json-schema/parsers/optional.js +20 -0
  401. package/dist/utils/zod-to-json-schema/parsers/optional.js.map +1 -0
  402. package/dist/utils/zod-to-json-schema/parsers/pipeline.cjs +28 -0
  403. package/dist/utils/zod-to-json-schema/parsers/pipeline.cjs.map +1 -0
  404. package/dist/utils/zod-to-json-schema/parsers/pipeline.js +28 -0
  405. package/dist/utils/zod-to-json-schema/parsers/pipeline.js.map +1 -0
  406. package/dist/utils/zod-to-json-schema/parsers/promise.cjs +10 -0
  407. package/dist/utils/zod-to-json-schema/parsers/promise.cjs.map +1 -0
  408. package/dist/utils/zod-to-json-schema/parsers/promise.js +10 -0
  409. package/dist/utils/zod-to-json-schema/parsers/promise.js.map +1 -0
  410. package/dist/utils/zod-to-json-schema/parsers/readonly.cjs +10 -0
  411. package/dist/utils/zod-to-json-schema/parsers/readonly.cjs.map +1 -0
  412. package/dist/utils/zod-to-json-schema/parsers/readonly.js +10 -0
  413. package/dist/utils/zod-to-json-schema/parsers/readonly.js.map +1 -0
  414. package/dist/utils/zod-to-json-schema/parsers/record.cjs +57 -0
  415. package/dist/utils/zod-to-json-schema/parsers/record.cjs.map +1 -0
  416. package/dist/utils/zod-to-json-schema/parsers/record.d.cts +14 -0
  417. package/dist/utils/zod-to-json-schema/parsers/record.d.cts.map +1 -0
  418. package/dist/utils/zod-to-json-schema/parsers/record.d.ts +15 -0
  419. package/dist/utils/zod-to-json-schema/parsers/record.d.ts.map +1 -0
  420. package/dist/utils/zod-to-json-schema/parsers/record.js +56 -0
  421. package/dist/utils/zod-to-json-schema/parsers/record.js.map +1 -0
  422. package/dist/utils/zod-to-json-schema/parsers/set.cjs +22 -0
  423. package/dist/utils/zod-to-json-schema/parsers/set.cjs.map +1 -0
  424. package/dist/utils/zod-to-json-schema/parsers/set.d.cts +15 -0
  425. package/dist/utils/zod-to-json-schema/parsers/set.d.cts.map +1 -0
  426. package/dist/utils/zod-to-json-schema/parsers/set.d.ts +16 -0
  427. package/dist/utils/zod-to-json-schema/parsers/set.d.ts.map +1 -0
  428. package/dist/utils/zod-to-json-schema/parsers/set.js +22 -0
  429. package/dist/utils/zod-to-json-schema/parsers/set.js.map +1 -0
  430. package/dist/utils/zod-to-json-schema/parsers/string.cjs +255 -0
  431. package/dist/utils/zod-to-json-schema/parsers/string.cjs.map +1 -0
  432. package/dist/utils/zod-to-json-schema/parsers/string.d.cts +28 -0
  433. package/dist/utils/zod-to-json-schema/parsers/string.d.cts.map +1 -0
  434. package/dist/utils/zod-to-json-schema/parsers/string.d.ts +29 -0
  435. package/dist/utils/zod-to-json-schema/parsers/string.d.ts.map +1 -0
  436. package/dist/utils/zod-to-json-schema/parsers/string.js +254 -0
  437. package/dist/utils/zod-to-json-schema/parsers/string.js.map +1 -0
  438. package/dist/utils/zod-to-json-schema/parsers/tuple.cjs +38 -0
  439. package/dist/utils/zod-to-json-schema/parsers/tuple.cjs.map +1 -0
  440. package/dist/utils/zod-to-json-schema/parsers/tuple.d.cts +15 -0
  441. package/dist/utils/zod-to-json-schema/parsers/tuple.d.cts.map +1 -0
  442. package/dist/utils/zod-to-json-schema/parsers/tuple.d.ts +16 -0
  443. package/dist/utils/zod-to-json-schema/parsers/tuple.d.ts.map +1 -0
  444. package/dist/utils/zod-to-json-schema/parsers/tuple.js +38 -0
  445. package/dist/utils/zod-to-json-schema/parsers/tuple.js.map +1 -0
  446. package/dist/utils/zod-to-json-schema/parsers/undefined.cjs +10 -0
  447. package/dist/utils/zod-to-json-schema/parsers/undefined.cjs.map +1 -0
  448. package/dist/utils/zod-to-json-schema/parsers/undefined.d.cts +9 -0
  449. package/dist/utils/zod-to-json-schema/parsers/undefined.d.cts.map +1 -0
  450. package/dist/utils/zod-to-json-schema/parsers/undefined.d.ts +9 -0
  451. package/dist/utils/zod-to-json-schema/parsers/undefined.d.ts.map +1 -0
  452. package/dist/utils/zod-to-json-schema/parsers/undefined.js +10 -0
  453. package/dist/utils/zod-to-json-schema/parsers/undefined.js.map +1 -0
  454. package/dist/utils/zod-to-json-schema/parsers/union.cjs +67 -0
  455. package/dist/utils/zod-to-json-schema/parsers/union.cjs.map +1 -0
  456. package/dist/utils/zod-to-json-schema/parsers/union.d.cts +24 -0
  457. package/dist/utils/zod-to-json-schema/parsers/union.d.cts.map +1 -0
  458. package/dist/utils/zod-to-json-schema/parsers/union.d.ts +25 -0
  459. package/dist/utils/zod-to-json-schema/parsers/union.d.ts.map +1 -0
  460. package/dist/utils/zod-to-json-schema/parsers/union.js +66 -0
  461. package/dist/utils/zod-to-json-schema/parsers/union.js.map +1 -0
  462. package/dist/utils/zod-to-json-schema/parsers/unknown.cjs +10 -0
  463. package/dist/utils/zod-to-json-schema/parsers/unknown.cjs.map +1 -0
  464. package/dist/utils/zod-to-json-schema/parsers/unknown.d.cts +7 -0
  465. package/dist/utils/zod-to-json-schema/parsers/unknown.d.cts.map +1 -0
  466. package/dist/utils/zod-to-json-schema/parsers/unknown.d.ts +7 -0
  467. package/dist/utils/zod-to-json-schema/parsers/unknown.d.ts.map +1 -0
  468. package/dist/utils/zod-to-json-schema/parsers/unknown.js +10 -0
  469. package/dist/utils/zod-to-json-schema/parsers/unknown.js.map +1 -0
  470. package/dist/utils/zod-to-json-schema/selectParser.cjs +81 -0
  471. package/dist/utils/zod-to-json-schema/selectParser.cjs.map +1 -0
  472. package/dist/utils/zod-to-json-schema/selectParser.js +80 -0
  473. package/dist/utils/zod-to-json-schema/selectParser.js.map +1 -0
  474. package/dist/utils/zod-to-json-schema/zodToJsonSchema.cjs +70 -0
  475. package/dist/utils/zod-to-json-schema/zodToJsonSchema.cjs.map +1 -0
  476. package/dist/utils/zod-to-json-schema/zodToJsonSchema.js +70 -0
  477. package/dist/utils/zod-to-json-schema/zodToJsonSchema.js.map +1 -0
  478. package/package.json +7 -36
  479. package/dist/utils/js-sha1/hash.cjs +0 -291
  480. package/dist/utils/js-sha1/hash.cjs.map +0 -1
  481. package/dist/utils/js-sha1/hash.d.cts +0 -9
  482. package/dist/utils/js-sha1/hash.d.cts.map +0 -1
  483. package/dist/utils/js-sha1/hash.d.ts +0 -9
  484. package/dist/utils/js-sha1/hash.d.ts.map +0 -1
  485. package/dist/utils/js-sha1/hash.js +0 -284
  486. package/dist/utils/js-sha1/hash.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","names":["BaseCallbackHandler","setContextVariable","PropertyKey","T","getContextVariable","_getConfigureHooks","ConfigureHook","registerConfigureHook"],"sources":["../../../src/singletons/async_local_storage/context.d.ts"],"sourcesContent":["import { BaseCallbackHandler } from \"../../callbacks/base.js\";\n/**\n * Set a context variable. Context variables are scoped to any\n * child runnables called by the current runnable, or globally if set outside\n * of any runnable.\n *\n * @remarks\n * This function is only supported in environments that support AsyncLocalStorage,\n * including Node.js, Deno, and Cloudflare Workers.\n *\n * @example\n * ```ts\n * import { RunnableLambda } from \"@langchain/core/runnables\";\n * import {\n * getContextVariable,\n * setContextVariable\n * } from \"@langchain/core/context\";\n *\n * const nested = RunnableLambda.from(() => {\n * // \"bar\" because it was set by a parent\n * console.log(getContextVariable(\"foo\"));\n *\n * // Override to \"baz\", but only for child runnables\n * setContextVariable(\"foo\", \"baz\");\n *\n * // Now \"baz\", but only for child runnables\n * return getContextVariable(\"foo\");\n * });\n *\n * const runnable = RunnableLambda.from(async () => {\n * // Set a context variable named \"foo\"\n * setContextVariable(\"foo\", \"bar\");\n *\n * const res = await nested.invoke({});\n *\n * // Still \"bar\" since child changes do not affect parents\n * console.log(getContextVariable(\"foo\"));\n *\n * return res;\n * });\n *\n * // undefined, because context variable has not been set yet\n * console.log(getContextVariable(\"foo\"));\n *\n * // Final return value is \"baz\"\n * const result = await runnable.invoke({});\n * ```\n *\n * @param name The name of the context variable.\n * @param value The value to set.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport declare function setContextVariable<T>(name: PropertyKey, value: T): void;\n/**\n * Get the value of a previously set context variable. Context variables\n * are scoped to any child runnables called by the current runnable,\n * or globally if set outside of any runnable.\n *\n * @remarks\n * This function is only supported in environments that support AsyncLocalStorage,\n * including Node.js, Deno, and Cloudflare Workers.\n *\n * @example\n * ```ts\n * import { RunnableLambda } from \"@langchain/core/runnables\";\n * import {\n * getContextVariable,\n * setContextVariable\n * } from \"@langchain/core/context\";\n *\n * const nested = RunnableLambda.from(() => {\n * // \"bar\" because it was set by a parent\n * console.log(getContextVariable(\"foo\"));\n *\n * // Override to \"baz\", but only for child runnables\n * setContextVariable(\"foo\", \"baz\");\n *\n * // Now \"baz\", but only for child runnables\n * return getContextVariable(\"foo\");\n * });\n *\n * const runnable = RunnableLambda.from(async () => {\n * // Set a context variable named \"foo\"\n * setContextVariable(\"foo\", \"bar\");\n *\n * const res = await nested.invoke({});\n *\n * // Still \"bar\" since child changes do not affect parents\n * console.log(getContextVariable(\"foo\"));\n *\n * return res;\n * });\n *\n * // undefined, because context variable has not been set yet\n * console.log(getContextVariable(\"foo\"));\n *\n * // Final return value is \"baz\"\n * const result = await runnable.invoke({});\n * ```\n *\n * @param name The name of the context variable.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport declare function getContextVariable<T = any>(name: PropertyKey): T | undefined;\nexport declare const _getConfigureHooks: () => ConfigureHook[];\n/**\n * Register a callback configure hook to automatically add callback handlers to all runs.\n *\n * There are two ways to use this:\n *\n * 1. Using a context variable:\n * - Set `contextVar` to specify the variable name\n * - Use `setContextVariable()` to store your handler instance\n *\n * 2. Using an environment variable:\n * - Set both `envVar` and `handlerClass`\n * - The handler will be instantiated when the env var is set to \"true\".\n *\n * @example\n * ```typescript\n * // Method 1: Using context variable\n * import {\n * registerConfigureHook,\n * setContextVariable\n * } from \"@langchain/core/context\";\n *\n * const tracer = new MyCallbackHandler();\n * registerConfigureHook({\n * contextVar: \"my_tracer\",\n * });\n * setContextVariable(\"my_tracer\", tracer);\n *\n * // ...run code here\n *\n * // Method 2: Using environment variable\n * registerConfigureHook({\n * handlerClass: MyCallbackHandler,\n * envVar: \"MY_TRACER_ENABLED\",\n * });\n * process.env.MY_TRACER_ENABLED = \"true\";\n *\n * // ...run code here\n * ```\n *\n * @param config Configuration object for the hook\n * @param config.contextVar Name of the context variable containing the handler instance\n * @param config.inheritable Whether child runs should inherit this handler\n * @param config.handlerClass Optional callback handler class (required if using envVar)\n * @param config.envVar Optional environment variable name to control handler activation\n */\nexport declare const registerConfigureHook: (config: ConfigureHook) => void;\nexport type ConfigureHook = {\n contextVar?: string;\n inheritable?: boolean;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n handlerClass?: new (...args: any[]) => BaseCallbackHandler;\n envVar?: string;\n};\n"],"mappings":";;;;;;AAoDA;;;;AAAyE;AAmDzE;;;;AAAyE;AA+CzE;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAnGwBC,4BAA4BC,oBAAoBC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAmDhDC,kCAAkCF,cAAcC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA+CnDI,gCAAgCD;KACzCA,aAAAA;;;;yCAI+BN"}
1
+ {"version":3,"file":"context.d.ts","names":["BaseCallbackHandler","setContextVariable","PropertyKey","T","getContextVariable","_getConfigureHooks","ConfigureHook","registerConfigureHook"],"sources":["../../../src/singletons/async_local_storage/context.d.ts"],"sourcesContent":["import { BaseCallbackHandler } from \"../../callbacks/base.js\";\n/**\n * Set a context variable. Context variables are scoped to any\n * child runnables called by the current runnable, or globally if set outside\n * of any runnable.\n *\n * @remarks\n * This function is only supported in environments that support AsyncLocalStorage,\n * including Node.js, Deno, and Cloudflare Workers.\n *\n * @example\n * ```ts\n * import { RunnableLambda } from \"@langchain/core/runnables\";\n * import {\n * getContextVariable,\n * setContextVariable\n * } from \"@langchain/core/context\";\n *\n * const nested = RunnableLambda.from(() => {\n * // \"bar\" because it was set by a parent\n * console.log(getContextVariable(\"foo\"));\n *\n * // Override to \"baz\", but only for child runnables\n * setContextVariable(\"foo\", \"baz\");\n *\n * // Now \"baz\", but only for child runnables\n * return getContextVariable(\"foo\");\n * });\n *\n * const runnable = RunnableLambda.from(async () => {\n * // Set a context variable named \"foo\"\n * setContextVariable(\"foo\", \"bar\");\n *\n * const res = await nested.invoke({});\n *\n * // Still \"bar\" since child changes do not affect parents\n * console.log(getContextVariable(\"foo\"));\n *\n * return res;\n * });\n *\n * // undefined, because context variable has not been set yet\n * console.log(getContextVariable(\"foo\"));\n *\n * // Final return value is \"baz\"\n * const result = await runnable.invoke({});\n * ```\n *\n * @param name The name of the context variable.\n * @param value The value to set.\n */\nexport declare function setContextVariable<T>(name: PropertyKey, value: T): void;\n/**\n * Get the value of a previously set context variable. Context variables\n * are scoped to any child runnables called by the current runnable,\n * or globally if set outside of any runnable.\n *\n * @remarks\n * This function is only supported in environments that support AsyncLocalStorage,\n * including Node.js, Deno, and Cloudflare Workers.\n *\n * @example\n * ```ts\n * import { RunnableLambda } from \"@langchain/core/runnables\";\n * import {\n * getContextVariable,\n * setContextVariable\n * } from \"@langchain/core/context\";\n *\n * const nested = RunnableLambda.from(() => {\n * // \"bar\" because it was set by a parent\n * console.log(getContextVariable(\"foo\"));\n *\n * // Override to \"baz\", but only for child runnables\n * setContextVariable(\"foo\", \"baz\");\n *\n * // Now \"baz\", but only for child runnables\n * return getContextVariable(\"foo\");\n * });\n *\n * const runnable = RunnableLambda.from(async () => {\n * // Set a context variable named \"foo\"\n * setContextVariable(\"foo\", \"bar\");\n *\n * const res = await nested.invoke({});\n *\n * // Still \"bar\" since child changes do not affect parents\n * console.log(getContextVariable(\"foo\"));\n *\n * return res;\n * });\n *\n * // undefined, because context variable has not been set yet\n * console.log(getContextVariable(\"foo\"));\n *\n * // Final return value is \"baz\"\n * const result = await runnable.invoke({});\n * ```\n *\n * @param name The name of the context variable.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport declare function getContextVariable<T = any>(name: PropertyKey): T | undefined;\nexport declare const _getConfigureHooks: () => ConfigureHook[];\n/**\n * Register a callback configure hook to automatically add callback handlers to all runs.\n *\n * There are two ways to use this:\n *\n * 1. Using a context variable:\n * - Set `contextVar` to specify the variable name\n * - Use `setContextVariable()` to store your handler instance\n *\n * 2. Using an environment variable:\n * - Set both `envVar` and `handlerClass`\n * - The handler will be instantiated when the env var is set to \"true\".\n *\n * @example\n * ```typescript\n * // Method 1: Using context variable\n * import {\n * registerConfigureHook,\n * setContextVariable\n * } from \"@langchain/core/context\";\n *\n * const tracer = new MyCallbackHandler();\n * registerConfigureHook({\n * contextVar: \"my_tracer\",\n * });\n * setContextVariable(\"my_tracer\", tracer);\n *\n * // ...run code here\n *\n * // Method 2: Using environment variable\n * registerConfigureHook({\n * handlerClass: MyCallbackHandler,\n * envVar: \"MY_TRACER_ENABLED\",\n * });\n * process.env.MY_TRACER_ENABLED = \"true\";\n *\n * // ...run code here\n * ```\n *\n * @param config Configuration object for the hook\n * @param config.contextVar Name of the context variable containing the handler instance\n * @param config.inheritable Whether child runs should inherit this handler\n * @param config.handlerClass Optional callback handler class (required if using envVar)\n * @param config.envVar Optional environment variable name to control handler activation\n */\nexport declare const registerConfigureHook: (config: ConfigureHook) => void;\nexport type ConfigureHook = {\n contextVar?: string;\n inheritable?: boolean;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n handlerClass?: new (...args: any[]) => BaseCallbackHandler;\n envVar?: string;\n};\n"],"mappings":";;;;;;AAmDA;;;;AAAyE;AAmDzE;;;;AAAyE;AA+CzE;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAnGwBC,4BAA4BC,oBAAoBC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAmDhDC,kCAAkCF,cAAcC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA+CnDI,gCAAgCD;KACzCA,aAAAA;;;;yCAI+BN"}
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","names":["name: PropertyKey","value: T","config: ConfigureHook"],"sources":["../../../src/singletons/async_local_storage/context.ts"],"sourcesContent":["import { isRunTree, RunTree } from \"langsmith/run_trees\";\nimport { BaseCallbackHandler } from \"../../callbacks/base.js\";\nimport {\n _CONTEXT_VARIABLES_KEY,\n getGlobalAsyncLocalStorageInstance,\n} from \"./globals.js\";\n\n/**\n * Set a context variable. Context variables are scoped to any\n * child runnables called by the current runnable, or globally if set outside\n * of any runnable.\n *\n * @remarks\n * This function is only supported in environments that support AsyncLocalStorage,\n * including Node.js, Deno, and Cloudflare Workers.\n *\n * @example\n * ```ts\n * import { RunnableLambda } from \"@langchain/core/runnables\";\n * import {\n * getContextVariable,\n * setContextVariable\n * } from \"@langchain/core/context\";\n *\n * const nested = RunnableLambda.from(() => {\n * // \"bar\" because it was set by a parent\n * console.log(getContextVariable(\"foo\"));\n *\n * // Override to \"baz\", but only for child runnables\n * setContextVariable(\"foo\", \"baz\");\n *\n * // Now \"baz\", but only for child runnables\n * return getContextVariable(\"foo\");\n * });\n *\n * const runnable = RunnableLambda.from(async () => {\n * // Set a context variable named \"foo\"\n * setContextVariable(\"foo\", \"bar\");\n *\n * const res = await nested.invoke({});\n *\n * // Still \"bar\" since child changes do not affect parents\n * console.log(getContextVariable(\"foo\"));\n *\n * return res;\n * });\n *\n * // undefined, because context variable has not been set yet\n * console.log(getContextVariable(\"foo\"));\n *\n * // Final return value is \"baz\"\n * const result = await runnable.invoke({});\n * ```\n *\n * @param name The name of the context variable.\n * @param value The value to set.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function setContextVariable<T>(name: PropertyKey, value: T): void {\n // Avoid using global singleton due to circuluar dependency issues\n const asyncLocalStorageInstance = getGlobalAsyncLocalStorageInstance();\n if (asyncLocalStorageInstance === undefined) {\n throw new Error(\n `Internal error: Global shared async local storage instance has not been initialized.`\n );\n }\n const runTree = asyncLocalStorageInstance.getStore();\n const contextVars = { ...runTree?.[_CONTEXT_VARIABLES_KEY] };\n contextVars[name] = value;\n let newValue = {};\n if (isRunTree(runTree)) {\n newValue = new RunTree(runTree);\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (newValue as any)[_CONTEXT_VARIABLES_KEY] = contextVars;\n asyncLocalStorageInstance.enterWith(newValue);\n}\n\n/**\n * Get the value of a previously set context variable. Context variables\n * are scoped to any child runnables called by the current runnable,\n * or globally if set outside of any runnable.\n *\n * @remarks\n * This function is only supported in environments that support AsyncLocalStorage,\n * including Node.js, Deno, and Cloudflare Workers.\n *\n * @example\n * ```ts\n * import { RunnableLambda } from \"@langchain/core/runnables\";\n * import {\n * getContextVariable,\n * setContextVariable\n * } from \"@langchain/core/context\";\n *\n * const nested = RunnableLambda.from(() => {\n * // \"bar\" because it was set by a parent\n * console.log(getContextVariable(\"foo\"));\n *\n * // Override to \"baz\", but only for child runnables\n * setContextVariable(\"foo\", \"baz\");\n *\n * // Now \"baz\", but only for child runnables\n * return getContextVariable(\"foo\");\n * });\n *\n * const runnable = RunnableLambda.from(async () => {\n * // Set a context variable named \"foo\"\n * setContextVariable(\"foo\", \"bar\");\n *\n * const res = await nested.invoke({});\n *\n * // Still \"bar\" since child changes do not affect parents\n * console.log(getContextVariable(\"foo\"));\n *\n * return res;\n * });\n *\n * // undefined, because context variable has not been set yet\n * console.log(getContextVariable(\"foo\"));\n *\n * // Final return value is \"baz\"\n * const result = await runnable.invoke({});\n * ```\n *\n * @param name The name of the context variable.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function getContextVariable<T = any>(name: PropertyKey): T | undefined {\n // Avoid using global singleton due to circuluar dependency issues\n const asyncLocalStorageInstance = getGlobalAsyncLocalStorageInstance();\n if (asyncLocalStorageInstance === undefined) {\n return undefined;\n }\n const runTree = asyncLocalStorageInstance.getStore();\n return runTree?.[_CONTEXT_VARIABLES_KEY]?.[name];\n}\n\nconst LC_CONFIGURE_HOOKS_KEY = Symbol(\"lc:configure_hooks\");\n\nexport const _getConfigureHooks = () =>\n getContextVariable<ConfigureHook[]>(LC_CONFIGURE_HOOKS_KEY) || [];\n\n/**\n * Register a callback configure hook to automatically add callback handlers to all runs.\n *\n * There are two ways to use this:\n *\n * 1. Using a context variable:\n * - Set `contextVar` to specify the variable name\n * - Use `setContextVariable()` to store your handler instance\n *\n * 2. Using an environment variable:\n * - Set both `envVar` and `handlerClass`\n * - The handler will be instantiated when the env var is set to \"true\".\n *\n * @example\n * ```typescript\n * // Method 1: Using context variable\n * import {\n * registerConfigureHook,\n * setContextVariable\n * } from \"@langchain/core/context\";\n *\n * const tracer = new MyCallbackHandler();\n * registerConfigureHook({\n * contextVar: \"my_tracer\",\n * });\n * setContextVariable(\"my_tracer\", tracer);\n *\n * // ...run code here\n *\n * // Method 2: Using environment variable\n * registerConfigureHook({\n * handlerClass: MyCallbackHandler,\n * envVar: \"MY_TRACER_ENABLED\",\n * });\n * process.env.MY_TRACER_ENABLED = \"true\";\n *\n * // ...run code here\n * ```\n *\n * @param config Configuration object for the hook\n * @param config.contextVar Name of the context variable containing the handler instance\n * @param config.inheritable Whether child runs should inherit this handler\n * @param config.handlerClass Optional callback handler class (required if using envVar)\n * @param config.envVar Optional environment variable name to control handler activation\n */\nexport const registerConfigureHook = (config: ConfigureHook) => {\n if (config.envVar && !config.handlerClass) {\n throw new Error(\n \"If envVar is set, handlerClass must also be set to a non-None value.\"\n );\n }\n setContextVariable(LC_CONFIGURE_HOOKS_KEY, [..._getConfigureHooks(), config]);\n};\n\nexport type ConfigureHook = {\n contextVar?: string;\n inheritable?: boolean;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n handlerClass?: new (...args: any[]) => BaseCallbackHandler;\n envVar?: string;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0DA,SAAgB,mBAAsBA,MAAmBC,OAAgB;CAEvE,MAAM,4BAA4B,oCAAoC;AACtE,KAAI,8BAA8B,OAChC,OAAM,IAAI,MACR,CAAC,oFAAoF,CAAC;CAG1F,MAAM,UAAU,0BAA0B,UAAU;CACpD,MAAM,cAAc,EAAE,GAAG,UAAU,wBAAyB;CAC5D,YAAY,QAAQ;CACpB,IAAI,WAAW,CAAE;AACjB,KAAI,UAAU,QAAQ,EACpB,WAAW,IAAI,QAAQ;CAGxB,SAAiB,0BAA0B;CAC5C,0BAA0B,UAAU,SAAS;AAC9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoDD,SAAgB,mBAA4BD,MAAkC;CAE5E,MAAM,4BAA4B,oCAAoC;AACtE,KAAI,8BAA8B,OAChC,QAAO;CAET,MAAM,UAAU,0BAA0B,UAAU;AACpD,QAAO,UAAU,0BAA0B;AAC5C;AAED,MAAM,yBAAyB,OAAO,qBAAqB;AAE3D,MAAa,qBAAqB,MAChC,mBAAoC,uBAAuB,IAAI,CAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CnE,MAAa,wBAAwB,CAACE,WAA0B;AAC9D,KAAI,OAAO,UAAU,CAAC,OAAO,aAC3B,OAAM,IAAI,MACR;CAGJ,mBAAmB,wBAAwB,CAAC,GAAG,oBAAoB,EAAE,MAAO,EAAC;AAC9E"}
1
+ {"version":3,"file":"context.js","names":["name: PropertyKey","value: T","config: ConfigureHook"],"sources":["../../../src/singletons/async_local_storage/context.ts"],"sourcesContent":["import { isRunTree, RunTree } from \"langsmith/run_trees\";\nimport { BaseCallbackHandler } from \"../../callbacks/base.js\";\nimport {\n _CONTEXT_VARIABLES_KEY,\n getGlobalAsyncLocalStorageInstance,\n} from \"./globals.js\";\n\n/**\n * Set a context variable. Context variables are scoped to any\n * child runnables called by the current runnable, or globally if set outside\n * of any runnable.\n *\n * @remarks\n * This function is only supported in environments that support AsyncLocalStorage,\n * including Node.js, Deno, and Cloudflare Workers.\n *\n * @example\n * ```ts\n * import { RunnableLambda } from \"@langchain/core/runnables\";\n * import {\n * getContextVariable,\n * setContextVariable\n * } from \"@langchain/core/context\";\n *\n * const nested = RunnableLambda.from(() => {\n * // \"bar\" because it was set by a parent\n * console.log(getContextVariable(\"foo\"));\n *\n * // Override to \"baz\", but only for child runnables\n * setContextVariable(\"foo\", \"baz\");\n *\n * // Now \"baz\", but only for child runnables\n * return getContextVariable(\"foo\");\n * });\n *\n * const runnable = RunnableLambda.from(async () => {\n * // Set a context variable named \"foo\"\n * setContextVariable(\"foo\", \"bar\");\n *\n * const res = await nested.invoke({});\n *\n * // Still \"bar\" since child changes do not affect parents\n * console.log(getContextVariable(\"foo\"));\n *\n * return res;\n * });\n *\n * // undefined, because context variable has not been set yet\n * console.log(getContextVariable(\"foo\"));\n *\n * // Final return value is \"baz\"\n * const result = await runnable.invoke({});\n * ```\n *\n * @param name The name of the context variable.\n * @param value The value to set.\n */\nexport function setContextVariable<T>(name: PropertyKey, value: T): void {\n // Avoid using global singleton due to circuluar dependency issues\n const asyncLocalStorageInstance = getGlobalAsyncLocalStorageInstance();\n if (asyncLocalStorageInstance === undefined) {\n throw new Error(\n `Internal error: Global shared async local storage instance has not been initialized.`\n );\n }\n const runTree = asyncLocalStorageInstance.getStore();\n const contextVars = { ...runTree?.[_CONTEXT_VARIABLES_KEY] };\n contextVars[name] = value;\n let newValue = {};\n if (isRunTree(runTree)) {\n newValue = new RunTree(runTree);\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (newValue as any)[_CONTEXT_VARIABLES_KEY] = contextVars;\n asyncLocalStorageInstance.enterWith(newValue);\n}\n\n/**\n * Get the value of a previously set context variable. Context variables\n * are scoped to any child runnables called by the current runnable,\n * or globally if set outside of any runnable.\n *\n * @remarks\n * This function is only supported in environments that support AsyncLocalStorage,\n * including Node.js, Deno, and Cloudflare Workers.\n *\n * @example\n * ```ts\n * import { RunnableLambda } from \"@langchain/core/runnables\";\n * import {\n * getContextVariable,\n * setContextVariable\n * } from \"@langchain/core/context\";\n *\n * const nested = RunnableLambda.from(() => {\n * // \"bar\" because it was set by a parent\n * console.log(getContextVariable(\"foo\"));\n *\n * // Override to \"baz\", but only for child runnables\n * setContextVariable(\"foo\", \"baz\");\n *\n * // Now \"baz\", but only for child runnables\n * return getContextVariable(\"foo\");\n * });\n *\n * const runnable = RunnableLambda.from(async () => {\n * // Set a context variable named \"foo\"\n * setContextVariable(\"foo\", \"bar\");\n *\n * const res = await nested.invoke({});\n *\n * // Still \"bar\" since child changes do not affect parents\n * console.log(getContextVariable(\"foo\"));\n *\n * return res;\n * });\n *\n * // undefined, because context variable has not been set yet\n * console.log(getContextVariable(\"foo\"));\n *\n * // Final return value is \"baz\"\n * const result = await runnable.invoke({});\n * ```\n *\n * @param name The name of the context variable.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function getContextVariable<T = any>(name: PropertyKey): T | undefined {\n // Avoid using global singleton due to circuluar dependency issues\n const asyncLocalStorageInstance = getGlobalAsyncLocalStorageInstance();\n if (asyncLocalStorageInstance === undefined) {\n return undefined;\n }\n const runTree = asyncLocalStorageInstance.getStore();\n return runTree?.[_CONTEXT_VARIABLES_KEY]?.[name];\n}\n\nconst LC_CONFIGURE_HOOKS_KEY = Symbol(\"lc:configure_hooks\");\n\nexport const _getConfigureHooks = () =>\n getContextVariable<ConfigureHook[]>(LC_CONFIGURE_HOOKS_KEY) || [];\n\n/**\n * Register a callback configure hook to automatically add callback handlers to all runs.\n *\n * There are two ways to use this:\n *\n * 1. Using a context variable:\n * - Set `contextVar` to specify the variable name\n * - Use `setContextVariable()` to store your handler instance\n *\n * 2. Using an environment variable:\n * - Set both `envVar` and `handlerClass`\n * - The handler will be instantiated when the env var is set to \"true\".\n *\n * @example\n * ```typescript\n * // Method 1: Using context variable\n * import {\n * registerConfigureHook,\n * setContextVariable\n * } from \"@langchain/core/context\";\n *\n * const tracer = new MyCallbackHandler();\n * registerConfigureHook({\n * contextVar: \"my_tracer\",\n * });\n * setContextVariable(\"my_tracer\", tracer);\n *\n * // ...run code here\n *\n * // Method 2: Using environment variable\n * registerConfigureHook({\n * handlerClass: MyCallbackHandler,\n * envVar: \"MY_TRACER_ENABLED\",\n * });\n * process.env.MY_TRACER_ENABLED = \"true\";\n *\n * // ...run code here\n * ```\n *\n * @param config Configuration object for the hook\n * @param config.contextVar Name of the context variable containing the handler instance\n * @param config.inheritable Whether child runs should inherit this handler\n * @param config.handlerClass Optional callback handler class (required if using envVar)\n * @param config.envVar Optional environment variable name to control handler activation\n */\nexport const registerConfigureHook = (config: ConfigureHook) => {\n if (config.envVar && !config.handlerClass) {\n throw new Error(\n \"If envVar is set, handlerClass must also be set to a non-None value.\"\n );\n }\n setContextVariable(LC_CONFIGURE_HOOKS_KEY, [..._getConfigureHooks(), config]);\n};\n\nexport type ConfigureHook = {\n contextVar?: string;\n inheritable?: boolean;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n handlerClass?: new (...args: any[]) => BaseCallbackHandler;\n envVar?: string;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyDA,SAAgB,mBAAsBA,MAAmBC,OAAgB;CAEvE,MAAM,4BAA4B,oCAAoC;AACtE,KAAI,8BAA8B,OAChC,OAAM,IAAI,MACR,CAAC,oFAAoF,CAAC;CAG1F,MAAM,UAAU,0BAA0B,UAAU;CACpD,MAAM,cAAc,EAAE,GAAG,UAAU,wBAAyB;CAC5D,YAAY,QAAQ;CACpB,IAAI,WAAW,CAAE;AACjB,KAAI,UAAU,QAAQ,EACpB,WAAW,IAAI,QAAQ;CAGxB,SAAiB,0BAA0B;CAC5C,0BAA0B,UAAU,SAAS;AAC9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoDD,SAAgB,mBAA4BD,MAAkC;CAE5E,MAAM,4BAA4B,oCAAoC;AACtE,KAAI,8BAA8B,OAChC,QAAO;CAET,MAAM,UAAU,0BAA0B,UAAU;AACpD,QAAO,UAAU,0BAA0B;AAC5C;AAED,MAAM,yBAAyB,OAAO,qBAAqB;AAE3D,MAAa,qBAAqB,MAChC,mBAAoC,uBAAuB,IAAI,CAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CnE,MAAa,wBAAwB,CAACE,WAA0B;AAC9D,KAAI,OAAO,UAAU,CAAC,OAAO,aAC3B,OAAM,IAAI,MACR;CAGJ,mBAAmB,wBAAwB,CAAC,GAAG,oBAAoB,EAAE,MAAO,EAAC;AAC9E"}
@@ -1 +1 @@
1
- {"version":3,"file":"callbacks.cjs","names":["queue: typeof import(\"p-queue\")[\"default\"][\"prototype\"]","PQueue: any","PQueueMod","promiseFn: () => Promise<T> | T | void","wait: boolean","getGlobalAsyncLocalStorageInstance","getDefaultLangChainClientSingleton"],"sources":["../../src/singletons/callbacks.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport PQueueMod from \"p-queue\";\nimport { getGlobalAsyncLocalStorageInstance } from \"./async_local_storage/globals.js\";\nimport { getDefaultLangChainClientSingleton } from \"./tracer.js\";\n\nlet queue: typeof import(\"p-queue\")[\"default\"][\"prototype\"];\n\n/**\n * Creates a queue using the p-queue library. The queue is configured to\n * auto-start and has a concurrency of 1, meaning it will process tasks\n * one at a time.\n */\nfunction createQueue() {\n const PQueue: any = \"default\" in PQueueMod ? PQueueMod.default : PQueueMod;\n return new PQueue({\n autoStart: true,\n concurrency: 1,\n });\n}\n\nexport function getQueue() {\n if (typeof queue === \"undefined\") {\n queue = createQueue();\n }\n return queue;\n}\n\n/**\n * Consume a promise, either adding it to the queue or waiting for it to resolve\n * @param promiseFn Promise to consume\n * @param wait Whether to wait for the promise to resolve or resolve immediately\n */\nexport async function consumeCallback<T>(\n promiseFn: () => Promise<T> | T | void,\n wait: boolean\n): Promise<void> {\n if (wait === true) {\n // Clear config since callbacks are not part of the root run\n // Avoid using global singleton due to circuluar dependency issues\n const asyncLocalStorageInstance = getGlobalAsyncLocalStorageInstance();\n if (asyncLocalStorageInstance !== undefined) {\n await asyncLocalStorageInstance.run(undefined, async () => promiseFn());\n } else {\n await promiseFn();\n }\n } else {\n queue = getQueue();\n void queue.add(async () => {\n const asyncLocalStorageInstance = getGlobalAsyncLocalStorageInstance();\n if (asyncLocalStorageInstance !== undefined) {\n await asyncLocalStorageInstance.run(undefined, async () => promiseFn());\n } else {\n await promiseFn();\n }\n });\n }\n}\n\n/**\n * Waits for all promises in the queue to resolve. If the queue is\n * undefined, it immediately resolves a promise.\n */\nexport async function awaitAllCallbacks(): Promise<void> {\n const defaultClient = getDefaultLangChainClientSingleton();\n await Promise.allSettled([\n typeof queue !== \"undefined\" ? queue.onIdle() : Promise.resolve(),\n defaultClient.awaitPendingTraceBatches(),\n ]);\n}\n"],"mappings":";;;;;;AAMA,IAAIA;;;;;;AAOJ,SAAS,cAAc;CACrB,MAAMC,SAAc,aAAaC,kBAAYA,gBAAU,UAAUA;AACjE,QAAO,IAAI,OAAO;EAChB,WAAW;EACX,aAAa;CACd;AACF;AAED,SAAgB,WAAW;AACzB,KAAI,OAAO,UAAU,aACnB,QAAQ,aAAa;AAEvB,QAAO;AACR;;;;;;AAOD,eAAsB,gBACpBC,WACAC,MACe;AACf,KAAI,SAAS,MAAM;EAGjB,MAAM,4BAA4BC,oDAAoC;AACtE,MAAI,8BAA8B,QAChC,MAAM,0BAA0B,IAAI,QAAW,YAAY,WAAW,CAAC;OAEvE,MAAM,WAAW;CAEpB,OAAM;EACL,QAAQ,UAAU;EACb,MAAM,IAAI,YAAY;GACzB,MAAM,4BAA4BA,oDAAoC;AACtE,OAAI,8BAA8B,QAChC,MAAM,0BAA0B,IAAI,QAAW,YAAY,WAAW,CAAC;QAEvE,MAAM,WAAW;EAEpB,EAAC;CACH;AACF;;;;;AAMD,eAAsB,oBAAmC;CACvD,MAAM,gBAAgBC,mDAAoC;CAC1D,MAAM,QAAQ,WAAW,CACvB,OAAO,UAAU,cAAc,MAAM,QAAQ,GAAG,QAAQ,SAAS,EACjE,cAAc,0BAA0B,AACzC,EAAC;AACH"}
1
+ {"version":3,"file":"callbacks.cjs","names":["queue: typeof import(\"p-queue\")[\"default\"][\"prototype\"]","PQueue: any","PQueueMod","promiseFn: () => Promise<T> | T | void","wait: boolean","getGlobalAsyncLocalStorageInstance","getDefaultLangChainClientSingleton"],"sources":["../../src/singletons/callbacks.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport PQueueMod from \"p-queue\";\nimport { getGlobalAsyncLocalStorageInstance } from \"./async_local_storage/globals.js\";\nimport { getDefaultLangChainClientSingleton } from \"./tracer.js\";\n\nlet queue: typeof import(\"p-queue\")[\"default\"][\"prototype\"];\n\n/**\n * Creates a queue using the p-queue library. The queue is configured to\n * auto-start and has a concurrency of 1, meaning it will process tasks\n * one at a time.\n */\nfunction createQueue() {\n const PQueue: any = \"default\" in PQueueMod ? PQueueMod.default : PQueueMod;\n return new PQueue({\n autoStart: true,\n concurrency: 1,\n });\n}\n\nexport function getQueue() {\n if (typeof queue === \"undefined\") {\n queue = createQueue();\n }\n return queue;\n}\n\n/**\n * Consume a promise, either adding it to the queue or waiting for it to resolve\n * @param promiseFn Promise to consume\n * @param wait Whether to wait for the promise to resolve or resolve immediately\n */\nexport async function consumeCallback<T>(\n promiseFn: () => Promise<T> | T | void,\n wait: boolean\n): Promise<void> {\n if (wait === true) {\n // Clear config since callbacks are not part of the root run\n // Avoid using global singleton due to circuluar dependency issues\n const asyncLocalStorageInstance = getGlobalAsyncLocalStorageInstance();\n if (asyncLocalStorageInstance !== undefined) {\n await asyncLocalStorageInstance.run(undefined, async () => promiseFn());\n } else {\n await promiseFn();\n }\n } else {\n queue = getQueue();\n // eslint-disable-next-line no-void\n void queue.add(async () => {\n const asyncLocalStorageInstance = getGlobalAsyncLocalStorageInstance();\n if (asyncLocalStorageInstance !== undefined) {\n await asyncLocalStorageInstance.run(undefined, async () => promiseFn());\n } else {\n await promiseFn();\n }\n });\n }\n}\n\n/**\n * Waits for all promises in the queue to resolve. If the queue is\n * undefined, it immediately resolves a promise.\n */\nexport async function awaitAllCallbacks(): Promise<void> {\n const defaultClient = getDefaultLangChainClientSingleton();\n await Promise.allSettled([\n typeof queue !== \"undefined\" ? queue.onIdle() : Promise.resolve(),\n defaultClient.awaitPendingTraceBatches(),\n ]);\n}\n"],"mappings":";;;;;;AAMA,IAAIA;;;;;;AAOJ,SAAS,cAAc;CACrB,MAAMC,SAAc,aAAaC,kBAAYA,gBAAU,UAAUA;AACjE,QAAO,IAAI,OAAO;EAChB,WAAW;EACX,aAAa;CACd;AACF;AAED,SAAgB,WAAW;AACzB,KAAI,OAAO,UAAU,aACnB,QAAQ,aAAa;AAEvB,QAAO;AACR;;;;;;AAOD,eAAsB,gBACpBC,WACAC,MACe;AACf,KAAI,SAAS,MAAM;EAGjB,MAAM,4BAA4BC,oDAAoC;AACtE,MAAI,8BAA8B,QAChC,MAAM,0BAA0B,IAAI,QAAW,YAAY,WAAW,CAAC;OAEvE,MAAM,WAAW;CAEpB,OAAM;EACL,QAAQ,UAAU;EAEb,MAAM,IAAI,YAAY;GACzB,MAAM,4BAA4BA,oDAAoC;AACtE,OAAI,8BAA8B,QAChC,MAAM,0BAA0B,IAAI,QAAW,YAAY,WAAW,CAAC;QAEvE,MAAM,WAAW;EAEpB,EAAC;CACH;AACF;;;;;AAMD,eAAsB,oBAAmC;CACvD,MAAM,gBAAgBC,mDAAoC;CAC1D,MAAM,QAAQ,WAAW,CACvB,OAAO,UAAU,cAAc,MAAM,QAAQ,GAAG,QAAQ,SAAS,EACjE,cAAc,0BAA0B,AACzC,EAAC;AACH"}
@@ -1 +1 @@
1
- {"version":3,"file":"callbacks.js","names":["queue: typeof import(\"p-queue\")[\"default\"][\"prototype\"]","PQueue: any","promiseFn: () => Promise<T> | T | void","wait: boolean"],"sources":["../../src/singletons/callbacks.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport PQueueMod from \"p-queue\";\nimport { getGlobalAsyncLocalStorageInstance } from \"./async_local_storage/globals.js\";\nimport { getDefaultLangChainClientSingleton } from \"./tracer.js\";\n\nlet queue: typeof import(\"p-queue\")[\"default\"][\"prototype\"];\n\n/**\n * Creates a queue using the p-queue library. The queue is configured to\n * auto-start and has a concurrency of 1, meaning it will process tasks\n * one at a time.\n */\nfunction createQueue() {\n const PQueue: any = \"default\" in PQueueMod ? PQueueMod.default : PQueueMod;\n return new PQueue({\n autoStart: true,\n concurrency: 1,\n });\n}\n\nexport function getQueue() {\n if (typeof queue === \"undefined\") {\n queue = createQueue();\n }\n return queue;\n}\n\n/**\n * Consume a promise, either adding it to the queue or waiting for it to resolve\n * @param promiseFn Promise to consume\n * @param wait Whether to wait for the promise to resolve or resolve immediately\n */\nexport async function consumeCallback<T>(\n promiseFn: () => Promise<T> | T | void,\n wait: boolean\n): Promise<void> {\n if (wait === true) {\n // Clear config since callbacks are not part of the root run\n // Avoid using global singleton due to circuluar dependency issues\n const asyncLocalStorageInstance = getGlobalAsyncLocalStorageInstance();\n if (asyncLocalStorageInstance !== undefined) {\n await asyncLocalStorageInstance.run(undefined, async () => promiseFn());\n } else {\n await promiseFn();\n }\n } else {\n queue = getQueue();\n void queue.add(async () => {\n const asyncLocalStorageInstance = getGlobalAsyncLocalStorageInstance();\n if (asyncLocalStorageInstance !== undefined) {\n await asyncLocalStorageInstance.run(undefined, async () => promiseFn());\n } else {\n await promiseFn();\n }\n });\n }\n}\n\n/**\n * Waits for all promises in the queue to resolve. If the queue is\n * undefined, it immediately resolves a promise.\n */\nexport async function awaitAllCallbacks(): Promise<void> {\n const defaultClient = getDefaultLangChainClientSingleton();\n await Promise.allSettled([\n typeof queue !== \"undefined\" ? queue.onIdle() : Promise.resolve(),\n defaultClient.awaitPendingTraceBatches(),\n ]);\n}\n"],"mappings":";;;;;AAMA,IAAIA;;;;;;AAOJ,SAAS,cAAc;CACrB,MAAMC,SAAc,aAAa,YAAY,UAAU,UAAU;AACjE,QAAO,IAAI,OAAO;EAChB,WAAW;EACX,aAAa;CACd;AACF;AAED,SAAgB,WAAW;AACzB,KAAI,OAAO,UAAU,aACnB,QAAQ,aAAa;AAEvB,QAAO;AACR;;;;;;AAOD,eAAsB,gBACpBC,WACAC,MACe;AACf,KAAI,SAAS,MAAM;EAGjB,MAAM,4BAA4B,oCAAoC;AACtE,MAAI,8BAA8B,QAChC,MAAM,0BAA0B,IAAI,QAAW,YAAY,WAAW,CAAC;OAEvE,MAAM,WAAW;CAEpB,OAAM;EACL,QAAQ,UAAU;EACb,MAAM,IAAI,YAAY;GACzB,MAAM,4BAA4B,oCAAoC;AACtE,OAAI,8BAA8B,QAChC,MAAM,0BAA0B,IAAI,QAAW,YAAY,WAAW,CAAC;QAEvE,MAAM,WAAW;EAEpB,EAAC;CACH;AACF;;;;;AAMD,eAAsB,oBAAmC;CACvD,MAAM,gBAAgB,oCAAoC;CAC1D,MAAM,QAAQ,WAAW,CACvB,OAAO,UAAU,cAAc,MAAM,QAAQ,GAAG,QAAQ,SAAS,EACjE,cAAc,0BAA0B,AACzC,EAAC;AACH"}
1
+ {"version":3,"file":"callbacks.js","names":["queue: typeof import(\"p-queue\")[\"default\"][\"prototype\"]","PQueue: any","promiseFn: () => Promise<T> | T | void","wait: boolean"],"sources":["../../src/singletons/callbacks.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport PQueueMod from \"p-queue\";\nimport { getGlobalAsyncLocalStorageInstance } from \"./async_local_storage/globals.js\";\nimport { getDefaultLangChainClientSingleton } from \"./tracer.js\";\n\nlet queue: typeof import(\"p-queue\")[\"default\"][\"prototype\"];\n\n/**\n * Creates a queue using the p-queue library. The queue is configured to\n * auto-start and has a concurrency of 1, meaning it will process tasks\n * one at a time.\n */\nfunction createQueue() {\n const PQueue: any = \"default\" in PQueueMod ? PQueueMod.default : PQueueMod;\n return new PQueue({\n autoStart: true,\n concurrency: 1,\n });\n}\n\nexport function getQueue() {\n if (typeof queue === \"undefined\") {\n queue = createQueue();\n }\n return queue;\n}\n\n/**\n * Consume a promise, either adding it to the queue or waiting for it to resolve\n * @param promiseFn Promise to consume\n * @param wait Whether to wait for the promise to resolve or resolve immediately\n */\nexport async function consumeCallback<T>(\n promiseFn: () => Promise<T> | T | void,\n wait: boolean\n): Promise<void> {\n if (wait === true) {\n // Clear config since callbacks are not part of the root run\n // Avoid using global singleton due to circuluar dependency issues\n const asyncLocalStorageInstance = getGlobalAsyncLocalStorageInstance();\n if (asyncLocalStorageInstance !== undefined) {\n await asyncLocalStorageInstance.run(undefined, async () => promiseFn());\n } else {\n await promiseFn();\n }\n } else {\n queue = getQueue();\n // eslint-disable-next-line no-void\n void queue.add(async () => {\n const asyncLocalStorageInstance = getGlobalAsyncLocalStorageInstance();\n if (asyncLocalStorageInstance !== undefined) {\n await asyncLocalStorageInstance.run(undefined, async () => promiseFn());\n } else {\n await promiseFn();\n }\n });\n }\n}\n\n/**\n * Waits for all promises in the queue to resolve. If the queue is\n * undefined, it immediately resolves a promise.\n */\nexport async function awaitAllCallbacks(): Promise<void> {\n const defaultClient = getDefaultLangChainClientSingleton();\n await Promise.allSettled([\n typeof queue !== \"undefined\" ? queue.onIdle() : Promise.resolve(),\n defaultClient.awaitPendingTraceBatches(),\n ]);\n}\n"],"mappings":";;;;;AAMA,IAAIA;;;;;;AAOJ,SAAS,cAAc;CACrB,MAAMC,SAAc,aAAa,YAAY,UAAU,UAAU;AACjE,QAAO,IAAI,OAAO;EAChB,WAAW;EACX,aAAa;CACd;AACF;AAED,SAAgB,WAAW;AACzB,KAAI,OAAO,UAAU,aACnB,QAAQ,aAAa;AAEvB,QAAO;AACR;;;;;;AAOD,eAAsB,gBACpBC,WACAC,MACe;AACf,KAAI,SAAS,MAAM;EAGjB,MAAM,4BAA4B,oCAAoC;AACtE,MAAI,8BAA8B,QAChC,MAAM,0BAA0B,IAAI,QAAW,YAAY,WAAW,CAAC;OAEvE,MAAM,WAAW;CAEpB,OAAM;EACL,QAAQ,UAAU;EAEb,MAAM,IAAI,YAAY;GACzB,MAAM,4BAA4B,oCAAoC;AACtE,OAAI,8BAA8B,QAChC,MAAM,0BAA0B,IAAI,QAAW,YAAY,WAAW,CAAC;QAEvE,MAAM,WAAW;EAEpB,EAAC;CACH;AACF;;;;;AAMD,eAAsB,oBAAmC;CACvD,MAAM,gBAAgB,oCAAoC;CAC1D,MAAM,QAAQ,WAAW,CACvB,OAAO,UAAU,cAAc,MAAM,QAAQ,GAAG,QAAQ,SAAS,EACjE,cAAc,0BAA0B,AACzC,EAAC;AACH"}
@@ -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","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: RunnableFunc<SchemaOutputT, ToolOutputT, ToolRunnableConfig>","fields: ToolWrapperParams<SchemaT>","isSimpleStringZodSchema","validatesOnlyStrings","patchConfig","AsyncLocalStorageProviderSingleton","pickRunnableConfigKeys","getAbortSignalError","params: {\n content: TOutput;\n name: string;\n artifact?: unknown;\n toolCallId?: string;\n}","isDirectToolOutput","ToolMessage","content: unknown"],"sources":["../../src/tools/index.ts"],"sourcesContent":["import { z } from \"zod/v3\";\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 {\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 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} 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} 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 * 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 }\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 // 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 });\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 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 void AsyncLocalStorageProviderSingleton.runWithConfig(\n pickRunnableConfigKeys(childConfig),\n async () => {\n try {\n // TS doesn't restrict the type here based on the guard above\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n resolve(func(input as any, childConfig));\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 if (config?.signal) {\n config.signal.addEventListener(\"abort\", () => {\n return reject(getAbortSignalError(config.signal));\n });\n }\n\n const childConfig = patchConfig(config, {\n callbacks: runManager?.getChild(),\n });\n void AsyncLocalStorageProviderSingleton.runWithConfig(\n pickRunnableConfigKeys(childConfig),\n async () => {\n try {\n const result = await func(input, childConfig);\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 return;\n }\n\n resolve(result);\n } catch (e) {\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}): ToolMessage | TOutput {\n const { content, artifact, toolCallId } = 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 content,\n artifact,\n tool_call_id: toolCallId,\n name: params.name,\n });\n } else {\n return new ToolMessage({\n content: _stringify(content),\n artifact,\n tool_call_id: toolCallId,\n name: params.name,\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqFA,IAAsB,iBAAtB,cAMUA,2CAKV;;;;;;;CAaE,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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ACrB;EACA;EACA,cAAc;EACd,MAAM,OAAO;CACd;KAED,QAAO,IAAIA,kCAAY;EACrB,SAAS,WAAW,QAAQ;EAC5B;EACA,cAAc;EACd,MAAM,OAAO;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","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: RunnableFunc<SchemaOutputT, ToolOutputT, ToolRunnableConfig>","fields: ToolWrapperParams<SchemaT>","isSimpleStringZodSchema","validatesOnlyStrings","patchConfig","AsyncLocalStorageProviderSingleton","pickRunnableConfigKeys","getAbortSignalError","params: {\n content: TOutput;\n name: string;\n artifact?: unknown;\n toolCallId?: string;\n}","isDirectToolOutput","ToolMessage","content: unknown"],"sources":["../../src/tools/index.ts"],"sourcesContent":["import { z } from \"zod/v3\";\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 {\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 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} 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} 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 * 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 }\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 // 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 });\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 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 // TS doesn't restrict the type here based on the guard above\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n resolve(func(input as any, childConfig));\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 if (config?.signal) {\n config.signal.addEventListener(\"abort\", () => {\n return reject(getAbortSignalError(config.signal));\n });\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 const result = await func(input, childConfig);\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 return;\n }\n\n resolve(result);\n } catch (e) {\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}): ToolMessage | TOutput {\n const { content, artifact, toolCallId } = 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 content,\n artifact,\n tool_call_id: toolCallId,\n name: params.name,\n });\n } else {\n return new ToolMessage({\n content: _stringify(content),\n artifact,\n tool_call_id: toolCallId,\n name: params.name,\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqFA,IAAsB,iBAAtB,cAMUA,2CAKV;;;;;;;CAaE,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,KA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S,CAEnD,QAAO,IAAIC,kCAAY;EACrB;EACA;EACA,cAAc;EACd,MAAM,OAAO;CACd;KAED,QAAO,IAAIA,kCAAY;EACrB,SAAS,WAAW,QAAQ;EAC5B;EACA,cAAc;EACd,MAAM,OAAO;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"}
@@ -3,7 +3,7 @@ import { InferInteropZodInput, InferInteropZodOutput, ZodObjectV3, ZodObjectV4,
3
3
  import { CallbackManagerForToolRun } from "../callbacks/manager.cjs";
4
4
  import { RunnableConfig } from "../runnables/types.cjs";
5
5
  import { RunnableFunc } from "../runnables/base.cjs";
6
- import { JSONSchema } from "../utils/json_schema.cjs";
6
+ import { JsonSchema7Type } from "../utils/zod-to-json-schema/parseTypes.cjs";
7
7
  import { BaseLangChain } from "../language_models/base.cjs";
8
8
  import { ToolInputParsingException } from "./utils.cjs";
9
9
  import { BaseDynamicToolInput, ContentAndArtifact, DynamicStructuredToolInput, DynamicToolInput, ResponseFormat, StringInputToolSchema, StructuredToolCallInput, StructuredToolInterface, StructuredToolParams, ToolInputSchemaBase, ToolInputSchemaInputType, ToolInputSchemaOutputType, ToolInterface, ToolOutputType, ToolParams, ToolReturnType, ToolRunnableConfig, isLangChainTool, isRunnableToolLike, isStructuredTool, isStructuredToolParams } from "./types.cjs";
@@ -203,7 +203,7 @@ declare function tool<SchemaT extends ZodStringV3, ToolOutputT = ToolOutputType>
203
203
  declare function tool<SchemaT extends ZodStringV4, ToolOutputT = ToolOutputType>(func: RunnableFunc<InferInteropZodOutput<SchemaT>, ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT>): DynamicTool<ToolOutputT>;
204
204
  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>;
205
205
  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>;
206
- 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>;
206
+ 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>;
207
207
  //#endregion
208
208
  export { type BaseDynamicToolInput, BaseToolkit, type ContentAndArtifact, DynamicStructuredTool, type DynamicStructuredToolInput, DynamicTool, type DynamicToolInput, type ResponseFormat, StructuredTool, type StructuredToolCallInput, type StructuredToolInterface, type StructuredToolParams, Tool, ToolInputParsingException, type ToolInterface, type ToolParams, type ToolReturnType, type ToolRunnableConfig, type ToolInputSchemaBase as ToolSchemaBase, isLangChainTool, isRunnableToolLike, isStructuredTool, isStructuredToolParams, tool };
209
209
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":["z","CallbackManagerForToolRun","BaseLangChain","RunnableConfig","RunnableFunc","ToolCall","ToolMessage","ToolInputParsingException","InferInteropZodInput","InferInteropZodOutput","ZodStringV3","ZodStringV4","ZodObjectV3","ZodObjectV4","StructuredToolCallInput","ToolInputSchemaBase","ToolReturnType","ResponseFormat","ToolInputSchemaInputType","ToolInputSchemaOutputType","ToolParams","ToolRunnableConfig","StructuredToolInterface","DynamicToolInput","DynamicStructuredToolInput","StringInputToolSchema","ToolInterface","ToolOutputType","JSONSchema","BaseDynamicToolInput","ContentAndArtifact","StructuredToolParams","ToolSchemaBase","isLangChainTool","isRunnableToolLike","isStructuredTool","isStructuredToolParams","StructuredTool","SchemaT","SchemaInputT","ToolOutputT","SchemaOutputT","Promise","TInput","TConfig","TArg","Tool","ZodString","ZodOptional","ZodTypeAny","ZodObject","ZodEffects","input","NonNullable","DynamicTool","DynamicStructuredTool","Parameters","BaseToolkit","ToolWrapperParams","RunInput","tool"],"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 { ToolInputParsingException } from \"./utils.js\";\nimport { type InferInteropZodInput, type InferInteropZodOutput, 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 } 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, } 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 * 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 // Match the base class signature including the generics and conditional return type\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, // DynamicTool's _call specifically expects a string after schema transformation\n 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 // Match the base class signature\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>;\n"],"mappings":";;;;;;;;;;;;;;;;AAgB4FmB,uBAA9DkB,cAA8DlB,CAAAA,UAArCJ,mBAAqCI,EAAAA,gBAAAA,yBAAAA,CAA0BmB,OAA1BnB,CAAAA,EAAAA,eAAmDD,wBAAnDC,CAA4EmB,OAA5EnB,CAAAA,EAAAA,cAAoGQ,cAApGR,CAAAA,SAA4HjB,a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EyLjB,kBAFzLiB,CAAAA,EAAAA,MAAAA,EAEsNoB,iBAFtNpB,CAEwOA,OAFxOA,CAAAA,CAAAA,EAEmPiB,qBAFnPjB,CAEyQA,OAFzQA,EAEkRG,aAFlRH,EAEiSC,YAFjSD,EAE+SE,WAF/SF,CAAAA"}
1
+ {"version":3,"file":"index.d.cts","names":["z","CallbackManagerForToolRun","BaseLangChain","RunnableConfig","RunnableFunc","ToolCall","ToolMessage","ToolInputParsingException","InferInteropZodInput","InferInteropZodOutput","ZodStringV3","ZodStringV4","ZodObjectV3","ZodObjectV4","StructuredToolCallInput","ToolInputSchemaBase","ToolReturnType","ResponseFormat","ToolInputSchemaInputType","ToolInputSchemaOutputType","ToolParams","ToolRunnableConfig","StructuredToolInterface","DynamicToolInput","DynamicStructuredToolInput","StringInputToolSchema","ToolInterface","ToolOutputType","JSONSchema","BaseDynamicToolInput","ContentAndArtifact","StructuredToolParams","ToolSchemaBase","isLangChainTool","isRunnableToolLike","isStructuredTool","isStructuredToolParams","StructuredTool","SchemaT","SchemaInputT","ToolOutputT","SchemaOutputT","Promise","TInput","TConfig","TArg","Tool","ZodString","ZodOptional","ZodTypeAny","ZodObject","ZodEffects","input","NonNullable","DynamicTool","DynamicStructuredTool","Parameters","BaseToolkit","ToolWrapperParams","RunInput","tool"],"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 { ToolInputParsingException } from \"./utils.js\";\nimport { type InferInteropZodInput, type InferInteropZodOutput, 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 } 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, } 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 * 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 // Match the base class signature including the generics and conditional return type\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, // DynamicTool's _call specifically expects a string after schema transformation\n 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 // Match the base class signature\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>;\n"],"mappings":";;;;;;;;;;;;;;;;AAgB4FmB,uBAA9DkB,cAA8DlB,CAAAA,UAArCJ,mBAAqCI,EAAAA,gBAA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AEgHkB,UAFhHlB,CAE2Hd,0BAF3Hc,CAEsJA,OAFtJA,CAAAA,CAAAA,MAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,EAE4KE,WAF5KF,EAEyLjB,kBAFzLiB,CAAAA,EAAAA,MAAAA,EAEsNoB,iBAFtNpB,CAEwOA,OAFxOA,CAAAA,CAAAA,EAEmPiB,qBAFnPjB,CAEyQA,OAFzQA,EAEkRG,aAFlRH,EAEiSC,YAFjSD,EAE+SE,WAF/SF,CAAAA"}
@@ -3,7 +3,7 @@ import { InferInteropZodInput, InferInteropZodOutput, ZodObjectV3, ZodObjectV4,
3
3
  import { CallbackManagerForToolRun } from "../callbacks/manager.js";
4
4
  import { RunnableConfig } from "../runnables/types.js";
5
5
  import { RunnableFunc } from "../runnables/base.js";
6
- import { JSONSchema } from "../utils/json_schema.js";
6
+ import { JsonSchema7Type } from "../utils/zod-to-json-schema/parseTypes.js";
7
7
  import { BaseLangChain } from "../language_models/base.js";
8
8
  import { ToolInputParsingException } from "./utils.js";
9
9
  import { BaseDynamicToolInput, ContentAndArtifact, DynamicStructuredToolInput, DynamicToolInput, ResponseFormat, StringInputToolSchema, StructuredToolCallInput, StructuredToolInterface, StructuredToolParams, ToolInputSchemaBase, ToolInputSchemaInputType, ToolInputSchemaOutputType, ToolInterface, ToolOutputType, ToolParams, ToolReturnType, ToolRunnableConfig, isLangChainTool, isRunnableToolLike, isStructuredTool, isStructuredToolParams } from "./types.js";
@@ -203,7 +203,7 @@ declare function tool<SchemaT extends ZodStringV3, ToolOutputT = ToolOutputType>
203
203
  declare function tool<SchemaT extends ZodStringV4, ToolOutputT = ToolOutputType>(func: RunnableFunc<InferInteropZodOutput<SchemaT>, ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT>): DynamicTool<ToolOutputT>;
204
204
  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>;
205
205
  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>;
206
- 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>;
206
+ 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>;
207
207
  //#endregion
208
208
  export { type BaseDynamicToolInput, BaseToolkit, type ContentAndArtifact, DynamicStructuredTool, type DynamicStructuredToolInput, DynamicTool, type DynamicToolInput, type ResponseFormat, StructuredTool, type StructuredToolCallInput, type StructuredToolInterface, type StructuredToolParams, Tool, ToolInputParsingException, type ToolInterface, type ToolParams, type ToolReturnType, type ToolRunnableConfig, type ToolInputSchemaBase as ToolSchemaBase, isLangChainTool, isRunnableToolLike, isStructuredTool, isStructuredToolParams, tool };
209
209
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":["z","CallbackManagerForToolRun","BaseLangChain","RunnableConfig","RunnableFunc","ToolCall","ToolMessage","ToolInputParsingException","InferInteropZodInput","InferInteropZodOutput","ZodStringV3","ZodStringV4","ZodObjectV3","ZodObjectV4","StructuredToolCallInput","ToolInputSchemaBase","ToolReturnType","ResponseFormat","ToolInputSchemaInputType","ToolInputSchemaOutputType","ToolParams","ToolRunnableConfig","StructuredToolInterface","DynamicToolInput","DynamicStructuredToolInput","StringInputToolSchema","ToolInterface","ToolOutputType","JSONSchema","BaseDynamicToolInput","ContentAndArtifact","StructuredToolParams","ToolSchemaBase","isLangChainTool","isRunnableToolLike","isStructuredTool","isStructuredToolParams","StructuredTool","SchemaT","SchemaInputT","ToolOutputT","SchemaOutputT","Promise","TInput","TConfig","TArg","Tool","ZodString","ZodOptional","ZodTypeAny","ZodObject","ZodEffects","input","NonNullable","DynamicTool","DynamicStructuredTool","Parameters","BaseToolkit","ToolWrapperParams","RunInput","tool"],"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 { ToolInputParsingException } from \"./utils.js\";\nimport { type InferInteropZodInput, type InferInteropZodOutput, 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 } 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, } 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 * 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 // Match the base class signature including the generics and conditional return type\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, // DynamicTool's _call specifically expects a string after schema transformation\n 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 // Match the base class signature\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>;\n"],"mappings":";;;;;;;;;;;;;;;;AAgB4FmB,uBAA9DkB,cAA8DlB,CAAAA,UAArCJ,mBAAqCI,EAAAA,gBAAAA,yBAAAA,CAA0BmB,OAA1BnB,CAAAA,EAAAA,eAAmDD,wBAAnDC,CAA4EmB,OAA5EnB,CAAAA,EAAAA,cAAoGQ,cAApGR,CAAAA,SAA4HjB,aAA5HiB,CAA0IL,uBAA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AA,EAAAA,MAAAA,EAEsNoB,iBAFtNpB,CAEwOA,OAFxOA,CAAAA,CAAAA,EAEmPiB,qBAFnPjB,CAEyQA,OAFzQA,EAEkRG,aAFlRH,EAEiSC,YAFjSD,EAE+SE,WAF/SF,CAAAA"}
1
+ {"version":3,"file":"index.d.ts","names":["z","CallbackManagerForToolRun","BaseLangChain","RunnableConfig","RunnableFunc","ToolCall","ToolMessage","ToolInputParsingException","InferInteropZodInput","InferInteropZodOutput","ZodStringV3","ZodStringV4","ZodObjectV3","ZodObjectV4","StructuredToolCallInput","ToolInputSchemaBase","ToolReturnType","ResponseFormat","ToolInputSchemaInputType","ToolInputSchemaOutputType","ToolParams","ToolRunnableConfig","StructuredToolInterface","DynamicToolInput","DynamicStructuredToolInput","StringInputToolSchema","ToolInterface","ToolOutputType","JSONSchema","BaseDynamicToolInput","ContentAndArtifact","StructuredToolParams","ToolSchemaBase","isLangChainTool","isRunnableToolLike","isStructuredTool","isStructuredToolParams","StructuredTool","SchemaT","SchemaInputT","ToolOutputT","SchemaOutputT","Promise","TInput","TConfig","TArg","Tool","ZodString","ZodOptional","ZodTypeAny","ZodObject","ZodEffects","input","NonNullable","DynamicTool","DynamicStructuredTool","Parameters","BaseToolkit","ToolWrapperParams","RunInput","tool"],"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 { ToolInputParsingException } from \"./utils.js\";\nimport { type InferInteropZodInput, type InferInteropZodOutput, 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 } 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, } 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 * 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 // Match the base class signature including the generics and conditional return type\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, // DynamicTool's _call specifically expects a string after schema transformation\n 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 // Match the base class signature\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>;\n"],"mappings":";;;;;;;;;;;;;;;;AAgB4FmB,uBAA9DkB,cAA8DlB,CAAAA,UAArCJ,mBAAqCI,EAAAA,gBAAAA,yBAAAA,CAA0BmB,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