langchain 1.0.0-alpha.8 → 1.0.1

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 (458) hide show
  1. package/CHANGELOG.md +260 -0
  2. package/LICENSE +6 -6
  3. package/README.md +29 -77
  4. package/dist/agents/ReactAgent.cjs +498 -104
  5. package/dist/agents/ReactAgent.cjs.map +1 -1
  6. package/dist/agents/ReactAgent.d.cts +140 -17
  7. package/dist/agents/ReactAgent.d.cts.map +1 -1
  8. package/dist/agents/ReactAgent.d.ts +140 -17
  9. package/dist/agents/ReactAgent.d.ts.map +1 -1
  10. package/dist/agents/ReactAgent.js +501 -107
  11. package/dist/agents/ReactAgent.js.map +1 -1
  12. package/dist/agents/annotation.cjs +34 -152
  13. package/dist/agents/annotation.cjs.map +1 -1
  14. package/dist/agents/annotation.js +36 -150
  15. package/dist/agents/annotation.js.map +1 -1
  16. package/dist/agents/constants.cjs.map +1 -1
  17. package/dist/agents/constants.d.cts +9 -0
  18. package/dist/agents/constants.d.cts.map +1 -0
  19. package/dist/agents/constants.d.ts +9 -0
  20. package/dist/agents/constants.d.ts.map +1 -0
  21. package/dist/agents/constants.js.map +1 -1
  22. package/dist/agents/errors.cjs +2 -1
  23. package/dist/agents/errors.cjs.map +1 -1
  24. package/dist/agents/errors.js +2 -1
  25. package/dist/agents/errors.js.map +1 -1
  26. package/dist/agents/index.cjs +5 -29
  27. package/dist/agents/index.cjs.map +1 -1
  28. package/dist/agents/index.d.cts +157 -128
  29. package/dist/agents/index.d.cts.map +1 -1
  30. package/dist/agents/index.d.ts +157 -128
  31. package/dist/agents/index.d.ts.map +1 -1
  32. package/dist/agents/index.js +5 -27
  33. package/dist/agents/index.js.map +1 -1
  34. package/dist/agents/{middlewareAgent/middleware → middleware}/callLimit.cjs +31 -29
  35. package/dist/agents/middleware/callLimit.cjs.map +1 -0
  36. package/dist/agents/{middlewareAgent/middleware → middleware}/callLimit.d.cts +3 -3
  37. package/dist/agents/middleware/callLimit.d.cts.map +1 -0
  38. package/dist/agents/{middlewareAgent/middleware → middleware}/callLimit.d.ts +3 -3
  39. package/dist/agents/middleware/callLimit.d.ts.map +1 -0
  40. package/dist/agents/{middlewareAgent/middleware → middleware}/callLimit.js +30 -28
  41. package/dist/agents/middleware/callLimit.js.map +1 -0
  42. package/dist/agents/{middlewareAgent/middleware → middleware}/contextEditing.cjs +6 -6
  43. package/dist/agents/middleware/contextEditing.cjs.map +1 -0
  44. package/dist/agents/{middlewareAgent/middleware → middleware}/contextEditing.d.cts +2 -2
  45. package/dist/agents/middleware/contextEditing.d.cts.map +1 -0
  46. package/dist/agents/{middlewareAgent/middleware → middleware}/contextEditing.d.ts +2 -2
  47. package/dist/agents/middleware/contextEditing.d.ts.map +1 -0
  48. package/dist/agents/{middlewareAgent/middleware → middleware}/contextEditing.js +5 -5
  49. package/dist/agents/middleware/contextEditing.js.map +1 -0
  50. package/dist/agents/{middlewareAgent/middleware → middleware}/dynamicSystemPrompt.cjs +6 -6
  51. package/dist/agents/middleware/dynamicSystemPrompt.cjs.map +1 -0
  52. package/dist/agents/{middlewareAgent/middleware → middleware}/dynamicSystemPrompt.d.cts +3 -2
  53. package/dist/agents/middleware/dynamicSystemPrompt.d.cts.map +1 -0
  54. package/dist/agents/{middlewareAgent/middleware → middleware}/dynamicSystemPrompt.d.ts +3 -2
  55. package/dist/agents/middleware/dynamicSystemPrompt.d.ts.map +1 -0
  56. package/dist/agents/{middlewareAgent/middleware → middleware}/dynamicSystemPrompt.js +6 -6
  57. package/dist/agents/middleware/dynamicSystemPrompt.js.map +1 -0
  58. package/dist/agents/middleware/hitl.cjs +406 -0
  59. package/dist/agents/middleware/hitl.cjs.map +1 -0
  60. package/dist/agents/middleware/hitl.d.cts +611 -0
  61. package/dist/agents/middleware/hitl.d.cts.map +1 -0
  62. package/dist/agents/middleware/hitl.d.ts +611 -0
  63. package/dist/agents/middleware/hitl.d.ts.map +1 -0
  64. package/dist/agents/middleware/hitl.js +405 -0
  65. package/dist/agents/middleware/hitl.js.map +1 -0
  66. package/dist/agents/middleware/index.cjs +12 -0
  67. package/dist/agents/middleware/index.js +12 -0
  68. package/dist/agents/{middlewareAgent/middleware → middleware}/llmToolSelector.cjs +7 -7
  69. package/dist/agents/middleware/llmToolSelector.cjs.map +1 -0
  70. package/dist/agents/{middlewareAgent/middleware → middleware}/llmToolSelector.d.cts +2 -2
  71. package/dist/agents/middleware/llmToolSelector.d.cts.map +1 -0
  72. package/dist/agents/{middlewareAgent/middleware → middleware}/llmToolSelector.d.ts +2 -2
  73. package/dist/agents/middleware/llmToolSelector.d.ts.map +1 -0
  74. package/dist/agents/{middlewareAgent/middleware → middleware}/llmToolSelector.js +6 -6
  75. package/dist/agents/middleware/llmToolSelector.js.map +1 -0
  76. package/dist/agents/{middlewareAgent/middleware → middleware}/modelFallback.cjs +29 -22
  77. package/dist/agents/middleware/modelFallback.cjs.map +1 -0
  78. package/dist/agents/{middlewareAgent/middleware → middleware}/modelFallback.d.cts +3 -3
  79. package/dist/agents/middleware/modelFallback.d.cts.map +1 -0
  80. package/dist/agents/{middlewareAgent/middleware → middleware}/modelFallback.d.ts +3 -3
  81. package/dist/agents/middleware/modelFallback.d.ts.map +1 -0
  82. package/dist/agents/{middlewareAgent/middleware → middleware}/modelFallback.js +29 -22
  83. package/dist/agents/middleware/modelFallback.js.map +1 -0
  84. package/dist/agents/{middlewareAgent/middleware → middleware}/piiRedaction.cjs +12 -12
  85. package/dist/agents/middleware/piiRedaction.cjs.map +1 -0
  86. package/dist/agents/{middlewareAgent/middleware → middleware}/piiRedaction.d.cts +4 -4
  87. package/dist/agents/middleware/piiRedaction.d.cts.map +1 -0
  88. package/dist/agents/{middlewareAgent/middleware → middleware}/piiRedaction.d.ts +4 -4
  89. package/dist/agents/middleware/piiRedaction.d.ts.map +1 -0
  90. package/dist/agents/{middlewareAgent/middleware → middleware}/piiRedaction.js +10 -10
  91. package/dist/agents/middleware/piiRedaction.js.map +1 -0
  92. package/dist/agents/{middlewareAgent/middleware → middleware}/promptCaching.cjs +27 -24
  93. package/dist/agents/middleware/promptCaching.cjs.map +1 -0
  94. package/dist/agents/{middlewareAgent/middleware → middleware}/promptCaching.d.cts +3 -3
  95. package/dist/agents/middleware/promptCaching.d.cts.map +1 -0
  96. package/dist/agents/{middlewareAgent/middleware → middleware}/promptCaching.d.ts +3 -3
  97. package/dist/agents/middleware/promptCaching.d.ts.map +1 -0
  98. package/dist/agents/{middlewareAgent/middleware → middleware}/promptCaching.js +26 -23
  99. package/dist/agents/middleware/promptCaching.js.map +1 -0
  100. package/dist/agents/{middlewareAgent/middleware → middleware}/summarization.cjs +7 -12
  101. package/dist/agents/middleware/summarization.cjs.map +1 -0
  102. package/dist/agents/{middlewareAgent/middleware → middleware}/summarization.d.cts +3 -3
  103. package/dist/agents/middleware/summarization.d.cts.map +1 -0
  104. package/dist/agents/{middlewareAgent/middleware → middleware}/summarization.d.ts +3 -3
  105. package/dist/agents/middleware/summarization.d.ts.map +1 -0
  106. package/dist/agents/{middlewareAgent/middleware → middleware}/summarization.js +5 -10
  107. package/dist/agents/middleware/summarization.js.map +1 -0
  108. package/dist/agents/middleware/todoListMiddleware.cjs +314 -0
  109. package/dist/agents/middleware/todoListMiddleware.cjs.map +1 -0
  110. package/dist/agents/middleware/todoListMiddleware.d.cts +75 -0
  111. package/dist/agents/middleware/todoListMiddleware.d.cts.map +1 -0
  112. package/dist/agents/middleware/todoListMiddleware.d.ts +75 -0
  113. package/dist/agents/middleware/todoListMiddleware.d.ts.map +1 -0
  114. package/dist/agents/middleware/todoListMiddleware.js +312 -0
  115. package/dist/agents/middleware/todoListMiddleware.js.map +1 -0
  116. package/dist/agents/{middlewareAgent/middleware → middleware}/toolCallLimit.cjs +32 -30
  117. package/dist/agents/middleware/toolCallLimit.cjs.map +1 -0
  118. package/dist/agents/{middlewareAgent/middleware → middleware}/toolCallLimit.d.cts +3 -3
  119. package/dist/agents/middleware/toolCallLimit.d.cts.map +1 -0
  120. package/dist/agents/{middlewareAgent/middleware → middleware}/toolCallLimit.d.ts +3 -3
  121. package/dist/agents/middleware/toolCallLimit.d.ts.map +1 -0
  122. package/dist/agents/{middlewareAgent/middleware → middleware}/toolCallLimit.js +31 -29
  123. package/dist/agents/middleware/toolCallLimit.js.map +1 -0
  124. package/dist/agents/middleware/types.d.cts +354 -0
  125. package/dist/agents/middleware/types.d.cts.map +1 -0
  126. package/dist/agents/middleware/types.d.ts +354 -0
  127. package/dist/agents/middleware/types.d.ts.map +1 -0
  128. package/dist/agents/{middlewareAgent/middleware → middleware}/utils.cjs +11 -1
  129. package/dist/agents/middleware/utils.cjs.map +1 -0
  130. package/dist/agents/{middlewareAgent/middleware → middleware}/utils.d.cts +1 -1
  131. package/dist/agents/middleware/utils.d.cts.map +1 -0
  132. package/dist/agents/{middlewareAgent/middleware → middleware}/utils.d.ts +1 -1
  133. package/dist/agents/middleware/utils.d.ts.map +1 -0
  134. package/dist/agents/{middlewareAgent/middleware → middleware}/utils.js +10 -2
  135. package/dist/agents/middleware/utils.js.map +1 -0
  136. package/dist/agents/{middlewareAgent/middleware.cjs → middleware.cjs} +11 -8
  137. package/dist/agents/middleware.cjs.map +1 -0
  138. package/dist/agents/middleware.d.cts +185 -0
  139. package/dist/agents/middleware.d.cts.map +1 -0
  140. package/dist/agents/middleware.d.ts +185 -0
  141. package/dist/agents/middleware.d.ts.map +1 -0
  142. package/dist/agents/{middlewareAgent/middleware.js → middleware.js} +11 -8
  143. package/dist/agents/middleware.js.map +1 -0
  144. package/dist/agents/nodes/AfterAgentNode.cjs +29 -0
  145. package/dist/agents/nodes/AfterAgentNode.cjs.map +1 -0
  146. package/dist/agents/nodes/AfterAgentNode.js +29 -0
  147. package/dist/agents/nodes/AfterAgentNode.js.map +1 -0
  148. package/dist/agents/{middlewareAgent/nodes/AfterModalNode.cjs → nodes/AfterModelNode.cjs} +6 -6
  149. package/dist/agents/nodes/AfterModelNode.cjs.map +1 -0
  150. package/dist/agents/{middlewareAgent/nodes/AfterModalNode.js → nodes/AfterModelNode.js} +6 -6
  151. package/dist/agents/nodes/AfterModelNode.js.map +1 -0
  152. package/dist/agents/nodes/AgentNode.cjs +203 -71
  153. package/dist/agents/nodes/AgentNode.cjs.map +1 -1
  154. package/dist/agents/nodes/AgentNode.js +205 -73
  155. package/dist/agents/nodes/AgentNode.js.map +1 -1
  156. package/dist/agents/nodes/BeforeAgentNode.cjs +29 -0
  157. package/dist/agents/nodes/BeforeAgentNode.cjs.map +1 -0
  158. package/dist/agents/nodes/BeforeAgentNode.js +29 -0
  159. package/dist/agents/nodes/BeforeAgentNode.js.map +1 -0
  160. package/dist/agents/{middlewareAgent/nodes/BeforeModalNode.cjs → nodes/BeforeModelNode.cjs} +6 -4
  161. package/dist/agents/nodes/BeforeModelNode.cjs.map +1 -0
  162. package/dist/agents/{middlewareAgent/nodes/BeforeModalNode.js → nodes/BeforeModelNode.js} +6 -4
  163. package/dist/agents/nodes/BeforeModelNode.js.map +1 -0
  164. package/dist/agents/nodes/ToolNode.cjs +163 -52
  165. package/dist/agents/nodes/ToolNode.cjs.map +1 -1
  166. package/dist/agents/nodes/ToolNode.js +164 -53
  167. package/dist/agents/nodes/ToolNode.js.map +1 -1
  168. package/dist/agents/{middlewareAgent/nodes → nodes}/middleware.cjs +36 -10
  169. package/dist/agents/nodes/middleware.cjs.map +1 -0
  170. package/dist/agents/{middlewareAgent/nodes → nodes}/middleware.js +35 -9
  171. package/dist/agents/nodes/middleware.js.map +1 -0
  172. package/dist/agents/nodes/types.d.cts +72 -0
  173. package/dist/agents/nodes/types.d.cts.map +1 -0
  174. package/dist/agents/nodes/types.d.ts +72 -0
  175. package/dist/agents/nodes/types.d.ts.map +1 -0
  176. package/dist/agents/nodes/utils.cjs +64 -0
  177. package/dist/agents/nodes/utils.cjs.map +1 -1
  178. package/dist/agents/nodes/utils.js +62 -1
  179. package/dist/agents/nodes/utils.js.map +1 -1
  180. package/dist/agents/responses.cjs +1 -1
  181. package/dist/agents/responses.cjs.map +1 -1
  182. package/dist/agents/responses.d.cts +9 -2
  183. package/dist/agents/responses.d.cts.map +1 -1
  184. package/dist/agents/responses.d.ts +8 -1
  185. package/dist/agents/responses.d.ts.map +1 -1
  186. package/dist/agents/responses.js +1 -1
  187. package/dist/agents/responses.js.map +1 -1
  188. package/dist/agents/runtime.d.cts +123 -0
  189. package/dist/agents/runtime.d.cts.map +1 -0
  190. package/dist/agents/runtime.d.ts +123 -0
  191. package/dist/agents/runtime.d.ts.map +1 -0
  192. package/dist/agents/tests/utils.cjs +13 -5
  193. package/dist/agents/tests/utils.cjs.map +1 -1
  194. package/dist/agents/tests/utils.d.cts +17 -8
  195. package/dist/agents/tests/utils.d.cts.map +1 -1
  196. package/dist/agents/tests/utils.d.ts +14 -5
  197. package/dist/agents/tests/utils.d.ts.map +1 -1
  198. package/dist/agents/tests/utils.js +13 -5
  199. package/dist/agents/tests/utils.js.map +1 -1
  200. package/dist/agents/tools.d.cts +9 -0
  201. package/dist/agents/tools.d.cts.map +1 -0
  202. package/dist/agents/tools.d.ts +9 -0
  203. package/dist/agents/tools.d.ts.map +1 -0
  204. package/dist/agents/types.d.cts +163 -119
  205. package/dist/agents/types.d.cts.map +1 -1
  206. package/dist/agents/types.d.ts +163 -119
  207. package/dist/agents/types.d.ts.map +1 -1
  208. package/dist/agents/utils.cjs +141 -38
  209. package/dist/agents/utils.cjs.map +1 -1
  210. package/dist/agents/utils.js +142 -40
  211. package/dist/agents/utils.js.map +1 -1
  212. package/dist/chat_models/universal.cjs +4 -0
  213. package/dist/chat_models/universal.cjs.map +1 -1
  214. package/dist/chat_models/universal.d.cts +6 -2
  215. package/dist/chat_models/universal.d.cts.map +1 -1
  216. package/dist/chat_models/universal.d.ts +4 -0
  217. package/dist/chat_models/universal.d.ts.map +1 -1
  218. package/dist/chat_models/universal.js +4 -0
  219. package/dist/chat_models/universal.js.map +1 -1
  220. package/dist/hub/base.cjs +4 -3
  221. package/dist/hub/base.cjs.map +1 -1
  222. package/dist/hub/base.d.cts +0 -4
  223. package/dist/hub/base.d.cts.map +1 -1
  224. package/dist/hub/base.d.ts +0 -4
  225. package/dist/hub/base.d.ts.map +1 -1
  226. package/dist/hub/base.js +4 -3
  227. package/dist/hub/base.js.map +1 -1
  228. package/dist/index.cjs +23 -43
  229. package/dist/index.cjs.map +1 -1
  230. package/dist/index.d.cts +21 -21
  231. package/dist/index.d.ts +21 -21
  232. package/dist/index.js +17 -26
  233. package/dist/index.js.map +1 -1
  234. package/dist/load/import_map.cjs +1 -7
  235. package/dist/load/import_map.cjs.map +1 -1
  236. package/dist/load/import_map.js +1 -7
  237. package/dist/load/import_map.js.map +1 -1
  238. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/client.cjs +74 -18
  239. package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/client.cjs.map +1 -0
  240. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/client.js +75 -19
  241. package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/client.js.map +1 -0
  242. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/env.cjs +1 -1
  243. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/env.cjs.map +1 -1
  244. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/env.js +1 -1
  245. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/env.js.map +1 -1
  246. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/experimental/otel/constants.cjs +1 -1
  247. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/experimental/otel/constants.cjs.map +1 -1
  248. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/experimental/otel/constants.js +1 -1
  249. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/experimental/otel/constants.js.map +1 -1
  250. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/experimental/otel/translator.cjs +1 -1
  251. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/experimental/otel/translator.cjs.map +1 -1
  252. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/experimental/otel/translator.js +1 -1
  253. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/experimental/otel/translator.js.map +1 -1
  254. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/index.cjs +2 -2
  255. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/index.cjs.map +1 -1
  256. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/index.js +2 -2
  257. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/index.js.map +1 -1
  258. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/run_trees.cjs +7 -5
  259. package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/run_trees.cjs.map +1 -0
  260. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/run_trees.js +7 -5
  261. package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/run_trees.js.map +1 -0
  262. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/singletons/constants.cjs +1 -1
  263. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/singletons/constants.cjs.map +1 -1
  264. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/singletons/constants.js +1 -1
  265. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/singletons/constants.js.map +1 -1
  266. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/singletons/fetch.cjs +1 -1
  267. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/singletons/fetch.cjs.map +1 -1
  268. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/singletons/fetch.js +1 -1
  269. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/singletons/fetch.js.map +1 -1
  270. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/singletons/otel.cjs +1 -1
  271. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/singletons/otel.cjs.map +1 -1
  272. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/singletons/otel.js +1 -1
  273. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/singletons/otel.js.map +1 -1
  274. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/_uuid.cjs +1 -1
  275. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/_uuid.cjs.map +1 -1
  276. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/_uuid.js +1 -1
  277. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/_uuid.js.map +1 -1
  278. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/async_caller.cjs +1 -1
  279. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/async_caller.cjs.map +1 -1
  280. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/async_caller.js +1 -1
  281. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/async_caller.js.map +1 -1
  282. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/env.cjs +19 -23
  283. package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/env.cjs.map +1 -0
  284. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/env.js +19 -23
  285. package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/env.js.map +1 -0
  286. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/error.cjs +16 -3
  287. package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/error.cjs.map +1 -0
  288. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/error.js +16 -3
  289. package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/error.js.map +1 -0
  290. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/fast-safe-stringify/index.cjs +1 -1
  291. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/fast-safe-stringify/index.cjs.map +1 -1
  292. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/fast-safe-stringify/index.js +1 -1
  293. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/fast-safe-stringify/index.js.map +1 -1
  294. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/messages.cjs +1 -1
  295. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/messages.cjs.map +1 -1
  296. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/messages.js +1 -1
  297. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/messages.js.map +1 -1
  298. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/project.cjs +1 -1
  299. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/project.cjs.map +1 -1
  300. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/project.js +1 -1
  301. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/project.js.map +1 -1
  302. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/prompts.cjs +1 -1
  303. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/prompts.cjs.map +1 -1
  304. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/prompts.js +1 -1
  305. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/prompts.js.map +1 -1
  306. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/warn.cjs +1 -1
  307. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/warn.cjs.map +1 -1
  308. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/warn.js +1 -1
  309. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/warn.js.map +1 -1
  310. package/package.json +30 -63
  311. package/dist/agents/RunnableCallable.d.cts +0 -41
  312. package/dist/agents/RunnableCallable.d.cts.map +0 -1
  313. package/dist/agents/RunnableCallable.d.ts +0 -41
  314. package/dist/agents/RunnableCallable.d.ts.map +0 -1
  315. package/dist/agents/annotation.d.cts +0 -52
  316. package/dist/agents/annotation.d.cts.map +0 -1
  317. package/dist/agents/annotation.d.ts +0 -52
  318. package/dist/agents/annotation.d.ts.map +0 -1
  319. package/dist/agents/createAgent.cjs +0 -10
  320. package/dist/agents/createAgent.cjs.map +0 -1
  321. package/dist/agents/createAgent.js +0 -10
  322. package/dist/agents/createAgent.js.map +0 -1
  323. package/dist/agents/interrupt.cjs +0 -2
  324. package/dist/agents/interrupt.d.cts +0 -81
  325. package/dist/agents/interrupt.d.cts.map +0 -1
  326. package/dist/agents/interrupt.d.ts +0 -81
  327. package/dist/agents/interrupt.d.ts.map +0 -1
  328. package/dist/agents/interrupt.js +0 -3
  329. package/dist/agents/middlewareAgent/ReactAgent.cjs +0 -579
  330. package/dist/agents/middlewareAgent/ReactAgent.cjs.map +0 -1
  331. package/dist/agents/middlewareAgent/ReactAgent.d.cts +0 -234
  332. package/dist/agents/middlewareAgent/ReactAgent.d.cts.map +0 -1
  333. package/dist/agents/middlewareAgent/ReactAgent.d.ts +0 -234
  334. package/dist/agents/middlewareAgent/ReactAgent.d.ts.map +0 -1
  335. package/dist/agents/middlewareAgent/ReactAgent.js +0 -578
  336. package/dist/agents/middlewareAgent/ReactAgent.js.map +0 -1
  337. package/dist/agents/middlewareAgent/annotation.cjs +0 -45
  338. package/dist/agents/middlewareAgent/annotation.cjs.map +0 -1
  339. package/dist/agents/middlewareAgent/annotation.js +0 -44
  340. package/dist/agents/middlewareAgent/annotation.js.map +0 -1
  341. package/dist/agents/middlewareAgent/constants.d.cts +0 -5
  342. package/dist/agents/middlewareAgent/constants.d.cts.map +0 -1
  343. package/dist/agents/middlewareAgent/constants.d.ts +0 -5
  344. package/dist/agents/middlewareAgent/constants.d.ts.map +0 -1
  345. package/dist/agents/middlewareAgent/index.cjs +0 -11
  346. package/dist/agents/middlewareAgent/index.cjs.map +0 -1
  347. package/dist/agents/middlewareAgent/index.js +0 -11
  348. package/dist/agents/middlewareAgent/index.js.map +0 -1
  349. package/dist/agents/middlewareAgent/middleware/callLimit.cjs.map +0 -1
  350. package/dist/agents/middlewareAgent/middleware/callLimit.d.cts.map +0 -1
  351. package/dist/agents/middlewareAgent/middleware/callLimit.d.ts.map +0 -1
  352. package/dist/agents/middlewareAgent/middleware/callLimit.js.map +0 -1
  353. package/dist/agents/middlewareAgent/middleware/contextEditing.cjs.map +0 -1
  354. package/dist/agents/middlewareAgent/middleware/contextEditing.d.cts.map +0 -1
  355. package/dist/agents/middlewareAgent/middleware/contextEditing.d.ts.map +0 -1
  356. package/dist/agents/middlewareAgent/middleware/contextEditing.js.map +0 -1
  357. package/dist/agents/middlewareAgent/middleware/dynamicSystemPrompt.cjs.map +0 -1
  358. package/dist/agents/middlewareAgent/middleware/dynamicSystemPrompt.d.cts.map +0 -1
  359. package/dist/agents/middlewareAgent/middleware/dynamicSystemPrompt.d.ts.map +0 -1
  360. package/dist/agents/middlewareAgent/middleware/dynamicSystemPrompt.js.map +0 -1
  361. package/dist/agents/middlewareAgent/middleware/hitl.cjs +0 -341
  362. package/dist/agents/middlewareAgent/middleware/hitl.cjs.map +0 -1
  363. package/dist/agents/middlewareAgent/middleware/hitl.d.cts +0 -524
  364. package/dist/agents/middlewareAgent/middleware/hitl.d.cts.map +0 -1
  365. package/dist/agents/middlewareAgent/middleware/hitl.d.ts +0 -524
  366. package/dist/agents/middlewareAgent/middleware/hitl.d.ts.map +0 -1
  367. package/dist/agents/middlewareAgent/middleware/hitl.js +0 -340
  368. package/dist/agents/middlewareAgent/middleware/hitl.js.map +0 -1
  369. package/dist/agents/middlewareAgent/middleware/index.cjs +0 -52
  370. package/dist/agents/middlewareAgent/middleware/index.cjs.map +0 -1
  371. package/dist/agents/middlewareAgent/middleware/index.d.cts +0 -13
  372. package/dist/agents/middlewareAgent/middleware/index.d.ts +0 -13
  373. package/dist/agents/middlewareAgent/middleware/index.js +0 -34
  374. package/dist/agents/middlewareAgent/middleware/index.js.map +0 -1
  375. package/dist/agents/middlewareAgent/middleware/llmToolSelector.cjs.map +0 -1
  376. package/dist/agents/middlewareAgent/middleware/llmToolSelector.d.cts.map +0 -1
  377. package/dist/agents/middlewareAgent/middleware/llmToolSelector.d.ts.map +0 -1
  378. package/dist/agents/middlewareAgent/middleware/llmToolSelector.js.map +0 -1
  379. package/dist/agents/middlewareAgent/middleware/modelFallback.cjs.map +0 -1
  380. package/dist/agents/middlewareAgent/middleware/modelFallback.d.cts.map +0 -1
  381. package/dist/agents/middlewareAgent/middleware/modelFallback.d.ts.map +0 -1
  382. package/dist/agents/middlewareAgent/middleware/modelFallback.js.map +0 -1
  383. package/dist/agents/middlewareAgent/middleware/piiRedaction.cjs.map +0 -1
  384. package/dist/agents/middlewareAgent/middleware/piiRedaction.d.cts.map +0 -1
  385. package/dist/agents/middlewareAgent/middleware/piiRedaction.d.ts.map +0 -1
  386. package/dist/agents/middlewareAgent/middleware/piiRedaction.js.map +0 -1
  387. package/dist/agents/middlewareAgent/middleware/promptCaching.cjs.map +0 -1
  388. package/dist/agents/middlewareAgent/middleware/promptCaching.d.cts.map +0 -1
  389. package/dist/agents/middlewareAgent/middleware/promptCaching.d.ts.map +0 -1
  390. package/dist/agents/middlewareAgent/middleware/promptCaching.js.map +0 -1
  391. package/dist/agents/middlewareAgent/middleware/summarization.cjs.map +0 -1
  392. package/dist/agents/middlewareAgent/middleware/summarization.d.cts.map +0 -1
  393. package/dist/agents/middlewareAgent/middleware/summarization.d.ts.map +0 -1
  394. package/dist/agents/middlewareAgent/middleware/summarization.js.map +0 -1
  395. package/dist/agents/middlewareAgent/middleware/toolCallLimit.cjs.map +0 -1
  396. package/dist/agents/middlewareAgent/middleware/toolCallLimit.d.cts.map +0 -1
  397. package/dist/agents/middlewareAgent/middleware/toolCallLimit.d.ts.map +0 -1
  398. package/dist/agents/middlewareAgent/middleware/toolCallLimit.js.map +0 -1
  399. package/dist/agents/middlewareAgent/middleware/utils.cjs.map +0 -1
  400. package/dist/agents/middlewareAgent/middleware/utils.d.cts.map +0 -1
  401. package/dist/agents/middlewareAgent/middleware/utils.d.ts.map +0 -1
  402. package/dist/agents/middlewareAgent/middleware/utils.js.map +0 -1
  403. package/dist/agents/middlewareAgent/middleware.cjs.map +0 -1
  404. package/dist/agents/middlewareAgent/middleware.d.cts +0 -117
  405. package/dist/agents/middlewareAgent/middleware.d.cts.map +0 -1
  406. package/dist/agents/middlewareAgent/middleware.d.ts +0 -117
  407. package/dist/agents/middlewareAgent/middleware.d.ts.map +0 -1
  408. package/dist/agents/middlewareAgent/middleware.js.map +0 -1
  409. package/dist/agents/middlewareAgent/nodes/AfterModalNode.cjs.map +0 -1
  410. package/dist/agents/middlewareAgent/nodes/AfterModalNode.js.map +0 -1
  411. package/dist/agents/middlewareAgent/nodes/AgentNode.cjs +0 -468
  412. package/dist/agents/middlewareAgent/nodes/AgentNode.cjs.map +0 -1
  413. package/dist/agents/middlewareAgent/nodes/AgentNode.js +0 -467
  414. package/dist/agents/middlewareAgent/nodes/AgentNode.js.map +0 -1
  415. package/dist/agents/middlewareAgent/nodes/BeforeModalNode.cjs.map +0 -1
  416. package/dist/agents/middlewareAgent/nodes/BeforeModalNode.js.map +0 -1
  417. package/dist/agents/middlewareAgent/nodes/middleware.cjs.map +0 -1
  418. package/dist/agents/middlewareAgent/nodes/middleware.js.map +0 -1
  419. package/dist/agents/middlewareAgent/nodes/utils.cjs +0 -66
  420. package/dist/agents/middlewareAgent/nodes/utils.cjs.map +0 -1
  421. package/dist/agents/middlewareAgent/nodes/utils.js +0 -63
  422. package/dist/agents/middlewareAgent/nodes/utils.js.map +0 -1
  423. package/dist/agents/middlewareAgent/types.d.cts +0 -472
  424. package/dist/agents/middlewareAgent/types.d.cts.map +0 -1
  425. package/dist/agents/middlewareAgent/types.d.ts +0 -472
  426. package/dist/agents/middlewareAgent/types.d.ts.map +0 -1
  427. package/dist/agents/nodes/ToolNode.d.cts +0 -97
  428. package/dist/agents/nodes/ToolNode.d.cts.map +0 -1
  429. package/dist/agents/nodes/ToolNode.d.ts +0 -97
  430. package/dist/agents/nodes/ToolNode.d.ts.map +0 -1
  431. package/dist/agents/types.cjs +0 -7
  432. package/dist/agents/types.cjs.map +0 -1
  433. package/dist/agents/types.js +0 -6
  434. package/dist/agents/types.js.map +0 -1
  435. package/dist/embeddings/cache_backed.cjs +0 -140
  436. package/dist/embeddings/cache_backed.cjs.map +0 -1
  437. package/dist/embeddings/cache_backed.d.cts +0 -107
  438. package/dist/embeddings/cache_backed.d.cts.map +0 -1
  439. package/dist/embeddings/cache_backed.d.ts +0 -107
  440. package/dist/embeddings/cache_backed.d.ts.map +0 -1
  441. package/dist/embeddings/cache_backed.js +0 -134
  442. package/dist/embeddings/cache_backed.js.map +0 -1
  443. package/dist/embeddings/fake.cjs +0 -22
  444. package/dist/embeddings/fake.cjs.map +0 -1
  445. package/dist/embeddings/fake.d.cts +0 -1
  446. package/dist/embeddings/fake.d.ts +0 -1
  447. package/dist/embeddings/fake.js +0 -12
  448. package/dist/embeddings/fake.js.map +0 -1
  449. package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/client.cjs.map +0 -1
  450. package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/client.js.map +0 -1
  451. package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/run_trees.cjs.map +0 -1
  452. package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/run_trees.js.map +0 -1
  453. package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/env.cjs.map +0 -1
  454. package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/env.js.map +0 -1
  455. package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/error.cjs.map +0 -1
  456. package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/error.js.map +0 -1
  457. /package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/index.cjs +0 -0
  458. /package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/index.js +0 -0
@@ -1,468 +0,0 @@
1
- const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
- const require_chat_models_universal = require('../../../chat_models/universal.cjs');
3
- const require_errors = require('../../errors.cjs');
4
- const require_utils = require('../../utils.cjs');
5
- const require_RunnableCallable = require('../../RunnableCallable.cjs');
6
- const require_utils$1 = require('../../nodes/utils.cjs');
7
- const require_withAgentName = require('../../withAgentName.cjs');
8
- const require_responses = require('../../responses.cjs');
9
- const __langchain_core_messages = require_rolldown_runtime.__toESM(require("@langchain/core/messages"));
10
- const __langchain_langgraph = require_rolldown_runtime.__toESM(require("@langchain/langgraph"));
11
- const __langchain_core_utils_types = require_rolldown_runtime.__toESM(require("@langchain/core/utils/types"));
12
- const zod_v3 = require_rolldown_runtime.__toESM(require("zod/v3"));
13
-
14
- //#region src/agents/middlewareAgent/nodes/AgentNode.ts
15
- var AgentNode = class extends require_RunnableCallable.RunnableCallable {
16
- #options;
17
- #runState = { runModelCallCount: 0 };
18
- constructor(options) {
19
- super({
20
- name: options.name ?? "model",
21
- func: (input, config) => this.#run(input, config)
22
- });
23
- this.#options = options;
24
- }
25
- /**
26
- * Returns response format primtivies based on given model and response format provided by the user.
27
- *
28
- * If the the user selects a tool output:
29
- * - return a record of tools to extract structured output from the model's response
30
- *
31
- * if the the user selects a native schema output or if the model supports JSON schema output:
32
- * - return a provider strategy to extract structured output from the model's response
33
- *
34
- * @param model - The model to get the response format for.
35
- * @returns The response format.
36
- */
37
- #getResponseFormat(model) {
38
- if (!this.#options.responseFormat) return void 0;
39
- const strategies = require_responses.transformResponseFormat(this.#options.responseFormat, void 0, model);
40
- /**
41
- * we either define a list of provider strategies or a list of tool strategies
42
- */
43
- const isProviderStrategy = strategies.every((format) => format instanceof require_responses.ProviderStrategy);
44
- /**
45
- * Populate a list of structured tool info.
46
- */
47
- if (!isProviderStrategy) return {
48
- type: "tool",
49
- tools: strategies.filter((format) => format instanceof require_responses.ToolStrategy).reduce((acc, format) => {
50
- acc[format.name] = format;
51
- return acc;
52
- }, {})
53
- };
54
- return {
55
- type: "native",
56
- strategy: strategies[0]
57
- };
58
- }
59
- async #run(state, config) {
60
- /**
61
- * Check if we just executed a returnDirect tool
62
- * If so, we should generate structured response (if needed) and stop
63
- */
64
- const lastMessage = state.messages.at(-1);
65
- if (lastMessage && __langchain_core_messages.ToolMessage.isInstance(lastMessage) && lastMessage.name && this.#options.shouldReturnDirect.has(lastMessage.name))
66
- /**
67
- * return directly without invoking the model again
68
- */
69
- return { messages: [] };
70
- const privateState = this.getState()._privateState;
71
- const response = await this.#invokeModel(state, config);
72
- this.#runState.runModelCallCount++;
73
- const _privateState = {
74
- ...privateState,
75
- threadLevelCallCount: privateState.threadLevelCallCount + 1
76
- };
77
- /**
78
- * if we were able to generate a structured response, return it
79
- */
80
- if ("structuredResponse" in response) return {
81
- messages: [...state.messages, ...response.messages || []],
82
- structuredResponse: response.structuredResponse,
83
- _privateState
84
- };
85
- /**
86
- * if we need to direct the agent to the model, return the update
87
- */
88
- if (response instanceof __langchain_langgraph.Command) return response;
89
- response.name = this.name;
90
- response.lc_kwargs.name = this.name;
91
- if (this.#areMoreStepsNeeded(state, response)) return {
92
- messages: [new __langchain_core_messages.AIMessage({
93
- content: "Sorry, need more steps to process this request.",
94
- name: this.name,
95
- id: response.id
96
- })],
97
- _privateState
98
- };
99
- return {
100
- messages: [response],
101
- _privateState
102
- };
103
- }
104
- /**
105
- * Derive the model from the options.
106
- * @param state - The state of the agent.
107
- * @param config - The config of the agent.
108
- * @returns The model.
109
- */
110
- #deriveModel() {
111
- if (typeof this.#options.model === "string") return require_chat_models_universal.initChatModel(this.#options.model);
112
- if (this.#options.model) return this.#options.model;
113
- throw new Error("No model option was provided, either via `model` option.");
114
- }
115
- async #invokeModel(state, config, options = {}) {
116
- const model = await this.#deriveModel();
117
- /**
118
- * Execute modifyModelRequest hooks from beforeModelNodes
119
- */
120
- let preparedOptions = await this.#executePrepareModelRequestHooks(model, state, config);
121
- /**
122
- * Retry loop for model invocation with error handling
123
- * Hard limit of 100 attempts to prevent infinite loops from buggy middleware
124
- */
125
- const maxAttempts = 100;
126
- for (let attempt = 1; attempt <= maxAttempts; attempt++) try {
127
- /**
128
- * If user provides a model in the preparedOptions, use it,
129
- * otherwise use the model from the options
130
- */
131
- const finalModel = preparedOptions?.model ?? model;
132
- /**
133
- * Check if the LLM already has bound tools and throw if it does.
134
- */
135
- require_utils.validateLLMHasNoBoundTools(finalModel);
136
- const structuredResponseFormat = this.#getResponseFormat(finalModel);
137
- const modelWithTools = await this.#bindTools(finalModel, preparedOptions, structuredResponseFormat);
138
- let modelInput = this.#getModelInputState(state);
139
- /**
140
- * Use messages from preparedOptions if provided
141
- */
142
- if (preparedOptions?.messages) modelInput = {
143
- ...modelInput,
144
- messages: preparedOptions.messages
145
- };
146
- const signal = require_utils$1.mergeAbortSignals(this.#options.signal, config.signal);
147
- const invokeConfig = {
148
- ...config,
149
- signal
150
- };
151
- const response = await modelWithTools.invoke(modelInput, invokeConfig);
152
- /**
153
- * if the user requests a native schema output, try to parse the response
154
- * and return the structured response if it is valid
155
- */
156
- if (structuredResponseFormat?.type === "native") {
157
- const structuredResponse = structuredResponseFormat.strategy.parse(response);
158
- if (structuredResponse) return {
159
- structuredResponse,
160
- messages: [response]
161
- };
162
- return response;
163
- }
164
- if (!structuredResponseFormat || !response.tool_calls) return response;
165
- const toolCalls = response.tool_calls.filter((call) => call.name in structuredResponseFormat.tools);
166
- /**
167
- * if there were not structured tool calls, we can return the response
168
- */
169
- if (toolCalls.length === 0) return response;
170
- /**
171
- * if there were multiple structured tool calls, we should throw an error as this
172
- * scenario is not defined/supported.
173
- */
174
- if (toolCalls.length > 1) return this.#handleMultipleStructuredOutputs(response, toolCalls, structuredResponseFormat);
175
- const toolStrategy = structuredResponseFormat.tools[toolCalls[0].name];
176
- const toolMessageContent = toolStrategy?.options?.toolMessageContent;
177
- return this.#handleSingleStructuredOutput(response, toolCalls[0], structuredResponseFormat, toolMessageContent ?? options.lastMessage);
178
- } catch (error) {
179
- const retryMiddleware = this.#options.retryModelRequestHookMiddleware ?? [];
180
- let shouldRetry = false;
181
- for (const [middleware, getMiddlewareState] of retryMiddleware) if (middleware.retryModelRequest) {
182
- /**
183
- * Cast config to LangGraphRunnableConfig to access LangGraph-specific properties
184
- */
185
- const lgConfig = config;
186
- /**
187
- * Merge context with default context of middleware
188
- */
189
- const context = middleware.contextSchema ? (0, __langchain_core_utils_types.interopParse)(middleware.contextSchema, lgConfig?.context || {}) : lgConfig?.context;
190
- /**
191
- * Create runtime
192
- */
193
- const privateState = this.getState()._privateState;
194
- const runtime = {
195
- ...privateState,
196
- context,
197
- writer: lgConfig.writer,
198
- interrupt: lgConfig.interrupt,
199
- signal: lgConfig.signal
200
- };
201
- const retryRequest = await middleware.retryModelRequest(
202
- error,
203
- {
204
- model: preparedOptions?.model ?? model,
205
- systemPrompt: preparedOptions?.systemPrompt,
206
- messages: preparedOptions?.messages ?? state.messages,
207
- tools: this.#options.toolClasses
208
- },
209
- {
210
- ...getMiddlewareState(),
211
- messages: state.messages
212
- },
213
- /**
214
- * ensure runtime is frozen to prevent modifications
215
- */
216
- Object.freeze({
217
- ...runtime,
218
- context
219
- }),
220
- attempt
221
- );
222
- if (retryRequest) {
223
- preparedOptions = retryRequest;
224
- shouldRetry = true;
225
- break;
226
- }
227
- }
228
- if (!shouldRetry) throw error;
229
- }
230
- throw new Error(`Maximum retry attempts (${maxAttempts}) exceeded`);
231
- }
232
- /**
233
- * If the model returns multiple structured outputs, we need to handle it.
234
- * @param response - The response from the model
235
- * @param toolCalls - The tool calls that were made
236
- * @returns The response from the model
237
- */
238
- #handleMultipleStructuredOutputs(response, toolCalls, responseFormat) {
239
- const multipleStructuredOutputsError = new require_errors.MultipleStructuredOutputsError(toolCalls.map((call) => call.name));
240
- return this.#handleToolStrategyError(multipleStructuredOutputsError, response, toolCalls[0], responseFormat);
241
- }
242
- /**
243
- * If the model returns a single structured output, we need to handle it.
244
- * @param toolCall - The tool call that was made
245
- * @returns The structured response and a message to the LLM if needed
246
- */
247
- #handleSingleStructuredOutput(response, toolCall, responseFormat, lastMessage) {
248
- const tool = responseFormat.tools[toolCall.name];
249
- try {
250
- const structuredResponse = tool.parse(toolCall.args);
251
- return {
252
- structuredResponse,
253
- messages: [response, new __langchain_core_messages.AIMessage(lastMessage ?? `Returning structured response: ${JSON.stringify(structuredResponse)}`)]
254
- };
255
- } catch (error) {
256
- return this.#handleToolStrategyError(error, response, toolCall, responseFormat);
257
- }
258
- }
259
- async #handleToolStrategyError(error, response, toolCall, responseFormat) {
260
- /**
261
- * Using the `errorHandler` option of the first `ToolStrategy` entry is sufficient here.
262
- * There is technically only one `ToolStrategy` entry in `structuredToolInfo` if the user
263
- * uses `toolStrategy` to define the response format. If the user applies a list of json
264
- * schema objects, these will be transformed into multiple `ToolStrategy` entries but all
265
- * with the same `handleError` option.
266
- */
267
- const errorHandler = Object.values(responseFormat.tools).at(0)?.options?.handleError;
268
- const toolCallId = toolCall.id;
269
- if (!toolCallId) throw new Error("Tool call ID is required to handle tool output errors. Please provide a tool call ID.");
270
- /**
271
- * retry if:
272
- */
273
- if (typeof errorHandler === "boolean" && errorHandler || Array.isArray(errorHandler) && errorHandler.some((h) => h instanceof require_errors.MultipleStructuredOutputsError)) return new __langchain_langgraph.Command({
274
- update: { messages: [response, new __langchain_core_messages.ToolMessage({
275
- content: error.message,
276
- tool_call_id: toolCallId
277
- })] },
278
- goto: "model"
279
- });
280
- /**
281
- * if `errorHandler` is a string, retry the tool call with given string
282
- */
283
- if (typeof errorHandler === "string") return new __langchain_langgraph.Command({
284
- update: { messages: [response, new __langchain_core_messages.ToolMessage({
285
- content: errorHandler,
286
- tool_call_id: toolCallId
287
- })] },
288
- goto: "model"
289
- });
290
- /**
291
- * if `errorHandler` is a function, retry the tool call with the function
292
- */
293
- if (typeof errorHandler === "function") {
294
- const content = await errorHandler(error);
295
- if (typeof content !== "string") throw new Error("Error handler must return a string.");
296
- return new __langchain_langgraph.Command({
297
- update: { messages: [response, new __langchain_core_messages.ToolMessage({
298
- content,
299
- tool_call_id: toolCallId
300
- })] },
301
- goto: "model"
302
- });
303
- }
304
- /**
305
- * throw otherwise, e.g. if `errorHandler` is not defined or set to `false`
306
- */
307
- throw error;
308
- }
309
- #areMoreStepsNeeded(state, response) {
310
- const allToolsReturnDirect = __langchain_core_messages.AIMessage.isInstance(response) && response.tool_calls?.every((call) => this.#options.shouldReturnDirect.has(call.name));
311
- const remainingSteps = "remainingSteps" in state ? state.remainingSteps : void 0;
312
- return Boolean(remainingSteps && (remainingSteps < 1 && allToolsReturnDirect || remainingSteps < 2 && require_utils.hasToolCalls(state.messages)));
313
- }
314
- #getModelInputState(state) {
315
- const { messages, llmInputMessages,...rest } = state;
316
- if (llmInputMessages && llmInputMessages.length > 0) return {
317
- messages: llmInputMessages,
318
- ...rest
319
- };
320
- return {
321
- messages,
322
- ...rest
323
- };
324
- }
325
- async #executePrepareModelRequestHooks(model, state, config) {
326
- if (!this.#options.modifyModelRequestHookMiddleware || this.#options.modifyModelRequestHookMiddleware.length === 0) return void 0;
327
- /**
328
- * Get the prompt for system message
329
- */
330
- const systemPrompt = this.#options.systemPrompt;
331
- /**
332
- * Prepare the initial call options
333
- */
334
- let currentOptions = {
335
- model,
336
- systemPrompt,
337
- messages: state.messages,
338
- tools: this.#options.toolClasses
339
- };
340
- /**
341
- * Execute modifyModelRequest hooks from all middleware
342
- */
343
- const middlewareList = this.#options.modifyModelRequestHookMiddleware;
344
- for (const [middleware, getMiddlewareState] of middlewareList) {
345
- /**
346
- * Merge context with default context of middleware
347
- */
348
- const context = middleware.contextSchema ? (0, __langchain_core_utils_types.interopParse)(middleware.contextSchema, config?.context || {}) : config?.context;
349
- /**
350
- * Create runtime
351
- */
352
- const privateState = this.getState()._privateState;
353
- const runtime = {
354
- ...privateState,
355
- context,
356
- writer: config.writer,
357
- interrupt: config.interrupt,
358
- signal: config.signal
359
- };
360
- const result = await middleware.modifyModelRequest(
361
- currentOptions,
362
- {
363
- ...getMiddlewareState(),
364
- messages: state.messages
365
- },
366
- /**
367
- * ensure runtime is frozen to prevent modifications
368
- */
369
- Object.freeze({
370
- ...runtime,
371
- context
372
- })
373
- );
374
- if (result) {
375
- const modifiedTools = result.tools ?? [];
376
- /**
377
- * Verify that the user didn't add any new tools.
378
- * We can't allow this as the ToolNode is already initiated with given tools.
379
- */
380
- const newTools = modifiedTools.filter((tool) => require_utils.isClientTool(tool) && !this.#options.toolClasses.some((t) => t.name === tool.name));
381
- if (newTools.length > 0) throw new Error(`You have added a new tool in "modifyModelRequest" hook of middleware "${middleware.name}": ${newTools.map((tool) => tool.name).join(", ")}. This is not supported.`);
382
- /**
383
- * Verify that user has not added or modified a tool with the same name.
384
- * We can't allow this as the ToolNode is already initiated with given tools.
385
- */
386
- const invalidTools = modifiedTools.filter((tool) => require_utils.isClientTool(tool) && this.#options.toolClasses.every((t) => t !== tool));
387
- if (invalidTools.length > 0) throw new Error(`You have modified a tool in "modifyModelRequest" hook of middleware "${middleware.name}": ${invalidTools.map((tool) => tool.name).join(", ")}. This is not supported.`);
388
- currentOptions = {
389
- ...currentOptions,
390
- ...result
391
- };
392
- }
393
- }
394
- return currentOptions;
395
- }
396
- async #bindTools(model, preparedOptions, structuredResponseFormat) {
397
- const options = {};
398
- const structuredTools = Object.values(structuredResponseFormat && "tools" in structuredResponseFormat ? structuredResponseFormat.tools : {});
399
- const allTools = [...preparedOptions?.tools ?? [], ...structuredTools.map((toolStrategy) => toolStrategy.tool)];
400
- /**
401
- * If there are structured tools, we need to set the tool choice to "any"
402
- * so that the model can choose to use a structured tool or not.
403
- */
404
- const toolChoice = preparedOptions?.toolChoice || (structuredTools.length > 0 ? "any" : void 0);
405
- /**
406
- * check if the user requests a native schema output
407
- */
408
- if (structuredResponseFormat?.type === "native") {
409
- /**
410
- * if the model does not support JSON schema output, throw an error
411
- */
412
- if (!require_responses.hasSupportForJsonSchemaOutput(model)) throw new Error("Model does not support native structured output responses. Please use a model that supports native structured output responses or use a tool output.");
413
- const jsonSchemaParams = {
414
- name: structuredResponseFormat.strategy.schema?.name ?? "extract",
415
- description: (0, __langchain_core_utils_types.getSchemaDescription)(structuredResponseFormat.strategy.schema),
416
- schema: structuredResponseFormat.strategy.schema,
417
- strict: true
418
- };
419
- Object.assign(options, {
420
- response_format: {
421
- type: "json_schema",
422
- json_schema: jsonSchemaParams
423
- },
424
- ls_structured_output_format: {
425
- kwargs: { method: "json_schema" },
426
- schema: structuredResponseFormat.strategy.schema
427
- },
428
- strict: true
429
- });
430
- }
431
- /**
432
- * Bind tools to the model if they are not already bound.
433
- */
434
- const modelWithTools = await require_utils.bindTools(model, allTools, {
435
- ...options,
436
- tool_choice: toolChoice
437
- });
438
- /**
439
- * Create a model runnable with the prompt and agent name
440
- */
441
- const modelRunnable = require_utils.getPromptRunnable(preparedOptions?.systemPrompt ?? this.#options.systemPrompt).pipe(this.#options.includeAgentName === "inline" ? require_withAgentName.withAgentName(modelWithTools, this.#options.includeAgentName) : modelWithTools);
442
- return modelRunnable;
443
- }
444
- static get nodeOptions() {
445
- return { input: zod_v3.z.object({
446
- messages: zod_v3.z.array(zod_v3.z.custom()),
447
- _privateState: zod_v3.z.object({ threadLevelCallCount: zod_v3.z.number() })
448
- }) };
449
- }
450
- getState() {
451
- const origState = super.getState() ?? { _privateState: {
452
- threadLevelCallCount: 0,
453
- runModelCallCount: 0
454
- } };
455
- return {
456
- messages: [],
457
- ...origState,
458
- _privateState: {
459
- ...origState._privateState ?? {},
460
- ...this.#runState
461
- }
462
- };
463
- }
464
- };
465
-
466
- //#endregion
467
- exports.AgentNode = AgentNode;
468
- //# sourceMappingURL=AgentNode.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AgentNode.cjs","names":["RunnableCallable","options: AgentNodeOptions<StructuredResponseFormat, ContextSchema>","#run","#options","model: string | LanguageModelLike","transformResponseFormat","ProviderStrategy","ToolStrategy","state: InternalAgentState<StructuredResponseFormat> &\n PreHookAnnotation[\"State\"]","config: RunnableConfig","ToolMessage","#invokeModel","#runState","Command","#areMoreStepsNeeded","AIMessage","initChatModel","options: {\n lastMessage?: string;\n }","#deriveModel","#executePrepareModelRequestHooks","validateLLMHasNoBoundTools","#getResponseFormat","#bindTools","#getModelInputState","mergeAbortSignals","#handleMultipleStructuredOutputs","#handleSingleStructuredOutput","runtime: Runtime<unknown>","response: AIMessage","toolCalls: ToolCall[]","responseFormat: ToolResponseFormat","MultipleStructuredOutputsError","#handleToolStrategyError","toolCall: ToolCall","lastMessage?: string","error: ToolStrategyError","response: BaseMessage","hasToolCalls","model: LanguageModelLike","config: LangGraphRunnableConfig","currentOptions: ModelRequest","isClientTool","preparedOptions: ModelRequest | undefined","structuredResponseFormat: ResponseFormat | undefined","options: Partial<BaseChatModelCallOptions>","hasSupportForJsonSchemaOutput","bindTools","getPromptRunnable","withAgentName","z"],"sources":["../../../../src/agents/middlewareAgent/nodes/AgentNode.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable no-instanceof/no-instanceof */\nimport { Runnable, RunnableConfig } from \"@langchain/core/runnables\";\nimport { BaseMessage, AIMessage, ToolMessage } from \"@langchain/core/messages\";\nimport { z } from \"zod/v3\";\nimport { Command, type LangGraphRunnableConfig } from \"@langchain/langgraph\";\nimport { type LanguageModelLike } from \"@langchain/core/language_models/base\";\nimport { type BaseChatModelCallOptions } from \"@langchain/core/language_models/chat_models\";\nimport {\n InteropZodObject,\n getSchemaDescription,\n interopParse,\n} from \"@langchain/core/utils/types\";\nimport type { ToolCall } from \"@langchain/core/messages/tool\";\n\nimport { initChatModel } from \"../../../chat_models/universal.js\";\nimport { MultipleStructuredOutputsError } from \"../../errors.js\";\nimport { RunnableCallable } from \"../../RunnableCallable.js\";\nimport { PreHookAnnotation, AnyAnnotationRoot } from \"../../annotation.js\";\nimport {\n bindTools,\n getPromptRunnable,\n validateLLMHasNoBoundTools,\n hasToolCalls,\n isClientTool,\n} from \"../../utils.js\";\nimport { mergeAbortSignals } from \"../../nodes/utils.js\";\nimport {\n ModelRequest,\n CreateAgentParams,\n InternalAgentState,\n Runtime,\n AgentMiddleware,\n PrivateState,\n} from \"../types.js\";\nimport type { ClientTool, ServerTool } from \"../../types.js\";\nimport { withAgentName } from \"../../withAgentName.js\";\nimport {\n ToolStrategy,\n ProviderStrategy,\n transformResponseFormat,\n ToolStrategyError,\n hasSupportForJsonSchemaOutput,\n} from \"../../responses.js\";\n\ntype ResponseHandlerResult<StructuredResponseFormat> =\n | {\n structuredResponse: StructuredResponseFormat;\n messages: BaseMessage[];\n }\n | Promise<Command>;\n\nexport interface AgentNodeOptions<\n StructuredResponseFormat extends Record<string, unknown> = Record<\n string,\n unknown\n >,\n ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot\n> extends Pick<\n CreateAgentParams<StructuredResponseFormat, ContextSchema>,\n | \"model\"\n | \"systemPrompt\"\n | \"includeAgentName\"\n | \"name\"\n | \"responseFormat\"\n | \"middleware\"\n > {\n toolClasses: (ClientTool | ServerTool)[];\n shouldReturnDirect: Set<string>;\n signal?: AbortSignal;\n modifyModelRequestHookMiddleware?: [\n AgentMiddleware<any, any, any>,\n () => any\n ][];\n retryModelRequestHookMiddleware?: [\n AgentMiddleware<any, any, any>,\n () => any\n ][];\n}\n\ninterface NativeResponseFormat {\n type: \"native\";\n strategy: ProviderStrategy;\n}\n\ninterface ToolResponseFormat {\n type: \"tool\";\n tools: Record<string, ToolStrategy>;\n}\n\ntype ResponseFormat = NativeResponseFormat | ToolResponseFormat;\n\nexport class AgentNode<\n StructuredResponseFormat extends Record<string, unknown> = Record<\n string,\n unknown\n >,\n ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot\n> extends RunnableCallable<\n InternalAgentState<StructuredResponseFormat> & PreHookAnnotation[\"State\"],\n | (\n | { messages: BaseMessage[] }\n | { structuredResponse: StructuredResponseFormat }\n ) & { _privateState: PrivateState }\n> {\n #options: AgentNodeOptions<StructuredResponseFormat, ContextSchema>;\n\n #runState: Pick<PrivateState, \"runModelCallCount\"> = {\n runModelCallCount: 0,\n };\n\n constructor(\n options: AgentNodeOptions<StructuredResponseFormat, ContextSchema>\n ) {\n super({\n name: options.name ?? \"model\",\n func: (input, config) =>\n this.#run(input, config as RunnableConfig) as any,\n });\n\n this.#options = options;\n }\n\n /**\n * Returns response format primtivies based on given model and response format provided by the user.\n *\n * If the the user selects a tool output:\n * - return a record of tools to extract structured output from the model's response\n *\n * if the the user selects a native schema output or if the model supports JSON schema output:\n * - return a provider strategy to extract structured output from the model's response\n *\n * @param model - The model to get the response format for.\n * @returns The response format.\n */\n #getResponseFormat(\n model: string | LanguageModelLike\n ): ResponseFormat | undefined {\n if (!this.#options.responseFormat) {\n return undefined;\n }\n\n const strategies = transformResponseFormat(\n this.#options.responseFormat,\n undefined,\n model\n );\n\n /**\n * we either define a list of provider strategies or a list of tool strategies\n */\n const isProviderStrategy = strategies.every(\n (format) => format instanceof ProviderStrategy\n );\n\n /**\n * Populate a list of structured tool info.\n */\n if (!isProviderStrategy) {\n return {\n type: \"tool\",\n tools: (\n strategies.filter(\n (format) => format instanceof ToolStrategy\n ) as ToolStrategy[]\n ).reduce((acc, format) => {\n acc[format.name] = format;\n return acc;\n }, {} as Record<string, ToolStrategy>),\n };\n }\n\n return {\n type: \"native\",\n /**\n * there can only be one provider strategy\n */\n strategy: strategies[0] as ProviderStrategy,\n };\n }\n\n async #run(\n state: InternalAgentState<StructuredResponseFormat> &\n PreHookAnnotation[\"State\"],\n config: RunnableConfig\n ) {\n /**\n * Check if we just executed a returnDirect tool\n * If so, we should generate structured response (if needed) and stop\n */\n const lastMessage = state.messages.at(-1);\n if (\n lastMessage &&\n ToolMessage.isInstance(lastMessage) &&\n lastMessage.name &&\n this.#options.shouldReturnDirect.has(lastMessage.name)\n ) {\n /**\n * return directly without invoking the model again\n */\n return { messages: [] };\n }\n\n const privateState = this.getState()._privateState;\n const response = await this.#invokeModel(state, config);\n this.#runState.runModelCallCount++;\n const _privateState = {\n ...privateState,\n threadLevelCallCount: privateState.threadLevelCallCount + 1,\n };\n\n /**\n * if we were able to generate a structured response, return it\n */\n if (\"structuredResponse\" in response) {\n return {\n messages: [...state.messages, ...(response.messages || [])],\n structuredResponse: response.structuredResponse,\n _privateState,\n };\n }\n\n /**\n * if we need to direct the agent to the model, return the update\n */\n if (response instanceof Command) {\n return response;\n }\n\n response.name = this.name;\n response.lc_kwargs.name = this.name;\n\n if (this.#areMoreStepsNeeded(state, response)) {\n return {\n messages: [\n new AIMessage({\n content: \"Sorry, need more steps to process this request.\",\n name: this.name,\n id: response.id,\n }),\n ],\n _privateState,\n };\n }\n\n return { messages: [response], _privateState };\n }\n\n /**\n * Derive the model from the options.\n * @param state - The state of the agent.\n * @param config - The config of the agent.\n * @returns The model.\n */\n #deriveModel() {\n if (typeof this.#options.model === \"string\") {\n return initChatModel(this.#options.model);\n }\n\n if (this.#options.model) {\n return this.#options.model;\n }\n\n throw new Error(\"No model option was provided, either via `model` option.\");\n }\n\n async #invokeModel(\n state: InternalAgentState<StructuredResponseFormat> &\n PreHookAnnotation[\"State\"],\n config: RunnableConfig,\n options: {\n lastMessage?: string;\n } = {}\n ): Promise<AIMessage | ResponseHandlerResult<StructuredResponseFormat>> {\n const model = await this.#deriveModel();\n\n /**\n * Execute modifyModelRequest hooks from beforeModelNodes\n */\n let preparedOptions = await this.#executePrepareModelRequestHooks(\n model,\n state,\n config\n );\n\n /**\n * Retry loop for model invocation with error handling\n * Hard limit of 100 attempts to prevent infinite loops from buggy middleware\n */\n const maxAttempts = 100;\n for (let attempt = 1; attempt <= maxAttempts; attempt++) {\n try {\n /**\n * If user provides a model in the preparedOptions, use it,\n * otherwise use the model from the options\n */\n const finalModel = preparedOptions?.model ?? model;\n\n /**\n * Check if the LLM already has bound tools and throw if it does.\n */\n validateLLMHasNoBoundTools(finalModel);\n\n const structuredResponseFormat = this.#getResponseFormat(finalModel);\n const modelWithTools = await this.#bindTools(\n finalModel,\n preparedOptions,\n structuredResponseFormat\n );\n let modelInput = this.#getModelInputState(state);\n\n /**\n * Use messages from preparedOptions if provided\n */\n if (preparedOptions?.messages) {\n modelInput = { ...modelInput, messages: preparedOptions.messages };\n }\n\n const signal = mergeAbortSignals(this.#options.signal, config.signal);\n const invokeConfig = { ...config, signal };\n const response = (await modelWithTools.invoke(\n modelInput,\n invokeConfig\n )) as AIMessage;\n\n /**\n * if the user requests a native schema output, try to parse the response\n * and return the structured response if it is valid\n */\n if (structuredResponseFormat?.type === \"native\") {\n const structuredResponse =\n structuredResponseFormat.strategy.parse(response);\n if (structuredResponse) {\n return { structuredResponse, messages: [response] };\n }\n\n return response;\n }\n\n if (!structuredResponseFormat || !response.tool_calls) {\n return response;\n }\n\n const toolCalls = response.tool_calls.filter(\n (call) => call.name in structuredResponseFormat.tools\n );\n\n /**\n * if there were not structured tool calls, we can return the response\n */\n if (toolCalls.length === 0) {\n return response;\n }\n\n /**\n * if there were multiple structured tool calls, we should throw an error as this\n * scenario is not defined/supported.\n */\n if (toolCalls.length > 1) {\n return this.#handleMultipleStructuredOutputs(\n response,\n toolCalls,\n structuredResponseFormat\n );\n }\n\n const toolStrategy = structuredResponseFormat.tools[toolCalls[0].name];\n const toolMessageContent = toolStrategy?.options?.toolMessageContent;\n return this.#handleSingleStructuredOutput(\n response,\n toolCalls[0],\n structuredResponseFormat,\n toolMessageContent ?? options.lastMessage\n );\n } catch (error) {\n // Try retry_model_request on each middleware\n const retryMiddleware =\n this.#options.retryModelRequestHookMiddleware ?? [];\n let shouldRetry = false;\n\n for (const [middleware, getMiddlewareState] of retryMiddleware) {\n if (middleware.retryModelRequest) {\n /**\n * Cast config to LangGraphRunnableConfig to access LangGraph-specific properties\n */\n const lgConfig = config as LangGraphRunnableConfig;\n\n /**\n * Merge context with default context of middleware\n */\n const context = middleware.contextSchema\n ? interopParse(middleware.contextSchema, lgConfig?.context || {})\n : lgConfig?.context;\n\n /**\n * Create runtime\n */\n const privateState = this.getState()._privateState;\n const runtime: Runtime<unknown> = {\n ...privateState,\n context,\n writer: lgConfig.writer,\n interrupt: lgConfig.interrupt,\n signal: lgConfig.signal,\n };\n\n const retryRequest = await middleware.retryModelRequest(\n error as Error,\n {\n model: preparedOptions?.model ?? model,\n systemPrompt: preparedOptions?.systemPrompt,\n messages: preparedOptions?.messages ?? state.messages,\n tools: this.#options.toolClasses,\n },\n {\n ...getMiddlewareState(),\n messages: state.messages,\n },\n /**\n * ensure runtime is frozen to prevent modifications\n */\n Object.freeze({\n ...runtime,\n context,\n }),\n attempt\n );\n\n if (retryRequest) {\n // Update preparedOptions with the modified request\n preparedOptions = retryRequest;\n shouldRetry = true;\n // Break on first middleware that wants to retry\n break;\n }\n }\n }\n\n // If no middleware wants to retry, re-raise the error\n if (!shouldRetry) {\n throw error;\n }\n }\n }\n\n // If we exit the loop, max attempts exceeded\n throw new Error(`Maximum retry attempts (${maxAttempts}) exceeded`);\n }\n\n /**\n * If the model returns multiple structured outputs, we need to handle it.\n * @param response - The response from the model\n * @param toolCalls - The tool calls that were made\n * @returns The response from the model\n */\n #handleMultipleStructuredOutputs(\n response: AIMessage,\n toolCalls: ToolCall[],\n responseFormat: ToolResponseFormat\n ): Promise<Command> {\n const multipleStructuredOutputsError = new MultipleStructuredOutputsError(\n toolCalls.map((call) => call.name)\n );\n\n return this.#handleToolStrategyError(\n multipleStructuredOutputsError,\n response,\n toolCalls[0],\n responseFormat\n );\n }\n\n /**\n * If the model returns a single structured output, we need to handle it.\n * @param toolCall - The tool call that was made\n * @returns The structured response and a message to the LLM if needed\n */\n #handleSingleStructuredOutput(\n response: AIMessage,\n toolCall: ToolCall,\n responseFormat: ToolResponseFormat,\n lastMessage?: string\n ): ResponseHandlerResult<StructuredResponseFormat> {\n const tool = responseFormat.tools[toolCall.name];\n\n try {\n const structuredResponse = tool.parse(\n toolCall.args\n ) as StructuredResponseFormat;\n\n return {\n structuredResponse,\n messages: [\n response,\n new AIMessage(\n lastMessage ??\n `Returning structured response: ${JSON.stringify(\n structuredResponse\n )}`\n ),\n ],\n };\n } catch (error) {\n return this.#handleToolStrategyError(\n error as ToolStrategyError,\n response,\n toolCall,\n responseFormat\n );\n }\n }\n\n async #handleToolStrategyError(\n error: ToolStrategyError,\n response: AIMessage,\n toolCall: ToolCall,\n responseFormat: ToolResponseFormat\n ): Promise<Command> {\n /**\n * Using the `errorHandler` option of the first `ToolStrategy` entry is sufficient here.\n * There is technically only one `ToolStrategy` entry in `structuredToolInfo` if the user\n * uses `toolStrategy` to define the response format. If the user applies a list of json\n * schema objects, these will be transformed into multiple `ToolStrategy` entries but all\n * with the same `handleError` option.\n */\n const errorHandler = Object.values(responseFormat.tools).at(0)?.options\n ?.handleError;\n\n const toolCallId = toolCall.id;\n if (!toolCallId) {\n throw new Error(\n \"Tool call ID is required to handle tool output errors. Please provide a tool call ID.\"\n );\n }\n\n /**\n * retry if:\n */\n if (\n /**\n * if the user has provided `true` as the `errorHandler` option, return a new AIMessage\n * with the error message and retry the tool call.\n */\n (typeof errorHandler === \"boolean\" && errorHandler) ||\n /**\n * if `errorHandler` is an array and contains MultipleStructuredOutputsError\n */\n (Array.isArray(errorHandler) &&\n errorHandler.some((h) => h instanceof MultipleStructuredOutputsError))\n ) {\n return new Command({\n update: {\n messages: [\n response,\n new ToolMessage({\n content: error.message,\n tool_call_id: toolCallId,\n }),\n ],\n },\n goto: \"model\",\n });\n }\n\n /**\n * if `errorHandler` is a string, retry the tool call with given string\n */\n if (typeof errorHandler === \"string\") {\n return new Command({\n update: {\n messages: [\n response,\n new ToolMessage({\n content: errorHandler,\n tool_call_id: toolCallId,\n }),\n ],\n },\n goto: \"model\",\n });\n }\n\n /**\n * if `errorHandler` is a function, retry the tool call with the function\n */\n if (typeof errorHandler === \"function\") {\n const content = await errorHandler(error);\n if (typeof content !== \"string\") {\n throw new Error(\"Error handler must return a string.\");\n }\n\n return new Command({\n update: {\n messages: [\n response,\n new ToolMessage({\n content,\n tool_call_id: toolCallId,\n }),\n ],\n },\n goto: \"model\",\n });\n }\n\n /**\n * throw otherwise, e.g. if `errorHandler` is not defined or set to `false`\n */\n throw error;\n }\n\n #areMoreStepsNeeded(\n state: InternalAgentState<StructuredResponseFormat> &\n PreHookAnnotation[\"State\"],\n response: BaseMessage\n ): boolean {\n const allToolsReturnDirect =\n AIMessage.isInstance(response) &&\n response.tool_calls?.every((call) =>\n this.#options.shouldReturnDirect.has(call.name)\n );\n const remainingSteps =\n \"remainingSteps\" in state ? (state.remainingSteps as number) : undefined;\n return Boolean(\n remainingSteps &&\n ((remainingSteps < 1 && allToolsReturnDirect) ||\n (remainingSteps < 2 && hasToolCalls(state.messages)))\n );\n }\n\n #getModelInputState(\n state: InternalAgentState<StructuredResponseFormat> &\n PreHookAnnotation[\"State\"]\n ): Omit<InternalAgentState<StructuredResponseFormat>, \"llmInputMessages\"> {\n const { messages, llmInputMessages, ...rest } = state;\n if (llmInputMessages && llmInputMessages.length > 0) {\n return { messages: llmInputMessages, ...rest } as Omit<\n InternalAgentState<StructuredResponseFormat>,\n \"llmInputMessages\"\n >;\n }\n return { messages, ...rest } as Omit<\n InternalAgentState<StructuredResponseFormat>,\n \"llmInputMessages\"\n >;\n }\n\n async #executePrepareModelRequestHooks(\n model: LanguageModelLike,\n state: InternalAgentState<StructuredResponseFormat> &\n PreHookAnnotation[\"State\"],\n config: LangGraphRunnableConfig\n ): Promise<ModelRequest | undefined> {\n if (\n !this.#options.modifyModelRequestHookMiddleware ||\n this.#options.modifyModelRequestHookMiddleware.length === 0\n ) {\n return undefined;\n }\n\n /**\n * Get the prompt for system message\n */\n const systemPrompt = this.#options.systemPrompt;\n\n /**\n * Prepare the initial call options\n */\n let currentOptions: ModelRequest = {\n model,\n systemPrompt,\n messages: state.messages,\n tools: this.#options.toolClasses,\n };\n\n /**\n * Execute modifyModelRequest hooks from all middleware\n */\n const middlewareList = this.#options.modifyModelRequestHookMiddleware;\n for (const [middleware, getMiddlewareState] of middlewareList) {\n /**\n * Merge context with default context of middleware\n */\n const context = middleware.contextSchema\n ? interopParse(middleware.contextSchema, config?.context || {})\n : config?.context;\n\n /**\n * Create runtime\n */\n const privateState = this.getState()._privateState;\n const runtime: Runtime<unknown> = {\n ...privateState,\n context,\n writer: config.writer,\n interrupt: config.interrupt,\n signal: config.signal,\n };\n\n const result = await middleware.modifyModelRequest!(\n currentOptions,\n {\n ...getMiddlewareState(),\n messages: state.messages,\n },\n /**\n * ensure runtime is frozen to prevent modifications\n */\n Object.freeze({\n ...runtime,\n context,\n })\n );\n\n if (result) {\n const modifiedTools = result.tools ?? [];\n\n /**\n * Verify that the user didn't add any new tools.\n * We can't allow this as the ToolNode is already initiated with given tools.\n */\n const newTools = modifiedTools.filter(\n (tool) =>\n isClientTool(tool) &&\n !this.#options.toolClasses.some((t) => t.name === tool.name)\n );\n if (newTools.length > 0) {\n throw new Error(\n `You have added a new tool in \"modifyModelRequest\" hook of middleware \"${\n middleware.name\n }\": ${newTools\n .map((tool) => tool.name)\n .join(\", \")}. This is not supported.`\n );\n }\n\n /**\n * Verify that user has not added or modified a tool with the same name.\n * We can't allow this as the ToolNode is already initiated with given tools.\n */\n const invalidTools = modifiedTools.filter(\n (tool) =>\n isClientTool(tool) &&\n this.#options.toolClasses.every((t) => t !== tool)\n );\n if (invalidTools.length > 0) {\n throw new Error(\n `You have modified a tool in \"modifyModelRequest\" hook of middleware \"${\n middleware.name\n }\": ${invalidTools\n .map((tool) => tool.name)\n .join(\", \")}. This is not supported.`\n );\n }\n\n currentOptions = { ...currentOptions, ...result };\n }\n }\n\n return currentOptions;\n }\n\n async #bindTools(\n model: LanguageModelLike,\n preparedOptions: ModelRequest | undefined,\n structuredResponseFormat: ResponseFormat | undefined\n ): Promise<Runnable> {\n const options: Partial<BaseChatModelCallOptions> = {};\n const structuredTools = Object.values(\n structuredResponseFormat && \"tools\" in structuredResponseFormat\n ? structuredResponseFormat.tools\n : {}\n );\n\n // Use tools from preparedOptions if provided, otherwise use default tools\n const allTools = [\n ...(preparedOptions?.tools ?? []),\n ...structuredTools.map((toolStrategy) => toolStrategy.tool),\n ];\n\n /**\n * If there are structured tools, we need to set the tool choice to \"any\"\n * so that the model can choose to use a structured tool or not.\n */\n const toolChoice =\n preparedOptions?.toolChoice ||\n (structuredTools.length > 0 ? \"any\" : undefined);\n\n /**\n * check if the user requests a native schema output\n */\n if (structuredResponseFormat?.type === \"native\") {\n /**\n * if the model does not support JSON schema output, throw an error\n */\n if (!hasSupportForJsonSchemaOutput(model)) {\n throw new Error(\n \"Model does not support native structured output responses. Please use a model that supports native structured output responses or use a tool output.\"\n );\n }\n\n const jsonSchemaParams = {\n name: structuredResponseFormat.strategy.schema?.name ?? \"extract\",\n description: getSchemaDescription(\n structuredResponseFormat.strategy.schema\n ),\n schema: structuredResponseFormat.strategy.schema,\n strict: true,\n };\n\n Object.assign(options, {\n response_format: {\n type: \"json_schema\",\n json_schema: jsonSchemaParams,\n },\n ls_structured_output_format: {\n kwargs: { method: \"json_schema\" },\n schema: structuredResponseFormat.strategy.schema,\n },\n strict: true,\n });\n }\n\n /**\n * Bind tools to the model if they are not already bound.\n */\n const modelWithTools = await bindTools(model, allTools, {\n ...options,\n tool_choice: toolChoice,\n });\n\n /**\n * Create a model runnable with the prompt and agent name\n */\n const modelRunnable = getPromptRunnable(\n preparedOptions?.systemPrompt ?? this.#options.systemPrompt\n ).pipe(\n this.#options.includeAgentName === \"inline\"\n ? withAgentName(modelWithTools, this.#options.includeAgentName)\n : modelWithTools\n );\n\n return modelRunnable;\n }\n\n static get nodeOptions(): {\n input: z.ZodObject<{\n messages: z.ZodArray<z.ZodType<BaseMessage>>;\n _privateState: z.ZodObject<{\n threadLevelCallCount: z.ZodNumber;\n }>;\n }>;\n } {\n return {\n input: z.object({\n messages: z.array(z.custom<BaseMessage>()),\n _privateState: z.object({\n threadLevelCallCount: z.number(),\n }),\n }),\n };\n }\n\n getState(): {\n messages: BaseMessage[];\n _privateState: PrivateState;\n } {\n const origState =\n super.getState() ??\n ({\n _privateState: {\n threadLevelCallCount: 0,\n runModelCallCount: 0,\n },\n } as {\n messages?: BaseMessage[];\n _privateState?: PrivateState;\n });\n\n return {\n messages: [],\n ...origState,\n _privateState: {\n ...(origState._privateState ?? {}),\n ...this.#runState,\n },\n };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AA4FA,IAAa,YAAb,cAMUA,0CAMR;CACA;CAEA,YAAqD,EACnD,mBAAmB,EACpB;CAED,YACEC,SACA;EACA,MAAM;GACJ,MAAM,QAAQ,QAAQ;GACtB,MAAM,CAAC,OAAO,WACZ,KAAKC,KAAK,OAAO,OAAyB;EAC7C,EAAC;EAEF,KAAKC,WAAW;CACjB;;;;;;;;;;;;;CAcD,mB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