@langchain/core 1.1.38 → 1.1.39

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 (345) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/agents.cjs.map +1 -1
  3. package/dist/agents.js.map +1 -1
  4. package/dist/callbacks/base.cjs.map +1 -1
  5. package/dist/callbacks/base.d.cts +71 -40
  6. package/dist/callbacks/base.d.cts.map +1 -1
  7. package/dist/callbacks/base.d.ts +71 -40
  8. package/dist/callbacks/base.d.ts.map +1 -1
  9. package/dist/callbacks/base.js.map +1 -1
  10. package/dist/callbacks/dispatch/index.cjs.map +1 -1
  11. package/dist/callbacks/dispatch/index.d.cts +0 -1
  12. package/dist/callbacks/dispatch/index.d.cts.map +1 -1
  13. package/dist/callbacks/dispatch/index.d.ts +0 -1
  14. package/dist/callbacks/dispatch/index.d.ts.map +1 -1
  15. package/dist/callbacks/dispatch/index.js.map +1 -1
  16. package/dist/callbacks/dispatch/web.cjs.map +1 -1
  17. package/dist/callbacks/dispatch/web.d.cts +0 -1
  18. package/dist/callbacks/dispatch/web.d.cts.map +1 -1
  19. package/dist/callbacks/dispatch/web.d.ts +0 -1
  20. package/dist/callbacks/dispatch/web.d.ts.map +1 -1
  21. package/dist/callbacks/dispatch/web.js.map +1 -1
  22. package/dist/callbacks/manager.cjs.map +1 -1
  23. package/dist/callbacks/manager.js.map +1 -1
  24. package/dist/chat_history.d.cts +0 -1
  25. package/dist/chat_history.d.cts.map +1 -1
  26. package/dist/document_loaders/langsmith.cjs.map +1 -1
  27. package/dist/document_loaders/langsmith.js.map +1 -1
  28. package/dist/documents/document.cjs.map +1 -1
  29. package/dist/documents/document.js.map +1 -1
  30. package/dist/errors/index.cjs.map +1 -1
  31. package/dist/errors/index.js.map +1 -1
  32. package/dist/indexing/base.cjs.map +1 -1
  33. package/dist/indexing/base.d.cts.map +1 -1
  34. package/dist/indexing/base.d.ts.map +1 -1
  35. package/dist/indexing/base.js.map +1 -1
  36. package/dist/language_models/base.cjs +1 -1
  37. package/dist/language_models/base.cjs.map +1 -1
  38. package/dist/language_models/base.d.cts +1 -1
  39. package/dist/language_models/base.d.cts.map +1 -1
  40. package/dist/language_models/base.d.ts +1 -1
  41. package/dist/language_models/base.d.ts.map +1 -1
  42. package/dist/language_models/base.js +1 -1
  43. package/dist/language_models/base.js.map +1 -1
  44. package/dist/language_models/chat_models.cjs.map +1 -1
  45. package/dist/language_models/chat_models.d.cts +0 -1
  46. package/dist/language_models/chat_models.d.cts.map +1 -1
  47. package/dist/language_models/chat_models.d.ts.map +1 -1
  48. package/dist/language_models/chat_models.js.map +1 -1
  49. package/dist/language_models/llms.cjs.map +1 -1
  50. package/dist/language_models/llms.d.cts.map +1 -1
  51. package/dist/language_models/llms.d.ts.map +1 -1
  52. package/dist/language_models/llms.js.map +1 -1
  53. package/dist/language_models/structured_output.cjs.map +1 -1
  54. package/dist/language_models/structured_output.d.cts +0 -1
  55. package/dist/language_models/structured_output.d.cts.map +1 -1
  56. package/dist/language_models/structured_output.d.ts.map +1 -1
  57. package/dist/language_models/structured_output.js.map +1 -1
  58. package/dist/load/index.cjs +1 -2
  59. package/dist/load/index.cjs.map +1 -1
  60. package/dist/load/index.js +1 -2
  61. package/dist/load/index.js.map +1 -1
  62. package/dist/load/map_keys.cjs.map +1 -1
  63. package/dist/load/map_keys.js.map +1 -1
  64. package/dist/load/serializable.cjs.map +1 -1
  65. package/dist/load/serializable.js.map +1 -1
  66. package/dist/memory.cjs +2 -8
  67. package/dist/memory.cjs.map +1 -1
  68. package/dist/memory.d.cts +2 -2
  69. package/dist/memory.d.cts.map +1 -1
  70. package/dist/memory.d.ts +2 -2
  71. package/dist/memory.d.ts.map +1 -1
  72. package/dist/memory.js +2 -8
  73. package/dist/memory.js.map +1 -1
  74. package/dist/messages/base.cjs.map +1 -1
  75. package/dist/messages/base.js.map +1 -1
  76. package/dist/messages/block_translators/utils.cjs.map +1 -1
  77. package/dist/messages/block_translators/utils.js.map +1 -1
  78. package/dist/messages/chat.cjs.map +1 -1
  79. package/dist/messages/chat.js.map +1 -1
  80. package/dist/messages/content/data.cjs.map +1 -1
  81. package/dist/messages/content/data.d.cts.map +1 -1
  82. package/dist/messages/content/data.d.ts.map +1 -1
  83. package/dist/messages/content/data.js.map +1 -1
  84. package/dist/messages/content/index.cjs.map +1 -1
  85. package/dist/messages/content/index.js.map +1 -1
  86. package/dist/messages/content/multimodal.cjs.map +1 -1
  87. package/dist/messages/content/multimodal.js.map +1 -1
  88. package/dist/messages/content/tools.cjs.map +1 -1
  89. package/dist/messages/content/tools.js.map +1 -1
  90. package/dist/messages/message.cjs.map +1 -1
  91. package/dist/messages/message.d.cts +3 -2
  92. package/dist/messages/message.d.cts.map +1 -1
  93. package/dist/messages/message.d.ts +3 -2
  94. package/dist/messages/message.d.ts.map +1 -1
  95. package/dist/messages/message.js.map +1 -1
  96. package/dist/messages/tool.cjs.map +1 -1
  97. package/dist/messages/tool.js.map +1 -1
  98. package/dist/messages/transformers.cjs.map +1 -1
  99. package/dist/messages/transformers.js.map +1 -1
  100. package/dist/messages/utils.d.cts.map +1 -1
  101. package/dist/messages/utils.d.ts.map +1 -1
  102. package/dist/output_parsers/base.d.cts +0 -1
  103. package/dist/output_parsers/base.d.cts.map +1 -1
  104. package/dist/output_parsers/base.d.ts.map +1 -1
  105. package/dist/output_parsers/json.cjs.map +1 -1
  106. package/dist/output_parsers/json.d.cts.map +1 -1
  107. package/dist/output_parsers/json.js.map +1 -1
  108. package/dist/output_parsers/list.d.cts.map +1 -1
  109. package/dist/output_parsers/openai_functions/json_output_functions_parsers.cjs.map +1 -1
  110. package/dist/output_parsers/openai_functions/json_output_functions_parsers.d.cts.map +1 -1
  111. package/dist/output_parsers/openai_functions/json_output_functions_parsers.d.ts.map +1 -1
  112. package/dist/output_parsers/openai_functions/json_output_functions_parsers.js.map +1 -1
  113. package/dist/output_parsers/openai_tools/json_output_tools_parsers.cjs.map +1 -1
  114. package/dist/output_parsers/openai_tools/json_output_tools_parsers.d.cts.map +1 -1
  115. package/dist/output_parsers/openai_tools/json_output_tools_parsers.d.ts.map +1 -1
  116. package/dist/output_parsers/openai_tools/json_output_tools_parsers.js.map +1 -1
  117. package/dist/output_parsers/standard_schema.cjs.map +1 -1
  118. package/dist/output_parsers/standard_schema.js.map +1 -1
  119. package/dist/output_parsers/string.d.cts.map +1 -1
  120. package/dist/output_parsers/transform.cjs.map +1 -1
  121. package/dist/output_parsers/transform.js.map +1 -1
  122. package/dist/output_parsers/xml.cjs +2 -2
  123. package/dist/output_parsers/xml.cjs.map +1 -1
  124. package/dist/output_parsers/xml.d.cts +1 -1
  125. package/dist/output_parsers/xml.d.ts +1 -1
  126. package/dist/output_parsers/xml.js +2 -2
  127. package/dist/output_parsers/xml.js.map +1 -1
  128. package/dist/outputs.cjs.map +1 -1
  129. package/dist/outputs.js.map +1 -1
  130. package/dist/prompt_values.cjs.map +1 -1
  131. package/dist/prompt_values.js.map +1 -1
  132. package/dist/prompts/base.cjs.map +1 -1
  133. package/dist/prompts/base.d.cts +0 -1
  134. package/dist/prompts/base.d.cts.map +1 -1
  135. package/dist/prompts/base.js.map +1 -1
  136. package/dist/prompts/chat.cjs.map +1 -1
  137. package/dist/prompts/chat.d.cts.map +1 -1
  138. package/dist/prompts/chat.js.map +1 -1
  139. package/dist/prompts/few_shot.cjs.map +1 -1
  140. package/dist/prompts/few_shot.d.cts.map +1 -1
  141. package/dist/prompts/few_shot.js.map +1 -1
  142. package/dist/prompts/image.cjs.map +1 -1
  143. package/dist/prompts/image.d.cts.map +1 -1
  144. package/dist/prompts/image.js.map +1 -1
  145. package/dist/prompts/pipeline.cjs.map +1 -1
  146. package/dist/prompts/pipeline.js.map +1 -1
  147. package/dist/prompts/prompt.cjs.map +1 -1
  148. package/dist/prompts/prompt.d.cts.map +1 -1
  149. package/dist/prompts/prompt.js.map +1 -1
  150. package/dist/prompts/serde.d.cts.map +1 -1
  151. package/dist/prompts/string.cjs.map +1 -1
  152. package/dist/prompts/string.js.map +1 -1
  153. package/dist/prompts/structured.cjs.map +1 -1
  154. package/dist/prompts/structured.d.cts.map +1 -1
  155. package/dist/prompts/structured.d.ts.map +1 -1
  156. package/dist/prompts/structured.js.map +1 -1
  157. package/dist/prompts/template.cjs +2 -5
  158. package/dist/prompts/template.cjs.map +1 -1
  159. package/dist/prompts/template.d.cts +0 -1
  160. package/dist/prompts/template.d.cts.map +1 -1
  161. package/dist/prompts/template.d.ts.map +1 -1
  162. package/dist/prompts/template.js +2 -5
  163. package/dist/prompts/template.js.map +1 -1
  164. package/dist/retrievers/document_compressors/index.cjs.map +1 -1
  165. package/dist/retrievers/document_compressors/index.js.map +1 -1
  166. package/dist/retrievers/index.cjs.map +1 -1
  167. package/dist/retrievers/index.d.cts.map +1 -1
  168. package/dist/retrievers/index.d.ts.map +1 -1
  169. package/dist/retrievers/index.js.map +1 -1
  170. package/dist/runnables/base.cjs.map +1 -1
  171. package/dist/runnables/base.js.map +1 -1
  172. package/dist/runnables/branch.cjs.map +1 -1
  173. package/dist/runnables/branch.d.cts.map +1 -1
  174. package/dist/runnables/branch.d.ts.map +1 -1
  175. package/dist/runnables/branch.js.map +1 -1
  176. package/dist/runnables/config.cjs.map +1 -1
  177. package/dist/runnables/config.js.map +1 -1
  178. package/dist/runnables/graph.cjs.map +1 -1
  179. package/dist/runnables/graph.js.map +1 -1
  180. package/dist/runnables/history.cjs +2 -4
  181. package/dist/runnables/history.cjs.map +1 -1
  182. package/dist/runnables/history.d.cts +2 -4
  183. package/dist/runnables/history.d.cts.map +1 -1
  184. package/dist/runnables/history.d.ts +2 -4
  185. package/dist/runnables/history.d.ts.map +1 -1
  186. package/dist/runnables/history.js +2 -4
  187. package/dist/runnables/history.js.map +1 -1
  188. package/dist/runnables/passthrough.cjs.map +1 -1
  189. package/dist/runnables/passthrough.d.cts.map +1 -1
  190. package/dist/runnables/passthrough.d.ts.map +1 -1
  191. package/dist/runnables/passthrough.js.map +1 -1
  192. package/dist/runnables/router.cjs.map +1 -1
  193. package/dist/runnables/router.d.cts.map +1 -1
  194. package/dist/runnables/router.d.ts.map +1 -1
  195. package/dist/runnables/router.js.map +1 -1
  196. package/dist/runnables/utils.cjs.map +1 -1
  197. package/dist/runnables/utils.js.map +1 -1
  198. package/dist/singletons/async_local_storage/context.cjs.map +1 -1
  199. package/dist/singletons/async_local_storage/context.d.cts.map +1 -1
  200. package/dist/singletons/async_local_storage/context.d.ts.map +1 -1
  201. package/dist/singletons/async_local_storage/context.js.map +1 -1
  202. package/dist/singletons/async_local_storage/globals.cjs.map +1 -1
  203. package/dist/singletons/async_local_storage/globals.js.map +1 -1
  204. package/dist/singletons/async_local_storage/index.cjs.map +1 -1
  205. package/dist/singletons/async_local_storage/index.js.map +1 -1
  206. package/dist/singletons/callbacks.cjs.map +1 -1
  207. package/dist/singletons/callbacks.d.cts.map +1 -1
  208. package/dist/singletons/callbacks.js.map +1 -1
  209. package/dist/stores.cjs.map +1 -1
  210. package/dist/stores.js.map +1 -1
  211. package/dist/structured_query/ir.d.cts.map +1 -1
  212. package/dist/structured_query/ir.d.ts.map +1 -1
  213. package/dist/structured_query/utils.cjs.map +1 -1
  214. package/dist/structured_query/utils.js.map +1 -1
  215. package/dist/testing/fake_model_builder.cjs.map +1 -1
  216. package/dist/testing/fake_model_builder.d.cts.map +1 -1
  217. package/dist/testing/fake_model_builder.js.map +1 -1
  218. package/dist/testing/matchers.cjs.map +1 -1
  219. package/dist/testing/matchers.d.cts +8 -8
  220. package/dist/testing/matchers.d.cts.map +1 -1
  221. package/dist/testing/matchers.d.ts +8 -8
  222. package/dist/testing/matchers.d.ts.map +1 -1
  223. package/dist/testing/matchers.js.map +1 -1
  224. package/dist/tools/index.cjs.map +1 -1
  225. package/dist/tools/index.d.cts +3 -2
  226. package/dist/tools/index.d.cts.map +1 -1
  227. package/dist/tools/index.d.ts +3 -2
  228. package/dist/tools/index.d.ts.map +1 -1
  229. package/dist/tools/index.js.map +1 -1
  230. package/dist/tools/types.cjs.map +1 -1
  231. package/dist/tools/types.d.cts +1 -1
  232. package/dist/tools/types.d.cts.map +1 -1
  233. package/dist/tools/types.d.ts +1 -1
  234. package/dist/tools/types.d.ts.map +1 -1
  235. package/dist/tools/types.js.map +1 -1
  236. package/dist/tracers/base.cjs.map +1 -1
  237. package/dist/tracers/base.d.cts +91 -91
  238. package/dist/tracers/base.d.cts.map +1 -1
  239. package/dist/tracers/base.d.ts +91 -91
  240. package/dist/tracers/base.d.ts.map +1 -1
  241. package/dist/tracers/base.js.map +1 -1
  242. package/dist/tracers/event_stream.cjs.map +1 -1
  243. package/dist/tracers/event_stream.d.cts +0 -1
  244. package/dist/tracers/event_stream.d.cts.map +1 -1
  245. package/dist/tracers/event_stream.js.map +1 -1
  246. package/dist/tracers/log_stream.cjs.map +1 -1
  247. package/dist/tracers/log_stream.d.cts.map +1 -1
  248. package/dist/tracers/log_stream.d.ts.map +1 -1
  249. package/dist/tracers/log_stream.js.map +1 -1
  250. package/dist/utils/async_caller.cjs.map +1 -1
  251. package/dist/utils/async_caller.js.map +1 -1
  252. package/dist/utils/chunk_array.d.cts.map +1 -1
  253. package/dist/utils/chunk_array.d.ts.map +1 -1
  254. package/dist/utils/env.cjs.map +1 -1
  255. package/dist/utils/env.js.map +1 -1
  256. package/dist/utils/event_source_parse.cjs.map +1 -1
  257. package/dist/utils/event_source_parse.d.cts +2 -2
  258. package/dist/utils/event_source_parse.d.cts.map +1 -1
  259. package/dist/utils/event_source_parse.d.ts +2 -2
  260. package/dist/utils/event_source_parse.d.ts.map +1 -1
  261. package/dist/utils/event_source_parse.js.map +1 -1
  262. package/dist/utils/function_calling.cjs.map +1 -1
  263. package/dist/utils/function_calling.js.map +1 -1
  264. package/dist/utils/is-network-error/index.cjs.map +1 -1
  265. package/dist/utils/is-network-error/index.js.map +1 -1
  266. package/dist/utils/json.cjs.map +1 -1
  267. package/dist/utils/json.js.map +1 -1
  268. package/dist/utils/json_schema.d.cts.map +1 -1
  269. package/dist/utils/namespace.cjs.map +1 -1
  270. package/dist/utils/namespace.js.map +1 -1
  271. package/dist/utils/p-retry/index.cjs.map +1 -1
  272. package/dist/utils/p-retry/index.js.map +1 -1
  273. package/dist/utils/signal.cjs.map +1 -1
  274. package/dist/utils/signal.js.map +1 -1
  275. package/dist/utils/standard_schema.cjs.map +1 -1
  276. package/dist/utils/standard_schema.js.map +1 -1
  277. package/dist/utils/stream.cjs.map +1 -1
  278. package/dist/utils/stream.d.cts +2 -2
  279. package/dist/utils/stream.d.cts.map +1 -1
  280. package/dist/utils/stream.d.ts +2 -2
  281. package/dist/utils/stream.d.ts.map +1 -1
  282. package/dist/utils/stream.js.map +1 -1
  283. package/dist/utils/testing/chat_models.cjs.map +1 -1
  284. package/dist/utils/testing/chat_models.d.cts.map +1 -1
  285. package/dist/utils/testing/chat_models.js.map +1 -1
  286. package/dist/utils/testing/retrievers.cjs.map +1 -1
  287. package/dist/utils/testing/retrievers.js.map +1 -1
  288. package/dist/utils/testing/vectorstores.cjs.map +1 -1
  289. package/dist/utils/testing/vectorstores.js.map +1 -1
  290. package/dist/utils/types/index.cjs.map +1 -1
  291. package/dist/utils/types/index.js.map +1 -1
  292. package/dist/utils/types/zod.cjs.map +1 -1
  293. package/dist/utils/types/zod.js.map +1 -1
  294. package/dist/utils/zod-to-json-schema/Options.d.cts +1 -0
  295. package/dist/utils/zod-to-json-schema/Refs.d.cts +1 -0
  296. package/dist/utils/zod-to-json-schema/errorMessages.d.cts +0 -1
  297. package/dist/utils/zod-to-json-schema/errorMessages.d.cts.map +1 -1
  298. package/dist/utils/zod-to-json-schema/index.d.cts +24 -0
  299. package/dist/utils/zod-to-json-schema/parseDef.d.cts +1 -0
  300. package/dist/utils/zod-to-json-schema/parsers/array.d.cts +0 -1
  301. package/dist/utils/zod-to-json-schema/parsers/array.d.cts.map +1 -1
  302. package/dist/utils/zod-to-json-schema/parsers/bigint.d.cts +0 -1
  303. package/dist/utils/zod-to-json-schema/parsers/bigint.d.cts.map +1 -1
  304. package/dist/utils/zod-to-json-schema/parsers/branded.d.cts +1 -0
  305. package/dist/utils/zod-to-json-schema/parsers/catch.d.cts +1 -0
  306. package/dist/utils/zod-to-json-schema/parsers/date.d.cts +0 -1
  307. package/dist/utils/zod-to-json-schema/parsers/date.d.cts.map +1 -1
  308. package/dist/utils/zod-to-json-schema/parsers/default.d.cts +1 -0
  309. package/dist/utils/zod-to-json-schema/parsers/effects.d.cts +1 -0
  310. package/dist/utils/zod-to-json-schema/parsers/intersection.d.cts +0 -1
  311. package/dist/utils/zod-to-json-schema/parsers/intersection.d.cts.map +1 -1
  312. package/dist/utils/zod-to-json-schema/parsers/map.d.cts +0 -1
  313. package/dist/utils/zod-to-json-schema/parsers/map.d.cts.map +1 -1
  314. package/dist/utils/zod-to-json-schema/parsers/never.d.cts +0 -1
  315. package/dist/utils/zod-to-json-schema/parsers/never.d.cts.map +1 -1
  316. package/dist/utils/zod-to-json-schema/parsers/nullable.d.cts +0 -1
  317. package/dist/utils/zod-to-json-schema/parsers/nullable.d.cts.map +1 -1
  318. package/dist/utils/zod-to-json-schema/parsers/number.d.cts +0 -1
  319. package/dist/utils/zod-to-json-schema/parsers/number.d.cts.map +1 -1
  320. package/dist/utils/zod-to-json-schema/parsers/object.d.cts +0 -1
  321. package/dist/utils/zod-to-json-schema/parsers/object.d.cts.map +1 -1
  322. package/dist/utils/zod-to-json-schema/parsers/optional.d.cts +1 -0
  323. package/dist/utils/zod-to-json-schema/parsers/pipeline.d.cts +1 -0
  324. package/dist/utils/zod-to-json-schema/parsers/promise.d.cts +1 -0
  325. package/dist/utils/zod-to-json-schema/parsers/readonly.d.cts +1 -0
  326. package/dist/utils/zod-to-json-schema/parsers/record.d.cts +0 -1
  327. package/dist/utils/zod-to-json-schema/parsers/record.d.cts.map +1 -1
  328. package/dist/utils/zod-to-json-schema/parsers/set.d.cts +0 -1
  329. package/dist/utils/zod-to-json-schema/parsers/set.d.cts.map +1 -1
  330. package/dist/utils/zod-to-json-schema/parsers/string.d.cts +0 -1
  331. package/dist/utils/zod-to-json-schema/parsers/string.d.cts.map +1 -1
  332. package/dist/utils/zod-to-json-schema/parsers/tuple.d.cts +0 -1
  333. package/dist/utils/zod-to-json-schema/parsers/tuple.d.cts.map +1 -1
  334. package/dist/utils/zod-to-json-schema/parsers/undefined.d.cts +0 -1
  335. package/dist/utils/zod-to-json-schema/parsers/undefined.d.cts.map +1 -1
  336. package/dist/utils/zod-to-json-schema/parsers/union.d.cts +1 -2
  337. package/dist/utils/zod-to-json-schema/parsers/union.d.cts.map +1 -1
  338. package/dist/utils/zod-to-json-schema/parsers/union.d.ts.map +1 -1
  339. package/dist/utils/zod-to-json-schema/parsers/unknown.d.cts +0 -1
  340. package/dist/utils/zod-to-json-schema/parsers/unknown.d.cts.map +1 -1
  341. package/dist/utils/zod-to-json-schema/selectParser.d.cts +1 -0
  342. package/dist/utils/zod-to-json-schema/zodToJsonSchema.d.cts +1 -0
  343. package/dist/vectorstores.cjs.map +1 -1
  344. package/dist/vectorstores.js.map +1 -1
  345. package/package.json +5 -13
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @langchain/core
2
2
 
3
+ ## 1.1.39
4
+
5
+ ### Patch Changes
6
+
7
+ - [#10430](https://github.com/langchain-ai/langchainjs/pull/10430) [`d3d0922`](https://github.com/langchain-ai/langchainjs/commit/d3d0922c24afcd3006fb94dcadd3ebe08fbf2383) Thanks [@christian-bromann](https://github.com/christian-bromann)! - feat(langchain): support for browser tools
8
+
3
9
  ## 1.1.38
4
10
 
5
11
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"agents.cjs","names":[],"sources":["../src/agents.ts"],"sourcesContent":["export type AgentAction = {\n tool: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n toolInput: string | Record<string, any>;\n log: string;\n};\n\nexport type AgentFinish = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n returnValues: Record<string, any>;\n log: string;\n};\n\nexport type AgentStep = {\n action: AgentAction;\n observation: string;\n};\n"],"mappings":""}
1
+ {"version":3,"file":"agents.cjs","names":[],"sources":["../src/agents.ts"],"sourcesContent":["export type AgentAction = {\n tool: string;\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n toolInput: string | Record<string, any>;\n log: string;\n};\n\nexport type AgentFinish = {\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n returnValues: Record<string, any>;\n log: string;\n};\n\nexport type AgentStep = {\n action: AgentAction;\n observation: string;\n};\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"agents.js","names":[],"sources":["../src/agents.ts"],"sourcesContent":["export type AgentAction = {\n tool: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n toolInput: string | Record<string, any>;\n log: string;\n};\n\nexport type AgentFinish = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n returnValues: Record<string, any>;\n log: string;\n};\n\nexport type AgentStep = {\n action: AgentAction;\n observation: string;\n};\n"],"mappings":""}
1
+ {"version":3,"file":"agents.js","names":[],"sources":["../src/agents.ts"],"sourcesContent":["export type AgentAction = {\n tool: string;\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n toolInput: string | Record<string, any>;\n log: string;\n};\n\nexport type AgentFinish = {\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n returnValues: Record<string, any>;\n log: string;\n};\n\nexport type AgentStep = {\n action: AgentAction;\n observation: string;\n};\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"base.cjs","names":["get_lc_unique_name","getEnvironmentVariable","Serializable"],"sources":["../../src/callbacks/base.ts"],"sourcesContent":["import * as uuid from \"uuid\";\nimport type { ChainValues } from \"../utils/types/index.js\";\nimport type { BaseMessage } from \"../messages/base.js\";\nimport type { AgentAction, AgentFinish } from \"../agents.js\";\nimport type {\n ChatGenerationChunk,\n GenerationChunk,\n LLMResult,\n} from \"../outputs.js\";\nimport {\n Serializable,\n Serialized,\n SerializedNotImplemented,\n get_lc_unique_name,\n} from \"../load/serializable.js\";\nimport type { SerializedFields } from \"../load/map_keys.js\";\nimport type { DocumentInterface } from \"../documents/document.js\";\nimport { getEnvironmentVariable } from \"../utils/env.js\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype Error = any;\n\n/**\n * Interface for the input parameters of the BaseCallbackHandler class. It\n * allows to specify which types of events should be ignored by the\n * callback handler.\n */\nexport interface BaseCallbackHandlerInput {\n ignoreLLM?: boolean;\n ignoreChain?: boolean;\n ignoreAgent?: boolean;\n ignoreRetriever?: boolean;\n ignoreCustomEvent?: boolean;\n _awaitHandler?: boolean;\n raiseError?: boolean;\n}\n\n/**\n * Interface for the indices of a new token produced by an LLM or Chat\n * Model in streaming mode.\n */\nexport interface NewTokenIndices {\n prompt: number;\n completion: number;\n}\n\n// TODO: Add all additional callback fields here\nexport type HandleLLMNewTokenCallbackFields = {\n chunk?: GenerationChunk | ChatGenerationChunk;\n};\n\n/**\n * Abstract class that provides a set of optional methods that can be\n * overridden in derived classes to handle various events during the\n * execution of a LangChain application.\n */\nabstract class BaseCallbackHandlerMethodsClass {\n /**\n * Called at the start of an LLM or Chat Model run, with the prompt(s)\n * and the run ID.\n */\n handleLLMStart?(\n llm: Serialized,\n prompts: string[],\n runId: string,\n parentRunId?: string,\n extraParams?: Record<string, unknown>,\n tags?: string[],\n metadata?: Record<string, unknown>,\n runName?: string\n ): // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n\n /**\n * Called when an LLM/ChatModel in `streaming` mode produces a new token\n */\n handleLLMNewToken?(\n token: string,\n /**\n * idx.prompt is the index of the prompt that produced the token\n * (if there are multiple prompts)\n * idx.completion is the index of the completion that produced the token\n * (if multiple completions per prompt are requested)\n */\n idx: NewTokenIndices,\n runId: string,\n parentRunId?: string,\n tags?: string[],\n fields?: HandleLLMNewTokenCallbackFields\n ): // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n\n /**\n * Called if an LLM/ChatModel run encounters an error\n */\n handleLLMError?(\n err: Error,\n runId: string,\n parentRunId?: string,\n tags?: string[],\n extraParams?: Record<string, unknown>\n ): // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n\n /**\n * Called at the end of an LLM/ChatModel run, with the output and the run ID.\n */\n handleLLMEnd?(\n output: LLMResult,\n runId: string,\n parentRunId?: string,\n tags?: string[],\n extraParams?: Record<string, unknown>\n ): // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n\n /**\n * Called at the start of a Chat Model run, with the prompt(s)\n * and the run ID.\n */\n handleChatModelStart?(\n llm: Serialized,\n messages: BaseMessage[][],\n runId: string,\n parentRunId?: string,\n extraParams?: Record<string, unknown>,\n tags?: string[],\n metadata?: Record<string, unknown>,\n runName?: string\n ): // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n\n /**\n * Called at the start of a Chain run, with the chain name and inputs\n * and the run ID.\n */\n handleChainStart?(\n chain: Serialized,\n inputs: ChainValues,\n runId: string,\n runType?: string,\n tags?: string[],\n metadata?: Record<string, unknown>,\n runName?: string,\n parentRunId?: string,\n extra?: Record<string, unknown>\n ): // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n\n /**\n * Called if a Chain run encounters an error\n */\n handleChainError?(\n err: Error,\n runId: string,\n parentRunId?: string,\n tags?: string[],\n kwargs?: { inputs?: Record<string, unknown> }\n ): // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n\n /**\n * Called at the end of a Chain run, with the outputs and the run ID.\n */\n handleChainEnd?(\n outputs: ChainValues,\n runId: string,\n parentRunId?: string,\n tags?: string[],\n kwargs?: { inputs?: Record<string, unknown> }\n ): // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n\n /**\n * Called at the start of a Tool run, with the tool name and input\n * and the run ID.\n */\n handleToolStart?(\n tool: Serialized,\n input: string,\n runId: string,\n parentRunId?: string,\n tags?: string[],\n metadata?: Record<string, unknown>,\n runName?: string,\n toolCallId?: string\n ): // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n\n /**\n * Called if a Tool run encounters an error\n */\n handleToolError?(\n err: Error,\n runId: string,\n parentRunId?: string,\n tags?: string[]\n ): // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n\n /**\n * Called at the end of a Tool run, with the tool output and the run ID.\n */\n handleToolEnd?(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n output: any,\n runId: string,\n parentRunId?: string,\n tags?: string[]\n ): // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n\n /**\n * Called when a streaming tool yields a partial value. Tools that are async generators\n * invoke this once per yielded value.\n */\n handleToolEvent?(\n chunk: unknown,\n runId: string,\n parentRunId?: string,\n tags?: string[]\n ): // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n\n handleText?(\n text: string,\n runId: string,\n parentRunId?: string,\n tags?: string[]\n ): Promise<void> | void;\n\n /**\n * Called when an agent is about to execute an action,\n * with the action and the run ID.\n */\n handleAgentAction?(\n action: AgentAction,\n runId: string,\n parentRunId?: string,\n tags?: string[]\n ): Promise<void> | void;\n\n /**\n * Called when an agent finishes execution, before it exits.\n * with the final output and the run ID.\n */\n handleAgentEnd?(\n action: AgentFinish,\n runId: string,\n parentRunId?: string,\n tags?: string[]\n ): Promise<void> | void;\n\n handleRetrieverStart?(\n retriever: Serialized,\n query: string,\n runId: string,\n parentRunId?: string,\n tags?: string[],\n metadata?: Record<string, unknown>,\n name?: string\n ): // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n\n handleRetrieverEnd?(\n documents: DocumentInterface[],\n runId: string,\n parentRunId?: string,\n tags?: string[]\n ): // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n\n handleRetrieverError?(\n err: Error,\n runId: string,\n parentRunId?: string,\n tags?: string[]\n ): // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n\n handleCustomEvent?(\n eventName: string,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data: any,\n runId: string,\n tags?: string[],\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n metadata?: Record<string, any>\n ): // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n}\n\n/**\n * Base interface for callbacks. All methods are optional. If a method is not\n * implemented, it will be ignored. If a method is implemented, it will be\n * called at the appropriate time. All methods are called with the run ID of\n * the LLM/ChatModel/Chain that is running, which is generated by the\n * CallbackManager.\n *\n * @interface\n */\nexport type CallbackHandlerMethods = BaseCallbackHandlerMethodsClass;\n\n/**\n * Interface for handlers that can indicate a preference for streaming responses.\n * When implemented, this allows the handler to signal whether it prefers to receive\n * streaming responses from language models rather than complete responses.\n */\nexport interface CallbackHandlerPrefersStreaming {\n readonly lc_prefer_streaming: boolean;\n}\n\nexport function callbackHandlerPrefersStreaming(x: BaseCallbackHandler) {\n return \"lc_prefer_streaming\" in x && x.lc_prefer_streaming;\n}\n\n/**\n * Abstract base class for creating callback handlers in the LangChain\n * framework. It provides a set of optional methods that can be overridden\n * in derived classes to handle various events during the execution of a\n * LangChain application.\n */\nexport abstract class BaseCallbackHandler\n extends BaseCallbackHandlerMethodsClass\n implements BaseCallbackHandlerInput, Serializable\n{\n lc_serializable = false;\n\n get lc_namespace(): [\"langchain_core\", \"callbacks\", string] {\n return [\"langchain_core\", \"callbacks\", this.name];\n }\n\n get lc_secrets(): { [key: string]: string } | undefined {\n return undefined;\n }\n\n get lc_attributes(): { [key: string]: string } | undefined {\n return undefined;\n }\n\n get lc_aliases(): { [key: string]: string } | undefined {\n return undefined;\n }\n\n get lc_serializable_keys(): string[] | undefined {\n return undefined;\n }\n\n /**\n * The name of the serializable. Override to provide an alias or\n * to preserve the serialized module name in minified environments.\n *\n * Implemented as a static method to support loading logic.\n */\n static lc_name(): string {\n return this.name;\n }\n\n /**\n * The final serialized identifier for the module.\n */\n get lc_id(): string[] {\n return [\n ...this.lc_namespace,\n get_lc_unique_name(this.constructor as typeof BaseCallbackHandler),\n ];\n }\n\n lc_kwargs: SerializedFields;\n\n abstract name: string;\n\n ignoreLLM = false;\n\n ignoreChain = false;\n\n ignoreAgent = false;\n\n ignoreRetriever = false;\n\n ignoreCustomEvent = false;\n\n raiseError = false;\n\n awaitHandlers =\n getEnvironmentVariable(\"LANGCHAIN_CALLBACKS_BACKGROUND\") === \"false\";\n\n constructor(input?: BaseCallbackHandlerInput) {\n super();\n this.lc_kwargs = input || {};\n if (input) {\n this.ignoreLLM = input.ignoreLLM ?? this.ignoreLLM;\n this.ignoreChain = input.ignoreChain ?? this.ignoreChain;\n this.ignoreAgent = input.ignoreAgent ?? this.ignoreAgent;\n this.ignoreRetriever = input.ignoreRetriever ?? this.ignoreRetriever;\n this.ignoreCustomEvent =\n input.ignoreCustomEvent ?? this.ignoreCustomEvent;\n this.raiseError = input.raiseError ?? this.raiseError;\n this.awaitHandlers =\n this.raiseError || (input._awaitHandler ?? this.awaitHandlers);\n }\n }\n\n copy(): BaseCallbackHandler {\n return new (this.constructor as new (\n input?: BaseCallbackHandlerInput\n ) => BaseCallbackHandler)(this);\n }\n\n toJSON(): Serialized {\n return Serializable.prototype.toJSON.call(this);\n }\n\n toJSONNotImplemented(): SerializedNotImplemented {\n return Serializable.prototype.toJSONNotImplemented.call(this);\n }\n\n static fromMethods(methods: CallbackHandlerMethods) {\n class Handler extends BaseCallbackHandler {\n name = uuid.v7();\n\n constructor() {\n super();\n Object.assign(this, methods);\n }\n }\n return new Handler();\n }\n}\n\nexport const isBaseCallbackHandler = (x: unknown) => {\n const callbackHandler = x as BaseCallbackHandler;\n return (\n callbackHandler !== undefined &&\n typeof callbackHandler.copy === \"function\" &&\n typeof callbackHandler.name === \"string\" &&\n typeof callbackHandler.awaitHandlers === \"boolean\"\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAwDA,IAAe,kCAAf,MAA+C;AAgQ/C,SAAgB,gCAAgC,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AAIxB,MAAa,yBAAyB,MAAe;CACnD,MAAM,kBAAkB;AACxB,QACE,oBAAoB,KAAA,KACpB,OAAO,gBAAgB,SAAS,cAChC,OAAO,gBAAgB,SAAS,YAChC,OAAO,gBAAgB,kBAAkB"}
1
+ {"version":3,"file":"base.cjs","names":["get_lc_unique_name","getEnvironmentVariable","Serializable"],"sources":["../../src/callbacks/base.ts"],"sourcesContent":["import * as uuid from \"uuid\";\nimport type { ChainValues } from \"../utils/types/index.js\";\nimport type { BaseMessage } from \"../messages/base.js\";\nimport type { AgentAction, AgentFinish } from \"../agents.js\";\nimport type {\n ChatGenerationChunk,\n GenerationChunk,\n LLMResult,\n} from \"../outputs.js\";\nimport {\n Serializable,\n Serialized,\n SerializedNotImplemented,\n get_lc_unique_name,\n} from \"../load/serializable.js\";\nimport type { SerializedFields } from \"../load/map_keys.js\";\nimport type { DocumentInterface } from \"../documents/document.js\";\nimport { getEnvironmentVariable } from \"../utils/env.js\";\n\n// oxlint-disable-next-line @typescript-eslint/no-explicit-any\ntype Error = any;\n\n/**\n * Interface for the input parameters of the BaseCallbackHandler class. It\n * allows to specify which types of events should be ignored by the\n * callback handler.\n */\nexport interface BaseCallbackHandlerInput {\n ignoreLLM?: boolean;\n ignoreChain?: boolean;\n ignoreAgent?: boolean;\n ignoreRetriever?: boolean;\n ignoreCustomEvent?: boolean;\n _awaitHandler?: boolean;\n raiseError?: boolean;\n}\n\n/**\n * Interface for the indices of a new token produced by an LLM or Chat\n * Model in streaming mode.\n */\nexport interface NewTokenIndices {\n prompt: number;\n completion: number;\n}\n\n// TODO: Add all additional callback fields here\nexport type HandleLLMNewTokenCallbackFields = {\n chunk?: GenerationChunk | ChatGenerationChunk;\n};\n\n/**\n * Abstract class that provides a set of optional methods that can be\n * overridden in derived classes to handle various events during the\n * execution of a LangChain application.\n */\nabstract class BaseCallbackHandlerMethodsClass {\n /**\n * Called at the start of an LLM or Chat Model run, with the prompt(s)\n * and the run ID.\n */\n handleLLMStart?(\n llm: Serialized,\n prompts: string[],\n runId: string,\n parentRunId?: string,\n extraParams?: Record<string, unknown>,\n tags?: string[],\n metadata?: Record<string, unknown>,\n runName?: string\n ): // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n\n /**\n * Called when an LLM/ChatModel in `streaming` mode produces a new token\n */\n handleLLMNewToken?(\n token: string,\n /**\n * idx.prompt is the index of the prompt that produced the token\n * (if there are multiple prompts)\n * idx.completion is the index of the completion that produced the token\n * (if multiple completions per prompt are requested)\n */\n idx: NewTokenIndices,\n runId: string,\n parentRunId?: string,\n tags?: string[],\n fields?: HandleLLMNewTokenCallbackFields\n ): // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n\n /**\n * Called if an LLM/ChatModel run encounters an error\n */\n handleLLMError?(\n err: Error,\n runId: string,\n parentRunId?: string,\n tags?: string[],\n extraParams?: Record<string, unknown>\n ): // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n\n /**\n * Called at the end of an LLM/ChatModel run, with the output and the run ID.\n */\n handleLLMEnd?(\n output: LLMResult,\n runId: string,\n parentRunId?: string,\n tags?: string[],\n extraParams?: Record<string, unknown>\n ): // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n\n /**\n * Called at the start of a Chat Model run, with the prompt(s)\n * and the run ID.\n */\n handleChatModelStart?(\n llm: Serialized,\n messages: BaseMessage[][],\n runId: string,\n parentRunId?: string,\n extraParams?: Record<string, unknown>,\n tags?: string[],\n metadata?: Record<string, unknown>,\n runName?: string\n ): // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n\n /**\n * Called at the start of a Chain run, with the chain name and inputs\n * and the run ID.\n */\n handleChainStart?(\n chain: Serialized,\n inputs: ChainValues,\n runId: string,\n runType?: string,\n tags?: string[],\n metadata?: Record<string, unknown>,\n runName?: string,\n parentRunId?: string,\n extra?: Record<string, unknown>\n ): // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n\n /**\n * Called if a Chain run encounters an error\n */\n handleChainError?(\n err: Error,\n runId: string,\n parentRunId?: string,\n tags?: string[],\n kwargs?: { inputs?: Record<string, unknown> }\n ): // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n\n /**\n * Called at the end of a Chain run, with the outputs and the run ID.\n */\n handleChainEnd?(\n outputs: ChainValues,\n runId: string,\n parentRunId?: string,\n tags?: string[],\n kwargs?: { inputs?: Record<string, unknown> }\n ): // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n\n /**\n * Called at the start of a Tool run, with the tool name and input\n * and the run ID.\n */\n handleToolStart?(\n tool: Serialized,\n input: string,\n runId: string,\n parentRunId?: string,\n tags?: string[],\n metadata?: Record<string, unknown>,\n runName?: string,\n toolCallId?: string\n ): // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n\n /**\n * Called if a Tool run encounters an error\n */\n handleToolError?(\n err: Error,\n runId: string,\n parentRunId?: string,\n tags?: string[]\n ): // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n\n /**\n * Called at the end of a Tool run, with the tool output and the run ID.\n */\n handleToolEnd?(\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n output: any,\n runId: string,\n parentRunId?: string,\n tags?: string[]\n ): // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n\n /**\n * Called when a streaming tool yields a partial value. Tools that are async generators\n * invoke this once per yielded value.\n */\n handleToolEvent?(\n chunk: unknown,\n runId: string,\n parentRunId?: string,\n tags?: string[]\n ): // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n\n handleText?(\n text: string,\n runId: string,\n parentRunId?: string,\n tags?: string[]\n ): Promise<void> | void;\n\n /**\n * Called when an agent is about to execute an action,\n * with the action and the run ID.\n */\n handleAgentAction?(\n action: AgentAction,\n runId: string,\n parentRunId?: string,\n tags?: string[]\n ): Promise<void> | void;\n\n /**\n * Called when an agent finishes execution, before it exits.\n * with the final output and the run ID.\n */\n handleAgentEnd?(\n action: AgentFinish,\n runId: string,\n parentRunId?: string,\n tags?: string[]\n ): Promise<void> | void;\n\n handleRetrieverStart?(\n retriever: Serialized,\n query: string,\n runId: string,\n parentRunId?: string,\n tags?: string[],\n metadata?: Record<string, unknown>,\n name?: string\n ): // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n\n handleRetrieverEnd?(\n documents: DocumentInterface[],\n runId: string,\n parentRunId?: string,\n tags?: string[]\n ): // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n\n handleRetrieverError?(\n err: Error,\n runId: string,\n parentRunId?: string,\n tags?: string[]\n ): // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n\n handleCustomEvent?(\n eventName: string,\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n data: any,\n runId: string,\n tags?: string[],\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n metadata?: Record<string, any>\n ): // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n}\n\n/**\n * Base interface for callbacks. All methods are optional. If a method is not\n * implemented, it will be ignored. If a method is implemented, it will be\n * called at the appropriate time. All methods are called with the run ID of\n * the LLM/ChatModel/Chain that is running, which is generated by the\n * CallbackManager.\n *\n * @interface\n */\nexport type CallbackHandlerMethods = BaseCallbackHandlerMethodsClass;\n\n/**\n * Interface for handlers that can indicate a preference for streaming responses.\n * When implemented, this allows the handler to signal whether it prefers to receive\n * streaming responses from language models rather than complete responses.\n */\nexport interface CallbackHandlerPrefersStreaming {\n readonly lc_prefer_streaming: boolean;\n}\n\nexport function callbackHandlerPrefersStreaming(x: BaseCallbackHandler) {\n return \"lc_prefer_streaming\" in x && x.lc_prefer_streaming;\n}\n\n/**\n * Abstract base class for creating callback handlers in the LangChain\n * framework. It provides a set of optional methods that can be overridden\n * in derived classes to handle various events during the execution of a\n * LangChain application.\n */\nexport abstract class BaseCallbackHandler\n extends BaseCallbackHandlerMethodsClass\n implements BaseCallbackHandlerInput, Serializable\n{\n lc_serializable = false;\n\n get lc_namespace(): [\"langchain_core\", \"callbacks\", string] {\n return [\"langchain_core\", \"callbacks\", this.name];\n }\n\n get lc_secrets(): { [key: string]: string } | undefined {\n return undefined;\n }\n\n get lc_attributes(): { [key: string]: string } | undefined {\n return undefined;\n }\n\n get lc_aliases(): { [key: string]: string } | undefined {\n return undefined;\n }\n\n get lc_serializable_keys(): string[] | undefined {\n return undefined;\n }\n\n /**\n * The name of the serializable. Override to provide an alias or\n * to preserve the serialized module name in minified environments.\n *\n * Implemented as a static method to support loading logic.\n */\n static lc_name(): string {\n return this.name;\n }\n\n /**\n * The final serialized identifier for the module.\n */\n get lc_id(): string[] {\n return [\n ...this.lc_namespace,\n get_lc_unique_name(this.constructor as typeof BaseCallbackHandler),\n ];\n }\n\n lc_kwargs: SerializedFields;\n\n abstract name: string;\n\n ignoreLLM = false;\n\n ignoreChain = false;\n\n ignoreAgent = false;\n\n ignoreRetriever = false;\n\n ignoreCustomEvent = false;\n\n raiseError = false;\n\n awaitHandlers =\n getEnvironmentVariable(\"LANGCHAIN_CALLBACKS_BACKGROUND\") === \"false\";\n\n constructor(input?: BaseCallbackHandlerInput) {\n super();\n this.lc_kwargs = input || {};\n if (input) {\n this.ignoreLLM = input.ignoreLLM ?? this.ignoreLLM;\n this.ignoreChain = input.ignoreChain ?? this.ignoreChain;\n this.ignoreAgent = input.ignoreAgent ?? this.ignoreAgent;\n this.ignoreRetriever = input.ignoreRetriever ?? this.ignoreRetriever;\n this.ignoreCustomEvent =\n input.ignoreCustomEvent ?? this.ignoreCustomEvent;\n this.raiseError = input.raiseError ?? this.raiseError;\n this.awaitHandlers =\n this.raiseError || (input._awaitHandler ?? this.awaitHandlers);\n }\n }\n\n copy(): BaseCallbackHandler {\n return new (this.constructor as new (\n input?: BaseCallbackHandlerInput\n ) => BaseCallbackHandler)(this);\n }\n\n toJSON(): Serialized {\n return Serializable.prototype.toJSON.call(this);\n }\n\n toJSONNotImplemented(): SerializedNotImplemented {\n return Serializable.prototype.toJSONNotImplemented.call(this);\n }\n\n static fromMethods(methods: CallbackHandlerMethods) {\n class Handler extends BaseCallbackHandler {\n name = uuid.v7();\n\n constructor() {\n super();\n Object.assign(this, methods);\n }\n }\n return new Handler();\n }\n}\n\nexport const isBaseCallbackHandler = (x: unknown) => {\n const callbackHandler = x as BaseCallbackHandler;\n return (\n callbackHandler !== undefined &&\n typeof callbackHandler.copy === \"function\" &&\n typeof callbackHandler.name === \"string\" &&\n typeof callbackHandler.awaitHandlers === \"boolean\"\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAwDA,IAAe,kCAAf,MAA+C;AAgQ/C,SAAgB,gCAAgC,GAAwB;AACtE,QAAO,yBAAyB,KAAK,EAAE;;;;;;;;AASzC,IAAsB,sBAAtB,cACU,gCAEV;CACE,kBAAkB;CAElB,IAAI,eAAwD;AAC1D,SAAO;GAAC;GAAkB;GAAa,KAAK;GAAK;;CAGnD,IAAI,aAAoD;CAIxD,IAAI,gBAAuD;CAI3D,IAAI,aAAoD;CAIxD,IAAI,uBAA6C;;;;;;;CAUjD,OAAO,UAAkB;AACvB,SAAO,KAAK;;;;;CAMd,IAAI,QAAkB;AACpB,SAAO,CACL,GAAG,KAAK,cACRA,0BAAAA,mBAAmB,KAAK,YAA0C,CACnE;;CAGH;CAIA,YAAY;CAEZ,cAAc;CAEd,cAAc;CAEd,kBAAkB;CAElB,oBAAoB;CAEpB,aAAa;CAEb,gBACEC,kBAAAA,uBAAuB,iCAAiC,KAAK;CAE/D,YAAY,OAAkC;AAC5C,SAAO;AACP,OAAK,YAAY,SAAS,EAAE;AAC5B,MAAI,OAAO;AACT,QAAK,YAAY,MAAM,aAAa,KAAK;AACzC,QAAK,cAAc,MAAM,eAAe,KAAK;AAC7C,QAAK,cAAc,MAAM,eAAe,KAAK;AAC7C,QAAK,kBAAkB,MAAM,mBAAmB,KAAK;AACrD,QAAK,oBACH,MAAM,qBAAqB,KAAK;AAClC,QAAK,aAAa,MAAM,cAAc,KAAK;AAC3C,QAAK,gBACH,KAAK,eAAe,MAAM,iBAAiB,KAAK;;;CAItD,OAA4B;AAC1B,SAAO,IAAK,KAAK,YAES,KAAK;;CAGjC,SAAqB;AACnB,SAAOC,0BAAAA,aAAa,UAAU,OAAO,KAAK,KAAK;;CAGjD,uBAAiD;AAC/C,SAAOA,0BAAAA,aAAa,UAAU,qBAAqB,KAAK,KAAK;;CAG/D,OAAO,YAAY,SAAiC;EAClD,MAAM,gBAAgB,oBAAoB;GACxC,OAAO,KAAK,IAAI;GAEhB,cAAc;AACZ,WAAO;AACP,WAAO,OAAO,MAAM,QAAQ;;;AAGhC,SAAO,IAAI,SAAS;;;AAIxB,MAAa,yBAAyB,MAAe;CACnD,MAAM,kBAAkB;AACxB,QACE,oBAAoB,KAAA,KACpB,OAAO,gBAAgB,SAAS,cAChC,OAAO,gBAAgB,SAAS,YAChC,OAAO,gBAAgB,kBAAkB"}
@@ -2,7 +2,6 @@ import { AgentAction, AgentFinish } from "../agents.cjs";
2
2
  import { SerializedFields } from "../load/map_keys.cjs";
3
3
  import { Serializable, Serialized, SerializedNotImplemented } from "../load/serializable.cjs";
4
4
  import { BaseMessage } from "../messages/base.cjs";
5
- import { MessageStructure, MessageToolSet, MessageType } from "../messages/message.cjs";
6
5
  import { ChatGenerationChunk, GenerationChunk, LLMResult } from "../outputs.cjs";
7
6
  import { ChainValues } from "../utils/types/index.cjs";
8
7
  import { DocumentInterface } from "../documents/document.cjs";
@@ -44,7 +43,8 @@ declare abstract class BaseCallbackHandlerMethodsClass {
44
43
  * Called at the start of an LLM or Chat Model run, with the prompt(s)
45
44
  * and the run ID.
46
45
  */
47
- handleLLMStart?(llm: Serialized, prompts: string[], runId: string, parentRunId?: string, extraParams?: Record<string, unknown>, tags?: string[], metadata?: Record<string, unknown>, runName?: string): Promise<any> | any;
46
+ handleLLMStart?(llm: Serialized, prompts: string[], runId: string, parentRunId?: string, extraParams?: Record<string, unknown>, tags?: string[], metadata?: Record<string, unknown>, runName?: string): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
47
+ Promise<any> | any;
48
48
  /**
49
49
  * Called when an LLM/ChatModel in `streaming` mode produces a new token
50
50
  */
@@ -56,55 +56,66 @@ declare abstract class BaseCallbackHandlerMethodsClass {
56
56
  * (if multiple completions per prompt are requested)
57
57
  */
58
58
 
59
- idx: NewTokenIndices, runId: string, parentRunId?: string, tags?: string[], fields?: HandleLLMNewTokenCallbackFields): Promise<any> | any;
59
+ idx: NewTokenIndices, runId: string, parentRunId?: string, tags?: string[], fields?: HandleLLMNewTokenCallbackFields): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
60
+ Promise<any> | any;
60
61
  /**
61
62
  * Called if an LLM/ChatModel run encounters an error
62
63
  */
63
- handleLLMError?(err: Error, runId: string, parentRunId?: string, tags?: string[], extraParams?: Record<string, unknown>): Promise<any> | any;
64
+ handleLLMError?(err: Error, runId: string, parentRunId?: string, tags?: string[], extraParams?: Record<string, unknown>): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
65
+ Promise<any> | any;
64
66
  /**
65
67
  * Called at the end of an LLM/ChatModel run, with the output and the run ID.
66
68
  */
67
- handleLLMEnd?(output: LLMResult, runId: string, parentRunId?: string, tags?: string[], extraParams?: Record<string, unknown>): Promise<any> | any;
69
+ handleLLMEnd?(output: LLMResult, runId: string, parentRunId?: string, tags?: string[], extraParams?: Record<string, unknown>): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
70
+ Promise<any> | any;
68
71
  /**
69
72
  * Called at the start of a Chat Model run, with the prompt(s)
70
73
  * and the run ID.
71
74
  */
72
- handleChatModelStart?(llm: Serialized, messages: BaseMessage[][], runId: string, parentRunId?: string, extraParams?: Record<string, unknown>, tags?: string[], metadata?: Record<string, unknown>, runName?: string): Promise<any> | any;
75
+ handleChatModelStart?(llm: Serialized, messages: BaseMessage[][], runId: string, parentRunId?: string, extraParams?: Record<string, unknown>, tags?: string[], metadata?: Record<string, unknown>, runName?: string): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
76
+ Promise<any> | any;
73
77
  /**
74
78
  * Called at the start of a Chain run, with the chain name and inputs
75
79
  * and the run ID.
76
80
  */
77
- handleChainStart?(chain: Serialized, inputs: ChainValues, runId: string, runType?: string, tags?: string[], metadata?: Record<string, unknown>, runName?: string, parentRunId?: string, extra?: Record<string, unknown>): Promise<any> | any;
81
+ handleChainStart?(chain: Serialized, inputs: ChainValues, runId: string, runType?: string, tags?: string[], metadata?: Record<string, unknown>, runName?: string, parentRunId?: string, extra?: Record<string, unknown>): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
82
+ Promise<any> | any;
78
83
  /**
79
84
  * Called if a Chain run encounters an error
80
85
  */
81
86
  handleChainError?(err: Error, runId: string, parentRunId?: string, tags?: string[], kwargs?: {
82
87
  inputs?: Record<string, unknown>;
83
- }): Promise<any> | any;
88
+ }): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
89
+ Promise<any> | any;
84
90
  /**
85
91
  * Called at the end of a Chain run, with the outputs and the run ID.
86
92
  */
87
93
  handleChainEnd?(outputs: ChainValues, runId: string, parentRunId?: string, tags?: string[], kwargs?: {
88
94
  inputs?: Record<string, unknown>;
89
- }): Promise<any> | any;
95
+ }): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
96
+ Promise<any> | any;
90
97
  /**
91
98
  * Called at the start of a Tool run, with the tool name and input
92
99
  * and the run ID.
93
100
  */
94
- handleToolStart?(tool: Serialized, input: string, runId: string, parentRunId?: string, tags?: string[], metadata?: Record<string, unknown>, runName?: string, toolCallId?: string): Promise<any> | any;
101
+ handleToolStart?(tool: Serialized, input: string, runId: string, parentRunId?: string, tags?: string[], metadata?: Record<string, unknown>, runName?: string, toolCallId?: string): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
102
+ Promise<any> | any;
95
103
  /**
96
104
  * Called if a Tool run encounters an error
97
105
  */
98
- handleToolError?(err: Error, runId: string, parentRunId?: string, tags?: string[]): Promise<any> | any;
106
+ handleToolError?(err: Error, runId: string, parentRunId?: string, tags?: string[]): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
107
+ Promise<any> | any;
99
108
  /**
100
109
  * Called at the end of a Tool run, with the tool output and the run ID.
101
110
  */
102
- handleToolEnd?(output: any, runId: string, parentRunId?: string, tags?: string[]): Promise<any> | any;
111
+ handleToolEnd?(output: any, runId: string, parentRunId?: string, tags?: string[]): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
112
+ Promise<any> | any;
103
113
  /**
104
114
  * Called when a streaming tool yields a partial value. Tools that are async generators
105
115
  * invoke this once per yielded value.
106
116
  */
107
- handleToolEvent?(chunk: unknown, runId: string, parentRunId?: string, tags?: string[]): Promise<any> | any;
117
+ handleToolEvent?(chunk: unknown, runId: string, parentRunId?: string, tags?: string[]): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
118
+ Promise<any> | any;
108
119
  handleText?(text: string, runId: string, parentRunId?: string, tags?: string[]): Promise<void> | void;
109
120
  /**
110
121
  * Called when an agent is about to execute an action,
@@ -116,10 +127,14 @@ declare abstract class BaseCallbackHandlerMethodsClass {
116
127
  * with the final output and the run ID.
117
128
  */
118
129
  handleAgentEnd?(action: AgentFinish, runId: string, parentRunId?: string, tags?: string[]): Promise<void> | void;
119
- handleRetrieverStart?(retriever: Serialized, query: string, runId: string, parentRunId?: string, tags?: string[], metadata?: Record<string, unknown>, name?: string): Promise<any> | any;
120
- handleRetrieverEnd?(documents: DocumentInterface[], runId: string, parentRunId?: string, tags?: string[]): Promise<any> | any;
121
- handleRetrieverError?(err: Error, runId: string, parentRunId?: string, tags?: string[]): Promise<any> | any;
122
- handleCustomEvent?(eventName: string, data: any, runId: string, tags?: string[], metadata?: Record<string, any>): Promise<any> | any;
130
+ handleRetrieverStart?(retriever: Serialized, query: string, runId: string, parentRunId?: string, tags?: string[], metadata?: Record<string, unknown>, name?: string): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
131
+ Promise<any> | any;
132
+ handleRetrieverEnd?(documents: DocumentInterface[], runId: string, parentRunId?: string, tags?: string[]): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
133
+ Promise<any> | any;
134
+ handleRetrieverError?(err: Error, runId: string, parentRunId?: string, tags?: string[]): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
135
+ Promise<any> | any;
136
+ handleCustomEvent?(eventName: string, data: any, runId: string, tags?: string[], metadata?: Record<string, any>): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
137
+ Promise<any> | any;
123
138
  }
124
139
  /**
125
140
  * Base interface for callbacks. All methods are optional. If a method is not
@@ -189,74 +204,90 @@ declare abstract class BaseCallbackHandler extends BaseCallbackHandlerMethodsCla
189
204
  * Called at the start of an LLM or Chat Model run, with the prompt(s)
190
205
  * and the run ID.
191
206
  */
192
- handleLLMStart?(llm: Serialized, prompts: string[], runId: string, parentRunId?: string | undefined, extraParams?: Record<string, unknown> | undefined, tags?: string[] | undefined, metadata?: Record<string, unknown> | undefined, runName?: string | undefined): any;
207
+ handleLLMStart?(llm: Serialized, prompts: string[], runId: string, parentRunId?: string, extraParams?: Record<string, unknown>, tags?: string[], metadata?: Record<string, unknown>, runName?: string): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
208
+ Promise<any> | any;
193
209
  /**
194
210
  * Called when an LLM/ChatModel in `streaming` mode produces a new token
195
211
  */
196
- handleLLMNewToken?(token: string, idx: NewTokenIndices, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined, fields?: HandleLLMNewTokenCallbackFields | undefined): any;
212
+ handleLLMNewToken?(token: string, idx: NewTokenIndices, runId: string, parentRunId?: string, tags?: string[], fields?: HandleLLMNewTokenCallbackFields): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
213
+ Promise<any> | any;
197
214
  /**
198
215
  * Called if an LLM/ChatModel run encounters an error
199
216
  */
200
- handleLLMError?(err: any, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined, extraParams?: Record<string, unknown> | undefined): any;
217
+ handleLLMError?(err: Error, runId: string, parentRunId?: string, tags?: string[], extraParams?: Record<string, unknown>): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
218
+ Promise<any> | any;
201
219
  /**
202
220
  * Called at the end of an LLM/ChatModel run, with the output and the run ID.
203
221
  */
204
- handleLLMEnd?(output: LLMResult, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined, extraParams?: Record<string, unknown> | undefined): any;
222
+ handleLLMEnd?(output: LLMResult, runId: string, parentRunId?: string, tags?: string[], extraParams?: Record<string, unknown>): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
223
+ Promise<any> | any;
205
224
  /**
206
225
  * Called at the start of a Chat Model run, with the prompt(s)
207
226
  * and the run ID.
208
227
  */
209
- handleChatModelStart?(llm: Serialized, messages: BaseMessage<MessageStructure<MessageToolSet>, MessageType>[][], runId: string, parentRunId?: string | undefined, extraParams?: Record<string, unknown> | undefined, tags?: string[] | undefined, metadata?: Record<string, unknown> | undefined, runName?: string | undefined): any;
228
+ handleChatModelStart?(llm: Serialized, messages: BaseMessage[][], runId: string, parentRunId?: string, extraParams?: Record<string, unknown>, tags?: string[], metadata?: Record<string, unknown>, runName?: string): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
229
+ Promise<any> | any;
210
230
  /**
211
231
  * Called at the start of a Chain run, with the chain name and inputs
212
232
  * and the run ID.
213
233
  */
214
- handleChainStart?(chain: Serialized, inputs: ChainValues, runId: string, runType?: string | undefined, tags?: string[] | undefined, metadata?: Record<string, unknown> | undefined, runName?: string | undefined, parentRunId?: string | undefined, extra?: Record<string, unknown> | undefined): any;
234
+ handleChainStart?(chain: Serialized, inputs: ChainValues, runId: string, runType?: string, tags?: string[], metadata?: Record<string, unknown>, runName?: string, parentRunId?: string, extra?: Record<string, unknown>): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
235
+ Promise<any> | any;
215
236
  /**
216
237
  * Called if a Chain run encounters an error
217
238
  */
218
- handleChainError?(err: any, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined, kwargs?: {
219
- inputs?: Record<string, unknown> | undefined;
220
- } | undefined): any;
239
+ handleChainError?(err: Error, runId: string, parentRunId?: string, tags?: string[], kwargs?: {
240
+ inputs?: Record<string, unknown>;
241
+ }): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
242
+ Promise<any> | any;
221
243
  /**
222
244
  * Called at the end of a Chain run, with the outputs and the run ID.
223
245
  */
224
- handleChainEnd?(outputs: ChainValues, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined, kwargs?: {
225
- inputs?: Record<string, unknown> | undefined;
226
- } | undefined): any;
246
+ handleChainEnd?(outputs: ChainValues, runId: string, parentRunId?: string, tags?: string[], kwargs?: {
247
+ inputs?: Record<string, unknown>;
248
+ }): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
249
+ Promise<any> | any;
227
250
  /**
228
251
  * Called at the start of a Tool run, with the tool name and input
229
252
  * and the run ID.
230
253
  */
231
- handleToolStart?(tool: Serialized, input: string, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined, metadata?: Record<string, unknown> | undefined, runName?: string | undefined, toolCallId?: string | undefined): any;
254
+ handleToolStart?(tool: Serialized, input: string, runId: string, parentRunId?: string, tags?: string[], metadata?: Record<string, unknown>, runName?: string, toolCallId?: string): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
255
+ Promise<any> | any;
232
256
  /**
233
257
  * Called if a Tool run encounters an error
234
258
  */
235
- handleToolError?(err: any, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined): any;
259
+ handleToolError?(err: Error, runId: string, parentRunId?: string, tags?: string[]): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
260
+ Promise<any> | any;
236
261
  /**
237
262
  * Called at the end of a Tool run, with the tool output and the run ID.
238
263
  */
239
- handleToolEnd?(output: any, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined): any;
264
+ handleToolEnd?(output: any, runId: string, parentRunId?: string, tags?: string[]): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
265
+ Promise<any> | any;
240
266
  /**
241
267
  * Called when a streaming tool yields a partial value. Tools that are async generators
242
268
  * invoke this once per yielded value.
243
269
  */
244
- handleToolEvent?(chunk: unknown, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined): any;
245
- handleText?(text: string, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined): void | Promise<void>;
270
+ handleToolEvent?(chunk: unknown, runId: string, parentRunId?: string, tags?: string[]): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
271
+ Promise<any> | any;
272
+ handleText?(text: string, runId: string, parentRunId?: string, tags?: string[]): Promise<void> | void;
246
273
  /**
247
274
  * Called when an agent is about to execute an action,
248
275
  * with the action and the run ID.
249
276
  */
250
- handleAgentAction?(action: AgentAction, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined): void | Promise<void>;
277
+ handleAgentAction?(action: AgentAction, runId: string, parentRunId?: string, tags?: string[]): Promise<void> | void;
251
278
  /**
252
279
  * Called when an agent finishes execution, before it exits.
253
280
  * with the final output and the run ID.
254
281
  */
255
- handleAgentEnd?(action: AgentFinish, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined): void | Promise<void>;
256
- handleRetrieverStart?(retriever: Serialized, query: string, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined, metadata?: Record<string, unknown> | undefined, name?: string | undefined): any;
257
- handleRetrieverEnd?(documents: DocumentInterface<Record<string, any>>[], runId: string, parentRunId?: string | undefined, tags?: string[] | undefined): any;
258
- handleRetrieverError?(err: any, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined): any;
259
- handleCustomEvent?(eventName: string, data: any, runId: string, tags?: string[] | undefined, metadata?: Record<string, any> | undefined): any;
282
+ handleAgentEnd?(action: AgentFinish, runId: string, parentRunId?: string, tags?: string[]): Promise<void> | void;
283
+ handleRetrieverStart?(retriever: Serialized, query: string, runId: string, parentRunId?: string, tags?: string[], metadata?: Record<string, unknown>, name?: string): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
284
+ Promise<any> | any;
285
+ handleRetrieverEnd?(documents: DocumentInterface[], runId: string, parentRunId?: string, tags?: string[]): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
286
+ Promise<any> | any;
287
+ handleRetrieverError?(err: Error, runId: string, parentRunId?: string, tags?: string[]): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
288
+ Promise<any> | any;
289
+ handleCustomEvent?(eventName: string, data: any, runId: string, tags?: string[], metadata?: Record<string, any>): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
290
+ Promise<any> | any;
260
291
  lc_serializable: boolean;
261
292
  get lc_namespace(): ["langchain_core", "callbacks", string];
262
293
  get lc_secrets(): {
@@ -1 +1 @@
1
- {"version":3,"file":"base.d.cts","names":[],"sources":["../../src/callbacks/base.ts"],"mappings":";;;;;;;;;;KAoBK,KAAA;;;AAJ6D;;;UAWjD,wBAAA;EACf,SAAA;EACA,WAAA;EACA,WAAA;EACA,eAAA;EACA,iBAAA;EACA,aAAA;EACA,UAAA;AAAA;;;;;UAOe,eAAA;EACf,MAAA;EACA,UAAA;AAAA;AAAA,KAIU,+BAAA;EACV,KAAA,GAAQ,eAAA,GAAkB,mBAAA;AAAA;AAD5B;;;;;AAAA,uBASe,+BAAA;EARa;;;AAC1B;EAYA,cAAA,CAAA,CACE,GAAA,EAAK,UAAA,EACL,OAAA,YACA,KAAA,UACA,WAAA,WACA,WAAA,GAAc,MAAA,mBACd,IAAA,aACA,QAAA,GAAW,MAAA,mBACX,OAAA,YAEA,OAAA;;;;EAKF,iBAAA,CAAA,CACE,KAAA;EANA;;;;;;;EAaA,GAAA,EAAK,eAAA,EACL,KAAA,UACA,WAAA,WACA,IAAA,aACA,MAAA,GAAS,+BAAA,GAET,OAAA;EAkBQ;;;EAbV,cAAA,CAAA,CACE,GAAA,EAAK,KAAA,EACL,KAAA,UACA,WAAA,WACA,IAAA,aACA,WAAA,GAAc,MAAA,oBA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,MAAA,mBAAuB,OAAA,WAClB,UAAA;IAGhB,OAAA;IAgFA;;;0BA1EK,KAAA,EAAK,KAAA,UACG,WAAA,WACO,IAAA;IAGpB,OAAA;IA2EA;;;gCApEW,KAAA,UACE,WAAA,WACO,IAAA;IAGpB,OAAA;IAsEF;;;;qCA/DgB,KAAA,UACD,WAAA,WACO,IAAA;IAGpB,OAAA;8BAGY,KAAA,UACC,WAAA,WACO,IAAA,cAEnB,OAAA;IA4DD;;;AAYJ;+BAjEY,WAAA,EAAW,KAAA,UACN,WAAA,WACO,IAAA,cAEnB,OAAA;IA6DgC;;;AAOrC;4BA7DY,WAAA,EAAW,KAAA,UACN,WAAA,WACO,IAAA,cAEnB,OAAA;qCAGU,UAAA,EAAU,KAAA,UACR,KAAA,UACA,WAAA,WACO,IAAA,aACL,QAAA,GACJ,MAAA,mBAAuB,IAAA;IAGlC,OAAA;mCAGW,iBAAA,IAAmB,KAAA,UACjB,WAAA,WACO,IAAA;IAGpB,OAAA;+BAGK,KAAA,EAAK,KAAA,UACG,WAAA,WACO,IAAA;IAGpB,OAAA;0CAGiB,IAAA,OAER,KAAA,UACI,IAAA,aACE,QAAA,GAEJ,MAAA;IAEX,OAAA;;;;OA2CmB,GAAA;IAAA;IAAA;OAIG,GAAA;IAAA;IAAA;OAIH,GAAA;IAAA;IAAA;IA7QnB;;;IAAA;eAySS,gBAAA;;;;;;;;YAmCH,mBAAA;cAME,UAAA;4BAIc,wBAAA;EAAA;AAAA;AAAA,cAiBb,qBAAA,GAAqB,CAAA"}
@@ -2,7 +2,6 @@ import { AgentAction, AgentFinish } from "../agents.js";
2
2
  import { SerializedFields } from "../load/map_keys.js";
3
3
  import { Serializable, Serialized, SerializedNotImplemented } from "../load/serializable.js";
4
4
  import { BaseMessage } from "../messages/base.js";
5
- import { MessageStructure, MessageToolSet, MessageType } from "../messages/message.js";
6
5
  import { ChatGenerationChunk, GenerationChunk, LLMResult } from "../outputs.js";
7
6
  import { ChainValues } from "../utils/types/index.js";
8
7
  import { DocumentInterface } from "../documents/document.js";
@@ -44,7 +43,8 @@ declare abstract class BaseCallbackHandlerMethodsClass {
44
43
  * Called at the start of an LLM or Chat Model run, with the prompt(s)
45
44
  * and the run ID.
46
45
  */
47
- handleLLMStart?(llm: Serialized, prompts: string[], runId: string, parentRunId?: string, extraParams?: Record<string, unknown>, tags?: string[], metadata?: Record<string, unknown>, runName?: string): Promise<any> | any;
46
+ handleLLMStart?(llm: Serialized, prompts: string[], runId: string, parentRunId?: string, extraParams?: Record<string, unknown>, tags?: string[], metadata?: Record<string, unknown>, runName?: string): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
47
+ Promise<any> | any;
48
48
  /**
49
49
  * Called when an LLM/ChatModel in `streaming` mode produces a new token
50
50
  */
@@ -56,55 +56,66 @@ declare abstract class BaseCallbackHandlerMethodsClass {
56
56
  * (if multiple completions per prompt are requested)
57
57
  */
58
58
 
59
- idx: NewTokenIndices, runId: string, parentRunId?: string, tags?: string[], fields?: HandleLLMNewTokenCallbackFields): Promise<any> | any;
59
+ idx: NewTokenIndices, runId: string, parentRunId?: string, tags?: string[], fields?: HandleLLMNewTokenCallbackFields): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
60
+ Promise<any> | any;
60
61
  /**
61
62
  * Called if an LLM/ChatModel run encounters an error
62
63
  */
63
- handleLLMError?(err: Error, runId: string, parentRunId?: string, tags?: string[], extraParams?: Record<string, unknown>): Promise<any> | any;
64
+ handleLLMError?(err: Error, runId: string, parentRunId?: string, tags?: string[], extraParams?: Record<string, unknown>): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
65
+ Promise<any> | any;
64
66
  /**
65
67
  * Called at the end of an LLM/ChatModel run, with the output and the run ID.
66
68
  */
67
- handleLLMEnd?(output: LLMResult, runId: string, parentRunId?: string, tags?: string[], extraParams?: Record<string, unknown>): Promise<any> | any;
69
+ handleLLMEnd?(output: LLMResult, runId: string, parentRunId?: string, tags?: string[], extraParams?: Record<string, unknown>): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
70
+ Promise<any> | any;
68
71
  /**
69
72
  * Called at the start of a Chat Model run, with the prompt(s)
70
73
  * and the run ID.
71
74
  */
72
- handleChatModelStart?(llm: Serialized, messages: BaseMessage[][], runId: string, parentRunId?: string, extraParams?: Record<string, unknown>, tags?: string[], metadata?: Record<string, unknown>, runName?: string): Promise<any> | any;
75
+ handleChatModelStart?(llm: Serialized, messages: BaseMessage[][], runId: string, parentRunId?: string, extraParams?: Record<string, unknown>, tags?: string[], metadata?: Record<string, unknown>, runName?: string): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
76
+ Promise<any> | any;
73
77
  /**
74
78
  * Called at the start of a Chain run, with the chain name and inputs
75
79
  * and the run ID.
76
80
  */
77
- handleChainStart?(chain: Serialized, inputs: ChainValues, runId: string, runType?: string, tags?: string[], metadata?: Record<string, unknown>, runName?: string, parentRunId?: string, extra?: Record<string, unknown>): Promise<any> | any;
81
+ handleChainStart?(chain: Serialized, inputs: ChainValues, runId: string, runType?: string, tags?: string[], metadata?: Record<string, unknown>, runName?: string, parentRunId?: string, extra?: Record<string, unknown>): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
82
+ Promise<any> | any;
78
83
  /**
79
84
  * Called if a Chain run encounters an error
80
85
  */
81
86
  handleChainError?(err: Error, runId: string, parentRunId?: string, tags?: string[], kwargs?: {
82
87
  inputs?: Record<string, unknown>;
83
- }): Promise<any> | any;
88
+ }): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
89
+ Promise<any> | any;
84
90
  /**
85
91
  * Called at the end of a Chain run, with the outputs and the run ID.
86
92
  */
87
93
  handleChainEnd?(outputs: ChainValues, runId: string, parentRunId?: string, tags?: string[], kwargs?: {
88
94
  inputs?: Record<string, unknown>;
89
- }): Promise<any> | any;
95
+ }): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
96
+ Promise<any> | any;
90
97
  /**
91
98
  * Called at the start of a Tool run, with the tool name and input
92
99
  * and the run ID.
93
100
  */
94
- handleToolStart?(tool: Serialized, input: string, runId: string, parentRunId?: string, tags?: string[], metadata?: Record<string, unknown>, runName?: string, toolCallId?: string): Promise<any> | any;
101
+ handleToolStart?(tool: Serialized, input: string, runId: string, parentRunId?: string, tags?: string[], metadata?: Record<string, unknown>, runName?: string, toolCallId?: string): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
102
+ Promise<any> | any;
95
103
  /**
96
104
  * Called if a Tool run encounters an error
97
105
  */
98
- handleToolError?(err: Error, runId: string, parentRunId?: string, tags?: string[]): Promise<any> | any;
106
+ handleToolError?(err: Error, runId: string, parentRunId?: string, tags?: string[]): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
107
+ Promise<any> | any;
99
108
  /**
100
109
  * Called at the end of a Tool run, with the tool output and the run ID.
101
110
  */
102
- handleToolEnd?(output: any, runId: string, parentRunId?: string, tags?: string[]): Promise<any> | any;
111
+ handleToolEnd?(output: any, runId: string, parentRunId?: string, tags?: string[]): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
112
+ Promise<any> | any;
103
113
  /**
104
114
  * Called when a streaming tool yields a partial value. Tools that are async generators
105
115
  * invoke this once per yielded value.
106
116
  */
107
- handleToolEvent?(chunk: unknown, runId: string, parentRunId?: string, tags?: string[]): Promise<any> | any;
117
+ handleToolEvent?(chunk: unknown, runId: string, parentRunId?: string, tags?: string[]): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
118
+ Promise<any> | any;
108
119
  handleText?(text: string, runId: string, parentRunId?: string, tags?: string[]): Promise<void> | void;
109
120
  /**
110
121
  * Called when an agent is about to execute an action,
@@ -116,10 +127,14 @@ declare abstract class BaseCallbackHandlerMethodsClass {
116
127
  * with the final output and the run ID.
117
128
  */
118
129
  handleAgentEnd?(action: AgentFinish, runId: string, parentRunId?: string, tags?: string[]): Promise<void> | void;
119
- handleRetrieverStart?(retriever: Serialized, query: string, runId: string, parentRunId?: string, tags?: string[], metadata?: Record<string, unknown>, name?: string): Promise<any> | any;
120
- handleRetrieverEnd?(documents: DocumentInterface[], runId: string, parentRunId?: string, tags?: string[]): Promise<any> | any;
121
- handleRetrieverError?(err: Error, runId: string, parentRunId?: string, tags?: string[]): Promise<any> | any;
122
- handleCustomEvent?(eventName: string, data: any, runId: string, tags?: string[], metadata?: Record<string, any>): Promise<any> | any;
130
+ handleRetrieverStart?(retriever: Serialized, query: string, runId: string, parentRunId?: string, tags?: string[], metadata?: Record<string, unknown>, name?: string): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
131
+ Promise<any> | any;
132
+ handleRetrieverEnd?(documents: DocumentInterface[], runId: string, parentRunId?: string, tags?: string[]): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
133
+ Promise<any> | any;
134
+ handleRetrieverError?(err: Error, runId: string, parentRunId?: string, tags?: string[]): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
135
+ Promise<any> | any;
136
+ handleCustomEvent?(eventName: string, data: any, runId: string, tags?: string[], metadata?: Record<string, any>): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
137
+ Promise<any> | any;
123
138
  }
124
139
  /**
125
140
  * Base interface for callbacks. All methods are optional. If a method is not
@@ -189,74 +204,90 @@ declare abstract class BaseCallbackHandler extends BaseCallbackHandlerMethodsCla
189
204
  * Called at the start of an LLM or Chat Model run, with the prompt(s)
190
205
  * and the run ID.
191
206
  */
192
- handleLLMStart?(llm: Serialized, prompts: string[], runId: string, parentRunId?: string | undefined, extraParams?: Record<string, unknown> | undefined, tags?: string[] | undefined, metadata?: Record<string, unknown> | undefined, runName?: string | undefined): any;
207
+ handleLLMStart?(llm: Serialized, prompts: string[], runId: string, parentRunId?: string, extraParams?: Record<string, unknown>, tags?: string[], metadata?: Record<string, unknown>, runName?: string): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
208
+ Promise<any> | any;
193
209
  /**
194
210
  * Called when an LLM/ChatModel in `streaming` mode produces a new token
195
211
  */
196
- handleLLMNewToken?(token: string, idx: NewTokenIndices, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined, fields?: HandleLLMNewTokenCallbackFields | undefined): any;
212
+ handleLLMNewToken?(token: string, idx: NewTokenIndices, runId: string, parentRunId?: string, tags?: string[], fields?: HandleLLMNewTokenCallbackFields): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
213
+ Promise<any> | any;
197
214
  /**
198
215
  * Called if an LLM/ChatModel run encounters an error
199
216
  */
200
- handleLLMError?(err: any, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined, extraParams?: Record<string, unknown> | undefined): any;
217
+ handleLLMError?(err: Error, runId: string, parentRunId?: string, tags?: string[], extraParams?: Record<string, unknown>): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
218
+ Promise<any> | any;
201
219
  /**
202
220
  * Called at the end of an LLM/ChatModel run, with the output and the run ID.
203
221
  */
204
- handleLLMEnd?(output: LLMResult, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined, extraParams?: Record<string, unknown> | undefined): any;
222
+ handleLLMEnd?(output: LLMResult, runId: string, parentRunId?: string, tags?: string[], extraParams?: Record<string, unknown>): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
223
+ Promise<any> | any;
205
224
  /**
206
225
  * Called at the start of a Chat Model run, with the prompt(s)
207
226
  * and the run ID.
208
227
  */
209
- handleChatModelStart?(llm: Serialized, messages: BaseMessage<MessageStructure<MessageToolSet>, MessageType>[][], runId: string, parentRunId?: string | undefined, extraParams?: Record<string, unknown> | undefined, tags?: string[] | undefined, metadata?: Record<string, unknown> | undefined, runName?: string | undefined): any;
228
+ handleChatModelStart?(llm: Serialized, messages: BaseMessage[][], runId: string, parentRunId?: string, extraParams?: Record<string, unknown>, tags?: string[], metadata?: Record<string, unknown>, runName?: string): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
229
+ Promise<any> | any;
210
230
  /**
211
231
  * Called at the start of a Chain run, with the chain name and inputs
212
232
  * and the run ID.
213
233
  */
214
- handleChainStart?(chain: Serialized, inputs: ChainValues, runId: string, runType?: string | undefined, tags?: string[] | undefined, metadata?: Record<string, unknown> | undefined, runName?: string | undefined, parentRunId?: string | undefined, extra?: Record<string, unknown> | undefined): any;
234
+ handleChainStart?(chain: Serialized, inputs: ChainValues, runId: string, runType?: string, tags?: string[], metadata?: Record<string, unknown>, runName?: string, parentRunId?: string, extra?: Record<string, unknown>): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
235
+ Promise<any> | any;
215
236
  /**
216
237
  * Called if a Chain run encounters an error
217
238
  */
218
- handleChainError?(err: any, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined, kwargs?: {
219
- inputs?: Record<string, unknown> | undefined;
220
- } | undefined): any;
239
+ handleChainError?(err: Error, runId: string, parentRunId?: string, tags?: string[], kwargs?: {
240
+ inputs?: Record<string, unknown>;
241
+ }): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
242
+ Promise<any> | any;
221
243
  /**
222
244
  * Called at the end of a Chain run, with the outputs and the run ID.
223
245
  */
224
- handleChainEnd?(outputs: ChainValues, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined, kwargs?: {
225
- inputs?: Record<string, unknown> | undefined;
226
- } | undefined): any;
246
+ handleChainEnd?(outputs: ChainValues, runId: string, parentRunId?: string, tags?: string[], kwargs?: {
247
+ inputs?: Record<string, unknown>;
248
+ }): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
249
+ Promise<any> | any;
227
250
  /**
228
251
  * Called at the start of a Tool run, with the tool name and input
229
252
  * and the run ID.
230
253
  */
231
- handleToolStart?(tool: Serialized, input: string, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined, metadata?: Record<string, unknown> | undefined, runName?: string | undefined, toolCallId?: string | undefined): any;
254
+ handleToolStart?(tool: Serialized, input: string, runId: string, parentRunId?: string, tags?: string[], metadata?: Record<string, unknown>, runName?: string, toolCallId?: string): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
255
+ Promise<any> | any;
232
256
  /**
233
257
  * Called if a Tool run encounters an error
234
258
  */
235
- handleToolError?(err: any, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined): any;
259
+ handleToolError?(err: Error, runId: string, parentRunId?: string, tags?: string[]): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
260
+ Promise<any> | any;
236
261
  /**
237
262
  * Called at the end of a Tool run, with the tool output and the run ID.
238
263
  */
239
- handleToolEnd?(output: any, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined): any;
264
+ handleToolEnd?(output: any, runId: string, parentRunId?: string, tags?: string[]): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
265
+ Promise<any> | any;
240
266
  /**
241
267
  * Called when a streaming tool yields a partial value. Tools that are async generators
242
268
  * invoke this once per yielded value.
243
269
  */
244
- handleToolEvent?(chunk: unknown, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined): any;
245
- handleText?(text: string, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined): void | Promise<void>;
270
+ handleToolEvent?(chunk: unknown, runId: string, parentRunId?: string, tags?: string[]): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
271
+ Promise<any> | any;
272
+ handleText?(text: string, runId: string, parentRunId?: string, tags?: string[]): Promise<void> | void;
246
273
  /**
247
274
  * Called when an agent is about to execute an action,
248
275
  * with the action and the run ID.
249
276
  */
250
- handleAgentAction?(action: AgentAction, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined): void | Promise<void>;
277
+ handleAgentAction?(action: AgentAction, runId: string, parentRunId?: string, tags?: string[]): Promise<void> | void;
251
278
  /**
252
279
  * Called when an agent finishes execution, before it exits.
253
280
  * with the final output and the run ID.
254
281
  */
255
- handleAgentEnd?(action: AgentFinish, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined): void | Promise<void>;
256
- handleRetrieverStart?(retriever: Serialized, query: string, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined, metadata?: Record<string, unknown> | undefined, name?: string | undefined): any;
257
- handleRetrieverEnd?(documents: DocumentInterface<Record<string, any>>[], runId: string, parentRunId?: string | undefined, tags?: string[] | undefined): any;
258
- handleRetrieverError?(err: any, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined): any;
259
- handleCustomEvent?(eventName: string, data: any, runId: string, tags?: string[] | undefined, metadata?: Record<string, any> | undefined): any;
282
+ handleAgentEnd?(action: AgentFinish, runId: string, parentRunId?: string, tags?: string[]): Promise<void> | void;
283
+ handleRetrieverStart?(retriever: Serialized, query: string, runId: string, parentRunId?: string, tags?: string[], metadata?: Record<string, unknown>, name?: string): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
284
+ Promise<any> | any;
285
+ handleRetrieverEnd?(documents: DocumentInterface[], runId: string, parentRunId?: string, tags?: string[]): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
286
+ Promise<any> | any;
287
+ handleRetrieverError?(err: Error, runId: string, parentRunId?: string, tags?: string[]): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
288
+ Promise<any> | any;
289
+ handleCustomEvent?(eventName: string, data: any, runId: string, tags?: string[], metadata?: Record<string, any>): // oxlint-disable-next-line @typescript-eslint/no-explicit-any
290
+ Promise<any> | any;
260
291
  lc_serializable: boolean;
261
292
  get lc_namespace(): ["langchain_core", "callbacks", string];
262
293
  get lc_secrets(): {