langchain 1.0.0-alpha.7 → 1.0.0-alpha.8

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 (1418) hide show
  1. package/dist/agents/ReactAgent.cjs +2 -2
  2. package/dist/agents/ReactAgent.cjs.map +1 -1
  3. package/dist/agents/ReactAgent.js +2 -2
  4. package/dist/agents/ReactAgent.js.map +1 -1
  5. package/dist/agents/RunnableCallable.cjs +10 -0
  6. package/dist/agents/RunnableCallable.cjs.map +1 -1
  7. package/dist/agents/RunnableCallable.d.cts +5 -0
  8. package/dist/agents/RunnableCallable.d.cts.map +1 -1
  9. package/dist/agents/RunnableCallable.d.ts +5 -0
  10. package/dist/agents/RunnableCallable.d.ts.map +1 -1
  11. package/dist/agents/RunnableCallable.js +10 -0
  12. package/dist/agents/RunnableCallable.js.map +1 -1
  13. package/dist/agents/annotation.cjs +14 -0
  14. package/dist/agents/annotation.cjs.map +1 -1
  15. package/dist/agents/annotation.d.cts +12 -7
  16. package/dist/agents/annotation.d.cts.map +1 -1
  17. package/dist/agents/annotation.d.ts +11 -6
  18. package/dist/agents/annotation.d.ts.map +1 -1
  19. package/dist/agents/annotation.js +12 -1
  20. package/dist/agents/annotation.js.map +1 -1
  21. package/dist/agents/errors.d.cts +9 -2
  22. package/dist/agents/errors.d.cts.map +1 -1
  23. package/dist/agents/errors.d.ts +9 -2
  24. package/dist/agents/errors.d.ts.map +1 -1
  25. package/dist/agents/index.cjs +3 -0
  26. package/dist/agents/index.cjs.map +1 -1
  27. package/dist/agents/index.d.cts +6 -5
  28. package/dist/agents/index.d.cts.map +1 -1
  29. package/dist/agents/index.d.ts +6 -5
  30. package/dist/agents/index.d.ts.map +1 -1
  31. package/dist/agents/index.js +4 -1
  32. package/dist/agents/index.js.map +1 -1
  33. package/dist/agents/interrupt.d.cts +5 -16
  34. package/dist/agents/interrupt.d.cts.map +1 -1
  35. package/dist/agents/interrupt.d.ts +3 -17
  36. package/dist/agents/interrupt.d.ts.map +1 -1
  37. package/dist/agents/interrupt.js +3 -1
  38. package/dist/agents/middlewareAgent/ReactAgent.cjs +145 -28
  39. package/dist/agents/middlewareAgent/ReactAgent.cjs.map +1 -1
  40. package/dist/agents/middlewareAgent/ReactAgent.d.cts +92 -12
  41. package/dist/agents/middlewareAgent/ReactAgent.d.cts.map +1 -1
  42. package/dist/agents/middlewareAgent/ReactAgent.d.ts +92 -12
  43. package/dist/agents/middlewareAgent/ReactAgent.d.ts.map +1 -1
  44. package/dist/agents/middlewareAgent/ReactAgent.js +145 -28
  45. package/dist/agents/middlewareAgent/ReactAgent.js.map +1 -1
  46. package/dist/agents/middlewareAgent/middleware/callLimit.cjs +128 -0
  47. package/dist/agents/middlewareAgent/middleware/callLimit.cjs.map +1 -0
  48. package/dist/agents/middlewareAgent/middleware/callLimit.d.cts +119 -0
  49. package/dist/agents/middlewareAgent/middleware/callLimit.d.cts.map +1 -0
  50. package/dist/agents/middlewareAgent/middleware/callLimit.d.ts +119 -0
  51. package/dist/agents/middlewareAgent/middleware/callLimit.d.ts.map +1 -0
  52. package/dist/agents/middlewareAgent/middleware/callLimit.js +127 -0
  53. package/dist/agents/middlewareAgent/middleware/callLimit.js.map +1 -0
  54. package/dist/agents/middlewareAgent/middleware/contextEditing.cjs +278 -0
  55. package/dist/agents/middlewareAgent/middleware/contextEditing.cjs.map +1 -0
  56. package/dist/agents/middlewareAgent/middleware/contextEditing.d.cts +239 -0
  57. package/dist/agents/middlewareAgent/middleware/contextEditing.d.cts.map +1 -0
  58. package/dist/agents/middlewareAgent/middleware/contextEditing.d.ts +239 -0
  59. package/dist/agents/middlewareAgent/middleware/contextEditing.d.ts.map +1 -0
  60. package/dist/agents/middlewareAgent/middleware/contextEditing.js +276 -0
  61. package/dist/agents/middlewareAgent/middleware/contextEditing.js.map +1 -0
  62. package/dist/agents/middlewareAgent/middleware/dynamicSystemPrompt.cjs +1 -1
  63. package/dist/agents/middlewareAgent/middleware/dynamicSystemPrompt.cjs.map +1 -1
  64. package/dist/agents/middlewareAgent/middleware/dynamicSystemPrompt.d.cts +2 -2
  65. package/dist/agents/middlewareAgent/middleware/dynamicSystemPrompt.d.cts.map +1 -1
  66. package/dist/agents/middlewareAgent/middleware/dynamicSystemPrompt.d.ts +2 -2
  67. package/dist/agents/middlewareAgent/middleware/dynamicSystemPrompt.d.ts.map +1 -1
  68. package/dist/agents/middlewareAgent/middleware/dynamicSystemPrompt.js +1 -1
  69. package/dist/agents/middlewareAgent/middleware/dynamicSystemPrompt.js.map +1 -1
  70. package/dist/agents/middlewareAgent/middleware/hitl.cjs +38 -8
  71. package/dist/agents/middlewareAgent/middleware/hitl.cjs.map +1 -1
  72. package/dist/agents/middlewareAgent/middleware/hitl.d.cts +130 -25
  73. package/dist/agents/middlewareAgent/middleware/hitl.d.cts.map +1 -1
  74. package/dist/agents/middlewareAgent/middleware/hitl.d.ts +129 -24
  75. package/dist/agents/middlewareAgent/middleware/hitl.d.ts.map +1 -1
  76. package/dist/agents/middlewareAgent/middleware/hitl.js +38 -8
  77. package/dist/agents/middlewareAgent/middleware/hitl.js.map +1 -1
  78. package/dist/agents/middlewareAgent/middleware/index.cjs +26 -6
  79. package/dist/agents/middlewareAgent/middleware/index.cjs.map +1 -1
  80. package/dist/agents/middlewareAgent/middleware/index.d.cts +10 -3
  81. package/dist/agents/middlewareAgent/middleware/index.d.ts +10 -3
  82. package/dist/agents/middlewareAgent/middleware/index.js +17 -4
  83. package/dist/agents/middlewareAgent/middleware/index.js.map +1 -1
  84. package/dist/agents/middlewareAgent/middleware/llmToolSelector.cjs +193 -0
  85. package/dist/agents/middlewareAgent/middleware/llmToolSelector.cjs.map +1 -0
  86. package/dist/agents/middlewareAgent/middleware/llmToolSelector.d.cts +83 -0
  87. package/dist/agents/middlewareAgent/middleware/llmToolSelector.d.cts.map +1 -0
  88. package/dist/agents/middlewareAgent/middleware/llmToolSelector.d.ts +83 -0
  89. package/dist/agents/middlewareAgent/middleware/llmToolSelector.d.ts.map +1 -0
  90. package/dist/agents/middlewareAgent/middleware/llmToolSelector.js +192 -0
  91. package/dist/agents/middlewareAgent/middleware/llmToolSelector.js.map +1 -0
  92. package/dist/agents/middlewareAgent/middleware/modelFallback.cjs +67 -0
  93. package/dist/agents/middlewareAgent/middleware/modelFallback.cjs.map +1 -0
  94. package/dist/agents/middlewareAgent/middleware/modelFallback.d.cts +45 -0
  95. package/dist/agents/middlewareAgent/middleware/modelFallback.d.cts.map +1 -0
  96. package/dist/agents/middlewareAgent/middleware/modelFallback.d.ts +45 -0
  97. package/dist/agents/middlewareAgent/middleware/modelFallback.d.ts.map +1 -0
  98. package/dist/agents/middlewareAgent/middleware/modelFallback.js +67 -0
  99. package/dist/agents/middlewareAgent/middleware/modelFallback.js.map +1 -0
  100. package/dist/agents/middlewareAgent/middleware/piiRedaction.cjs +333 -0
  101. package/dist/agents/middlewareAgent/middleware/piiRedaction.cjs.map +1 -0
  102. package/dist/agents/middlewareAgent/middleware/piiRedaction.d.cts +155 -0
  103. package/dist/agents/middlewareAgent/middleware/piiRedaction.d.cts.map +1 -0
  104. package/dist/agents/middlewareAgent/middleware/piiRedaction.d.ts +155 -0
  105. package/dist/agents/middlewareAgent/middleware/piiRedaction.d.ts.map +1 -0
  106. package/dist/agents/middlewareAgent/middleware/piiRedaction.js +332 -0
  107. package/dist/agents/middlewareAgent/middleware/piiRedaction.js.map +1 -0
  108. package/dist/agents/middlewareAgent/middleware/promptCaching.cjs +50 -38
  109. package/dist/agents/middlewareAgent/middleware/promptCaching.cjs.map +1 -1
  110. package/dist/agents/middlewareAgent/middleware/promptCaching.d.cts +18 -18
  111. package/dist/agents/middlewareAgent/middleware/promptCaching.d.cts.map +1 -1
  112. package/dist/agents/middlewareAgent/middleware/promptCaching.d.ts +17 -17
  113. package/dist/agents/middlewareAgent/middleware/promptCaching.d.ts.map +1 -1
  114. package/dist/agents/middlewareAgent/middleware/promptCaching.js +50 -38
  115. package/dist/agents/middlewareAgent/middleware/promptCaching.js.map +1 -1
  116. package/dist/agents/middlewareAgent/middleware/summarization.cjs +3 -23
  117. package/dist/agents/middlewareAgent/middleware/summarization.cjs.map +1 -1
  118. package/dist/agents/middlewareAgent/middleware/summarization.d.cts +10 -17
  119. package/dist/agents/middlewareAgent/middleware/summarization.d.cts.map +1 -1
  120. package/dist/agents/middlewareAgent/middleware/summarization.d.ts +2 -9
  121. package/dist/agents/middlewareAgent/middleware/summarization.d.ts.map +1 -1
  122. package/dist/agents/middlewareAgent/middleware/summarization.js +3 -22
  123. package/dist/agents/middlewareAgent/middleware/summarization.js.map +1 -1
  124. package/dist/agents/middlewareAgent/middleware/toolCallLimit.cjs +242 -0
  125. package/dist/agents/middlewareAgent/middleware/toolCallLimit.cjs.map +1 -0
  126. package/dist/agents/middlewareAgent/middleware/toolCallLimit.d.cts +158 -0
  127. package/dist/agents/middlewareAgent/middleware/toolCallLimit.d.cts.map +1 -0
  128. package/dist/agents/middlewareAgent/middleware/toolCallLimit.d.ts +158 -0
  129. package/dist/agents/middlewareAgent/middleware/toolCallLimit.d.ts.map +1 -0
  130. package/dist/agents/middlewareAgent/middleware/toolCallLimit.js +240 -0
  131. package/dist/agents/middlewareAgent/middleware/toolCallLimit.js.map +1 -0
  132. package/dist/agents/middlewareAgent/middleware/utils.cjs +26 -0
  133. package/dist/agents/middlewareAgent/middleware/utils.cjs.map +1 -0
  134. package/dist/agents/middlewareAgent/middleware/utils.d.cts +13 -0
  135. package/dist/agents/middlewareAgent/middleware/utils.d.cts.map +1 -0
  136. package/dist/agents/middlewareAgent/middleware/utils.d.ts +13 -0
  137. package/dist/agents/middlewareAgent/middleware/utils.d.ts.map +1 -0
  138. package/dist/agents/middlewareAgent/middleware/utils.js +25 -0
  139. package/dist/agents/middlewareAgent/middleware/utils.js.map +1 -0
  140. package/dist/agents/middlewareAgent/middleware.cjs +1 -0
  141. package/dist/agents/middlewareAgent/middleware.cjs.map +1 -1
  142. package/dist/agents/middlewareAgent/middleware.d.cts +14 -3
  143. package/dist/agents/middlewareAgent/middleware.d.cts.map +1 -1
  144. package/dist/agents/middlewareAgent/middleware.d.ts +14 -3
  145. package/dist/agents/middlewareAgent/middleware.d.ts.map +1 -1
  146. package/dist/agents/middlewareAgent/middleware.js +1 -0
  147. package/dist/agents/middlewareAgent/middleware.js.map +1 -1
  148. package/dist/agents/middlewareAgent/nodes/AfterModalNode.cjs +2 -2
  149. package/dist/agents/middlewareAgent/nodes/AfterModalNode.cjs.map +1 -1
  150. package/dist/agents/middlewareAgent/nodes/AfterModalNode.js +2 -2
  151. package/dist/agents/middlewareAgent/nodes/AfterModalNode.js.map +1 -1
  152. package/dist/agents/middlewareAgent/nodes/AgentNode.cjs +172 -78
  153. package/dist/agents/middlewareAgent/nodes/AgentNode.cjs.map +1 -1
  154. package/dist/agents/middlewareAgent/nodes/AgentNode.js +173 -79
  155. package/dist/agents/middlewareAgent/nodes/AgentNode.js.map +1 -1
  156. package/dist/agents/middlewareAgent/nodes/BeforeModalNode.cjs +2 -2
  157. package/dist/agents/middlewareAgent/nodes/BeforeModalNode.cjs.map +1 -1
  158. package/dist/agents/middlewareAgent/nodes/BeforeModalNode.js +2 -2
  159. package/dist/agents/middlewareAgent/nodes/BeforeModalNode.js.map +1 -1
  160. package/dist/agents/middlewareAgent/nodes/middleware.cjs +11 -10
  161. package/dist/agents/middlewareAgent/nodes/middleware.cjs.map +1 -1
  162. package/dist/agents/middlewareAgent/nodes/middleware.js +12 -11
  163. package/dist/agents/middlewareAgent/nodes/middleware.js.map +1 -1
  164. package/dist/agents/middlewareAgent/nodes/utils.cjs +8 -30
  165. package/dist/agents/middlewareAgent/nodes/utils.cjs.map +1 -1
  166. package/dist/agents/middlewareAgent/nodes/utils.js +9 -30
  167. package/dist/agents/middlewareAgent/nodes/utils.js.map +1 -1
  168. package/dist/agents/middlewareAgent/types.d.cts +56 -51
  169. package/dist/agents/middlewareAgent/types.d.cts.map +1 -1
  170. package/dist/agents/middlewareAgent/types.d.ts +56 -51
  171. package/dist/agents/middlewareAgent/types.d.ts.map +1 -1
  172. package/dist/agents/nodes/ToolNode.d.cts +1 -1
  173. package/dist/agents/tests/utils.cjs +77 -0
  174. package/dist/agents/tests/utils.cjs.map +1 -0
  175. package/dist/agents/tests/utils.d.cts +53 -0
  176. package/dist/agents/tests/utils.d.cts.map +1 -0
  177. package/dist/agents/tests/utils.d.ts +53 -0
  178. package/dist/agents/tests/utils.d.ts.map +1 -0
  179. package/dist/agents/tests/utils.js +76 -0
  180. package/dist/agents/tests/utils.js.map +1 -0
  181. package/dist/agents/types.cjs +7 -0
  182. package/dist/agents/types.cjs.map +1 -0
  183. package/dist/agents/types.d.cts +38 -4
  184. package/dist/agents/types.d.cts.map +1 -1
  185. package/dist/agents/types.d.ts +38 -4
  186. package/dist/agents/types.d.ts.map +1 -1
  187. package/dist/agents/types.js +6 -0
  188. package/dist/agents/types.js.map +1 -0
  189. package/dist/chat_models/universal.cjs +7 -0
  190. package/dist/chat_models/universal.cjs.map +1 -1
  191. package/dist/chat_models/universal.d.cts +7 -2
  192. package/dist/chat_models/universal.d.cts.map +1 -1
  193. package/dist/chat_models/universal.d.ts +7 -2
  194. package/dist/chat_models/universal.d.ts.map +1 -1
  195. package/dist/chat_models/universal.js +7 -0
  196. package/dist/chat_models/universal.js.map +1 -1
  197. package/dist/hub/base.cjs +4 -1
  198. package/dist/hub/base.cjs.map +1 -1
  199. package/dist/hub/base.js +4 -1
  200. package/dist/hub/base.js.map +1 -1
  201. package/dist/index.cjs +64 -6
  202. package/dist/index.cjs.map +1 -1
  203. package/dist/index.d.cts +18 -9
  204. package/dist/index.d.ts +18 -9
  205. package/dist/index.js +37 -5
  206. package/dist/index.js.map +1 -1
  207. package/dist/load/import_constants.cjs +0 -19
  208. package/dist/load/import_constants.cjs.map +1 -1
  209. package/dist/load/import_constants.js +0 -19
  210. package/dist/load/import_constants.js.map +1 -1
  211. package/dist/load/import_map.cjs +2 -113
  212. package/dist/load/import_map.cjs.map +1 -1
  213. package/dist/load/import_map.js +3 -114
  214. package/dist/load/import_map.js.map +1 -1
  215. package/dist/load/serializable.d.cts +1 -10
  216. package/dist/load/serializable.d.ts +1 -10
  217. 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/async_caller.cjs +5 -4
  218. 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/async_caller.cjs.map +1 -1
  219. 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/async_caller.js +3 -2
  220. 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/async_caller.js.map +1 -1
  221. package/dist/node_modules/.pnpm/p-retry@4.6.2/node_modules/p-retry/index.cjs +83 -0
  222. package/dist/node_modules/.pnpm/p-retry@4.6.2/node_modules/p-retry/index.cjs.map +1 -0
  223. package/dist/node_modules/.pnpm/p-retry@4.6.2/node_modules/p-retry/index.js +79 -0
  224. package/dist/node_modules/.pnpm/p-retry@4.6.2/node_modules/p-retry/index.js.map +1 -0
  225. package/dist/node_modules/.pnpm/retry@0.13.1/node_modules/retry/index.cjs +16 -0
  226. package/dist/node_modules/.pnpm/retry@0.13.1/node_modules/retry/index.cjs.map +1 -0
  227. package/dist/node_modules/.pnpm/retry@0.13.1/node_modules/retry/index.js +13 -0
  228. package/dist/node_modules/.pnpm/retry@0.13.1/node_modules/retry/index.js.map +1 -0
  229. package/dist/node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.cjs +77 -0
  230. package/dist/node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.cjs.map +1 -0
  231. package/dist/node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.js +74 -0
  232. package/dist/node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.js.map +1 -0
  233. package/dist/node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.cjs +115 -0
  234. package/dist/node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.cjs.map +1 -0
  235. package/dist/node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js +112 -0
  236. package/dist/node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js.map +1 -0
  237. package/dist/storage/encoder_backed.cjs +1 -1
  238. package/dist/storage/encoder_backed.d.cts +1 -1
  239. package/dist/storage/encoder_backed.d.ts +1 -1
  240. package/dist/storage/encoder_backed.js +1 -1
  241. package/dist/storage/file_system.cjs +1 -1
  242. package/dist/storage/file_system.js +1 -1
  243. package/package.json +36 -649
  244. package/dist/agents/middlewareAgent/middleware/bigTool.cjs +0 -162
  245. package/dist/agents/middlewareAgent/middleware/bigTool.cjs.map +0 -1
  246. package/dist/agents/middlewareAgent/middleware/bigTool.d.cts +0 -113
  247. package/dist/agents/middlewareAgent/middleware/bigTool.d.cts.map +0 -1
  248. package/dist/agents/middlewareAgent/middleware/bigTool.d.ts +0 -113
  249. package/dist/agents/middlewareAgent/middleware/bigTool.d.ts.map +0 -1
  250. package/dist/agents/middlewareAgent/middleware/bigTool.js +0 -161
  251. package/dist/agents/middlewareAgent/middleware/bigTool.js.map +0 -1
  252. package/dist/chains/analyze_documents_chain.cjs +0 -83
  253. package/dist/chains/analyze_documents_chain.cjs.map +0 -1
  254. package/dist/chains/analyze_documents_chain.d.cts +0 -58
  255. package/dist/chains/analyze_documents_chain.d.cts.map +0 -1
  256. package/dist/chains/analyze_documents_chain.d.ts +0 -58
  257. package/dist/chains/analyze_documents_chain.d.ts.map +0 -1
  258. package/dist/chains/analyze_documents_chain.js +0 -82
  259. package/dist/chains/analyze_documents_chain.js.map +0 -1
  260. package/dist/chains/api/api_chain.cjs +0 -100
  261. package/dist/chains/api/api_chain.cjs.map +0 -1
  262. package/dist/chains/api/api_chain.d.cts +0 -63
  263. package/dist/chains/api/api_chain.d.cts.map +0 -1
  264. package/dist/chains/api/api_chain.d.ts +0 -63
  265. package/dist/chains/api/api_chain.d.ts.map +0 -1
  266. package/dist/chains/api/api_chain.js +0 -100
  267. package/dist/chains/api/api_chain.js.map +0 -1
  268. package/dist/chains/api/prompts.cjs +0 -38
  269. package/dist/chains/api/prompts.cjs.map +0 -1
  270. package/dist/chains/api/prompts.js +0 -36
  271. package/dist/chains/api/prompts.js.map +0 -1
  272. package/dist/chains/base.cjs +0 -180
  273. package/dist/chains/base.cjs.map +0 -1
  274. package/dist/chains/base.d.cts +0 -88
  275. package/dist/chains/base.d.cts.map +0 -1
  276. package/dist/chains/base.d.ts +0 -88
  277. package/dist/chains/base.d.ts.map +0 -1
  278. package/dist/chains/base.js +0 -179
  279. package/dist/chains/base.js.map +0 -1
  280. package/dist/chains/chat_vector_db_chain.cjs +0 -130
  281. package/dist/chains/chat_vector_db_chain.cjs.map +0 -1
  282. package/dist/chains/chat_vector_db_chain.d.cts +0 -62
  283. package/dist/chains/chat_vector_db_chain.d.cts.map +0 -1
  284. package/dist/chains/chat_vector_db_chain.d.ts +0 -62
  285. package/dist/chains/chat_vector_db_chain.d.ts.map +0 -1
  286. package/dist/chains/chat_vector_db_chain.js +0 -129
  287. package/dist/chains/chat_vector_db_chain.js.map +0 -1
  288. package/dist/chains/combine_docs_chain.cjs +0 -275
  289. package/dist/chains/combine_docs_chain.cjs.map +0 -1
  290. package/dist/chains/combine_docs_chain.d.cts +0 -126
  291. package/dist/chains/combine_docs_chain.d.cts.map +0 -1
  292. package/dist/chains/combine_docs_chain.d.ts +0 -126
  293. package/dist/chains/combine_docs_chain.d.ts.map +0 -1
  294. package/dist/chains/combine_docs_chain.js +0 -272
  295. package/dist/chains/combine_docs_chain.js.map +0 -1
  296. package/dist/chains/combine_documents/base.cjs +0 -22
  297. package/dist/chains/combine_documents/base.cjs.map +0 -1
  298. package/dist/chains/combine_documents/base.js +0 -18
  299. package/dist/chains/combine_documents/base.js.map +0 -1
  300. package/dist/chains/combine_documents/index.cjs +0 -16
  301. package/dist/chains/combine_documents/index.cjs.map +0 -1
  302. package/dist/chains/combine_documents/index.d.cts +0 -2
  303. package/dist/chains/combine_documents/index.d.ts +0 -2
  304. package/dist/chains/combine_documents/index.js +0 -10
  305. package/dist/chains/combine_documents/index.js.map +0 -1
  306. package/dist/chains/combine_documents/reduce.cjs +0 -73
  307. package/dist/chains/combine_documents/reduce.cjs.map +0 -1
  308. package/dist/chains/combine_documents/reduce.d.cts +0 -36
  309. package/dist/chains/combine_documents/reduce.d.cts.map +0 -1
  310. package/dist/chains/combine_documents/reduce.d.ts +0 -36
  311. package/dist/chains/combine_documents/reduce.d.ts.map +0 -1
  312. package/dist/chains/combine_documents/reduce.js +0 -66
  313. package/dist/chains/combine_documents/reduce.js.map +0 -1
  314. package/dist/chains/combine_documents/stuff.cjs +0 -41
  315. package/dist/chains/combine_documents/stuff.cjs.map +0 -1
  316. package/dist/chains/combine_documents/stuff.d.cts +0 -40
  317. package/dist/chains/combine_documents/stuff.d.cts.map +0 -1
  318. package/dist/chains/combine_documents/stuff.d.ts +0 -40
  319. package/dist/chains/combine_documents/stuff.d.ts.map +0 -1
  320. package/dist/chains/combine_documents/stuff.js +0 -40
  321. package/dist/chains/combine_documents/stuff.js.map +0 -1
  322. package/dist/chains/constitutional_ai/constitutional_chain.cjs +0 -131
  323. package/dist/chains/constitutional_ai/constitutional_chain.cjs.map +0 -1
  324. package/dist/chains/constitutional_ai/constitutional_chain.d.cts +0 -79
  325. package/dist/chains/constitutional_ai/constitutional_chain.d.cts.map +0 -1
  326. package/dist/chains/constitutional_ai/constitutional_chain.d.ts +0 -79
  327. package/dist/chains/constitutional_ai/constitutional_chain.d.ts.map +0 -1
  328. package/dist/chains/constitutional_ai/constitutional_chain.js +0 -131
  329. package/dist/chains/constitutional_ai/constitutional_chain.js.map +0 -1
  330. package/dist/chains/constitutional_ai/constitutional_principle.cjs +0 -322
  331. package/dist/chains/constitutional_ai/constitutional_principle.cjs.map +0 -1
  332. package/dist/chains/constitutional_ai/constitutional_principle.d.cts +0 -50
  333. package/dist/chains/constitutional_ai/constitutional_principle.d.cts.map +0 -1
  334. package/dist/chains/constitutional_ai/constitutional_principle.d.ts +0 -50
  335. package/dist/chains/constitutional_ai/constitutional_principle.d.ts.map +0 -1
  336. package/dist/chains/constitutional_ai/constitutional_principle.js +0 -320
  337. package/dist/chains/constitutional_ai/constitutional_principle.js.map +0 -1
  338. package/dist/chains/constitutional_ai/constitutional_prompts.cjs +0 -96
  339. package/dist/chains/constitutional_ai/constitutional_prompts.cjs.map +0 -1
  340. package/dist/chains/constitutional_ai/constitutional_prompts.js +0 -94
  341. package/dist/chains/constitutional_ai/constitutional_prompts.js.map +0 -1
  342. package/dist/chains/conversation.cjs +0 -50
  343. package/dist/chains/conversation.cjs.map +0 -1
  344. package/dist/chains/conversation.d.cts +0 -34
  345. package/dist/chains/conversation.d.cts.map +0 -1
  346. package/dist/chains/conversation.d.ts +0 -34
  347. package/dist/chains/conversation.d.ts.map +0 -1
  348. package/dist/chains/conversation.js +0 -48
  349. package/dist/chains/conversation.js.map +0 -1
  350. package/dist/chains/conversational_retrieval_chain.cjs +0 -218
  351. package/dist/chains/conversational_retrieval_chain.cjs.map +0 -1
  352. package/dist/chains/conversational_retrieval_chain.d.cts +0 -152
  353. package/dist/chains/conversational_retrieval_chain.d.cts.map +0 -1
  354. package/dist/chains/conversational_retrieval_chain.d.ts +0 -152
  355. package/dist/chains/conversational_retrieval_chain.d.ts.map +0 -1
  356. package/dist/chains/conversational_retrieval_chain.js +0 -217
  357. package/dist/chains/conversational_retrieval_chain.js.map +0 -1
  358. package/dist/chains/graph_qa/cypher.cjs +0 -133
  359. package/dist/chains/graph_qa/cypher.cjs.map +0 -1
  360. package/dist/chains/graph_qa/cypher.d.cts +0 -76
  361. package/dist/chains/graph_qa/cypher.d.cts.map +0 -1
  362. package/dist/chains/graph_qa/cypher.d.ts +0 -76
  363. package/dist/chains/graph_qa/cypher.d.ts.map +0 -1
  364. package/dist/chains/graph_qa/cypher.js +0 -126
  365. package/dist/chains/graph_qa/cypher.js.map +0 -1
  366. package/dist/chains/graph_qa/prompts.cjs +0 -46
  367. package/dist/chains/graph_qa/prompts.cjs.map +0 -1
  368. package/dist/chains/graph_qa/prompts.js +0 -44
  369. package/dist/chains/graph_qa/prompts.js.map +0 -1
  370. package/dist/chains/history_aware_retriever.cjs +0 -55
  371. package/dist/chains/history_aware_retriever.cjs.map +0 -1
  372. package/dist/chains/history_aware_retriever.d.cts +0 -64
  373. package/dist/chains/history_aware_retriever.d.cts.map +0 -1
  374. package/dist/chains/history_aware_retriever.d.ts +0 -64
  375. package/dist/chains/history_aware_retriever.d.ts.map +0 -1
  376. package/dist/chains/history_aware_retriever.js +0 -49
  377. package/dist/chains/history_aware_retriever.js.map +0 -1
  378. package/dist/chains/index.cjs +0 -106
  379. package/dist/chains/index.cjs.map +0 -1
  380. package/dist/chains/index.d.cts +0 -25
  381. package/dist/chains/index.d.ts +0 -25
  382. package/dist/chains/index.js +0 -67
  383. package/dist/chains/index.js.map +0 -1
  384. package/dist/chains/llm_chain.cjs +0 -155
  385. package/dist/chains/llm_chain.cjs.map +0 -1
  386. package/dist/chains/llm_chain.d.cts +0 -97
  387. package/dist/chains/llm_chain.d.cts.map +0 -1
  388. package/dist/chains/llm_chain.d.ts +0 -97
  389. package/dist/chains/llm_chain.d.ts.map +0 -1
  390. package/dist/chains/llm_chain.js +0 -154
  391. package/dist/chains/llm_chain.js.map +0 -1
  392. package/dist/chains/load.cjs +0 -48
  393. package/dist/chains/load.cjs.map +0 -1
  394. package/dist/chains/load.d.cts +0 -30
  395. package/dist/chains/load.d.cts.map +0 -1
  396. package/dist/chains/load.d.ts +0 -30
  397. package/dist/chains/load.d.ts.map +0 -1
  398. package/dist/chains/load.js +0 -42
  399. package/dist/chains/load.js.map +0 -1
  400. package/dist/chains/openai_functions/base.cjs +0 -139
  401. package/dist/chains/openai_functions/base.cjs.map +0 -1
  402. package/dist/chains/openai_functions/base.d.cts +0 -172
  403. package/dist/chains/openai_functions/base.d.cts.map +0 -1
  404. package/dist/chains/openai_functions/base.d.ts +0 -172
  405. package/dist/chains/openai_functions/base.d.ts.map +0 -1
  406. package/dist/chains/openai_functions/base.js +0 -137
  407. package/dist/chains/openai_functions/base.js.map +0 -1
  408. package/dist/chains/openai_functions/extraction.cjs +0 -71
  409. package/dist/chains/openai_functions/extraction.cjs.map +0 -1
  410. package/dist/chains/openai_functions/extraction.d.cts +0 -29
  411. package/dist/chains/openai_functions/extraction.d.cts.map +0 -1
  412. package/dist/chains/openai_functions/extraction.d.ts +0 -29
  413. package/dist/chains/openai_functions/extraction.d.ts.map +0 -1
  414. package/dist/chains/openai_functions/extraction.js +0 -69
  415. package/dist/chains/openai_functions/extraction.js.map +0 -1
  416. package/dist/chains/openai_functions/index.cjs +0 -33
  417. package/dist/chains/openai_functions/index.cjs.map +0 -1
  418. package/dist/chains/openai_functions/index.d.cts +0 -5
  419. package/dist/chains/openai_functions/index.d.ts +0 -5
  420. package/dist/chains/openai_functions/index.js +0 -21
  421. package/dist/chains/openai_functions/index.js.map +0 -1
  422. package/dist/chains/openai_functions/openapi.cjs +0 -287
  423. package/dist/chains/openai_functions/openapi.cjs.map +0 -1
  424. package/dist/chains/openai_functions/openapi.d.cts +0 -61
  425. package/dist/chains/openai_functions/openapi.d.cts.map +0 -1
  426. package/dist/chains/openai_functions/openapi.d.ts +0 -61
  427. package/dist/chains/openai_functions/openapi.d.ts.map +0 -1
  428. package/dist/chains/openai_functions/openapi.js +0 -285
  429. package/dist/chains/openai_functions/openapi.js.map +0 -1
  430. package/dist/chains/openai_functions/tagging.cjs +0 -72
  431. package/dist/chains/openai_functions/tagging.cjs.map +0 -1
  432. package/dist/chains/openai_functions/tagging.d.cts +0 -47
  433. package/dist/chains/openai_functions/tagging.d.cts.map +0 -1
  434. package/dist/chains/openai_functions/tagging.d.ts +0 -47
  435. package/dist/chains/openai_functions/tagging.d.ts.map +0 -1
  436. package/dist/chains/openai_functions/tagging.js +0 -70
  437. package/dist/chains/openai_functions/tagging.js.map +0 -1
  438. package/dist/chains/query_constructor/index.cjs +0 -145
  439. package/dist/chains/query_constructor/index.cjs.map +0 -1
  440. package/dist/chains/query_constructor/index.d.cts +0 -82
  441. package/dist/chains/query_constructor/index.d.cts.map +0 -1
  442. package/dist/chains/query_constructor/index.d.ts +0 -82
  443. package/dist/chains/query_constructor/index.d.ts.map +0 -1
  444. package/dist/chains/query_constructor/index.js +0 -130
  445. package/dist/chains/query_constructor/index.js.map +0 -1
  446. package/dist/chains/query_constructor/ir.cjs +0 -22
  447. package/dist/chains/query_constructor/ir.cjs.map +0 -1
  448. package/dist/chains/query_constructor/ir.d.cts +0 -1
  449. package/dist/chains/query_constructor/ir.d.ts +0 -1
  450. package/dist/chains/query_constructor/ir.js +0 -12
  451. package/dist/chains/query_constructor/ir.js.map +0 -1
  452. package/dist/chains/query_constructor/parser.cjs +0 -80
  453. package/dist/chains/query_constructor/parser.cjs.map +0 -1
  454. package/dist/chains/query_constructor/parser.d.cts +0 -43
  455. package/dist/chains/query_constructor/parser.d.cts.map +0 -1
  456. package/dist/chains/query_constructor/parser.d.ts +0 -43
  457. package/dist/chains/query_constructor/parser.d.ts.map +0 -1
  458. package/dist/chains/query_constructor/parser.js +0 -79
  459. package/dist/chains/query_constructor/parser.js.map +0 -1
  460. package/dist/chains/query_constructor/prompt.cjs +0 -137
  461. package/dist/chains/query_constructor/prompt.cjs.map +0 -1
  462. package/dist/chains/query_constructor/prompt.d.cts +0 -22
  463. package/dist/chains/query_constructor/prompt.d.cts.map +0 -1
  464. package/dist/chains/query_constructor/prompt.d.ts +0 -22
  465. package/dist/chains/query_constructor/prompt.d.ts.map +0 -1
  466. package/dist/chains/query_constructor/prompt.js +0 -132
  467. package/dist/chains/query_constructor/prompt.js.map +0 -1
  468. package/dist/chains/question_answering/load.cjs +0 -99
  469. package/dist/chains/question_answering/load.cjs.map +0 -1
  470. package/dist/chains/question_answering/load.d.cts +0 -72
  471. package/dist/chains/question_answering/load.d.cts.map +0 -1
  472. package/dist/chains/question_answering/load.d.ts +0 -72
  473. package/dist/chains/question_answering/load.d.ts.map +0 -1
  474. package/dist/chains/question_answering/load.js +0 -96
  475. package/dist/chains/question_answering/load.js.map +0 -1
  476. package/dist/chains/question_answering/map_reduce_prompts.cjs +0 -61
  477. package/dist/chains/question_answering/map_reduce_prompts.cjs.map +0 -1
  478. package/dist/chains/question_answering/map_reduce_prompts.js +0 -59
  479. package/dist/chains/question_answering/map_reduce_prompts.js.map +0 -1
  480. package/dist/chains/question_answering/refine_prompts.cjs +0 -60
  481. package/dist/chains/question_answering/refine_prompts.cjs.map +0 -1
  482. package/dist/chains/question_answering/refine_prompts.js +0 -58
  483. package/dist/chains/question_answering/refine_prompts.js.map +0 -1
  484. package/dist/chains/question_answering/stuff_prompts.cjs +0 -20
  485. package/dist/chains/question_answering/stuff_prompts.cjs.map +0 -1
  486. package/dist/chains/question_answering/stuff_prompts.js +0 -19
  487. package/dist/chains/question_answering/stuff_prompts.js.map +0 -1
  488. package/dist/chains/retrieval.cjs +0 -55
  489. package/dist/chains/retrieval.cjs.map +0 -1
  490. package/dist/chains/retrieval.d.cts +0 -77
  491. package/dist/chains/retrieval.d.cts.map +0 -1
  492. package/dist/chains/retrieval.d.ts +0 -77
  493. package/dist/chains/retrieval.d.ts.map +0 -1
  494. package/dist/chains/retrieval.js +0 -49
  495. package/dist/chains/retrieval.js.map +0 -1
  496. package/dist/chains/retrieval_qa.cjs +0 -106
  497. package/dist/chains/retrieval_qa.cjs.map +0 -1
  498. package/dist/chains/retrieval_qa.d.cts +0 -81
  499. package/dist/chains/retrieval_qa.d.cts.map +0 -1
  500. package/dist/chains/retrieval_qa.d.ts +0 -81
  501. package/dist/chains/retrieval_qa.d.ts.map +0 -1
  502. package/dist/chains/retrieval_qa.js +0 -106
  503. package/dist/chains/retrieval_qa.js.map +0 -1
  504. package/dist/chains/router/llm_router.cjs +0 -50
  505. package/dist/chains/router/llm_router.cjs.map +0 -1
  506. package/dist/chains/router/llm_router.d.cts +0 -54
  507. package/dist/chains/router/llm_router.d.cts.map +0 -1
  508. package/dist/chains/router/llm_router.d.ts +0 -54
  509. package/dist/chains/router/llm_router.d.ts.map +0 -1
  510. package/dist/chains/router/llm_router.js +0 -50
  511. package/dist/chains/router/llm_router.js.map +0 -1
  512. package/dist/chains/router/multi_prompt.cjs +0 -116
  513. package/dist/chains/router/multi_prompt.cjs.map +0 -1
  514. package/dist/chains/router/multi_prompt.d.cts +0 -76
  515. package/dist/chains/router/multi_prompt.d.cts.map +0 -1
  516. package/dist/chains/router/multi_prompt.d.ts +0 -76
  517. package/dist/chains/router/multi_prompt.d.ts.map +0 -1
  518. package/dist/chains/router/multi_prompt.js +0 -115
  519. package/dist/chains/router/multi_prompt.js.map +0 -1
  520. package/dist/chains/router/multi_prompt_prompt.cjs +0 -22
  521. package/dist/chains/router/multi_prompt_prompt.cjs.map +0 -1
  522. package/dist/chains/router/multi_prompt_prompt.js +0 -21
  523. package/dist/chains/router/multi_prompt_prompt.js.map +0 -1
  524. package/dist/chains/router/multi_retrieval_prompt.cjs +0 -22
  525. package/dist/chains/router/multi_retrieval_prompt.cjs.map +0 -1
  526. package/dist/chains/router/multi_retrieval_prompt.js +0 -21
  527. package/dist/chains/router/multi_retrieval_prompt.js.map +0 -1
  528. package/dist/chains/router/multi_retrieval_qa.cjs +0 -137
  529. package/dist/chains/router/multi_retrieval_qa.cjs.map +0 -1
  530. package/dist/chains/router/multi_retrieval_qa.d.cts +0 -100
  531. package/dist/chains/router/multi_retrieval_qa.d.cts.map +0 -1
  532. package/dist/chains/router/multi_retrieval_qa.d.ts +0 -100
  533. package/dist/chains/router/multi_retrieval_qa.d.ts.map +0 -1
  534. package/dist/chains/router/multi_retrieval_qa.js +0 -136
  535. package/dist/chains/router/multi_retrieval_qa.js.map +0 -1
  536. package/dist/chains/router/multi_route.cjs +0 -69
  537. package/dist/chains/router/multi_route.cjs.map +0 -1
  538. package/dist/chains/router/multi_route.d.cts +0 -69
  539. package/dist/chains/router/multi_route.d.cts.map +0 -1
  540. package/dist/chains/router/multi_route.d.ts +0 -69
  541. package/dist/chains/router/multi_route.d.ts.map +0 -1
  542. package/dist/chains/router/multi_route.js +0 -68
  543. package/dist/chains/router/multi_route.js.map +0 -1
  544. package/dist/chains/router/utils.cjs +0 -18
  545. package/dist/chains/router/utils.cjs.map +0 -1
  546. package/dist/chains/router/utils.js +0 -17
  547. package/dist/chains/router/utils.js.map +0 -1
  548. package/dist/chains/sequential_chain.cjs +0 -255
  549. package/dist/chains/sequential_chain.cjs.map +0 -1
  550. package/dist/chains/sequential_chain.d.cts +0 -158
  551. package/dist/chains/sequential_chain.d.cts.map +0 -1
  552. package/dist/chains/sequential_chain.d.ts +0 -158
  553. package/dist/chains/sequential_chain.d.ts.map +0 -1
  554. package/dist/chains/sequential_chain.js +0 -254
  555. package/dist/chains/sequential_chain.js.map +0 -1
  556. package/dist/chains/serde.d.cts +0 -156
  557. package/dist/chains/serde.d.cts.map +0 -1
  558. package/dist/chains/serde.d.ts +0 -156
  559. package/dist/chains/serde.d.ts.map +0 -1
  560. package/dist/chains/sql_db/index.cjs +0 -35
  561. package/dist/chains/sql_db/index.cjs.map +0 -1
  562. package/dist/chains/sql_db/index.d.cts +0 -3
  563. package/dist/chains/sql_db/index.d.ts +0 -3
  564. package/dist/chains/sql_db/index.js +0 -21
  565. package/dist/chains/sql_db/index.js.map +0 -1
  566. package/dist/chains/sql_db/sql_db_chain.cjs +0 -196
  567. package/dist/chains/sql_db/sql_db_chain.cjs.map +0 -1
  568. package/dist/chains/sql_db/sql_db_chain.d.cts +0 -124
  569. package/dist/chains/sql_db/sql_db_chain.d.cts.map +0 -1
  570. package/dist/chains/sql_db/sql_db_chain.d.ts +0 -124
  571. package/dist/chains/sql_db/sql_db_chain.d.ts.map +0 -1
  572. package/dist/chains/sql_db/sql_db_chain.js +0 -194
  573. package/dist/chains/sql_db/sql_db_chain.js.map +0 -1
  574. package/dist/chains/sql_db/sql_db_prompt.cjs +0 -194
  575. package/dist/chains/sql_db/sql_db_prompt.cjs.map +0 -1
  576. package/dist/chains/sql_db/sql_db_prompt.d.cts +0 -44
  577. package/dist/chains/sql_db/sql_db_prompt.d.cts.map +0 -1
  578. package/dist/chains/sql_db/sql_db_prompt.d.ts +0 -44
  579. package/dist/chains/sql_db/sql_db_prompt.d.ts.map +0 -1
  580. package/dist/chains/sql_db/sql_db_prompt.js +0 -186
  581. package/dist/chains/sql_db/sql_db_prompt.js.map +0 -1
  582. package/dist/chains/summarization/load.cjs +0 -74
  583. package/dist/chains/summarization/load.cjs.map +0 -1
  584. package/dist/chains/summarization/load.d.cts +0 -33
  585. package/dist/chains/summarization/load.d.cts.map +0 -1
  586. package/dist/chains/summarization/load.d.ts +0 -33
  587. package/dist/chains/summarization/load.d.ts.map +0 -1
  588. package/dist/chains/summarization/load.js +0 -74
  589. package/dist/chains/summarization/load.js.map +0 -1
  590. package/dist/chains/summarization/refine_prompts.cjs +0 -24
  591. package/dist/chains/summarization/refine_prompts.cjs.map +0 -1
  592. package/dist/chains/summarization/refine_prompts.js +0 -23
  593. package/dist/chains/summarization/refine_prompts.js.map +0 -1
  594. package/dist/chains/summarization/stuff_prompts.cjs +0 -19
  595. package/dist/chains/summarization/stuff_prompts.cjs.map +0 -1
  596. package/dist/chains/summarization/stuff_prompts.js +0 -18
  597. package/dist/chains/summarization/stuff_prompts.js.map +0 -1
  598. package/dist/chains/transform.cjs +0 -43
  599. package/dist/chains/transform.cjs.map +0 -1
  600. package/dist/chains/transform.d.cts +0 -44
  601. package/dist/chains/transform.d.cts.map +0 -1
  602. package/dist/chains/transform.d.ts +0 -44
  603. package/dist/chains/transform.d.ts.map +0 -1
  604. package/dist/chains/transform.js +0 -43
  605. package/dist/chains/transform.js.map +0 -1
  606. package/dist/chains/vector_db_qa.cjs +0 -95
  607. package/dist/chains/vector_db_qa.cjs.map +0 -1
  608. package/dist/chains/vector_db_qa.d.cts +0 -66
  609. package/dist/chains/vector_db_qa.d.cts.map +0 -1
  610. package/dist/chains/vector_db_qa.d.ts +0 -66
  611. package/dist/chains/vector_db_qa.d.ts.map +0 -1
  612. package/dist/chains/vector_db_qa.js +0 -95
  613. package/dist/chains/vector_db_qa.js.map +0 -1
  614. package/dist/document.cjs +0 -21
  615. package/dist/document.cjs.map +0 -1
  616. package/dist/document.d.cts +0 -2
  617. package/dist/document.d.ts +0 -2
  618. package/dist/document.js +0 -10
  619. package/dist/document.js.map +0 -1
  620. package/dist/document_loaders/base.cjs +0 -22
  621. package/dist/document_loaders/base.cjs.map +0 -1
  622. package/dist/document_loaders/base.d.cts +0 -1
  623. package/dist/document_loaders/base.d.ts +0 -1
  624. package/dist/document_loaders/base.js +0 -12
  625. package/dist/document_loaders/base.js.map +0 -1
  626. package/dist/document_loaders/fs/buffer.cjs +0 -69
  627. package/dist/document_loaders/fs/buffer.cjs.map +0 -1
  628. package/dist/document_loaders/fs/buffer.d.cts +0 -46
  629. package/dist/document_loaders/fs/buffer.d.cts.map +0 -1
  630. package/dist/document_loaders/fs/buffer.d.ts +0 -46
  631. package/dist/document_loaders/fs/buffer.d.ts.map +0 -1
  632. package/dist/document_loaders/fs/buffer.js +0 -63
  633. package/dist/document_loaders/fs/buffer.js.map +0 -1
  634. package/dist/document_loaders/fs/directory.cjs +0 -116
  635. package/dist/document_loaders/fs/directory.cjs.map +0 -1
  636. package/dist/document_loaders/fs/directory.d.cts +0 -76
  637. package/dist/document_loaders/fs/directory.d.cts.map +0 -1
  638. package/dist/document_loaders/fs/directory.d.ts +0 -76
  639. package/dist/document_loaders/fs/directory.d.ts.map +0 -1
  640. package/dist/document_loaders/fs/directory.js +0 -109
  641. package/dist/document_loaders/fs/directory.js.map +0 -1
  642. package/dist/document_loaders/fs/json.cjs +0 -128
  643. package/dist/document_loaders/fs/json.cjs.map +0 -1
  644. package/dist/document_loaders/fs/json.d.cts +0 -65
  645. package/dist/document_loaders/fs/json.d.cts.map +0 -1
  646. package/dist/document_loaders/fs/json.d.ts +0 -65
  647. package/dist/document_loaders/fs/json.d.ts.map +0 -1
  648. package/dist/document_loaders/fs/json.js +0 -121
  649. package/dist/document_loaders/fs/json.js.map +0 -1
  650. package/dist/document_loaders/fs/multi_file.cjs +0 -82
  651. package/dist/document_loaders/fs/multi_file.cjs.map +0 -1
  652. package/dist/document_loaders/fs/multi_file.d.cts +0 -43
  653. package/dist/document_loaders/fs/multi_file.d.cts.map +0 -1
  654. package/dist/document_loaders/fs/multi_file.d.ts +0 -43
  655. package/dist/document_loaders/fs/multi_file.d.ts.map +0 -1
  656. package/dist/document_loaders/fs/multi_file.js +0 -76
  657. package/dist/document_loaders/fs/multi_file.js.map +0 -1
  658. package/dist/document_loaders/fs/text.cjs +0 -101
  659. package/dist/document_loaders/fs/text.cjs.map +0 -1
  660. package/dist/document_loaders/fs/text.d.cts +0 -57
  661. package/dist/document_loaders/fs/text.d.cts.map +0 -1
  662. package/dist/document_loaders/fs/text.d.ts +0 -57
  663. package/dist/document_loaders/fs/text.d.ts.map +0 -1
  664. package/dist/document_loaders/fs/text.js +0 -95
  665. package/dist/document_loaders/fs/text.js.map +0 -1
  666. package/dist/evaluation/agents/index.cjs +0 -1
  667. package/dist/evaluation/agents/index.js +0 -1
  668. package/dist/evaluation/agents/prompt.cjs +0 -132
  669. package/dist/evaluation/agents/prompt.cjs.map +0 -1
  670. package/dist/evaluation/agents/prompt.js +0 -130
  671. package/dist/evaluation/agents/prompt.js.map +0 -1
  672. package/dist/evaluation/agents/trajectory.cjs +0 -132
  673. package/dist/evaluation/agents/trajectory.cjs.map +0 -1
  674. package/dist/evaluation/agents/trajectory.d.cts +0 -61
  675. package/dist/evaluation/agents/trajectory.d.cts.map +0 -1
  676. package/dist/evaluation/agents/trajectory.d.ts +0 -61
  677. package/dist/evaluation/agents/trajectory.d.ts.map +0 -1
  678. package/dist/evaluation/agents/trajectory.js +0 -130
  679. package/dist/evaluation/agents/trajectory.js.map +0 -1
  680. package/dist/evaluation/base.cjs +0 -169
  681. package/dist/evaluation/base.cjs.map +0 -1
  682. package/dist/evaluation/base.d.cts +0 -240
  683. package/dist/evaluation/base.d.cts.map +0 -1
  684. package/dist/evaluation/base.d.ts +0 -240
  685. package/dist/evaluation/base.d.ts.map +0 -1
  686. package/dist/evaluation/base.js +0 -164
  687. package/dist/evaluation/base.js.map +0 -1
  688. package/dist/evaluation/comparison/index.cjs +0 -1
  689. package/dist/evaluation/comparison/index.js +0 -1
  690. package/dist/evaluation/comparison/pairwise.cjs +0 -178
  691. package/dist/evaluation/comparison/pairwise.cjs.map +0 -1
  692. package/dist/evaluation/comparison/pairwise.d.cts +0 -56
  693. package/dist/evaluation/comparison/pairwise.d.cts.map +0 -1
  694. package/dist/evaluation/comparison/pairwise.d.ts +0 -56
  695. package/dist/evaluation/comparison/pairwise.d.ts.map +0 -1
  696. package/dist/evaluation/comparison/pairwise.js +0 -175
  697. package/dist/evaluation/comparison/pairwise.js.map +0 -1
  698. package/dist/evaluation/comparison/prompt.cjs +0 -77
  699. package/dist/evaluation/comparison/prompt.cjs.map +0 -1
  700. package/dist/evaluation/comparison/prompt.js +0 -75
  701. package/dist/evaluation/comparison/prompt.js.map +0 -1
  702. package/dist/evaluation/criteria/criteria.cjs +0 -164
  703. package/dist/evaluation/criteria/criteria.cjs.map +0 -1
  704. package/dist/evaluation/criteria/criteria.d.cts +0 -85
  705. package/dist/evaluation/criteria/criteria.d.cts.map +0 -1
  706. package/dist/evaluation/criteria/criteria.d.ts +0 -85
  707. package/dist/evaluation/criteria/criteria.d.ts.map +0 -1
  708. package/dist/evaluation/criteria/criteria.js +0 -161
  709. package/dist/evaluation/criteria/criteria.js.map +0 -1
  710. package/dist/evaluation/criteria/index.cjs +0 -1
  711. package/dist/evaluation/criteria/index.js +0 -1
  712. package/dist/evaluation/criteria/prompt.cjs +0 -50
  713. package/dist/evaluation/criteria/prompt.cjs.map +0 -1
  714. package/dist/evaluation/criteria/prompt.js +0 -48
  715. package/dist/evaluation/criteria/prompt.js.map +0 -1
  716. package/dist/evaluation/embedding_distance/base.cjs +0 -108
  717. package/dist/evaluation/embedding_distance/base.cjs.map +0 -1
  718. package/dist/evaluation/embedding_distance/base.d.cts +0 -82
  719. package/dist/evaluation/embedding_distance/base.d.cts.map +0 -1
  720. package/dist/evaluation/embedding_distance/base.d.ts +0 -82
  721. package/dist/evaluation/embedding_distance/base.d.ts.map +0 -1
  722. package/dist/evaluation/embedding_distance/base.js +0 -105
  723. package/dist/evaluation/embedding_distance/base.js.map +0 -1
  724. package/dist/evaluation/embedding_distance/index.cjs +0 -1
  725. package/dist/evaluation/embedding_distance/index.js +0 -1
  726. package/dist/evaluation/index.cjs +0 -54
  727. package/dist/evaluation/index.cjs.map +0 -1
  728. package/dist/evaluation/index.d.cts +0 -8
  729. package/dist/evaluation/index.d.ts +0 -8
  730. package/dist/evaluation/index.js +0 -35
  731. package/dist/evaluation/index.js.map +0 -1
  732. package/dist/evaluation/loader.cjs +0 -57
  733. package/dist/evaluation/loader.cjs.map +0 -1
  734. package/dist/evaluation/loader.d.cts +0 -38
  735. package/dist/evaluation/loader.d.cts.map +0 -1
  736. package/dist/evaluation/loader.d.ts +0 -38
  737. package/dist/evaluation/loader.d.ts.map +0 -1
  738. package/dist/evaluation/loader.js +0 -56
  739. package/dist/evaluation/loader.js.map +0 -1
  740. package/dist/evaluation/qa/eval_chain.cjs +0 -41
  741. package/dist/evaluation/qa/eval_chain.cjs.map +0 -1
  742. package/dist/evaluation/qa/eval_chain.d.cts +0 -22
  743. package/dist/evaluation/qa/eval_chain.d.cts.map +0 -1
  744. package/dist/evaluation/qa/eval_chain.d.ts +0 -22
  745. package/dist/evaluation/qa/eval_chain.d.ts.map +0 -1
  746. package/dist/evaluation/qa/eval_chain.js +0 -41
  747. package/dist/evaluation/qa/eval_chain.js.map +0 -1
  748. package/dist/evaluation/qa/index.cjs +0 -1
  749. package/dist/evaluation/qa/index.js +0 -1
  750. package/dist/evaluation/qa/prompt.cjs +0 -31
  751. package/dist/evaluation/qa/prompt.cjs.map +0 -1
  752. package/dist/evaluation/qa/prompt.js +0 -30
  753. package/dist/evaluation/qa/prompt.js.map +0 -1
  754. package/dist/evaluation/types.d.cts +0 -40
  755. package/dist/evaluation/types.d.cts.map +0 -1
  756. package/dist/evaluation/types.d.ts +0 -40
  757. package/dist/evaluation/types.d.ts.map +0 -1
  758. package/dist/langchain-core/dist/load/map_keys.d.cts +0 -10
  759. package/dist/langchain-core/dist/load/map_keys.d.cts.map +0 -1
  760. package/dist/langchain-core/dist/load/serializable.d.cts +0 -82
  761. package/dist/langchain-core/dist/load/serializable.d.cts.map +0 -1
  762. package/dist/langchain-core/dist/messages/base.d.cts +0 -125
  763. package/dist/langchain-core/dist/messages/base.d.cts.map +0 -1
  764. package/dist/langchain-core/dist/messages/content/base.d.cts +0 -22
  765. package/dist/langchain-core/dist/messages/content/base.d.cts.map +0 -1
  766. package/dist/langchain-core/dist/messages/content/data.d.cts +0 -96
  767. package/dist/langchain-core/dist/messages/content/data.d.cts.map +0 -1
  768. package/dist/langchain-core/dist/messages/content/index.d.cts +0 -121
  769. package/dist/langchain-core/dist/messages/content/index.d.cts.map +0 -1
  770. package/dist/langchain-core/dist/messages/content/multimodal.d.cts +0 -110
  771. package/dist/langchain-core/dist/messages/content/multimodal.d.cts.map +0 -1
  772. package/dist/langchain-core/dist/messages/content/tools.d.cts +0 -214
  773. package/dist/langchain-core/dist/messages/content/tools.d.cts.map +0 -1
  774. package/dist/langchain-core/dist/messages/message.d.cts +0 -598
  775. package/dist/langchain-core/dist/messages/message.d.cts.map +0 -1
  776. package/dist/langchain-core/dist/messages/metadata.d.cts +0 -97
  777. package/dist/langchain-core/dist/messages/metadata.d.cts.map +0 -1
  778. package/dist/langchain-core/dist/messages/utils.d.cts +0 -75
  779. package/dist/langchain-core/dist/messages/utils.d.cts.map +0 -1
  780. package/dist/langchain-core/dist/prompt_values.d.cts +0 -13
  781. package/dist/langchain-core/dist/prompt_values.d.cts.map +0 -1
  782. package/dist/langchain-core/dist/utils/types/index.d.cts +0 -8
  783. package/dist/langchain-core/dist/utils/types/index.d.cts.map +0 -1
  784. package/dist/libs/langchain-core/dist/load/map_keys.d.ts +0 -10
  785. package/dist/libs/langchain-core/dist/load/map_keys.d.ts.map +0 -1
  786. package/dist/libs/langchain-core/dist/load/serializable.d.ts +0 -82
  787. package/dist/libs/langchain-core/dist/load/serializable.d.ts.map +0 -1
  788. package/dist/libs/langchain-core/dist/messages/base.d.ts +0 -125
  789. package/dist/libs/langchain-core/dist/messages/base.d.ts.map +0 -1
  790. package/dist/libs/langchain-core/dist/messages/content/base.d.ts +0 -22
  791. package/dist/libs/langchain-core/dist/messages/content/base.d.ts.map +0 -1
  792. package/dist/libs/langchain-core/dist/messages/content/data.d.ts +0 -96
  793. package/dist/libs/langchain-core/dist/messages/content/data.d.ts.map +0 -1
  794. package/dist/libs/langchain-core/dist/messages/content/index.d.ts +0 -121
  795. package/dist/libs/langchain-core/dist/messages/content/index.d.ts.map +0 -1
  796. package/dist/libs/langchain-core/dist/messages/content/multimodal.d.ts +0 -110
  797. package/dist/libs/langchain-core/dist/messages/content/multimodal.d.ts.map +0 -1
  798. package/dist/libs/langchain-core/dist/messages/content/tools.d.ts +0 -214
  799. package/dist/libs/langchain-core/dist/messages/content/tools.d.ts.map +0 -1
  800. package/dist/libs/langchain-core/dist/messages/message.d.ts +0 -598
  801. package/dist/libs/langchain-core/dist/messages/message.d.ts.map +0 -1
  802. package/dist/libs/langchain-core/dist/messages/metadata.d.ts +0 -97
  803. package/dist/libs/langchain-core/dist/messages/metadata.d.ts.map +0 -1
  804. package/dist/libs/langchain-core/dist/messages/utils.d.ts +0 -75
  805. package/dist/libs/langchain-core/dist/messages/utils.d.ts.map +0 -1
  806. package/dist/libs/langchain-core/dist/prompt_values.d.ts +0 -13
  807. package/dist/libs/langchain-core/dist/prompt_values.d.ts.map +0 -1
  808. package/dist/libs/langchain-core/dist/utils/types/index.d.ts +0 -10
  809. package/dist/libs/langchain-core/dist/utils/types/index.d.ts.map +0 -1
  810. package/dist/libs/langchain-core/dist/utils/types/zod.d.ts +0 -1
  811. package/dist/load/map_keys.d.cts +0 -8
  812. package/dist/load/map_keys.d.cts.map +0 -1
  813. package/dist/load/map_keys.d.ts +0 -8
  814. package/dist/load/map_keys.d.ts.map +0 -1
  815. package/dist/load/serializable.d.cts.map +0 -1
  816. package/dist/load/serializable.d.ts.map +0 -1
  817. package/dist/memory/buffer_memory.cjs +0 -80
  818. package/dist/memory/buffer_memory.cjs.map +0 -1
  819. package/dist/memory/buffer_memory.d.cts +0 -67
  820. package/dist/memory/buffer_memory.d.cts.map +0 -1
  821. package/dist/memory/buffer_memory.d.ts +0 -67
  822. package/dist/memory/buffer_memory.d.ts.map +0 -1
  823. package/dist/memory/buffer_memory.js +0 -79
  824. package/dist/memory/buffer_memory.js.map +0 -1
  825. package/dist/memory/buffer_token_memory.cjs +0 -80
  826. package/dist/memory/buffer_token_memory.cjs.map +0 -1
  827. package/dist/memory/buffer_token_memory.d.cts +0 -67
  828. package/dist/memory/buffer_token_memory.d.cts.map +0 -1
  829. package/dist/memory/buffer_token_memory.d.ts +0 -67
  830. package/dist/memory/buffer_token_memory.d.ts.map +0 -1
  831. package/dist/memory/buffer_token_memory.js +0 -79
  832. package/dist/memory/buffer_token_memory.js.map +0 -1
  833. package/dist/memory/buffer_window_memory.cjs +0 -77
  834. package/dist/memory/buffer_window_memory.cjs.map +0 -1
  835. package/dist/memory/buffer_window_memory.d.cts +0 -64
  836. package/dist/memory/buffer_window_memory.d.cts.map +0 -1
  837. package/dist/memory/buffer_window_memory.d.ts +0 -64
  838. package/dist/memory/buffer_window_memory.d.ts.map +0 -1
  839. package/dist/memory/buffer_window_memory.js +0 -76
  840. package/dist/memory/buffer_window_memory.js.map +0 -1
  841. package/dist/memory/chat_memory.cjs +0 -53
  842. package/dist/memory/chat_memory.cjs.map +0 -1
  843. package/dist/memory/chat_memory.d.cts +0 -42
  844. package/dist/memory/chat_memory.d.cts.map +0 -1
  845. package/dist/memory/chat_memory.d.ts +0 -42
  846. package/dist/memory/chat_memory.d.ts.map +0 -1
  847. package/dist/memory/chat_memory.js +0 -47
  848. package/dist/memory/chat_memory.js.map +0 -1
  849. package/dist/memory/combined_memory.cjs +0 -88
  850. package/dist/memory/combined_memory.cjs.map +0 -1
  851. package/dist/memory/combined_memory.d.cts +0 -60
  852. package/dist/memory/combined_memory.d.cts.map +0 -1
  853. package/dist/memory/combined_memory.d.ts +0 -60
  854. package/dist/memory/combined_memory.d.ts.map +0 -1
  855. package/dist/memory/combined_memory.js +0 -88
  856. package/dist/memory/combined_memory.js.map +0 -1
  857. package/dist/memory/entity_memory.cjs +0 -144
  858. package/dist/memory/entity_memory.cjs.map +0 -1
  859. package/dist/memory/entity_memory.d.cts +0 -99
  860. package/dist/memory/entity_memory.d.cts.map +0 -1
  861. package/dist/memory/entity_memory.d.ts +0 -99
  862. package/dist/memory/entity_memory.d.ts.map +0 -1
  863. package/dist/memory/entity_memory.js +0 -143
  864. package/dist/memory/entity_memory.js.map +0 -1
  865. package/dist/memory/index.cjs +0 -85
  866. package/dist/memory/index.cjs.map +0 -1
  867. package/dist/memory/index.d.cts +0 -14
  868. package/dist/memory/index.d.ts +0 -14
  869. package/dist/memory/index.js +0 -39
  870. package/dist/memory/index.js.map +0 -1
  871. package/dist/memory/prompt.cjs +0 -124
  872. package/dist/memory/prompt.cjs.map +0 -1
  873. package/dist/memory/prompt.d.cts +0 -12
  874. package/dist/memory/prompt.d.cts.map +0 -1
  875. package/dist/memory/prompt.d.ts +0 -12
  876. package/dist/memory/prompt.d.ts.map +0 -1
  877. package/dist/memory/prompt.js +0 -120
  878. package/dist/memory/prompt.js.map +0 -1
  879. package/dist/memory/stores/entity/base.cjs +0 -13
  880. package/dist/memory/stores/entity/base.cjs.map +0 -1
  881. package/dist/memory/stores/entity/base.d.cts +0 -18
  882. package/dist/memory/stores/entity/base.d.cts.map +0 -1
  883. package/dist/memory/stores/entity/base.d.ts +0 -18
  884. package/dist/memory/stores/entity/base.d.ts.map +0 -1
  885. package/dist/memory/stores/entity/base.js +0 -12
  886. package/dist/memory/stores/entity/base.js.map +0 -1
  887. package/dist/memory/stores/entity/in_memory.cjs +0 -64
  888. package/dist/memory/stores/entity/in_memory.cjs.map +0 -1
  889. package/dist/memory/stores/entity/in_memory.js +0 -64
  890. package/dist/memory/stores/entity/in_memory.js.map +0 -1
  891. package/dist/memory/summary.cjs +0 -127
  892. package/dist/memory/summary.cjs.map +0 -1
  893. package/dist/memory/summary.d.cts +0 -101
  894. package/dist/memory/summary.d.cts.map +0 -1
  895. package/dist/memory/summary.d.ts +0 -101
  896. package/dist/memory/summary.d.ts.map +0 -1
  897. package/dist/memory/summary.js +0 -125
  898. package/dist/memory/summary.js.map +0 -1
  899. package/dist/memory/summary_buffer.cjs +0 -117
  900. package/dist/memory/summary_buffer.cjs.map +0 -1
  901. package/dist/memory/summary_buffer.d.cts +0 -90
  902. package/dist/memory/summary_buffer.d.cts.map +0 -1
  903. package/dist/memory/summary_buffer.d.ts +0 -90
  904. package/dist/memory/summary_buffer.d.ts.map +0 -1
  905. package/dist/memory/summary_buffer.js +0 -116
  906. package/dist/memory/summary_buffer.js.map +0 -1
  907. package/dist/memory/vector_store.cjs +0 -87
  908. package/dist/memory/vector_store.cjs.map +0 -1
  909. package/dist/memory/vector_store.d.cts +0 -81
  910. package/dist/memory/vector_store.d.cts.map +0 -1
  911. package/dist/memory/vector_store.d.ts +0 -81
  912. package/dist/memory/vector_store.d.ts.map +0 -1
  913. package/dist/memory/vector_store.js +0 -86
  914. package/dist/memory/vector_store.js.map +0 -1
  915. package/dist/output_parsers/combining.cjs +0 -61
  916. package/dist/output_parsers/combining.cjs.map +0 -1
  917. package/dist/output_parsers/combining.d.cts +0 -46
  918. package/dist/output_parsers/combining.d.cts.map +0 -1
  919. package/dist/output_parsers/combining.d.ts +0 -46
  920. package/dist/output_parsers/combining.d.ts.map +0 -1
  921. package/dist/output_parsers/combining.js +0 -60
  922. package/dist/output_parsers/combining.js.map +0 -1
  923. package/dist/output_parsers/datetime.cjs +0 -46
  924. package/dist/output_parsers/datetime.cjs.map +0 -1
  925. package/dist/output_parsers/datetime.d.cts +0 -33
  926. package/dist/output_parsers/datetime.d.cts.map +0 -1
  927. package/dist/output_parsers/datetime.d.ts +0 -33
  928. package/dist/output_parsers/datetime.d.ts.map +0 -1
  929. package/dist/output_parsers/datetime.js +0 -45
  930. package/dist/output_parsers/datetime.js.map +0 -1
  931. package/dist/output_parsers/expression.cjs +0 -86
  932. package/dist/output_parsers/expression.cjs.map +0 -1
  933. package/dist/output_parsers/expression.d.cts +0 -53
  934. package/dist/output_parsers/expression.d.cts.map +0 -1
  935. package/dist/output_parsers/expression.d.ts +0 -53
  936. package/dist/output_parsers/expression.d.ts.map +0 -1
  937. package/dist/output_parsers/expression.js +0 -79
  938. package/dist/output_parsers/expression.js.map +0 -1
  939. package/dist/output_parsers/expression_type_handlers/array_literal_expression_handler.cjs +0 -38
  940. package/dist/output_parsers/expression_type_handlers/array_literal_expression_handler.cjs.map +0 -1
  941. package/dist/output_parsers/expression_type_handlers/array_literal_expression_handler.js +0 -38
  942. package/dist/output_parsers/expression_type_handlers/array_literal_expression_handler.js.map +0 -1
  943. package/dist/output_parsers/expression_type_handlers/base.cjs +0 -130
  944. package/dist/output_parsers/expression_type_handlers/base.cjs.map +0 -1
  945. package/dist/output_parsers/expression_type_handlers/base.d.cts +0 -108
  946. package/dist/output_parsers/expression_type_handlers/base.d.cts.map +0 -1
  947. package/dist/output_parsers/expression_type_handlers/base.d.ts +0 -108
  948. package/dist/output_parsers/expression_type_handlers/base.d.ts.map +0 -1
  949. package/dist/output_parsers/expression_type_handlers/base.js +0 -129
  950. package/dist/output_parsers/expression_type_handlers/base.js.map +0 -1
  951. package/dist/output_parsers/expression_type_handlers/boolean_literal_handler.cjs +0 -38
  952. package/dist/output_parsers/expression_type_handlers/boolean_literal_handler.cjs.map +0 -1
  953. package/dist/output_parsers/expression_type_handlers/boolean_literal_handler.js +0 -38
  954. package/dist/output_parsers/expression_type_handlers/boolean_literal_handler.js.map +0 -1
  955. package/dist/output_parsers/expression_type_handlers/call_expression_handler.cjs +0 -64
  956. package/dist/output_parsers/expression_type_handlers/call_expression_handler.cjs.map +0 -1
  957. package/dist/output_parsers/expression_type_handlers/call_expression_handler.js +0 -64
  958. package/dist/output_parsers/expression_type_handlers/call_expression_handler.js.map +0 -1
  959. package/dist/output_parsers/expression_type_handlers/factory.cjs +0 -68
  960. package/dist/output_parsers/expression_type_handlers/factory.cjs.map +0 -1
  961. package/dist/output_parsers/expression_type_handlers/factory.d.cts +0 -35
  962. package/dist/output_parsers/expression_type_handlers/factory.d.cts.map +0 -1
  963. package/dist/output_parsers/expression_type_handlers/factory.d.ts +0 -35
  964. package/dist/output_parsers/expression_type_handlers/factory.d.ts.map +0 -1
  965. package/dist/output_parsers/expression_type_handlers/factory.js +0 -68
  966. package/dist/output_parsers/expression_type_handlers/factory.js.map +0 -1
  967. package/dist/output_parsers/expression_type_handlers/grammar/parser_grammar.cjs +0 -299
  968. package/dist/output_parsers/expression_type_handlers/grammar/parser_grammar.cjs.map +0 -1
  969. package/dist/output_parsers/expression_type_handlers/grammar/parser_grammar.js +0 -298
  970. package/dist/output_parsers/expression_type_handlers/grammar/parser_grammar.js.map +0 -1
  971. package/dist/output_parsers/expression_type_handlers/identifier_handler.cjs +0 -40
  972. package/dist/output_parsers/expression_type_handlers/identifier_handler.cjs.map +0 -1
  973. package/dist/output_parsers/expression_type_handlers/identifier_handler.js +0 -40
  974. package/dist/output_parsers/expression_type_handlers/identifier_handler.js.map +0 -1
  975. package/dist/output_parsers/expression_type_handlers/member_expression_handler.cjs +0 -48
  976. package/dist/output_parsers/expression_type_handlers/member_expression_handler.cjs.map +0 -1
  977. package/dist/output_parsers/expression_type_handlers/member_expression_handler.js +0 -48
  978. package/dist/output_parsers/expression_type_handlers/member_expression_handler.js.map +0 -1
  979. package/dist/output_parsers/expression_type_handlers/numeric_literal_handler.cjs +0 -36
  980. package/dist/output_parsers/expression_type_handlers/numeric_literal_handler.cjs.map +0 -1
  981. package/dist/output_parsers/expression_type_handlers/numeric_literal_handler.js +0 -36
  982. package/dist/output_parsers/expression_type_handlers/numeric_literal_handler.js.map +0 -1
  983. package/dist/output_parsers/expression_type_handlers/object_literal_expression_handler.cjs +0 -40
  984. package/dist/output_parsers/expression_type_handlers/object_literal_expression_handler.cjs.map +0 -1
  985. package/dist/output_parsers/expression_type_handlers/object_literal_expression_handler.js +0 -40
  986. package/dist/output_parsers/expression_type_handlers/object_literal_expression_handler.js.map +0 -1
  987. package/dist/output_parsers/expression_type_handlers/property_assignment_handler.cjs +0 -45
  988. package/dist/output_parsers/expression_type_handlers/property_assignment_handler.cjs.map +0 -1
  989. package/dist/output_parsers/expression_type_handlers/property_assignment_handler.js +0 -45
  990. package/dist/output_parsers/expression_type_handlers/property_assignment_handler.js.map +0 -1
  991. package/dist/output_parsers/expression_type_handlers/string_literal_handler.cjs +0 -37
  992. package/dist/output_parsers/expression_type_handlers/string_literal_handler.cjs.map +0 -1
  993. package/dist/output_parsers/expression_type_handlers/string_literal_handler.js +0 -37
  994. package/dist/output_parsers/expression_type_handlers/string_literal_handler.js.map +0 -1
  995. package/dist/output_parsers/expression_type_handlers/types.d.cts +0 -95
  996. package/dist/output_parsers/expression_type_handlers/types.d.cts.map +0 -1
  997. package/dist/output_parsers/expression_type_handlers/types.d.ts +0 -95
  998. package/dist/output_parsers/expression_type_handlers/types.d.ts.map +0 -1
  999. package/dist/output_parsers/fix.cjs +0 -92
  1000. package/dist/output_parsers/fix.cjs.map +0 -1
  1001. package/dist/output_parsers/fix.d.cts +0 -60
  1002. package/dist/output_parsers/fix.d.cts.map +0 -1
  1003. package/dist/output_parsers/fix.d.ts +0 -60
  1004. package/dist/output_parsers/fix.d.ts.map +0 -1
  1005. package/dist/output_parsers/fix.js +0 -91
  1006. package/dist/output_parsers/fix.js.map +0 -1
  1007. package/dist/output_parsers/http_response.cjs +0 -53
  1008. package/dist/output_parsers/http_response.cjs.map +0 -1
  1009. package/dist/output_parsers/http_response.d.cts +0 -33
  1010. package/dist/output_parsers/http_response.d.cts.map +0 -1
  1011. package/dist/output_parsers/http_response.d.ts +0 -33
  1012. package/dist/output_parsers/http_response.d.ts.map +0 -1
  1013. package/dist/output_parsers/http_response.js +0 -52
  1014. package/dist/output_parsers/http_response.js.map +0 -1
  1015. package/dist/output_parsers/index.cjs +0 -74
  1016. package/dist/output_parsers/index.cjs.map +0 -1
  1017. package/dist/output_parsers/index.d.cts +0 -11
  1018. package/dist/output_parsers/index.d.ts +0 -11
  1019. package/dist/output_parsers/index.js +0 -37
  1020. package/dist/output_parsers/index.js.map +0 -1
  1021. package/dist/output_parsers/noop.cjs +0 -43
  1022. package/dist/output_parsers/noop.cjs.map +0 -1
  1023. package/dist/output_parsers/noop.js +0 -42
  1024. package/dist/output_parsers/noop.js.map +0 -1
  1025. package/dist/output_parsers/openai_functions.cjs +0 -145
  1026. package/dist/output_parsers/openai_functions.cjs.map +0 -1
  1027. package/dist/output_parsers/openai_functions.d.cts +0 -85
  1028. package/dist/output_parsers/openai_functions.d.cts.map +0 -1
  1029. package/dist/output_parsers/openai_functions.d.ts +0 -85
  1030. package/dist/output_parsers/openai_functions.d.ts.map +0 -1
  1031. package/dist/output_parsers/openai_functions.js +0 -142
  1032. package/dist/output_parsers/openai_functions.js.map +0 -1
  1033. package/dist/output_parsers/openai_tools.cjs +0 -89
  1034. package/dist/output_parsers/openai_tools.cjs.map +0 -1
  1035. package/dist/output_parsers/openai_tools.d.cts +0 -69
  1036. package/dist/output_parsers/openai_tools.d.cts.map +0 -1
  1037. package/dist/output_parsers/openai_tools.d.ts +0 -69
  1038. package/dist/output_parsers/openai_tools.d.ts.map +0 -1
  1039. package/dist/output_parsers/openai_tools.js +0 -87
  1040. package/dist/output_parsers/openai_tools.js.map +0 -1
  1041. package/dist/output_parsers/prompts.cjs +0 -25
  1042. package/dist/output_parsers/prompts.cjs.map +0 -1
  1043. package/dist/output_parsers/prompts.js +0 -24
  1044. package/dist/output_parsers/prompts.js.map +0 -1
  1045. package/dist/output_parsers/regex.cjs +0 -74
  1046. package/dist/output_parsers/regex.cjs.map +0 -1
  1047. package/dist/output_parsers/regex.d.cts +0 -49
  1048. package/dist/output_parsers/regex.d.cts.map +0 -1
  1049. package/dist/output_parsers/regex.d.ts +0 -49
  1050. package/dist/output_parsers/regex.d.ts.map +0 -1
  1051. package/dist/output_parsers/regex.js +0 -73
  1052. package/dist/output_parsers/regex.js.map +0 -1
  1053. package/dist/output_parsers/router.cjs +0 -40
  1054. package/dist/output_parsers/router.cjs.map +0 -1
  1055. package/dist/output_parsers/router.d.cts +0 -36
  1056. package/dist/output_parsers/router.d.cts.map +0 -1
  1057. package/dist/output_parsers/router.d.ts +0 -36
  1058. package/dist/output_parsers/router.d.ts.map +0 -1
  1059. package/dist/output_parsers/router.js +0 -39
  1060. package/dist/output_parsers/router.js.map +0 -1
  1061. package/dist/output_parsers/structured.cjs +0 -164
  1062. package/dist/output_parsers/structured.cjs.map +0 -1
  1063. package/dist/output_parsers/structured.d.cts +0 -97
  1064. package/dist/output_parsers/structured.d.cts.map +0 -1
  1065. package/dist/output_parsers/structured.d.ts +0 -97
  1066. package/dist/output_parsers/structured.d.ts.map +0 -1
  1067. package/dist/output_parsers/structured.js +0 -161
  1068. package/dist/output_parsers/structured.js.map +0 -1
  1069. package/dist/retrievers/contextual_compression.cjs +0 -53
  1070. package/dist/retrievers/contextual_compression.cjs.map +0 -1
  1071. package/dist/retrievers/contextual_compression.d.cts +0 -42
  1072. package/dist/retrievers/contextual_compression.d.cts.map +0 -1
  1073. package/dist/retrievers/contextual_compression.d.ts +0 -42
  1074. package/dist/retrievers/contextual_compression.d.ts.map +0 -1
  1075. package/dist/retrievers/contextual_compression.js +0 -47
  1076. package/dist/retrievers/contextual_compression.js.map +0 -1
  1077. package/dist/retrievers/document_compressors/chain_extract.cjs +0 -103
  1078. package/dist/retrievers/document_compressors/chain_extract.cjs.map +0 -1
  1079. package/dist/retrievers/document_compressors/chain_extract.d.cts +0 -47
  1080. package/dist/retrievers/document_compressors/chain_extract.d.cts.map +0 -1
  1081. package/dist/retrievers/document_compressors/chain_extract.d.ts +0 -47
  1082. package/dist/retrievers/document_compressors/chain_extract.d.ts.map +0 -1
  1083. package/dist/retrievers/document_compressors/chain_extract.js +0 -97
  1084. package/dist/retrievers/document_compressors/chain_extract.js.map +0 -1
  1085. package/dist/retrievers/document_compressors/chain_extract_prompt.cjs +0 -16
  1086. package/dist/retrievers/document_compressors/chain_extract_prompt.cjs.map +0 -1
  1087. package/dist/retrievers/document_compressors/chain_extract_prompt.js +0 -15
  1088. package/dist/retrievers/document_compressors/chain_extract_prompt.js.map +0 -1
  1089. package/dist/retrievers/document_compressors/embeddings_filter.cjs +0 -74
  1090. package/dist/retrievers/document_compressors/embeddings_filter.cjs.map +0 -1
  1091. package/dist/retrievers/document_compressors/embeddings_filter.d.cts +0 -58
  1092. package/dist/retrievers/document_compressors/embeddings_filter.d.cts.map +0 -1
  1093. package/dist/retrievers/document_compressors/embeddings_filter.d.ts +0 -58
  1094. package/dist/retrievers/document_compressors/embeddings_filter.d.ts.map +0 -1
  1095. package/dist/retrievers/document_compressors/embeddings_filter.js +0 -68
  1096. package/dist/retrievers/document_compressors/embeddings_filter.js.map +0 -1
  1097. package/dist/retrievers/document_compressors/index.cjs +0 -69
  1098. package/dist/retrievers/document_compressors/index.cjs.map +0 -1
  1099. package/dist/retrievers/document_compressors/index.d.cts +0 -61
  1100. package/dist/retrievers/document_compressors/index.d.cts.map +0 -1
  1101. package/dist/retrievers/document_compressors/index.d.ts +0 -61
  1102. package/dist/retrievers/document_compressors/index.d.ts.map +0 -1
  1103. package/dist/retrievers/document_compressors/index.js +0 -62
  1104. package/dist/retrievers/document_compressors/index.js.map +0 -1
  1105. package/dist/retrievers/ensemble.cjs +0 -76
  1106. package/dist/retrievers/ensemble.cjs.map +0 -1
  1107. package/dist/retrievers/ensemble.d.cts +0 -39
  1108. package/dist/retrievers/ensemble.d.cts.map +0 -1
  1109. package/dist/retrievers/ensemble.d.ts +0 -39
  1110. package/dist/retrievers/ensemble.d.ts.map +0 -1
  1111. package/dist/retrievers/ensemble.js +0 -70
  1112. package/dist/retrievers/ensemble.js.map +0 -1
  1113. package/dist/retrievers/hyde.cjs +0 -128
  1114. package/dist/retrievers/hyde.cjs.map +0 -1
  1115. package/dist/retrievers/hyde.d.cts +0 -61
  1116. package/dist/retrievers/hyde.d.cts.map +0 -1
  1117. package/dist/retrievers/hyde.d.ts +0 -61
  1118. package/dist/retrievers/hyde.d.ts.map +0 -1
  1119. package/dist/retrievers/hyde.js +0 -121
  1120. package/dist/retrievers/hyde.js.map +0 -1
  1121. package/dist/retrievers/matryoshka_retriever.cjs +0 -116
  1122. package/dist/retrievers/matryoshka_retriever.cjs.map +0 -1
  1123. package/dist/retrievers/matryoshka_retriever.d.cts +0 -99
  1124. package/dist/retrievers/matryoshka_retriever.d.cts.map +0 -1
  1125. package/dist/retrievers/matryoshka_retriever.d.ts +0 -99
  1126. package/dist/retrievers/matryoshka_retriever.d.ts.map +0 -1
  1127. package/dist/retrievers/matryoshka_retriever.js +0 -110
  1128. package/dist/retrievers/matryoshka_retriever.js.map +0 -1
  1129. package/dist/retrievers/multi_query.cjs +0 -150
  1130. package/dist/retrievers/multi_query.cjs.map +0 -1
  1131. package/dist/retrievers/multi_query.d.cts +0 -59
  1132. package/dist/retrievers/multi_query.d.cts.map +0 -1
  1133. package/dist/retrievers/multi_query.d.ts +0 -59
  1134. package/dist/retrievers/multi_query.d.ts.map +0 -1
  1135. package/dist/retrievers/multi_query.js +0 -144
  1136. package/dist/retrievers/multi_query.js.map +0 -1
  1137. package/dist/retrievers/multi_vector.cjs +0 -67
  1138. package/dist/retrievers/multi_vector.cjs.map +0 -1
  1139. package/dist/retrievers/multi_vector.d.cts +0 -51
  1140. package/dist/retrievers/multi_vector.d.cts.map +0 -1
  1141. package/dist/retrievers/multi_vector.d.ts +0 -51
  1142. package/dist/retrievers/multi_vector.d.ts.map +0 -1
  1143. package/dist/retrievers/multi_vector.js +0 -61
  1144. package/dist/retrievers/multi_vector.js.map +0 -1
  1145. package/dist/retrievers/parent_document.cjs +0 -137
  1146. package/dist/retrievers/parent_document.cjs.map +0 -1
  1147. package/dist/retrievers/parent_document.d.cts +0 -92
  1148. package/dist/retrievers/parent_document.d.cts.map +0 -1
  1149. package/dist/retrievers/parent_document.d.ts +0 -92
  1150. package/dist/retrievers/parent_document.d.ts.map +0 -1
  1151. package/dist/retrievers/parent_document.js +0 -131
  1152. package/dist/retrievers/parent_document.js.map +0 -1
  1153. package/dist/retrievers/score_threshold.cjs +0 -43
  1154. package/dist/retrievers/score_threshold.cjs.map +0 -1
  1155. package/dist/retrievers/score_threshold.d.cts +0 -20
  1156. package/dist/retrievers/score_threshold.d.cts.map +0 -1
  1157. package/dist/retrievers/score_threshold.d.ts +0 -20
  1158. package/dist/retrievers/score_threshold.d.ts.map +0 -1
  1159. package/dist/retrievers/score_threshold.js +0 -37
  1160. package/dist/retrievers/score_threshold.js.map +0 -1
  1161. package/dist/retrievers/self_query/functional.cjs +0 -21
  1162. package/dist/retrievers/self_query/functional.cjs.map +0 -1
  1163. package/dist/retrievers/self_query/functional.d.cts +0 -2
  1164. package/dist/retrievers/self_query/functional.d.ts +0 -2
  1165. package/dist/retrievers/self_query/functional.js +0 -10
  1166. package/dist/retrievers/self_query/functional.js.map +0 -1
  1167. package/dist/retrievers/self_query/index.cjs +0 -130
  1168. package/dist/retrievers/self_query/index.cjs.map +0 -1
  1169. package/dist/retrievers/self_query/index.d.cts +0 -79
  1170. package/dist/retrievers/self_query/index.d.cts.map +0 -1
  1171. package/dist/retrievers/self_query/index.d.ts +0 -79
  1172. package/dist/retrievers/self_query/index.d.ts.map +0 -1
  1173. package/dist/retrievers/self_query/index.js +0 -106
  1174. package/dist/retrievers/self_query/index.js.map +0 -1
  1175. package/dist/retrievers/time_weighted.cjs +0 -236
  1176. package/dist/retrievers/time_weighted.cjs.map +0 -1
  1177. package/dist/retrievers/time_weighted.d.cts +0 -142
  1178. package/dist/retrievers/time_weighted.d.cts.map +0 -1
  1179. package/dist/retrievers/time_weighted.d.ts +0 -142
  1180. package/dist/retrievers/time_weighted.d.ts.map +0 -1
  1181. package/dist/retrievers/time_weighted.js +0 -228
  1182. package/dist/retrievers/time_weighted.js.map +0 -1
  1183. package/dist/sql_db.cjs +0 -119
  1184. package/dist/sql_db.cjs.map +0 -1
  1185. package/dist/sql_db.d.cts +0 -60
  1186. package/dist/sql_db.d.cts.map +0 -1
  1187. package/dist/sql_db.d.ts +0 -60
  1188. package/dist/sql_db.d.ts.map +0 -1
  1189. package/dist/sql_db.js +0 -113
  1190. package/dist/sql_db.js.map +0 -1
  1191. package/dist/stores/doc/base.cjs +0 -20
  1192. package/dist/stores/doc/base.cjs.map +0 -1
  1193. package/dist/stores/doc/base.d.cts +0 -15
  1194. package/dist/stores/doc/base.d.cts.map +0 -1
  1195. package/dist/stores/doc/base.d.ts +0 -15
  1196. package/dist/stores/doc/base.d.ts.map +0 -1
  1197. package/dist/stores/doc/base.js +0 -14
  1198. package/dist/stores/doc/base.js.map +0 -1
  1199. package/dist/stores/doc/in_memory.cjs +0 -94
  1200. package/dist/stores/doc/in_memory.cjs.map +0 -1
  1201. package/dist/stores/doc/in_memory.d.cts +0 -53
  1202. package/dist/stores/doc/in_memory.d.cts.map +0 -1
  1203. package/dist/stores/doc/in_memory.d.ts +0 -53
  1204. package/dist/stores/doc/in_memory.d.ts.map +0 -1
  1205. package/dist/stores/doc/in_memory.js +0 -87
  1206. package/dist/stores/doc/in_memory.js.map +0 -1
  1207. package/dist/stores/file/base.cjs +0 -13
  1208. package/dist/stores/file/base.cjs.map +0 -1
  1209. package/dist/stores/file/base.d.cts +0 -15
  1210. package/dist/stores/file/base.d.cts.map +0 -1
  1211. package/dist/stores/file/base.d.ts +0 -15
  1212. package/dist/stores/file/base.d.ts.map +0 -1
  1213. package/dist/stores/file/base.js +0 -12
  1214. package/dist/stores/file/base.js.map +0 -1
  1215. package/dist/stores/file/in_memory.cjs +0 -53
  1216. package/dist/stores/file/in_memory.cjs.map +0 -1
  1217. package/dist/stores/file/in_memory.d.cts +0 -33
  1218. package/dist/stores/file/in_memory.d.cts.map +0 -1
  1219. package/dist/stores/file/in_memory.d.ts +0 -33
  1220. package/dist/stores/file/in_memory.d.ts.map +0 -1
  1221. package/dist/stores/file/in_memory.js +0 -47
  1222. package/dist/stores/file/in_memory.js.map +0 -1
  1223. package/dist/stores/file/node.cjs +0 -52
  1224. package/dist/stores/file/node.cjs.map +0 -1
  1225. package/dist/stores/file/node.d.cts +0 -29
  1226. package/dist/stores/file/node.d.cts.map +0 -1
  1227. package/dist/stores/file/node.d.ts +0 -29
  1228. package/dist/stores/file/node.d.ts.map +0 -1
  1229. package/dist/stores/file/node.js +0 -46
  1230. package/dist/stores/file/node.js.map +0 -1
  1231. package/dist/stores/message/in_memory.cjs +0 -21
  1232. package/dist/stores/message/in_memory.cjs.map +0 -1
  1233. package/dist/stores/message/in_memory.d.cts +0 -2
  1234. package/dist/stores/message/in_memory.d.ts +0 -2
  1235. package/dist/stores/message/in_memory.js +0 -10
  1236. package/dist/stores/message/in_memory.js.map +0 -1
  1237. package/dist/text_splitter.cjs +0 -22
  1238. package/dist/text_splitter.cjs.map +0 -1
  1239. package/dist/text_splitter.d.cts +0 -1
  1240. package/dist/text_splitter.d.ts +0 -1
  1241. package/dist/text_splitter.js +0 -12
  1242. package/dist/text_splitter.js.map +0 -1
  1243. package/dist/tools/chain.cjs +0 -36
  1244. package/dist/tools/chain.cjs.map +0 -1
  1245. package/dist/tools/chain.d.cts +0 -32
  1246. package/dist/tools/chain.d.cts.map +0 -1
  1247. package/dist/tools/chain.d.ts +0 -32
  1248. package/dist/tools/chain.d.ts.map +0 -1
  1249. package/dist/tools/chain.js +0 -30
  1250. package/dist/tools/chain.js.map +0 -1
  1251. package/dist/tools/fs.cjs +0 -56
  1252. package/dist/tools/fs.cjs.map +0 -1
  1253. package/dist/tools/fs.d.cts +0 -92
  1254. package/dist/tools/fs.d.cts.map +0 -1
  1255. package/dist/tools/fs.d.ts +0 -92
  1256. package/dist/tools/fs.d.ts.map +0 -1
  1257. package/dist/tools/fs.js +0 -54
  1258. package/dist/tools/fs.js.map +0 -1
  1259. package/dist/tools/index.cjs +0 -68
  1260. package/dist/tools/index.cjs.map +0 -1
  1261. package/dist/tools/index.d.cts +0 -8
  1262. package/dist/tools/index.d.ts +0 -8
  1263. package/dist/tools/index.js +0 -30
  1264. package/dist/tools/index.js.map +0 -1
  1265. package/dist/tools/json.cjs +0 -107
  1266. package/dist/tools/json.cjs.map +0 -1
  1267. package/dist/tools/json.d.cts +0 -65
  1268. package/dist/tools/json.d.cts.map +0 -1
  1269. package/dist/tools/json.d.ts +0 -65
  1270. package/dist/tools/json.d.ts.map +0 -1
  1271. package/dist/tools/json.js +0 -104
  1272. package/dist/tools/json.js.map +0 -1
  1273. package/dist/tools/render.cjs +0 -55
  1274. package/dist/tools/render.cjs.map +0 -1
  1275. package/dist/tools/render.d.cts +0 -32
  1276. package/dist/tools/render.d.cts.map +0 -1
  1277. package/dist/tools/render.d.ts +0 -32
  1278. package/dist/tools/render.d.ts.map +0 -1
  1279. package/dist/tools/render.js +0 -48
  1280. package/dist/tools/render.js.map +0 -1
  1281. package/dist/tools/requests.cjs +0 -73
  1282. package/dist/tools/requests.cjs.map +0 -1
  1283. package/dist/tools/requests.d.cts +0 -56
  1284. package/dist/tools/requests.d.cts.map +0 -1
  1285. package/dist/tools/requests.d.ts +0 -56
  1286. package/dist/tools/requests.d.ts.map +0 -1
  1287. package/dist/tools/requests.js +0 -71
  1288. package/dist/tools/requests.js.map +0 -1
  1289. package/dist/tools/retriever.cjs +0 -30
  1290. package/dist/tools/retriever.cjs.map +0 -1
  1291. package/dist/tools/retriever.d.cts +0 -19
  1292. package/dist/tools/retriever.d.cts.map +0 -1
  1293. package/dist/tools/retriever.d.ts +0 -19
  1294. package/dist/tools/retriever.d.ts.map +0 -1
  1295. package/dist/tools/retriever.js +0 -24
  1296. package/dist/tools/retriever.js.map +0 -1
  1297. package/dist/tools/sql.cjs +0 -165
  1298. package/dist/tools/sql.cjs.map +0 -1
  1299. package/dist/tools/sql.d.cts +0 -86
  1300. package/dist/tools/sql.d.cts.map +0 -1
  1301. package/dist/tools/sql.d.ts +0 -86
  1302. package/dist/tools/sql.d.ts.map +0 -1
  1303. package/dist/tools/sql.js +0 -156
  1304. package/dist/tools/sql.js.map +0 -1
  1305. package/dist/tools/vectorstore.cjs +0 -45
  1306. package/dist/tools/vectorstore.cjs.map +0 -1
  1307. package/dist/tools/vectorstore.d.cts +0 -40
  1308. package/dist/tools/vectorstore.d.cts.map +0 -1
  1309. package/dist/tools/vectorstore.d.ts +0 -40
  1310. package/dist/tools/vectorstore.d.ts.map +0 -1
  1311. package/dist/tools/vectorstore.js +0 -44
  1312. package/dist/tools/vectorstore.js.map +0 -1
  1313. package/dist/tools/webbrowser.cjs +0 -176
  1314. package/dist/tools/webbrowser.cjs.map +0 -1
  1315. package/dist/tools/webbrowser.d.cts +0 -69
  1316. package/dist/tools/webbrowser.d.cts.map +0 -1
  1317. package/dist/tools/webbrowser.d.ts +0 -69
  1318. package/dist/tools/webbrowser.d.ts.map +0 -1
  1319. package/dist/tools/webbrowser.js +0 -168
  1320. package/dist/tools/webbrowser.js.map +0 -1
  1321. package/dist/types/expression-parser.d.cts +0 -91
  1322. package/dist/types/expression-parser.d.cts.map +0 -1
  1323. package/dist/types/expression-parser.d.ts +0 -91
  1324. package/dist/types/expression-parser.d.ts.map +0 -1
  1325. package/dist/types/type-utils.d.cts +0 -7
  1326. package/dist/types/type-utils.d.cts.map +0 -1
  1327. package/dist/types/type-utils.d.ts +0 -7
  1328. package/dist/types/type-utils.d.ts.map +0 -1
  1329. package/dist/util/document.cjs +0 -23
  1330. package/dist/util/document.cjs.map +0 -1
  1331. package/dist/util/document.d.cts +0 -15
  1332. package/dist/util/document.d.cts.map +0 -1
  1333. package/dist/util/document.d.ts +0 -15
  1334. package/dist/util/document.d.ts.map +0 -1
  1335. package/dist/util/document.js +0 -17
  1336. package/dist/util/document.js.map +0 -1
  1337. package/dist/util/entrypoint_deprecation.cjs +0 -1
  1338. package/dist/util/entrypoint_deprecation.js +0 -1
  1339. package/dist/util/env.cjs +0 -2
  1340. package/dist/util/env.js +0 -1
  1341. package/dist/util/extname.cjs +0 -7
  1342. package/dist/util/extname.cjs.map +0 -1
  1343. package/dist/util/extname.js +0 -6
  1344. package/dist/util/extname.js.map +0 -1
  1345. package/dist/util/hub.cjs +0 -39
  1346. package/dist/util/hub.cjs.map +0 -1
  1347. package/dist/util/hub.js +0 -38
  1348. package/dist/util/hub.js.map +0 -1
  1349. package/dist/util/load.cjs +0 -15
  1350. package/dist/util/load.cjs.map +0 -1
  1351. package/dist/util/load.d.cts +0 -6
  1352. package/dist/util/load.d.cts.map +0 -1
  1353. package/dist/util/load.d.ts +0 -6
  1354. package/dist/util/load.d.ts.map +0 -1
  1355. package/dist/util/load.js +0 -14
  1356. package/dist/util/load.js.map +0 -1
  1357. package/dist/util/math.cjs +0 -22
  1358. package/dist/util/math.cjs.map +0 -1
  1359. package/dist/util/math.d.cts +0 -1
  1360. package/dist/util/math.d.ts +0 -1
  1361. package/dist/util/math.js +0 -12
  1362. package/dist/util/math.js.map +0 -1
  1363. package/dist/util/ml-distance/distances.cjs +0 -35
  1364. package/dist/util/ml-distance/distances.cjs.map +0 -1
  1365. package/dist/util/ml-distance/distances.js +0 -33
  1366. package/dist/util/ml-distance/distances.js.map +0 -1
  1367. package/dist/util/ml-distance/similarities.cjs +0 -23
  1368. package/dist/util/ml-distance/similarities.cjs.map +0 -1
  1369. package/dist/util/ml-distance/similarities.d.cts +0 -11
  1370. package/dist/util/ml-distance/similarities.d.cts.map +0 -1
  1371. package/dist/util/ml-distance/similarities.d.ts +0 -11
  1372. package/dist/util/ml-distance/similarities.d.ts.map +0 -1
  1373. package/dist/util/ml-distance/similarities.js +0 -22
  1374. package/dist/util/ml-distance/similarities.js.map +0 -1
  1375. package/dist/util/ml-distance-euclidean/euclidean.cjs +0 -14
  1376. package/dist/util/ml-distance-euclidean/euclidean.cjs.map +0 -1
  1377. package/dist/util/ml-distance-euclidean/euclidean.js +0 -13
  1378. package/dist/util/ml-distance-euclidean/euclidean.js.map +0 -1
  1379. package/dist/util/openapi.cjs +0 -149
  1380. package/dist/util/openapi.cjs.map +0 -1
  1381. package/dist/util/openapi.d.cts +0 -83
  1382. package/dist/util/openapi.d.cts.map +0 -1
  1383. package/dist/util/openapi.d.ts +0 -83
  1384. package/dist/util/openapi.d.ts.map +0 -1
  1385. package/dist/util/openapi.js +0 -148
  1386. package/dist/util/openapi.js.map +0 -1
  1387. package/dist/util/parse.cjs +0 -22
  1388. package/dist/util/parse.cjs.map +0 -1
  1389. package/dist/util/parse.js +0 -21
  1390. package/dist/util/parse.js.map +0 -1
  1391. package/dist/util/set.cjs +0 -35
  1392. package/dist/util/set.cjs.map +0 -1
  1393. package/dist/util/set.js +0 -32
  1394. package/dist/util/set.js.map +0 -1
  1395. package/dist/util/sql_utils.cjs +0 -178
  1396. package/dist/util/sql_utils.cjs.map +0 -1
  1397. package/dist/util/sql_utils.d.cts +0 -31
  1398. package/dist/util/sql_utils.d.cts.map +0 -1
  1399. package/dist/util/sql_utils.d.ts +0 -31
  1400. package/dist/util/sql_utils.d.ts.map +0 -1
  1401. package/dist/util/sql_utils.js +0 -173
  1402. package/dist/util/sql_utils.js.map +0 -1
  1403. package/dist/util/time.cjs +0 -25
  1404. package/dist/util/time.cjs.map +0 -1
  1405. package/dist/util/time.d.cts +0 -10
  1406. package/dist/util/time.d.cts.map +0 -1
  1407. package/dist/util/time.d.ts +0 -10
  1408. package/dist/util/time.d.ts.map +0 -1
  1409. package/dist/util/time.js +0 -19
  1410. package/dist/util/time.js.map +0 -1
  1411. package/dist/vectorstores/memory.cjs +0 -265
  1412. package/dist/vectorstores/memory.cjs.map +0 -1
  1413. package/dist/vectorstores/memory.d.cts +0 -216
  1414. package/dist/vectorstores/memory.d.cts.map +0 -1
  1415. package/dist/vectorstores/memory.d.ts +0 -216
  1416. package/dist/vectorstores/memory.d.ts.map +0 -1
  1417. package/dist/vectorstores/memory.js +0 -259
  1418. package/dist/vectorstores/memory.js.map +0 -1
@@ -0,0 +1,240 @@
1
+ import { createMiddleware } from "../middleware.js";
2
+ import { AIMessage, HumanMessage } from "@langchain/core/messages";
3
+ import { z } from "zod/v3";
4
+
5
+ //#region src/agents/middlewareAgent/middleware/toolCallLimit.ts
6
+ /**
7
+ * Count tool calls in a list of messages.
8
+ *
9
+ * @param messages - List of messages to count tool calls in.
10
+ * @param toolName - If specified, only count calls to this specific tool.
11
+ * If undefined, count all tool calls.
12
+ * @returns The total number of tool calls (optionally filtered by toolName).
13
+ */
14
+ function countToolCallsInMessages(messages, toolName) {
15
+ let count = 0;
16
+ for (const message of messages) if (AIMessage.isInstance(message) && message.tool_calls) if (toolName === void 0) count += message.tool_calls.length;
17
+ else count += message.tool_calls.filter((tc) => tc.name === toolName).length;
18
+ return count;
19
+ }
20
+ /**
21
+ * Get messages from the current run (after the last HumanMessage).
22
+ *
23
+ * @param messages - Full list of messages.
24
+ * @returns Messages from the current run (after last HumanMessage).
25
+ */
26
+ function getRunMessages(messages) {
27
+ /**
28
+ * Find the last HumanMessage
29
+ */
30
+ let lastHumanIndex = -1;
31
+ for (let i = messages.length - 1; i >= 0; i--) if (HumanMessage.isInstance(messages[i])) {
32
+ lastHumanIndex = i;
33
+ break;
34
+ }
35
+ /**
36
+ * If no HumanMessage found, return all messages
37
+ */
38
+ if (lastHumanIndex === -1) return messages;
39
+ /**
40
+ * Return messages after the last HumanMessage
41
+ */
42
+ return messages.slice(lastHumanIndex + 1);
43
+ }
44
+ /**
45
+ * Build a message indicating which tool call limits were reached.
46
+ *
47
+ * @param threadCount - Current thread tool call count.
48
+ * @param runCount - Current run tool call count.
49
+ * @param threadLimit - Thread tool call limit (if set).
50
+ * @param runLimit - Run tool call limit (if set).
51
+ * @param toolName - Tool name being limited (if specific tool), or undefined for all tools.
52
+ * @returns A formatted message describing which limits were reached.
53
+ */
54
+ function buildToolLimitExceededMessage(threadCount, runCount, threadLimit, runLimit, toolName) {
55
+ const toolDesc = toolName ? `'${toolName}' tool call` : "Tool call";
56
+ const exceededLimits = [];
57
+ if (threadLimit !== void 0 && threadCount >= threadLimit) exceededLimits.push(`thread limit reached (${threadCount}/${threadLimit})`);
58
+ if (runLimit !== void 0 && runCount >= runLimit) exceededLimits.push(`run limit reached (${runCount}/${runLimit})`);
59
+ return `${toolDesc} limit${exceededLimits.length > 1 ? "s" : ""}: ${exceededLimits.join(", ")}. Stopping to prevent further tool calls.`;
60
+ }
61
+ /**
62
+ * Exception raised when tool call limits are exceeded.
63
+ *
64
+ * This exception is raised when the configured exit behavior is 'error'
65
+ * and either the thread or run tool call limit has been exceeded.
66
+ */
67
+ var ToolCallLimitExceededError = class extends Error {
68
+ /**
69
+ * Current thread tool call count.
70
+ */
71
+ threadCount;
72
+ /**
73
+ * Current run tool call count.
74
+ */
75
+ runCount;
76
+ /**
77
+ * Thread tool call limit (if set).
78
+ */
79
+ threadLimit;
80
+ /**
81
+ * Run tool call limit (if set).
82
+ */
83
+ runLimit;
84
+ /**
85
+ * Tool name being limited (if specific tool), or undefined for all tools.
86
+ */
87
+ toolName;
88
+ constructor(threadCount, runCount, threadLimit, runLimit, toolName = void 0) {
89
+ const message = buildToolLimitExceededMessage(threadCount, runCount, threadLimit, runLimit, toolName);
90
+ super(message);
91
+ this.name = "ToolCallLimitExceededError";
92
+ this.threadCount = threadCount;
93
+ this.runCount = runCount;
94
+ this.threadLimit = threadLimit;
95
+ this.runLimit = runLimit;
96
+ this.toolName = toolName;
97
+ }
98
+ };
99
+ /**
100
+ * Options for configuring the Tool Call Limit middleware.
101
+ */
102
+ const ToolCallLimitOptionsSchema = z.object({
103
+ toolName: z.string().optional(),
104
+ threadLimit: z.number().optional(),
105
+ runLimit: z.number().optional(),
106
+ exitBehavior: z.enum(["end", "error"]).default("end")
107
+ });
108
+ /**
109
+ * Middleware that tracks tool call counts and enforces limits.
110
+ *
111
+ * This middleware monitors the number of tool calls made during agent execution
112
+ * and can terminate the agent when specified limits are reached. It supports
113
+ * both thread-level and run-level call counting with configurable exit behaviors.
114
+ *
115
+ * Thread-level: The middleware counts all tool calls in the entire message history
116
+ * and persists this count across multiple runs (invocations) of the agent.
117
+ *
118
+ * Run-level: The middleware counts tool calls made after the last HumanMessage,
119
+ * representing the current run (invocation) of the agent.
120
+ *
121
+ * @param options - Configuration options for the middleware
122
+ * @param options.toolName - Name of the specific tool to limit. If undefined, limits apply to all tools.
123
+ * @param options.threadLimit - Maximum number of tool calls allowed per thread. undefined means no limit.
124
+ * @param options.runLimit - Maximum number of tool calls allowed per run. undefined means no limit.
125
+ * @param options.exitBehavior - What to do when limits are exceeded.
126
+ * - "end": Jump to the end of the agent execution and inject an artificial AI message indicating that the limit was exceeded.
127
+ * - "error": throws a ToolCallLimitExceededError
128
+ *
129
+ * @throws {Error} If both limits are undefined or if exitBehavior is invalid.
130
+ *
131
+ * @example Limit all tool calls globally
132
+ * ```ts
133
+ * import { toolCallLimitMiddleware } from "@langchain/langchain/agents/middleware";
134
+ * import { createAgent } from "@langchain/langchain/agents";
135
+ *
136
+ * const globalLimiter = toolCallLimitMiddleware({
137
+ * threadLimit: 20,
138
+ * runLimit: 10,
139
+ * exitBehavior: "end"
140
+ * });
141
+ *
142
+ * const agent = createAgent({
143
+ * model: "openai:gpt-4o",
144
+ * middleware: [globalLimiter]
145
+ * });
146
+ * ```
147
+ *
148
+ * @example Limit a specific tool
149
+ * ```ts
150
+ * import { toolCallLimitMiddleware } from "@langchain/langchain/agents/middleware";
151
+ * import { createAgent } from "@langchain/langchain/agents";
152
+ *
153
+ * const searchLimiter = toolCallLimitMiddleware({
154
+ * toolName: "search",
155
+ * threadLimit: 5,
156
+ * runLimit: 3,
157
+ * exitBehavior: "end"
158
+ * });
159
+ *
160
+ * const agent = createAgent({
161
+ * model: "openai:gpt-4o",
162
+ * middleware: [searchLimiter]
163
+ * });
164
+ * ```
165
+ *
166
+ * @example Use both in the same agent
167
+ * ```ts
168
+ * import { toolCallLimitMiddleware } from "@langchain/langchain/agents/middleware";
169
+ * import { createAgent } from "@langchain/langchain/agents";
170
+ *
171
+ * const globalLimiter = toolCallLimitMiddleware({
172
+ * threadLimit: 20,
173
+ * runLimit: 10,
174
+ * exitBehavior: "end"
175
+ * });
176
+ *
177
+ * const searchLimiter = toolCallLimitMiddleware({
178
+ * toolName: "search",
179
+ * threadLimit: 5,
180
+ * runLimit: 3,
181
+ * exitBehavior: "end"
182
+ * });
183
+ *
184
+ * const agent = createAgent({
185
+ * model: "openai:gpt-4o",
186
+ * middleware: [globalLimiter, searchLimiter]
187
+ * });
188
+ * ```
189
+ */
190
+ function toolCallLimitMiddleware(options) {
191
+ /**
192
+ * Validate that at least one limit is specified
193
+ */
194
+ if (options.threadLimit === void 0 && options.runLimit === void 0) throw new Error("At least one limit must be specified (threadLimit or runLimit)");
195
+ /**
196
+ * Apply default for exitBehavior and validate
197
+ */
198
+ const exitBehavior = options.exitBehavior ?? "end";
199
+ if (exitBehavior !== "end" && exitBehavior !== "error") throw new Error(`Invalid exit behavior: ${exitBehavior}. Must be 'end' or 'error'`);
200
+ /**
201
+ * Generate the middleware name based on the tool name
202
+ */
203
+ const middlewareName = options.toolName ? `ToolCallLimitMiddleware[${options.toolName}]` : "ToolCallLimitMiddleware";
204
+ return createMiddleware({
205
+ name: middlewareName,
206
+ beforeModelJumpTo: ["end"],
207
+ async beforeModel(state) {
208
+ const messages = state.messages;
209
+ /**
210
+ * Count tool calls in entire thread
211
+ */
212
+ const threadCount = countToolCallsInMessages(messages, options.toolName);
213
+ /**
214
+ * Count tool calls in current run (after last HumanMessage)
215
+ */
216
+ const runMessages = getRunMessages(messages);
217
+ const runCount = countToolCallsInMessages(runMessages, options.toolName);
218
+ /**
219
+ * Check if any limits are exceeded
220
+ */
221
+ const threadLimitExceeded = options.threadLimit !== void 0 && threadCount >= options.threadLimit;
222
+ const runLimitExceeded = options.runLimit !== void 0 && runCount >= options.runLimit;
223
+ if (!threadLimitExceeded && !runLimitExceeded) return void 0;
224
+ if (exitBehavior === "error") throw new ToolCallLimitExceededError(threadCount, runCount, options.threadLimit, options.runLimit, options.toolName);
225
+ /**
226
+ * Create a message indicating the limit was exceeded
227
+ */
228
+ const limitMessage = buildToolLimitExceededMessage(threadCount, runCount, options.threadLimit, options.runLimit, options.toolName);
229
+ const limitAiMessage = new AIMessage(limitMessage);
230
+ return {
231
+ jumpTo: "end",
232
+ messages: [limitAiMessage]
233
+ };
234
+ }
235
+ });
236
+ }
237
+
238
+ //#endregion
239
+ export { ToolCallLimitExceededError, toolCallLimitMiddleware };
240
+ //# sourceMappingURL=toolCallLimit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toolCallLimit.js","names":["messages: BaseMessage[]","toolName?: string","threadCount: number","runCount: number","threadLimit: number | undefined","runLimit: number | undefined","toolName: string | undefined","exceededLimits: string[]","options: ToolCallLimitConfig","state: AgentBuiltInState"],"sources":["../../../../src/agents/middlewareAgent/middleware/toolCallLimit.ts"],"sourcesContent":["/**\n * Tool call limit middleware for agents.\n */\n\nimport { AIMessage, BaseMessage, HumanMessage } from \"@langchain/core/messages\";\nimport { z } from \"zod/v3\";\nimport type { InferInteropZodInput } from \"@langchain/core/utils/types\";\n\nimport { createMiddleware } from \"../middleware.js\";\nimport type { AgentBuiltInState } from \"../types.js\";\n\n/**\n * Count tool calls in a list of messages.\n *\n * @param messages - List of messages to count tool calls in.\n * @param toolName - If specified, only count calls to this specific tool.\n * If undefined, count all tool calls.\n * @returns The total number of tool calls (optionally filtered by toolName).\n */\nfunction countToolCallsInMessages(\n messages: BaseMessage[],\n toolName?: string\n): number {\n let count = 0;\n for (const message of messages) {\n if (AIMessage.isInstance(message) && message.tool_calls) {\n if (toolName === undefined) {\n // Count all tool calls\n count += message.tool_calls.length;\n } else {\n // Count only calls to the specified tool\n count += message.tool_calls.filter((tc) => tc.name === toolName).length;\n }\n }\n }\n return count;\n}\n\n/**\n * Get messages from the current run (after the last HumanMessage).\n *\n * @param messages - Full list of messages.\n * @returns Messages from the current run (after last HumanMessage).\n */\nfunction getRunMessages(messages: BaseMessage[]): BaseMessage[] {\n /**\n * Find the last HumanMessage\n */\n let lastHumanIndex = -1;\n for (let i = messages.length - 1; i >= 0; i--) {\n if (HumanMessage.isInstance(messages[i])) {\n lastHumanIndex = i;\n break;\n }\n }\n\n /**\n * If no HumanMessage found, return all messages\n */\n if (lastHumanIndex === -1) {\n return messages;\n }\n\n /**\n * Return messages after the last HumanMessage\n */\n return messages.slice(lastHumanIndex + 1);\n}\n\n/**\n * Build a message indicating which tool call limits were reached.\n *\n * @param threadCount - Current thread tool call count.\n * @param runCount - Current run tool call count.\n * @param threadLimit - Thread tool call limit (if set).\n * @param runLimit - Run tool call limit (if set).\n * @param toolName - Tool name being limited (if specific tool), or undefined for all tools.\n * @returns A formatted message describing which limits were reached.\n */\nfunction buildToolLimitExceededMessage(\n threadCount: number,\n runCount: number,\n threadLimit: number | undefined,\n runLimit: number | undefined,\n toolName: string | undefined\n): string {\n const toolDesc = toolName ? `'${toolName}' tool call` : \"Tool call\";\n const exceededLimits: string[] = [];\n\n if (threadLimit !== undefined && threadCount >= threadLimit) {\n exceededLimits.push(`thread limit reached (${threadCount}/${threadLimit})`);\n }\n if (runLimit !== undefined && runCount >= runLimit) {\n exceededLimits.push(`run limit reached (${runCount}/${runLimit})`);\n }\n\n return `${toolDesc} limit${\n exceededLimits.length > 1 ? \"s\" : \"\"\n }: ${exceededLimits.join(\", \")}. Stopping to prevent further tool calls.`;\n}\n\n/**\n * Exception raised when tool call limits are exceeded.\n *\n * This exception is raised when the configured exit behavior is 'error'\n * and either the thread or run tool call limit has been exceeded.\n */\nexport class ToolCallLimitExceededError extends Error {\n /**\n * Current thread tool call count.\n */\n threadCount: number;\n /**\n * Current run tool call count.\n */\n runCount: number;\n /**\n * Thread tool call limit (if set).\n */\n threadLimit: number | undefined;\n /**\n * Run tool call limit (if set).\n */\n runLimit: number | undefined;\n /**\n * Tool name being limited (if specific tool), or undefined for all tools.\n */\n toolName: string | undefined;\n\n constructor(\n threadCount: number,\n runCount: number,\n threadLimit: number | undefined,\n runLimit: number | undefined,\n toolName: string | undefined = undefined\n ) {\n const message = buildToolLimitExceededMessage(\n threadCount,\n runCount,\n threadLimit,\n runLimit,\n toolName\n );\n super(message);\n\n this.name = \"ToolCallLimitExceededError\";\n this.threadCount = threadCount;\n this.runCount = runCount;\n this.threadLimit = threadLimit;\n this.runLimit = runLimit;\n this.toolName = toolName;\n }\n}\n\n/**\n * Options for configuring the Tool Call Limit middleware.\n */\nexport const ToolCallLimitOptionsSchema = z.object({\n /**\n * Name of the specific tool to limit. If undefined, limits apply to all tools.\n */\n toolName: z.string().optional(),\n /**\n * Maximum number of tool calls allowed per thread.\n * undefined means no limit.\n */\n threadLimit: z.number().optional(),\n /**\n * Maximum number of tool calls allowed per run.\n * undefined means no limit.\n */\n runLimit: z.number().optional(),\n /**\n * What to do when limits are exceeded.\n * - \"end\": Jump to the end of the agent execution and inject an artificial\n * AI message indicating that the limit was exceeded.\n * - \"error\": throws a ToolCallLimitExceededError\n */\n exitBehavior: z.enum([\"end\", \"error\"]).default(\"end\"),\n});\n\nexport type ToolCallLimitConfig = InferInteropZodInput<\n typeof ToolCallLimitOptionsSchema\n>;\n\n/**\n * Middleware that tracks tool call counts and enforces limits.\n *\n * This middleware monitors the number of tool calls made during agent execution\n * and can terminate the agent when specified limits are reached. It supports\n * both thread-level and run-level call counting with configurable exit behaviors.\n *\n * Thread-level: The middleware counts all tool calls in the entire message history\n * and persists this count across multiple runs (invocations) of the agent.\n *\n * Run-level: The middleware counts tool calls made after the last HumanMessage,\n * representing the current run (invocation) of the agent.\n *\n * @param options - Configuration options for the middleware\n * @param options.toolName - Name of the specific tool to limit. If undefined, limits apply to all tools.\n * @param options.threadLimit - Maximum number of tool calls allowed per thread. undefined means no limit.\n * @param options.runLimit - Maximum number of tool calls allowed per run. undefined means no limit.\n * @param options.exitBehavior - What to do when limits are exceeded.\n * - \"end\": Jump to the end of the agent execution and inject an artificial AI message indicating that the limit was exceeded.\n * - \"error\": throws a ToolCallLimitExceededError\n *\n * @throws {Error} If both limits are undefined or if exitBehavior is invalid.\n *\n * @example Limit all tool calls globally\n * ```ts\n * import { toolCallLimitMiddleware } from \"@langchain/langchain/agents/middleware\";\n * import { createAgent } from \"@langchain/langchain/agents\";\n *\n * const globalLimiter = toolCallLimitMiddleware({\n * threadLimit: 20,\n * runLimit: 10,\n * exitBehavior: \"end\"\n * });\n *\n * const agent = createAgent({\n * model: \"openai:gpt-4o\",\n * middleware: [globalLimiter]\n * });\n * ```\n *\n * @example Limit a specific tool\n * ```ts\n * import { toolCallLimitMiddleware } from \"@langchain/langchain/agents/middleware\";\n * import { createAgent } from \"@langchain/langchain/agents\";\n *\n * const searchLimiter = toolCallLimitMiddleware({\n * toolName: \"search\",\n * threadLimit: 5,\n * runLimit: 3,\n * exitBehavior: \"end\"\n * });\n *\n * const agent = createAgent({\n * model: \"openai:gpt-4o\",\n * middleware: [searchLimiter]\n * });\n * ```\n *\n * @example Use both in the same agent\n * ```ts\n * import { toolCallLimitMiddleware } from \"@langchain/langchain/agents/middleware\";\n * import { createAgent } from \"@langchain/langchain/agents\";\n *\n * const globalLimiter = toolCallLimitMiddleware({\n * threadLimit: 20,\n * runLimit: 10,\n * exitBehavior: \"end\"\n * });\n *\n * const searchLimiter = toolCallLimitMiddleware({\n * toolName: \"search\",\n * threadLimit: 5,\n * runLimit: 3,\n * exitBehavior: \"end\"\n * });\n *\n * const agent = createAgent({\n * model: \"openai:gpt-4o\",\n * middleware: [globalLimiter, searchLimiter]\n * });\n * ```\n */\nexport function toolCallLimitMiddleware(options: ToolCallLimitConfig) {\n /**\n * Validate that at least one limit is specified\n */\n if (options.threadLimit === undefined && options.runLimit === undefined) {\n throw new Error(\n \"At least one limit must be specified (threadLimit or runLimit)\"\n );\n }\n\n /**\n * Apply default for exitBehavior and validate\n */\n const exitBehavior = options.exitBehavior ?? \"end\";\n if (exitBehavior !== \"end\" && exitBehavior !== \"error\") {\n throw new Error(\n `Invalid exit behavior: ${exitBehavior}. Must be 'end' or 'error'`\n );\n }\n\n /**\n * Generate the middleware name based on the tool name\n */\n const middlewareName = options.toolName\n ? `ToolCallLimitMiddleware[${options.toolName}]`\n : \"ToolCallLimitMiddleware\";\n\n return createMiddleware({\n name: middlewareName,\n beforeModelJumpTo: [\"end\"],\n async beforeModel(state: AgentBuiltInState) {\n const messages = state.messages;\n\n /**\n * Count tool calls in entire thread\n */\n const threadCount = countToolCallsInMessages(messages, options.toolName);\n\n /**\n * Count tool calls in current run (after last HumanMessage)\n */\n const runMessages = getRunMessages(messages);\n const runCount = countToolCallsInMessages(runMessages, options.toolName);\n\n /**\n * Check if any limits are exceeded\n */\n const threadLimitExceeded =\n options.threadLimit !== undefined && threadCount >= options.threadLimit;\n const runLimitExceeded =\n options.runLimit !== undefined && runCount >= options.runLimit;\n\n if (!threadLimitExceeded && !runLimitExceeded) {\n return undefined;\n }\n\n if (exitBehavior === \"error\") {\n throw new ToolCallLimitExceededError(\n threadCount,\n runCount,\n options.threadLimit,\n options.runLimit,\n options.toolName\n );\n }\n\n /**\n * Create a message indicating the limit was exceeded\n */\n const limitMessage = buildToolLimitExceededMessage(\n threadCount,\n runCount,\n options.threadLimit,\n options.runLimit,\n options.toolName\n );\n const limitAiMessage = new AIMessage(limitMessage);\n\n return {\n jumpTo: \"end\",\n messages: [limitAiMessage],\n };\n },\n });\n}\n"],"mappings":"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"}
@@ -0,0 +1,26 @@
1
+
2
+ //#region src/agents/middlewareAgent/middleware/utils.ts
3
+ /**
4
+ * Default token counter that approximates based on character count
5
+ * @param messages Messages to count tokens for
6
+ * @returns Approximate token count
7
+ */
8
+ function countTokensApproximately(messages) {
9
+ let totalChars = 0;
10
+ for (const msg of messages) {
11
+ let textContent;
12
+ if (typeof msg.content === "string") textContent = msg.content;
13
+ else if (Array.isArray(msg.content)) textContent = msg.content.map((item) => {
14
+ if (typeof item === "string") return item;
15
+ if (item.type === "text" && "text" in item) return item.text;
16
+ return "";
17
+ }).join("");
18
+ else textContent = "";
19
+ totalChars += textContent.length;
20
+ }
21
+ return Math.ceil(totalChars / 4);
22
+ }
23
+
24
+ //#endregion
25
+ exports.countTokensApproximately = countTokensApproximately;
26
+ //# sourceMappingURL=utils.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.cjs","names":["messages: BaseMessage[]","textContent: string"],"sources":["../../../../src/agents/middlewareAgent/middleware/utils.ts"],"sourcesContent":["import type { BaseMessage } from \"@langchain/core/messages\";\n\n/**\n * Default token counter that approximates based on character count\n * @param messages Messages to count tokens for\n * @returns Approximate token count\n */\nexport function countTokensApproximately(messages: BaseMessage[]): number {\n let totalChars = 0;\n for (const msg of messages) {\n let textContent: string;\n if (typeof msg.content === \"string\") {\n textContent = msg.content;\n } else if (Array.isArray(msg.content)) {\n textContent = msg.content\n .map((item) => {\n if (typeof item === \"string\") return item;\n if (item.type === \"text\" && \"text\" in item) return item.text;\n return \"\";\n })\n .join(\"\");\n } else {\n textContent = \"\";\n }\n totalChars += textContent.length;\n }\n // Approximate 1 token = 4 characters\n return Math.ceil(totalChars / 4);\n}\n"],"mappings":";;;;;;;AAOA,SAAgB,yBAAyBA,UAAiC;CACxE,IAAI,aAAa;AACjB,MAAK,MAAM,OAAO,UAAU;EAC1B,IAAIC;AACJ,MAAI,OAAO,IAAI,YAAY,UACzB,cAAc,IAAI;WACT,MAAM,QAAQ,IAAI,QAAQ,EACnC,cAAc,IAAI,QACf,IAAI,CAAC,SAAS;AACb,OAAI,OAAO,SAAS,SAAU,QAAO;AACrC,OAAI,KAAK,SAAS,UAAU,UAAU,KAAM,QAAO,KAAK;AACxD,UAAO;EACR,EAAC,CACD,KAAK,GAAG;OAEX,cAAc;EAEhB,cAAc,YAAY;CAC3B;AAED,QAAO,KAAK,KAAK,aAAa,EAAE;AACjC"}
@@ -0,0 +1,13 @@
1
+ import { BaseMessage } from "@langchain/core/messages";
2
+
3
+ //#region src/agents/middlewareAgent/middleware/utils.d.ts
4
+
5
+ /**
6
+ * Default token counter that approximates based on character count
7
+ * @param messages Messages to count tokens for
8
+ * @returns Approximate token count
9
+ */
10
+ declare function countTokensApproximately(messages: BaseMessage[]): number;
11
+ //#endregion
12
+ export { countTokensApproximately };
13
+ //# sourceMappingURL=utils.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.cts","names":["BaseMessage","countTokensApproximately"],"sources":["../../../../src/agents/middlewareAgent/middleware/utils.d.ts"],"sourcesContent":["import type { BaseMessage } from \"@langchain/core/messages\";\n/**\n * Default token counter that approximates based on character count\n * @param messages Messages to count tokens for\n * @returns Approximate token count\n */\nexport declare function countTokensApproximately(messages: BaseMessage[]): number;\n"],"mappings":";;;;;;AAMA;;;iBAAwBC,wBAAAA,WAAmCD"}
@@ -0,0 +1,13 @@
1
+ import { BaseMessage } from "@langchain/core/messages";
2
+
3
+ //#region src/agents/middlewareAgent/middleware/utils.d.ts
4
+
5
+ /**
6
+ * Default token counter that approximates based on character count
7
+ * @param messages Messages to count tokens for
8
+ * @returns Approximate token count
9
+ */
10
+ declare function countTokensApproximately(messages: BaseMessage[]): number;
11
+ //#endregion
12
+ export { countTokensApproximately };
13
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","names":["BaseMessage","countTokensApproximately"],"sources":["../../../../src/agents/middlewareAgent/middleware/utils.d.ts"],"sourcesContent":["import type { BaseMessage } from \"@langchain/core/messages\";\n/**\n * Default token counter that approximates based on character count\n * @param messages Messages to count tokens for\n * @returns Approximate token count\n */\nexport declare function countTokensApproximately(messages: BaseMessage[]): number;\n"],"mappings":";;;;;;AAMA;;;iBAAwBC,wBAAAA,WAAmCD"}
@@ -0,0 +1,25 @@
1
+ //#region src/agents/middlewareAgent/middleware/utils.ts
2
+ /**
3
+ * Default token counter that approximates based on character count
4
+ * @param messages Messages to count tokens for
5
+ * @returns Approximate token count
6
+ */
7
+ function countTokensApproximately(messages) {
8
+ let totalChars = 0;
9
+ for (const msg of messages) {
10
+ let textContent;
11
+ if (typeof msg.content === "string") textContent = msg.content;
12
+ else if (Array.isArray(msg.content)) textContent = msg.content.map((item) => {
13
+ if (typeof item === "string") return item;
14
+ if (item.type === "text" && "text" in item) return item.text;
15
+ return "";
16
+ }).join("");
17
+ else textContent = "";
18
+ totalChars += textContent.length;
19
+ }
20
+ return Math.ceil(totalChars / 4);
21
+ }
22
+
23
+ //#endregion
24
+ export { countTokensApproximately };
25
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","names":["messages: BaseMessage[]","textContent: string"],"sources":["../../../../src/agents/middlewareAgent/middleware/utils.ts"],"sourcesContent":["import type { BaseMessage } from \"@langchain/core/messages\";\n\n/**\n * Default token counter that approximates based on character count\n * @param messages Messages to count tokens for\n * @returns Approximate token count\n */\nexport function countTokensApproximately(messages: BaseMessage[]): number {\n let totalChars = 0;\n for (const msg of messages) {\n let textContent: string;\n if (typeof msg.content === \"string\") {\n textContent = msg.content;\n } else if (Array.isArray(msg.content)) {\n textContent = msg.content\n .map((item) => {\n if (typeof item === \"string\") return item;\n if (item.type === \"text\" && \"text\" in item) return item.text;\n return \"\";\n })\n .join(\"\");\n } else {\n textContent = \"\";\n }\n totalChars += textContent.length;\n }\n // Approximate 1 token = 4 characters\n return Math.ceil(totalChars / 4);\n}\n"],"mappings":";;;;;;AAOA,SAAgB,yBAAyBA,UAAiC;CACxE,IAAI,aAAa;AACjB,MAAK,MAAM,OAAO,UAAU;EAC1B,IAAIC;AACJ,MAAI,OAAO,IAAI,YAAY,UACzB,cAAc,IAAI;WACT,MAAM,QAAQ,IAAI,QAAQ,EACnC,cAAc,IAAI,QACf,IAAI,CAAC,SAAS;AACb,OAAI,OAAO,SAAS,SAAU,QAAO;AACrC,OAAI,KAAK,SAAS,UAAU,UAAU,KAAM,QAAO,KAAK;AACxD,UAAO;EACR,EAAC,CACD,KAAK,GAAG;OAEX,cAAc;EAEhB,cAAc,YAAY;CAC3B;AAED,QAAO,KAAK,KAAK,aAAa,EAAE;AACjC"}
@@ -40,6 +40,7 @@ function createMiddleware(config) {
40
40
  tools: config.tools ?? []
41
41
  };
42
42
  if (config.modifyModelRequest) middleware.modifyModelRequest = async (options, state, runtime) => Promise.resolve(config.modifyModelRequest(options, state, runtime));
43
+ if (config.retryModelRequest) middleware.retryModelRequest = async (error, request, state, runtime, attempt) => Promise.resolve(config.retryModelRequest(error, request, state, runtime, attempt));
43
44
  if (config.beforeModel) middleware.beforeModel = async (state, runtime) => Promise.resolve(config.beforeModel(state, runtime));
44
45
  if (config.afterModel) middleware.afterModel = async (state, runtime) => Promise.resolve(config.afterModel(state, runtime));
45
46
  return middleware;
@@ -1 +1 @@
1
- {"version":3,"file":"middleware.cjs","names":["config: {\n /**\n * The name of the middleware\n */\n name: string;\n /**\n * The schema of the middleware state. Middleware state is persisted between multiple invocations. It can be either:\n * - A Zod object\n * - A Zod optional object\n * - A Zod default object\n * - Undefined\n */\n stateSchema?: TSchema;\n /**\n * The schema of the middleware context. Middleware context is read-only and not persisted between multiple invocations. It can be either:\n * - A Zod object\n * - A Zod optional object\n * - A Zod default object\n * - Undefined\n */\n contextSchema?: TContextSchema;\n /**\n * Explitictly defines which targets are allowed to be jumped to from the `beforeModel` hook.\n */\n beforeModelJumpTo?: JumpToTarget[];\n /**\n * Explitictly defines which targets are allowed to be jumped to from the `afterModel` hook.\n */\n afterModelJumpTo?: JumpToTarget[];\n /**\n * Additional tools registered by the middleware.\n */\n tools?: (ClientTool | ServerTool)[];\n /**\n * The function to modify the model request. This function is called after the `beforeModel` hook of this middleware and before the model is invoked.\n * It allows to modify the model request before it is passed to the model.\n *\n * @param request - The model request\n * @param request.model - The model to use for this step.\n * @param request.messages - The messages to send to the model.\n * @param request.systemPrompt - The system message for this step.\n * @param request.toolChoice - The tool choice configuration for this step.\n * @param request.tools - The tools to make available for this step.\n * @param state - The middleware state\n * @param runtime - The middleware runtime\n * @returns The modified model request or undefined to pass through\n */\n modifyModelRequest?: (\n options: ModelRequest,\n state: (TSchema extends InteropZodObject\n ? InferInteropZodInput<TSchema>\n : {}) &\n AgentBuiltInState,\n runtime: Runtime<\n (TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}) &\n AgentBuiltInState,\n TContextSchema extends InteropZodObject\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodDefault<any>\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodOptional<any>\n ? Partial<InferInteropZodOutput<TContextSchema>>\n : never\n >\n ) => Promise<ModelRequest | void> | ModelRequest | void;\n /**\n * The function to run before the model call. This function is called before the model is invoked and before the `modifyModelRequest` hook.\n * It allows to modify the state of the agent.\n *\n * @param state - The middleware state\n * @param runtime - The middleware runtime\n * @returns The modified middleware state or undefined to pass through\n */\n beforeModel?: (\n state: (TSchema extends InteropZodObject\n ? InferInteropZodInput<TSchema>\n : {}) &\n AgentBuiltInState,\n runtime: Runtime<\n (TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}) &\n AgentBuiltInState,\n TContextSchema extends InteropZodObject\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodDefault<any>\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodOptional<any>\n ? Partial<InferInteropZodOutput<TContextSchema>>\n : never\n >\n ) =>\n | Promise<\n MiddlewareResult<\n Partial<\n TSchema extends InteropZodObject\n ? InferInteropZodInput<TSchema>\n : {}\n >\n >\n >\n | MiddlewareResult<\n Partial<\n TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}\n >\n >;\n /**\n * The function to run after the model call. This function is called after the model is invoked and before any tools are called.\n * It allows to modify the state of the agent after the model is invoked, e.g. to update tool call parameters.\n *\n * @param state - The middleware state\n * @param runtime - The middleware runtime\n * @returns The modified middleware state or undefined to pass through\n */\n afterModel?: (\n state: (TSchema extends InteropZodObject\n ? InferInteropZodInput<TSchema>\n : {}) &\n AgentBuiltInState,\n runtime: Runtime<\n (TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}) &\n AgentBuiltInState,\n TContextSchema extends InteropZodObject\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodDefault<any>\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodOptional<any>\n ? Partial<InferInteropZodOutput<TContextSchema>>\n : never\n >\n ) =>\n | Promise<\n MiddlewareResult<\n Partial<\n TSchema extends InteropZodObject\n ? InferInteropZodInput<TSchema>\n : {}\n >\n >\n >\n | MiddlewareResult<\n Partial<\n TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}\n >\n >;\n}","middleware: AgentMiddleware<TSchema, TContextSchema, any>"],"sources":["../../../src/agents/middlewareAgent/middleware.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type {\n InteropZodObject,\n InteropZodDefault,\n InteropZodOptional,\n InferInteropZodInput,\n InferInteropZodOutput,\n} from \"@langchain/core/utils/types\";\nimport type {\n AgentMiddleware,\n Runtime,\n MiddlewareResult,\n AgentBuiltInState,\n ModelRequest,\n JumpToTarget,\n} from \"./types.js\";\nimport type { ClientTool, ServerTool } from \"../types.js\";\n\n/**\n * Creates a middleware instance with automatic schema inference.\n *\n * @param config - Middleware configuration\n * @param config.name - The name of the middleware\n * @param config.stateSchema - The schema of the middleware state\n * @param config.contextSchema - The schema of the middleware context\n * @param config.modifyModelRequest - The function to prepare the model request\n * @param config.beforeModel - The function to run before the model call\n * @param config.afterModel - The function to run after the model call\n * @returns A middleware instance\n *\n * @example\n * ```ts\n * const authMiddleware = createMiddleware({\n * name: \"AuthMiddleware\",\n * stateSchema: z.object({\n * isAuthenticated: z.boolean().default(false),\n * }),\n * contextSchema: z.object({\n * userId: z.string(),\n * }),\n * beforeModel: async (state, runtime, controls) => {\n * if (!state.isAuthenticated) {\n * return controls.terminate(new Error(\"Not authenticated\"));\n * }\n * },\n * });\n * ```\n */\nexport function createMiddleware<\n TSchema extends InteropZodObject | undefined = undefined,\n TContextSchema extends\n | InteropZodObject\n | InteropZodOptional<InteropZodObject>\n | InteropZodDefault<InteropZodObject>\n | undefined = undefined\n>(config: {\n /**\n * The name of the middleware\n */\n name: string;\n /**\n * The schema of the middleware state. Middleware state is persisted between multiple invocations. It can be either:\n * - A Zod object\n * - A Zod optional object\n * - A Zod default object\n * - Undefined\n */\n stateSchema?: TSchema;\n /**\n * The schema of the middleware context. Middleware context is read-only and not persisted between multiple invocations. It can be either:\n * - A Zod object\n * - A Zod optional object\n * - A Zod default object\n * - Undefined\n */\n contextSchema?: TContextSchema;\n /**\n * Explitictly defines which targets are allowed to be jumped to from the `beforeModel` hook.\n */\n beforeModelJumpTo?: JumpToTarget[];\n /**\n * Explitictly defines which targets are allowed to be jumped to from the `afterModel` hook.\n */\n afterModelJumpTo?: JumpToTarget[];\n /**\n * Additional tools registered by the middleware.\n */\n tools?: (ClientTool | ServerTool)[];\n /**\n * The function to modify the model request. This function is called after the `beforeModel` hook of this middleware and before the model is invoked.\n * It allows to modify the model request before it is passed to the model.\n *\n * @param request - The model request\n * @param request.model - The model to use for this step.\n * @param request.messages - The messages to send to the model.\n * @param request.systemPrompt - The system message for this step.\n * @param request.toolChoice - The tool choice configuration for this step.\n * @param request.tools - The tools to make available for this step.\n * @param state - The middleware state\n * @param runtime - The middleware runtime\n * @returns The modified model request or undefined to pass through\n */\n modifyModelRequest?: (\n options: ModelRequest,\n state: (TSchema extends InteropZodObject\n ? InferInteropZodInput<TSchema>\n : {}) &\n AgentBuiltInState,\n runtime: Runtime<\n (TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}) &\n AgentBuiltInState,\n TContextSchema extends InteropZodObject\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodDefault<any>\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodOptional<any>\n ? Partial<InferInteropZodOutput<TContextSchema>>\n : never\n >\n ) => Promise<ModelRequest | void> | ModelRequest | void;\n /**\n * The function to run before the model call. This function is called before the model is invoked and before the `modifyModelRequest` hook.\n * It allows to modify the state of the agent.\n *\n * @param state - The middleware state\n * @param runtime - The middleware runtime\n * @returns The modified middleware state or undefined to pass through\n */\n beforeModel?: (\n state: (TSchema extends InteropZodObject\n ? InferInteropZodInput<TSchema>\n : {}) &\n AgentBuiltInState,\n runtime: Runtime<\n (TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}) &\n AgentBuiltInState,\n TContextSchema extends InteropZodObject\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodDefault<any>\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodOptional<any>\n ? Partial<InferInteropZodOutput<TContextSchema>>\n : never\n >\n ) =>\n | Promise<\n MiddlewareResult<\n Partial<\n TSchema extends InteropZodObject\n ? InferInteropZodInput<TSchema>\n : {}\n >\n >\n >\n | MiddlewareResult<\n Partial<\n TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}\n >\n >;\n /**\n * The function to run after the model call. This function is called after the model is invoked and before any tools are called.\n * It allows to modify the state of the agent after the model is invoked, e.g. to update tool call parameters.\n *\n * @param state - The middleware state\n * @param runtime - The middleware runtime\n * @returns The modified middleware state or undefined to pass through\n */\n afterModel?: (\n state: (TSchema extends InteropZodObject\n ? InferInteropZodInput<TSchema>\n : {}) &\n AgentBuiltInState,\n runtime: Runtime<\n (TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}) &\n AgentBuiltInState,\n TContextSchema extends InteropZodObject\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodDefault<any>\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodOptional<any>\n ? Partial<InferInteropZodOutput<TContextSchema>>\n : never\n >\n ) =>\n | Promise<\n MiddlewareResult<\n Partial<\n TSchema extends InteropZodObject\n ? InferInteropZodInput<TSchema>\n : {}\n >\n >\n >\n | MiddlewareResult<\n Partial<\n TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}\n >\n >;\n}): AgentMiddleware<TSchema, TContextSchema, any> {\n const middleware: AgentMiddleware<TSchema, TContextSchema, any> = {\n name: config.name,\n stateSchema: config.stateSchema,\n contextSchema: config.contextSchema,\n beforeModelJumpTo: config.beforeModelJumpTo,\n afterModelJumpTo: config.afterModelJumpTo,\n tools: config.tools ?? [],\n };\n\n if (config.modifyModelRequest) {\n middleware.modifyModelRequest = async (options, state, runtime) =>\n Promise.resolve(\n config.modifyModelRequest!(\n options,\n state,\n runtime as Runtime<\n (TSchema extends InteropZodObject\n ? InferInteropZodInput<TSchema>\n : {}) &\n AgentBuiltInState,\n TContextSchema extends InteropZodObject\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodDefault<any>\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodOptional<any>\n ? Partial<InferInteropZodOutput<TContextSchema>>\n : never\n >\n )\n );\n }\n\n if (config.beforeModel) {\n middleware.beforeModel = async (state, runtime) =>\n Promise.resolve(\n config.beforeModel!(\n state,\n runtime as Runtime<\n (TSchema extends InteropZodObject\n ? InferInteropZodInput<TSchema>\n : {}) &\n AgentBuiltInState,\n TContextSchema extends InteropZodObject\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodDefault<any>\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodOptional<any>\n ? Partial<InferInteropZodOutput<TContextSchema>>\n : never\n >\n )\n );\n }\n\n if (config.afterModel) {\n middleware.afterModel = async (state, runtime) =>\n Promise.resolve(\n config.afterModel!(\n state,\n runtime as Runtime<\n (TSchema extends InteropZodObject\n ? InferInteropZodInput<TSchema>\n : {}) &\n AgentBuiltInState,\n TContextSchema extends InteropZodObject\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodDefault<any>\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodOptional<any>\n ? Partial<InferInteropZodOutput<TContextSchema>>\n : never\n >\n )\n );\n }\n\n return middleware;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDA,SAAgB,iBAOdA,QA+IgD;CAChD,MAAMC,aAA4D;EAChE,MAAM,OAAO;EACb,aAAa,OAAO;EACpB,eAAe,OAAO;EACtB,mBAAmB,OAAO;EAC1B,kBAAkB,OAAO;EACzB,OAAO,OAAO,SAAS,CAAE;CAC1B;AAED,KAAI,OAAO,oBACT,WAAW,qBAAqB,OAAO,SAAS,OAAO,YACrD,QAAQ,QACN,OAAO,mBACL,SACA,OACA,QAaD,CACF;AAGL,KAAI,OAAO,aACT,WAAW,cAAc,OAAO,OAAO,YACrC,QAAQ,QACN,OAAO,YACL,OACA,QAaD,CACF;AAGL,KAAI,OAAO,YACT,WAAW,aAAa,OAAO,OAAO,YACpC,QAAQ,QACN,OAAO,WACL,OACA,QAaD,CACF;AAGL,QAAO;AACR"}
1
+ {"version":3,"file":"middleware.cjs","names":["config: {\n /**\n * The name of the middleware\n */\n name: string;\n /**\n * The schema of the middleware state. Middleware state is persisted between multiple invocations. It can be either:\n * - A Zod object\n * - A Zod optional object\n * - A Zod default object\n * - Undefined\n */\n stateSchema?: TSchema;\n /**\n * The schema of the middleware context. Middleware context is read-only and not persisted between multiple invocations. It can be either:\n * - A Zod object\n * - A Zod optional object\n * - A Zod default object\n * - Undefined\n */\n contextSchema?: TContextSchema;\n /**\n * Explitictly defines which targets are allowed to be jumped to from the `beforeModel` hook.\n */\n beforeModelJumpTo?: JumpToTarget[];\n /**\n * Explitictly defines which targets are allowed to be jumped to from the `afterModel` hook.\n */\n afterModelJumpTo?: JumpToTarget[];\n /**\n * Additional tools registered by the middleware.\n */\n tools?: (ClientTool | ServerTool)[];\n /**\n * The function to modify the model request. This function is called after the `beforeModel` hook of this middleware and before the model is invoked.\n * It allows to modify the model request before it is passed to the model.\n *\n * @param request - The model request\n * @param request.model - The model to use for this step.\n * @param request.messages - The messages to send to the model.\n * @param request.systemPrompt - The system message for this step.\n * @param request.toolChoice - The tool choice configuration for this step.\n * @param request.tools - The tools to make available for this step.\n * @param state - The middleware state\n * @param runtime - The middleware runtime\n * @returns The modified model request or undefined to pass through\n */\n modifyModelRequest?: (\n options: ModelRequest,\n state: (TSchema extends InteropZodObject\n ? InferInteropZodInput<TSchema>\n : {}) &\n AgentBuiltInState,\n runtime: Runtime<\n TContextSchema extends InteropZodObject\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodDefault<any>\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodOptional<any>\n ? Partial<InferInteropZodOutput<TContextSchema>>\n : never\n >\n ) => Promise<ModelRequest | void> | ModelRequest | void;\n /**\n * The function to handle model invocation errors and optionally retry.\n *\n * @param error - The exception that occurred during model invocation\n * @param request - The original model request that failed\n * @param state - The current agent state\n * @param runtime - The runtime context\n * @param attempt - The current attempt number (1-indexed)\n * @returns Modified request to retry with, or undefined/null to propagate the error (re-raise)\n */\n retryModelRequest?: (\n error: Error,\n request: ModelRequest,\n state: (TSchema extends InteropZodObject\n ? InferInteropZodInput<TSchema>\n : {}) &\n AgentBuiltInState,\n runtime: Runtime<\n TContextSchema extends InteropZodObject\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodDefault<any>\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodOptional<any>\n ? Partial<InferInteropZodOutput<TContextSchema>>\n : never\n >,\n attempt: number\n ) => Promise<ModelRequest | void> | ModelRequest | void;\n /**\n * The function to run before the model call. This function is called before the model is invoked and before the `modifyModelRequest` hook.\n * It allows to modify the state of the agent.\n *\n * @param state - The middleware state\n * @param runtime - The middleware runtime\n * @returns The modified middleware state or undefined to pass through\n */\n beforeModel?: (\n state: (TSchema extends InteropZodObject\n ? InferInteropZodInput<TSchema>\n : {}) &\n AgentBuiltInState,\n runtime: Runtime<\n TContextSchema extends InteropZodObject\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodDefault<any>\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodOptional<any>\n ? Partial<InferInteropZodOutput<TContextSchema>>\n : never\n >\n ) =>\n | Promise<\n MiddlewareResult<\n Partial<\n TSchema extends InteropZodObject\n ? InferInteropZodInput<TSchema>\n : {}\n >\n >\n >\n | MiddlewareResult<\n Partial<\n TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}\n >\n >;\n /**\n * The function to run after the model call. This function is called after the model is invoked and before any tools are called.\n * It allows to modify the state of the agent after the model is invoked, e.g. to update tool call parameters.\n *\n * @param state - The middleware state\n * @param runtime - The middleware runtime\n * @returns The modified middleware state or undefined to pass through\n */\n afterModel?: (\n state: (TSchema extends InteropZodObject\n ? InferInteropZodInput<TSchema>\n : {}) &\n AgentBuiltInState,\n runtime: Runtime<\n TContextSchema extends InteropZodObject\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodDefault<any>\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodOptional<any>\n ? Partial<InferInteropZodOutput<TContextSchema>>\n : never\n >\n ) =>\n | Promise<\n MiddlewareResult<\n Partial<\n TSchema extends InteropZodObject\n ? InferInteropZodInput<TSchema>\n : {}\n >\n >\n >\n | MiddlewareResult<\n Partial<\n TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}\n >\n >;\n}","middleware: AgentMiddleware<TSchema, TContextSchema, any>"],"sources":["../../../src/agents/middlewareAgent/middleware.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type {\n InteropZodObject,\n InteropZodDefault,\n InteropZodOptional,\n InferInteropZodInput,\n InferInteropZodOutput,\n} from \"@langchain/core/utils/types\";\nimport type {\n AgentMiddleware,\n Runtime,\n MiddlewareResult,\n AgentBuiltInState,\n ModelRequest,\n JumpToTarget,\n} from \"./types.js\";\nimport type { ClientTool, ServerTool } from \"../types.js\";\n\n/**\n * Creates a middleware instance with automatic schema inference.\n *\n * @param config - Middleware configuration\n * @param config.name - The name of the middleware\n * @param config.stateSchema - The schema of the middleware state\n * @param config.contextSchema - The schema of the middleware context\n * @param config.modifyModelRequest - The function to prepare the model request\n * @param config.beforeModel - The function to run before the model call\n * @param config.afterModel - The function to run after the model call\n * @returns A middleware instance\n *\n * @example\n * ```ts\n * const authMiddleware = createMiddleware({\n * name: \"AuthMiddleware\",\n * stateSchema: z.object({\n * isAuthenticated: z.boolean().default(false),\n * }),\n * contextSchema: z.object({\n * userId: z.string(),\n * }),\n * beforeModel: async (state, runtime, controls) => {\n * if (!state.isAuthenticated) {\n * return controls.terminate(new Error(\"Not authenticated\"));\n * }\n * },\n * });\n * ```\n */\nexport function createMiddleware<\n TSchema extends InteropZodObject | undefined = undefined,\n TContextSchema extends\n | InteropZodObject\n | InteropZodOptional<InteropZodObject>\n | InteropZodDefault<InteropZodObject>\n | undefined = undefined\n>(config: {\n /**\n * The name of the middleware\n */\n name: string;\n /**\n * The schema of the middleware state. Middleware state is persisted between multiple invocations. It can be either:\n * - A Zod object\n * - A Zod optional object\n * - A Zod default object\n * - Undefined\n */\n stateSchema?: TSchema;\n /**\n * The schema of the middleware context. Middleware context is read-only and not persisted between multiple invocations. It can be either:\n * - A Zod object\n * - A Zod optional object\n * - A Zod default object\n * - Undefined\n */\n contextSchema?: TContextSchema;\n /**\n * Explitictly defines which targets are allowed to be jumped to from the `beforeModel` hook.\n */\n beforeModelJumpTo?: JumpToTarget[];\n /**\n * Explitictly defines which targets are allowed to be jumped to from the `afterModel` hook.\n */\n afterModelJumpTo?: JumpToTarget[];\n /**\n * Additional tools registered by the middleware.\n */\n tools?: (ClientTool | ServerTool)[];\n /**\n * The function to modify the model request. This function is called after the `beforeModel` hook of this middleware and before the model is invoked.\n * It allows to modify the model request before it is passed to the model.\n *\n * @param request - The model request\n * @param request.model - The model to use for this step.\n * @param request.messages - The messages to send to the model.\n * @param request.systemPrompt - The system message for this step.\n * @param request.toolChoice - The tool choice configuration for this step.\n * @param request.tools - The tools to make available for this step.\n * @param state - The middleware state\n * @param runtime - The middleware runtime\n * @returns The modified model request or undefined to pass through\n */\n modifyModelRequest?: (\n options: ModelRequest,\n state: (TSchema extends InteropZodObject\n ? InferInteropZodInput<TSchema>\n : {}) &\n AgentBuiltInState,\n runtime: Runtime<\n TContextSchema extends InteropZodObject\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodDefault<any>\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodOptional<any>\n ? Partial<InferInteropZodOutput<TContextSchema>>\n : never\n >\n ) => Promise<ModelRequest | void> | ModelRequest | void;\n /**\n * The function to handle model invocation errors and optionally retry.\n *\n * @param error - The exception that occurred during model invocation\n * @param request - The original model request that failed\n * @param state - The current agent state\n * @param runtime - The runtime context\n * @param attempt - The current attempt number (1-indexed)\n * @returns Modified request to retry with, or undefined/null to propagate the error (re-raise)\n */\n retryModelRequest?: (\n error: Error,\n request: ModelRequest,\n state: (TSchema extends InteropZodObject\n ? InferInteropZodInput<TSchema>\n : {}) &\n AgentBuiltInState,\n runtime: Runtime<\n TContextSchema extends InteropZodObject\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodDefault<any>\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodOptional<any>\n ? Partial<InferInteropZodOutput<TContextSchema>>\n : never\n >,\n attempt: number\n ) => Promise<ModelRequest | void> | ModelRequest | void;\n /**\n * The function to run before the model call. This function is called before the model is invoked and before the `modifyModelRequest` hook.\n * It allows to modify the state of the agent.\n *\n * @param state - The middleware state\n * @param runtime - The middleware runtime\n * @returns The modified middleware state or undefined to pass through\n */\n beforeModel?: (\n state: (TSchema extends InteropZodObject\n ? InferInteropZodInput<TSchema>\n : {}) &\n AgentBuiltInState,\n runtime: Runtime<\n TContextSchema extends InteropZodObject\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodDefault<any>\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodOptional<any>\n ? Partial<InferInteropZodOutput<TContextSchema>>\n : never\n >\n ) =>\n | Promise<\n MiddlewareResult<\n Partial<\n TSchema extends InteropZodObject\n ? InferInteropZodInput<TSchema>\n : {}\n >\n >\n >\n | MiddlewareResult<\n Partial<\n TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}\n >\n >;\n /**\n * The function to run after the model call. This function is called after the model is invoked and before any tools are called.\n * It allows to modify the state of the agent after the model is invoked, e.g. to update tool call parameters.\n *\n * @param state - The middleware state\n * @param runtime - The middleware runtime\n * @returns The modified middleware state or undefined to pass through\n */\n afterModel?: (\n state: (TSchema extends InteropZodObject\n ? InferInteropZodInput<TSchema>\n : {}) &\n AgentBuiltInState,\n runtime: Runtime<\n TContextSchema extends InteropZodObject\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodDefault<any>\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodOptional<any>\n ? Partial<InferInteropZodOutput<TContextSchema>>\n : never\n >\n ) =>\n | Promise<\n MiddlewareResult<\n Partial<\n TSchema extends InteropZodObject\n ? InferInteropZodInput<TSchema>\n : {}\n >\n >\n >\n | MiddlewareResult<\n Partial<\n TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}\n >\n >;\n}): AgentMiddleware<TSchema, TContextSchema, any> {\n const middleware: AgentMiddleware<TSchema, TContextSchema, any> = {\n name: config.name,\n stateSchema: config.stateSchema,\n contextSchema: config.contextSchema,\n beforeModelJumpTo: config.beforeModelJumpTo,\n afterModelJumpTo: config.afterModelJumpTo,\n tools: config.tools ?? [],\n };\n\n if (config.modifyModelRequest) {\n middleware.modifyModelRequest = async (options, state, runtime) =>\n Promise.resolve(\n config.modifyModelRequest!(\n options,\n state,\n runtime as Runtime<\n TContextSchema extends InteropZodObject\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodDefault<any>\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodOptional<any>\n ? Partial<InferInteropZodOutput<TContextSchema>>\n : never\n >\n )\n );\n }\n\n if (config.retryModelRequest) {\n middleware.retryModelRequest = async (\n error,\n request,\n state,\n runtime,\n attempt\n ) =>\n Promise.resolve(\n config.retryModelRequest!(\n error,\n request,\n state,\n runtime as Runtime<\n TContextSchema extends InteropZodObject\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodDefault<any>\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodOptional<any>\n ? Partial<InferInteropZodOutput<TContextSchema>>\n : never\n >,\n attempt\n )\n );\n }\n\n if (config.beforeModel) {\n middleware.beforeModel = async (state, runtime) =>\n Promise.resolve(\n config.beforeModel!(\n state,\n runtime as Runtime<\n TContextSchema extends InteropZodObject\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodDefault<any>\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodOptional<any>\n ? Partial<InferInteropZodOutput<TContextSchema>>\n : never\n >\n )\n );\n }\n\n if (config.afterModel) {\n middleware.afterModel = async (state, runtime) =>\n Promise.resolve(\n config.afterModel!(\n state,\n runtime as Runtime<\n TContextSchema extends InteropZodObject\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodDefault<any>\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodOptional<any>\n ? Partial<InferInteropZodOutput<TContextSchema>>\n : never\n >\n )\n );\n }\n\n return middleware;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDA,SAAgB,iBAOdA,QAqKgD;CAChD,MAAMC,aAA4D;EAChE,MAAM,OAAO;EACb,aAAa,OAAO;EACpB,eAAe,OAAO;EACtB,mBAAmB,OAAO;EAC1B,kBAAkB,OAAO;EACzB,OAAO,OAAO,SAAS,CAAE;CAC1B;AAED,KAAI,OAAO,oBACT,WAAW,qBAAqB,OAAO,SAAS,OAAO,YACrD,QAAQ,QACN,OAAO,mBACL,SACA,OACA,QASD,CACF;AAGL,KAAI,OAAO,mBACT,WAAW,oBAAoB,OAC7B,OACA,SACA,OACA,SACA,YAEA,QAAQ,QACN,OAAO,kBACL,OACA,SACA,OACA,SASA,QACD,CACF;AAGL,KAAI,OAAO,aACT,WAAW,cAAc,OAAO,OAAO,YACrC,QAAQ,QACN,OAAO,YACL,OACA,QASD,CACF;AAGL,KAAI,OAAO,YACT,WAAW,aAAa,OAAO,OAAO,YACpC,QAAQ,QACN,OAAO,WACL,OACA,QASD,CACF;AAGL,QAAO;AACR"}
@@ -81,7 +81,18 @@ declare function createMiddleware<TSchema extends InteropZodObject | undefined =
81
81
  * @param runtime - The middleware runtime
82
82
  * @returns The modified model request or undefined to pass through
83
83
  */
84
- modifyModelRequest?: (options: ModelRequest, state: (TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}) & AgentBuiltInState, runtime: Runtime<(TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}) & AgentBuiltInState, TContextSchema extends InteropZodObject ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodDefault<any> ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodOptional<any> ? Partial<InferInteropZodOutput<TContextSchema>> : never>) => Promise<ModelRequest | void> | ModelRequest | void;
84
+ modifyModelRequest?: (options: ModelRequest, state: (TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}) & AgentBuiltInState, runtime: Runtime<TContextSchema extends InteropZodObject ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodDefault<any> ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodOptional<any> ? Partial<InferInteropZodOutput<TContextSchema>> : never>) => Promise<ModelRequest | void> | ModelRequest | void;
85
+ /**
86
+ * The function to handle model invocation errors and optionally retry.
87
+ *
88
+ * @param error - The exception that occurred during model invocation
89
+ * @param request - The original model request that failed
90
+ * @param state - The current agent state
91
+ * @param runtime - The runtime context
92
+ * @param attempt - The current attempt number (1-indexed)
93
+ * @returns Modified request to retry with, or undefined/null to propagate the error (re-raise)
94
+ */
95
+ retryModelRequest?: (error: Error, request: ModelRequest, state: (TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}) & AgentBuiltInState, runtime: Runtime<TContextSchema extends InteropZodObject ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodDefault<any> ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodOptional<any> ? Partial<InferInteropZodOutput<TContextSchema>> : never>, attempt: number) => Promise<ModelRequest | void> | ModelRequest | void;
85
96
  /**
86
97
  * The function to run before the model call. This function is called before the model is invoked and before the `modifyModelRequest` hook.
87
98
  * It allows to modify the state of the agent.
@@ -90,7 +101,7 @@ declare function createMiddleware<TSchema extends InteropZodObject | undefined =
90
101
  * @param runtime - The middleware runtime
91
102
  * @returns The modified middleware state or undefined to pass through
92
103
  */
93
- beforeModel?: (state: (TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}) & AgentBuiltInState, runtime: Runtime<(TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}) & AgentBuiltInState, TContextSchema extends InteropZodObject ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodDefault<any> ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodOptional<any> ? Partial<InferInteropZodOutput<TContextSchema>> : never>) => Promise<MiddlewareResult<Partial<TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}>>> | MiddlewareResult<Partial<TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}>>;
104
+ beforeModel?: (state: (TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}) & AgentBuiltInState, runtime: Runtime<TContextSchema extends InteropZodObject ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodDefault<any> ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodOptional<any> ? Partial<InferInteropZodOutput<TContextSchema>> : never>) => Promise<MiddlewareResult<Partial<TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}>>> | MiddlewareResult<Partial<TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}>>;
94
105
  /**
95
106
  * The function to run after the model call. This function is called after the model is invoked and before any tools are called.
96
107
  * It allows to modify the state of the agent after the model is invoked, e.g. to update tool call parameters.
@@ -99,7 +110,7 @@ declare function createMiddleware<TSchema extends InteropZodObject | undefined =
99
110
  * @param runtime - The middleware runtime
100
111
  * @returns The modified middleware state or undefined to pass through
101
112
  */
102
- afterModel?: (state: (TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}) & AgentBuiltInState, runtime: Runtime<(TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}) & AgentBuiltInState, TContextSchema extends InteropZodObject ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodDefault<any> ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodOptional<any> ? Partial<InferInteropZodOutput<TContextSchema>> : never>) => Promise<MiddlewareResult<Partial<TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}>>> | MiddlewareResult<Partial<TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}>>;
113
+ afterModel?: (state: (TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}) & AgentBuiltInState, runtime: Runtime<TContextSchema extends InteropZodObject ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodDefault<any> ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodOptional<any> ? Partial<InferInteropZodOutput<TContextSchema>> : never>) => Promise<MiddlewareResult<Partial<TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}>>> | MiddlewareResult<Partial<TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}>>;
103
114
  }): AgentMiddleware<TSchema, TContextSchema, any>;
104
115
  //#endregion
105
116
  export { createMiddleware };
@@ -1 +1 @@
1
- {"version":3,"file":"middleware.d.cts","names":["InteropZodObject","InteropZodDefault","InteropZodOptional","InferInteropZodInput","InferInteropZodOutput","AgentMiddleware","Runtime","MiddlewareResult","AgentBuiltInState","ModelRequest","JumpToTarget","ClientTool","ServerTool","createMiddleware","TSchema","TContextSchema","Partial","Promise"],"sources":["../../../src/agents/middlewareAgent/middleware.d.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { InteropZodObject, InteropZodDefault, InteropZodOptional, InferInteropZodInput, InferInteropZodOutput } from \"@langchain/core/utils/types\";\nimport type { AgentMiddleware, Runtime, MiddlewareResult, AgentBuiltInState, ModelRequest, JumpToTarget } from \"./types.js\";\nimport type { ClientTool, ServerTool } from \"../types.js\";\n/**\n * Creates a middleware instance with automatic schema inference.\n *\n * @param config - Middleware configuration\n * @param config.name - The name of the middleware\n * @param config.stateSchema - The schema of the middleware state\n * @param config.contextSchema - The schema of the middleware context\n * @param config.modifyModelRequest - The function to prepare the model request\n * @param config.beforeModel - The function to run before the model call\n * @param config.afterModel - The function to run after the model call\n * @returns A middleware instance\n *\n * @example\n * ```ts\n * const authMiddleware = createMiddleware({\n * name: \"AuthMiddleware\",\n * stateSchema: z.object({\n * isAuthenticated: z.boolean().default(false),\n * }),\n * contextSchema: z.object({\n * userId: z.string(),\n * }),\n * beforeModel: async (state, runtime, controls) => {\n * if (!state.isAuthenticated) {\n * return controls.terminate(new Error(\"Not authenticated\"));\n * }\n * },\n * });\n * ```\n */\nexport declare function createMiddleware<TSchema extends InteropZodObject | undefined = undefined, TContextSchema extends InteropZodObject | InteropZodOptional<InteropZodObject> | InteropZodDefault<InteropZodObject> | undefined = undefined>(config: {\n /**\n * The name of the middleware\n */\n name: string;\n /**\n * The schema of the middleware state. Middleware state is persisted between multiple invocations. It can be either:\n * - A Zod object\n * - A Zod optional object\n * - A Zod default object\n * - Undefined\n */\n stateSchema?: TSchema;\n /**\n * The schema of the middleware context. Middleware context is read-only and not persisted between multiple invocations. It can be either:\n * - A Zod object\n * - A Zod optional object\n * - A Zod default object\n * - Undefined\n */\n contextSchema?: TContextSchema;\n /**\n * Explitictly defines which targets are allowed to be jumped to from the `beforeModel` hook.\n */\n beforeModelJumpTo?: JumpToTarget[];\n /**\n * Explitictly defines which targets are allowed to be jumped to from the `afterModel` hook.\n */\n afterModelJumpTo?: JumpToTarget[];\n /**\n * Additional tools registered by the middleware.\n */\n tools?: (ClientTool | ServerTool)[];\n /**\n * The function to modify the model request. This function is called after the `beforeModel` hook of this middleware and before the model is invoked.\n * It allows to modify the model request before it is passed to the model.\n *\n * @param request - The model request\n * @param request.model - The model to use for this step.\n * @param request.messages - The messages to send to the model.\n * @param request.systemPrompt - The system message for this step.\n * @param request.toolChoice - The tool choice configuration for this step.\n * @param request.tools - The tools to make available for this step.\n * @param state - The middleware state\n * @param runtime - The middleware runtime\n * @returns The modified model request or undefined to pass through\n */\n modifyModelRequest?: (options: ModelRequest, state: (TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}) & AgentBuiltInState, runtime: Runtime<(TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}) & AgentBuiltInState, TContextSchema extends InteropZodObject ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodDefault<any> ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodOptional<any> ? Partial<InferInteropZodOutput<TContextSchema>> : never>) => Promise<ModelRequest | void> | ModelRequest | void;\n /**\n * The function to run before the model call. This function is called before the model is invoked and before the `modifyModelRequest` hook.\n * It allows to modify the state of the agent.\n *\n * @param state - The middleware state\n * @param runtime - The middleware runtime\n * @returns The modified middleware state or undefined to pass through\n */\n beforeModel?: (state: (TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}) & AgentBuiltInState, runtime: Runtime<(TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}) & AgentBuiltInState, TContextSchema extends InteropZodObject ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodDefault<any> ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodOptional<any> ? Partial<InferInteropZodOutput<TContextSchema>> : never>) => Promise<MiddlewareResult<Partial<TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}>>> | MiddlewareResult<Partial<TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}>>;\n /**\n * The function to run after the model call. This function is called after the model is invoked and before any tools are called.\n * It allows to modify the state of the agent after the model is invoked, e.g. to update tool call parameters.\n *\n * @param state - The middleware state\n * @param runtime - The middleware runtime\n * @returns The modified middleware state or undefined to pass through\n */\n afterModel?: (state: (TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}) & AgentBuiltInState, runtime: Runtime<(TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}) & AgentBuiltInState, TContextSchema extends InteropZodObject ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodDefault<any> ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodOptional<any> ? Partial<InferInteropZodOutput<TContextSchema>> : never>) => Promise<MiddlewareResult<Partial<TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}>>> | MiddlewareResult<Partial<TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}>>;\n}): AgentMiddleware<TSchema, TContextSchema, any>;\n"],"mappings":"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"}
1
+ {"version":3,"file":"middleware.d.cts","names":["InteropZodObject","InteropZodDefault","InteropZodOptional","InferInteropZodInput","InferInteropZodOutput","AgentMiddleware","Runtime","MiddlewareResult","AgentBuiltInState","ModelRequest","JumpToTarget","ClientTool","ServerTool","createMiddleware","TSchema","TContextSchema","Partial","Promise","Error"],"sources":["../../../src/agents/middlewareAgent/middleware.d.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { InteropZodObject, InteropZodDefault, InteropZodOptional, InferInteropZodInput, InferInteropZodOutput } from \"@langchain/core/utils/types\";\nimport type { AgentMiddleware, Runtime, MiddlewareResult, AgentBuiltInState, ModelRequest, JumpToTarget } from \"./types.js\";\nimport type { ClientTool, ServerTool } from \"../types.js\";\n/**\n * Creates a middleware instance with automatic schema inference.\n *\n * @param config - Middleware configuration\n * @param config.name - The name of the middleware\n * @param config.stateSchema - The schema of the middleware state\n * @param config.contextSchema - The schema of the middleware context\n * @param config.modifyModelRequest - The function to prepare the model request\n * @param config.beforeModel - The function to run before the model call\n * @param config.afterModel - The function to run after the model call\n * @returns A middleware instance\n *\n * @example\n * ```ts\n * const authMiddleware = createMiddleware({\n * name: \"AuthMiddleware\",\n * stateSchema: z.object({\n * isAuthenticated: z.boolean().default(false),\n * }),\n * contextSchema: z.object({\n * userId: z.string(),\n * }),\n * beforeModel: async (state, runtime, controls) => {\n * if (!state.isAuthenticated) {\n * return controls.terminate(new Error(\"Not authenticated\"));\n * }\n * },\n * });\n * ```\n */\nexport declare function createMiddleware<TSchema extends InteropZodObject | undefined = undefined, TContextSchema extends InteropZodObject | InteropZodOptional<InteropZodObject> | InteropZodDefault<InteropZodObject> | undefined = undefined>(config: {\n /**\n * The name of the middleware\n */\n name: string;\n /**\n * The schema of the middleware state. Middleware state is persisted between multiple invocations. It can be either:\n * - A Zod object\n * - A Zod optional object\n * - A Zod default object\n * - Undefined\n */\n stateSchema?: TSchema;\n /**\n * The schema of the middleware context. Middleware context is read-only and not persisted between multiple invocations. It can be either:\n * - A Zod object\n * - A Zod optional object\n * - A Zod default object\n * - Undefined\n */\n contextSchema?: TContextSchema;\n /**\n * Explitictly defines which targets are allowed to be jumped to from the `beforeModel` hook.\n */\n beforeModelJumpTo?: JumpToTarget[];\n /**\n * Explitictly defines which targets are allowed to be jumped to from the `afterModel` hook.\n */\n afterModelJumpTo?: JumpToTarget[];\n /**\n * Additional tools registered by the middleware.\n */\n tools?: (ClientTool | ServerTool)[];\n /**\n * The function to modify the model request. This function is called after the `beforeModel` hook of this middleware and before the model is invoked.\n * It allows to modify the model request before it is passed to the model.\n *\n * @param request - The model request\n * @param request.model - The model to use for this step.\n * @param request.messages - The messages to send to the model.\n * @param request.systemPrompt - The system message for this step.\n * @param request.toolChoice - The tool choice configuration for this step.\n * @param request.tools - The tools to make available for this step.\n * @param state - The middleware state\n * @param runtime - The middleware runtime\n * @returns The modified model request or undefined to pass through\n */\n modifyModelRequest?: (options: ModelRequest, state: (TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}) & AgentBuiltInState, runtime: Runtime<TContextSchema extends InteropZodObject ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodDefault<any> ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodOptional<any> ? Partial<InferInteropZodOutput<TContextSchema>> : never>) => Promise<ModelRequest | void> | ModelRequest | void;\n /**\n * The function to handle model invocation errors and optionally retry.\n *\n * @param error - The exception that occurred during model invocation\n * @param request - The original model request that failed\n * @param state - The current agent state\n * @param runtime - The runtime context\n * @param attempt - The current attempt number (1-indexed)\n * @returns Modified request to retry with, or undefined/null to propagate the error (re-raise)\n */\n retryModelRequest?: (error: Error, request: ModelRequest, state: (TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}) & AgentBuiltInState, runtime: Runtime<TContextSchema extends InteropZodObject ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodDefault<any> ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodOptional<any> ? Partial<InferInteropZodOutput<TContextSchema>> : never>, attempt: number) => Promise<ModelRequest | void> | ModelRequest | void;\n /**\n * The function to run before the model call. This function is called before the model is invoked and before the `modifyModelRequest` hook.\n * It allows to modify the state of the agent.\n *\n * @param state - The middleware state\n * @param runtime - The middleware runtime\n * @returns The modified middleware state or undefined to pass through\n */\n beforeModel?: (state: (TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}) & AgentBuiltInState, runtime: Runtime<TContextSchema extends InteropZodObject ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodDefault<any> ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodOptional<any> ? Partial<InferInteropZodOutput<TContextSchema>> : never>) => Promise<MiddlewareResult<Partial<TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}>>> | MiddlewareResult<Partial<TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}>>;\n /**\n * The function to run after the model call. This function is called after the model is invoked and before any tools are called.\n * It allows to modify the state of the agent after the model is invoked, e.g. to update tool call parameters.\n *\n * @param state - The middleware state\n * @param runtime - The middleware runtime\n * @returns The modified middleware state or undefined to pass through\n */\n afterModel?: (state: (TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}) & AgentBuiltInState, runtime: Runtime<TContextSchema extends InteropZodObject ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodDefault<any> ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodOptional<any> ? Partial<InferInteropZodOutput<TContextSchema>> : never>) => Promise<MiddlewareResult<Partial<TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}>>> | MiddlewareResult<Partial<TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}>>;\n}): AgentMiddleware<TSchema, TContextSchema, any>;\n"],"mappings":"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"}
@@ -81,7 +81,18 @@ declare function createMiddleware<TSchema extends InteropZodObject | undefined =
81
81
  * @param runtime - The middleware runtime
82
82
  * @returns The modified model request or undefined to pass through
83
83
  */
84
- modifyModelRequest?: (options: ModelRequest, state: (TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}) & AgentBuiltInState, runtime: Runtime<(TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}) & AgentBuiltInState, TContextSchema extends InteropZodObject ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodDefault<any> ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodOptional<any> ? Partial<InferInteropZodOutput<TContextSchema>> : never>) => Promise<ModelRequest | void> | ModelRequest | void;
84
+ modifyModelRequest?: (options: ModelRequest, state: (TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}) & AgentBuiltInState, runtime: Runtime<TContextSchema extends InteropZodObject ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodDefault<any> ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodOptional<any> ? Partial<InferInteropZodOutput<TContextSchema>> : never>) => Promise<ModelRequest | void> | ModelRequest | void;
85
+ /**
86
+ * The function to handle model invocation errors and optionally retry.
87
+ *
88
+ * @param error - The exception that occurred during model invocation
89
+ * @param request - The original model request that failed
90
+ * @param state - The current agent state
91
+ * @param runtime - The runtime context
92
+ * @param attempt - The current attempt number (1-indexed)
93
+ * @returns Modified request to retry with, or undefined/null to propagate the error (re-raise)
94
+ */
95
+ retryModelRequest?: (error: Error, request: ModelRequest, state: (TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}) & AgentBuiltInState, runtime: Runtime<TContextSchema extends InteropZodObject ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodDefault<any> ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodOptional<any> ? Partial<InferInteropZodOutput<TContextSchema>> : never>, attempt: number) => Promise<ModelRequest | void> | ModelRequest | void;
85
96
  /**
86
97
  * The function to run before the model call. This function is called before the model is invoked and before the `modifyModelRequest` hook.
87
98
  * It allows to modify the state of the agent.
@@ -90,7 +101,7 @@ declare function createMiddleware<TSchema extends InteropZodObject | undefined =
90
101
  * @param runtime - The middleware runtime
91
102
  * @returns The modified middleware state or undefined to pass through
92
103
  */
93
- beforeModel?: (state: (TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}) & AgentBuiltInState, runtime: Runtime<(TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}) & AgentBuiltInState, TContextSchema extends InteropZodObject ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodDefault<any> ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodOptional<any> ? Partial<InferInteropZodOutput<TContextSchema>> : never>) => Promise<MiddlewareResult<Partial<TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}>>> | MiddlewareResult<Partial<TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}>>;
104
+ beforeModel?: (state: (TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}) & AgentBuiltInState, runtime: Runtime<TContextSchema extends InteropZodObject ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodDefault<any> ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodOptional<any> ? Partial<InferInteropZodOutput<TContextSchema>> : never>) => Promise<MiddlewareResult<Partial<TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}>>> | MiddlewareResult<Partial<TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}>>;
94
105
  /**
95
106
  * The function to run after the model call. This function is called after the model is invoked and before any tools are called.
96
107
  * It allows to modify the state of the agent after the model is invoked, e.g. to update tool call parameters.
@@ -99,7 +110,7 @@ declare function createMiddleware<TSchema extends InteropZodObject | undefined =
99
110
  * @param runtime - The middleware runtime
100
111
  * @returns The modified middleware state or undefined to pass through
101
112
  */
102
- afterModel?: (state: (TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}) & AgentBuiltInState, runtime: Runtime<(TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}) & AgentBuiltInState, TContextSchema extends InteropZodObject ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodDefault<any> ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodOptional<any> ? Partial<InferInteropZodOutput<TContextSchema>> : never>) => Promise<MiddlewareResult<Partial<TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}>>> | MiddlewareResult<Partial<TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}>>;
113
+ afterModel?: (state: (TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}) & AgentBuiltInState, runtime: Runtime<TContextSchema extends InteropZodObject ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodDefault<any> ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodOptional<any> ? Partial<InferInteropZodOutput<TContextSchema>> : never>) => Promise<MiddlewareResult<Partial<TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}>>> | MiddlewareResult<Partial<TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}>>;
103
114
  }): AgentMiddleware<TSchema, TContextSchema, any>;
104
115
  //#endregion
105
116
  export { createMiddleware };