@langchain/core 0.3.72 → 1.0.0-alpha.2

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 (1382) hide show
  1. package/README.md +3 -3
  2. package/dist/_virtual/rolldown_runtime.cjs +32 -0
  3. package/dist/_virtual/rolldown_runtime.js +11 -0
  4. package/dist/agents.cjs +12 -2
  5. package/dist/agents.cjs.map +1 -0
  6. package/dist/agents.d.cts +19 -0
  7. package/dist/agents.d.cts.map +1 -0
  8. package/dist/agents.d.ts +16 -10
  9. package/dist/agents.d.ts.map +1 -0
  10. package/dist/agents.js +6 -1
  11. package/dist/agents.js.map +1 -0
  12. package/dist/caches/base.cjs +99 -104
  13. package/dist/caches/base.cjs.map +1 -0
  14. package/dist/caches/base.d.cts +83 -0
  15. package/dist/caches/base.d.cts.map +1 -0
  16. package/dist/caches/base.d.ts +60 -45
  17. package/dist/caches/base.d.ts.map +1 -0
  18. package/dist/caches/base.js +91 -98
  19. package/dist/caches/base.js.map +1 -0
  20. package/dist/callbacks/base.cjs +112 -185
  21. package/dist/callbacks/base.cjs.map +1 -0
  22. package/dist/callbacks/base.d.cts +318 -0
  23. package/dist/callbacks/base.d.cts.map +1 -0
  24. package/dist/callbacks/base.d.ts +234 -222
  25. package/dist/callbacks/base.d.ts.map +1 -0
  26. package/dist/callbacks/base.js +107 -149
  27. package/dist/callbacks/base.js.map +1 -0
  28. package/dist/callbacks/dispatch/index.cjs +56 -46
  29. package/dist/callbacks/dispatch/index.cjs.map +1 -0
  30. package/dist/callbacks/dispatch/index.d.cts +43 -0
  31. package/dist/callbacks/dispatch/index.d.cts.map +1 -0
  32. package/dist/callbacks/dispatch/index.d.ts +10 -2
  33. package/dist/callbacks/dispatch/index.d.ts.map +1 -0
  34. package/dist/callbacks/dispatch/index.js +48 -41
  35. package/dist/callbacks/dispatch/index.js.map +1 -0
  36. package/dist/callbacks/dispatch/web.cjs +60 -56
  37. package/dist/callbacks/dispatch/web.cjs.map +1 -0
  38. package/dist/callbacks/dispatch/web.d.cts +40 -0
  39. package/dist/callbacks/dispatch/web.d.cts.map +1 -0
  40. package/dist/callbacks/dispatch/web.d.ts +10 -2
  41. package/dist/callbacks/dispatch/web.d.ts.map +1 -0
  42. package/dist/callbacks/dispatch/web.js +54 -53
  43. package/dist/callbacks/dispatch/web.js.map +1 -0
  44. package/dist/callbacks/manager.cjs +580 -877
  45. package/dist/callbacks/manager.cjs.map +1 -0
  46. package/dist/callbacks/manager.d.cts +192 -0
  47. package/dist/callbacks/manager.d.cts.map +1 -0
  48. package/dist/callbacks/manager.d.ts +146 -133
  49. package/dist/callbacks/manager.d.ts.map +1 -0
  50. package/dist/callbacks/manager.js +564 -863
  51. package/dist/callbacks/manager.js.map +1 -0
  52. package/dist/callbacks/promises.cjs +20 -6
  53. package/dist/callbacks/promises.cjs.map +1 -0
  54. package/dist/callbacks/promises.d.cts +2 -0
  55. package/dist/callbacks/promises.d.ts +1 -1
  56. package/dist/callbacks/promises.js +12 -1
  57. package/dist/callbacks/promises.js.map +1 -0
  58. package/dist/chat_history.cjs +126 -119
  59. package/dist/chat_history.cjs.map +1 -0
  60. package/dist/chat_history.d.cts +99 -0
  61. package/dist/chat_history.d.cts.map +1 -0
  62. package/dist/chat_history.d.ts +82 -75
  63. package/dist/chat_history.d.ts.map +1 -0
  64. package/dist/chat_history.js +118 -113
  65. package/dist/chat_history.js.map +1 -0
  66. package/dist/context.cjs +29 -18
  67. package/dist/context.cjs.map +1 -0
  68. package/dist/context.d.cts +7 -0
  69. package/dist/context.d.cts.map +1 -0
  70. package/dist/context.d.ts +7 -2
  71. package/dist/context.d.ts.map +1 -0
  72. package/dist/context.js +18 -11
  73. package/dist/context.js.map +1 -0
  74. package/dist/document_loaders/base.cjs +31 -22
  75. package/dist/document_loaders/base.cjs.map +1 -0
  76. package/dist/document_loaders/base.d.cts +34 -0
  77. package/dist/document_loaders/base.d.cts.map +1 -0
  78. package/dist/document_loaders/base.d.ts +22 -16
  79. package/dist/document_loaders/base.d.ts.map +1 -0
  80. package/dist/document_loaders/base.js +26 -19
  81. package/dist/document_loaders/base.js.map +1 -0
  82. package/dist/document_loaders/langsmith.cjs +128 -195
  83. package/dist/document_loaders/langsmith.cjs.map +1 -0
  84. package/dist/document_loaders/langsmith.d.cts +103 -0
  85. package/dist/document_loaders/langsmith.d.cts.map +1 -0
  86. package/dist/document_loaders/langsmith.d.ts +52 -45
  87. package/dist/document_loaders/langsmith.d.ts.map +1 -0
  88. package/dist/document_loaders/langsmith.js +121 -190
  89. package/dist/document_loaders/langsmith.js.map +1 -0
  90. package/dist/documents/document.cjs +23 -40
  91. package/dist/documents/document.cjs.map +1 -0
  92. package/dist/documents/document.d.cts +50 -0
  93. package/dist/documents/document.d.cts.map +1 -0
  94. package/dist/documents/document.d.ts +44 -31
  95. package/dist/documents/document.d.ts.map +1 -0
  96. package/dist/documents/document.js +23 -37
  97. package/dist/documents/document.js.map +1 -0
  98. package/dist/documents/index.cjs +23 -18
  99. package/dist/documents/index.cjs.map +1 -0
  100. package/dist/documents/index.d.cts +3 -0
  101. package/dist/documents/index.d.ts +3 -2
  102. package/dist/documents/index.js +15 -2
  103. package/dist/documents/index.js.map +1 -0
  104. package/dist/documents/transformers.cjs +46 -48
  105. package/dist/documents/transformers.cjs.map +1 -0
  106. package/dist/documents/transformers.d.cts +44 -0
  107. package/dist/documents/transformers.d.cts.map +1 -0
  108. package/dist/documents/transformers.d.ts +27 -21
  109. package/dist/documents/transformers.d.ts.map +1 -0
  110. package/dist/documents/transformers.js +45 -43
  111. package/dist/documents/transformers.js.map +1 -0
  112. package/dist/embeddings.cjs +28 -22
  113. package/dist/embeddings.cjs.map +1 -0
  114. package/dist/embeddings.d.cts +56 -0
  115. package/dist/embeddings.d.cts.map +1 -0
  116. package/dist/embeddings.d.ts +45 -39
  117. package/dist/embeddings.d.ts.map +1 -0
  118. package/dist/embeddings.js +22 -18
  119. package/dist/embeddings.js.map +1 -0
  120. package/dist/errors/index.cjs +9 -8
  121. package/dist/errors/index.cjs.map +1 -0
  122. package/dist/errors/index.js +9 -6
  123. package/dist/errors/index.js.map +1 -0
  124. package/dist/example_selectors/base.cjs +15 -17
  125. package/dist/example_selectors/base.cjs.map +1 -0
  126. package/dist/example_selectors/base.d.cts +26 -0
  127. package/dist/example_selectors/base.d.cts.map +1 -0
  128. package/dist/example_selectors/base.d.ts +21 -15
  129. package/dist/example_selectors/base.d.ts.map +1 -0
  130. package/dist/example_selectors/base.js +15 -13
  131. package/dist/example_selectors/base.js.map +1 -0
  132. package/dist/example_selectors/conditional.cjs +56 -68
  133. package/dist/example_selectors/conditional.cjs.map +1 -0
  134. package/dist/example_selectors/conditional.d.cts +62 -0
  135. package/dist/example_selectors/conditional.d.cts.map +1 -0
  136. package/dist/example_selectors/conditional.d.ts +42 -43
  137. package/dist/example_selectors/conditional.d.ts.map +1 -0
  138. package/dist/example_selectors/conditional.js +54 -63
  139. package/dist/example_selectors/conditional.js.map +1 -0
  140. package/dist/example_selectors/index.cjs +33 -20
  141. package/dist/example_selectors/index.cjs.map +1 -0
  142. package/dist/example_selectors/index.d.cts +5 -0
  143. package/dist/example_selectors/index.d.ts +5 -4
  144. package/dist/example_selectors/index.js +21 -4
  145. package/dist/example_selectors/index.js.map +1 -0
  146. package/dist/example_selectors/length_based.cjs +118 -145
  147. package/dist/example_selectors/length_based.cjs.map +1 -0
  148. package/dist/example_selectors/length_based.d.cts +95 -0
  149. package/dist/example_selectors/length_based.d.cts.map +1 -0
  150. package/dist/example_selectors/length_based.d.ts +45 -39
  151. package/dist/example_selectors/length_based.d.ts.map +1 -0
  152. package/dist/example_selectors/length_based.js +118 -141
  153. package/dist/example_selectors/length_based.js.map +1 -0
  154. package/dist/example_selectors/semantic_similarity.cjs +118 -135
  155. package/dist/example_selectors/semantic_similarity.cjs.map +1 -0
  156. package/dist/example_selectors/semantic_similarity.d.cts +97 -0
  157. package/dist/example_selectors/semantic_similarity.d.cts.map +1 -0
  158. package/dist/example_selectors/semantic_similarity.d.ts +59 -53
  159. package/dist/example_selectors/semantic_similarity.d.ts.map +1 -0
  160. package/dist/example_selectors/semantic_similarity.js +117 -130
  161. package/dist/example_selectors/semantic_similarity.js.map +1 -0
  162. package/dist/index.cjs +12 -0
  163. package/dist/index.cjs.map +1 -0
  164. package/dist/index.d.cts +1 -0
  165. package/dist/index.d.ts +1 -0
  166. package/dist/index.js +6 -0
  167. package/dist/index.js.map +1 -0
  168. package/dist/indexing/base.cjs +207 -272
  169. package/dist/indexing/base.cjs.map +1 -0
  170. package/dist/indexing/base.d.cts +125 -0
  171. package/dist/indexing/base.d.cts.map +1 -0
  172. package/dist/indexing/base.d.ts +88 -80
  173. package/dist/indexing/base.d.ts.map +1 -0
  174. package/dist/indexing/base.js +205 -267
  175. package/dist/indexing/base.js.map +1 -0
  176. package/dist/indexing/index.cjs +33 -18
  177. package/dist/indexing/index.cjs.map +1 -0
  178. package/dist/indexing/index.d.cts +3 -0
  179. package/dist/indexing/index.d.ts +3 -2
  180. package/dist/indexing/index.js +20 -2
  181. package/dist/indexing/index.js.map +1 -0
  182. package/dist/indexing/record_manager.cjs +11 -17
  183. package/dist/indexing/record_manager.cjs.map +1 -0
  184. package/dist/indexing/record_manager.d.cts +70 -0
  185. package/dist/indexing/record_manager.d.cts.map +1 -0
  186. package/dist/indexing/record_manager.d.ts +65 -59
  187. package/dist/indexing/record_manager.d.ts.map +1 -0
  188. package/dist/indexing/record_manager.js +10 -13
  189. package/dist/indexing/record_manager.js.map +1 -0
  190. package/dist/language_models/base.cjs +212 -293
  191. package/dist/language_models/base.cjs.map +1 -0
  192. package/dist/language_models/base.d.cts +301 -0
  193. package/dist/language_models/base.d.cts.map +1 -0
  194. package/dist/language_models/base.d.ts +256 -212
  195. package/dist/language_models/base.d.ts.map +1 -0
  196. package/dist/language_models/base.js +202 -285
  197. package/dist/language_models/base.js.map +1 -0
  198. package/dist/language_models/chat_models.cjs +500 -622
  199. package/dist/language_models/chat_models.cjs.map +1 -0
  200. package/dist/language_models/chat_models.d.cts +261 -0
  201. package/dist/language_models/chat_models.d.cts.map +1 -0
  202. package/dist/language_models/chat_models.d.ts +228 -172
  203. package/dist/language_models/chat_models.d.ts.map +1 -0
  204. package/dist/language_models/chat_models.js +492 -616
  205. package/dist/language_models/chat_models.js.map +1 -0
  206. package/dist/language_models/llms.cjs +328 -376
  207. package/dist/language_models/llms.cjs.map +1 -0
  208. package/dist/language_models/llms.d.cts +149 -0
  209. package/dist/language_models/llms.d.cts.map +1 -0
  210. package/dist/language_models/llms.d.ts +135 -115
  211. package/dist/language_models/llms.d.ts.map +1 -0
  212. package/dist/language_models/llms.js +321 -371
  213. package/dist/language_models/llms.js.map +1 -0
  214. package/dist/language_models/utils.cjs +19 -0
  215. package/dist/language_models/utils.cjs.map +1 -0
  216. package/dist/language_models/utils.js +17 -0
  217. package/dist/language_models/utils.js.map +1 -0
  218. package/dist/load/import_constants.cjs +7 -5
  219. package/dist/load/import_constants.cjs.map +1 -0
  220. package/dist/load/import_constants.js +6 -2
  221. package/dist/load/import_constants.js.map +1 -0
  222. package/dist/load/import_map.cjs +138 -79
  223. package/dist/load/import_map.cjs.map +1 -0
  224. package/dist/load/import_map.js +134 -44
  225. package/dist/load/import_map.js.map +1 -0
  226. package/dist/load/import_type.d.cts +7 -0
  227. package/dist/load/import_type.d.cts.map +1 -0
  228. package/dist/load/import_type.d.ts +7 -4
  229. package/dist/load/import_type.d.ts.map +1 -0
  230. package/dist/load/index.cjs +85 -192
  231. package/dist/load/index.cjs.map +1 -0
  232. package/dist/load/index.d.cts +12 -0
  233. package/dist/load/index.d.cts.map +1 -0
  234. package/dist/load/index.d.ts +11 -6
  235. package/dist/load/index.d.ts.map +1 -0
  236. package/dist/load/index.js +84 -155
  237. package/dist/load/index.js.map +1 -0
  238. package/dist/load/map_keys.cjs +16 -19
  239. package/dist/load/map_keys.cjs.map +1 -0
  240. package/dist/load/map_keys.d.cts +8 -0
  241. package/dist/load/map_keys.d.cts.map +1 -0
  242. package/dist/load/map_keys.d.ts +7 -8
  243. package/dist/load/map_keys.d.ts.map +1 -0
  244. package/dist/load/map_keys.js +14 -12
  245. package/dist/load/map_keys.js.map +1 -0
  246. package/dist/load/serializable.cjs +143 -185
  247. package/dist/load/serializable.cjs.map +1 -0
  248. package/dist/load/serializable.d.cts +82 -0
  249. package/dist/load/serializable.d.cts.map +1 -0
  250. package/dist/load/serializable.d.ts +74 -68
  251. package/dist/load/serializable.d.ts.map +1 -0
  252. package/dist/load/serializable.js +136 -180
  253. package/dist/load/serializable.js.map +1 -0
  254. package/dist/memory.cjs +60 -51
  255. package/dist/memory.cjs.map +1 -0
  256. package/dist/memory.d.cts +69 -0
  257. package/dist/memory.d.cts.map +1 -0
  258. package/dist/memory.d.ts +34 -27
  259. package/dist/memory.d.ts.map +1 -0
  260. package/dist/memory.js +54 -47
  261. package/dist/memory.js.map +1 -0
  262. package/dist/messages/ai.cjs +280 -333
  263. package/dist/messages/ai.cjs.map +1 -0
  264. package/dist/messages/ai.d.cts +148 -0
  265. package/dist/messages/ai.d.cts.map +1 -0
  266. package/dist/messages/ai.d.ts +119 -107
  267. package/dist/messages/ai.d.ts.map +1 -0
  268. package/dist/messages/ai.js +279 -328
  269. package/dist/messages/ai.js.map +1 -0
  270. package/dist/messages/base.cjs +225 -364
  271. package/dist/messages/base.cjs.map +1 -0
  272. package/dist/messages/base.d.cts +188 -0
  273. package/dist/messages/base.d.cts.map +1 -0
  274. package/dist/messages/base.d.ts +147 -147
  275. package/dist/messages/base.d.ts.map +1 -0
  276. package/dist/messages/base.js +222 -357
  277. package/dist/messages/base.js.map +1 -0
  278. package/dist/messages/block_translators/anthropic.cjs +320 -0
  279. package/dist/messages/block_translators/anthropic.cjs.map +1 -0
  280. package/dist/messages/block_translators/anthropic.js +319 -0
  281. package/dist/messages/block_translators/anthropic.js.map +1 -0
  282. package/dist/messages/block_translators/data.cjs +71 -0
  283. package/dist/messages/block_translators/data.cjs.map +1 -0
  284. package/dist/messages/block_translators/data.js +69 -0
  285. package/dist/messages/block_translators/data.js.map +1 -0
  286. package/dist/messages/block_translators/index.cjs +12 -0
  287. package/dist/messages/block_translators/index.cjs.map +1 -0
  288. package/dist/messages/block_translators/index.js +12 -0
  289. package/dist/messages/block_translators/index.js.map +1 -0
  290. package/dist/messages/block_translators/openai.cjs +324 -0
  291. package/dist/messages/block_translators/openai.cjs.map +1 -0
  292. package/dist/messages/block_translators/openai.js +323 -0
  293. package/dist/messages/block_translators/openai.js.map +1 -0
  294. package/dist/messages/block_translators/utils.cjs +35 -0
  295. package/dist/messages/block_translators/utils.cjs.map +1 -0
  296. package/dist/messages/block_translators/utils.js +28 -0
  297. package/dist/messages/block_translators/utils.js.map +1 -0
  298. package/dist/messages/chat.cjs +78 -86
  299. package/dist/messages/chat.cjs.map +1 -0
  300. package/dist/messages/chat.d.cts +37 -0
  301. package/dist/messages/chat.d.cts.map +1 -0
  302. package/dist/messages/chat.d.ts +27 -22
  303. package/dist/messages/chat.d.ts.map +1 -0
  304. package/dist/messages/chat.js +77 -81
  305. package/dist/messages/chat.js.map +1 -0
  306. package/dist/messages/content/base.d.cts +20 -0
  307. package/dist/messages/content/base.d.cts.map +1 -0
  308. package/dist/messages/content/base.d.ts +20 -0
  309. package/dist/messages/content/base.d.ts.map +1 -0
  310. package/dist/messages/content/data.cjs +146 -0
  311. package/dist/messages/content/data.cjs.map +1 -0
  312. package/dist/messages/content/data.d.cts +280 -0
  313. package/dist/messages/content/data.d.cts.map +1 -0
  314. package/dist/messages/content/data.d.ts +280 -0
  315. package/dist/messages/content/data.d.ts.map +1 -0
  316. package/dist/messages/content/data.js +137 -0
  317. package/dist/messages/content/data.js.map +1 -0
  318. package/dist/messages/content/index.cjs +14 -0
  319. package/dist/messages/content/index.cjs.map +1 -0
  320. package/dist/messages/content/index.d.cts +101 -0
  321. package/dist/messages/content/index.d.cts.map +1 -0
  322. package/dist/messages/content/index.d.ts +101 -0
  323. package/dist/messages/content/index.d.ts.map +1 -0
  324. package/dist/messages/content/index.js +14 -0
  325. package/dist/messages/content/index.js.map +1 -0
  326. package/dist/messages/content/multimodal.cjs +13 -0
  327. package/dist/messages/content/multimodal.cjs.map +1 -0
  328. package/dist/messages/content/multimodal.d.cts +108 -0
  329. package/dist/messages/content/multimodal.d.cts.map +1 -0
  330. package/dist/messages/content/multimodal.d.ts +108 -0
  331. package/dist/messages/content/multimodal.d.ts.map +1 -0
  332. package/dist/messages/content/multimodal.js +12 -0
  333. package/dist/messages/content/multimodal.js.map +1 -0
  334. package/dist/messages/content/tools.cjs +15 -0
  335. package/dist/messages/content/tools.cjs.map +1 -0
  336. package/dist/messages/content/tools.d.cts +151 -0
  337. package/dist/messages/content/tools.d.cts.map +1 -0
  338. package/dist/messages/content/tools.d.ts +151 -0
  339. package/dist/messages/content/tools.d.ts.map +1 -0
  340. package/dist/messages/content/tools.js +14 -0
  341. package/dist/messages/content/tools.js.map +1 -0
  342. package/dist/messages/function.cjs +49 -49
  343. package/dist/messages/function.cjs.map +1 -0
  344. package/dist/messages/function.d.cts +30 -0
  345. package/dist/messages/function.d.cts.map +1 -0
  346. package/dist/messages/function.d.ts +20 -16
  347. package/dist/messages/function.d.ts.map +1 -0
  348. package/dist/messages/function.js +48 -44
  349. package/dist/messages/function.js.map +1 -0
  350. package/dist/messages/human.cjs +47 -49
  351. package/dist/messages/human.cjs.map +1 -0
  352. package/dist/messages/human.d.cts +31 -0
  353. package/dist/messages/human.d.cts.map +1 -0
  354. package/dist/messages/human.d.ts +22 -22
  355. package/dist/messages/human.d.ts.map +1 -0
  356. package/dist/messages/human.js +46 -44
  357. package/dist/messages/human.js.map +1 -0
  358. package/dist/messages/index.cjs +139 -34
  359. package/dist/messages/index.cjs.map +1 -0
  360. package/dist/messages/index.d.cts +13 -0
  361. package/dist/messages/index.d.ts +13 -11
  362. package/dist/messages/index.js +78 -13
  363. package/dist/messages/index.js.map +1 -0
  364. package/dist/messages/modifier.cjs +30 -33
  365. package/dist/messages/modifier.cjs.map +1 -0
  366. package/dist/messages/modifier.d.cts +24 -0
  367. package/dist/messages/modifier.d.cts.map +1 -0
  368. package/dist/messages/modifier.d.ts +18 -13
  369. package/dist/messages/modifier.d.ts.map +1 -0
  370. package/dist/messages/modifier.js +30 -29
  371. package/dist/messages/modifier.js.map +1 -0
  372. package/dist/messages/system.cjs +47 -49
  373. package/dist/messages/system.cjs.map +1 -0
  374. package/dist/messages/system.d.cts +31 -0
  375. package/dist/messages/system.d.cts.map +1 -0
  376. package/dist/messages/system.d.ts +22 -22
  377. package/dist/messages/system.d.ts.map +1 -0
  378. package/dist/messages/system.js +46 -44
  379. package/dist/messages/system.js.map +1 -0
  380. package/dist/messages/tool.cjs +153 -189
  381. package/dist/messages/tool.cjs.map +1 -0
  382. package/dist/messages/tool.d.cts +173 -0
  383. package/dist/messages/tool.d.cts.map +1 -0
  384. package/dist/messages/tool.d.ts +96 -90
  385. package/dist/messages/tool.d.ts.map +1 -0
  386. package/dist/messages/tool.js +145 -183
  387. package/dist/messages/tool.js.map +1 -0
  388. package/dist/messages/transformers.cjs +287 -431
  389. package/dist/messages/transformers.cjs.map +1 -0
  390. package/dist/messages/transformers.d.cts +472 -0
  391. package/dist/messages/transformers.d.cts.map +1 -0
  392. package/dist/messages/transformers.d.ts +111 -105
  393. package/dist/messages/transformers.d.ts.map +1 -0
  394. package/dist/messages/transformers.js +284 -425
  395. package/dist/messages/transformers.js.map +1 -0
  396. package/dist/messages/utils.cjs +172 -267
  397. package/dist/messages/utils.cjs.map +1 -0
  398. package/dist/messages/utils.d.cts +36 -0
  399. package/dist/messages/utils.d.cts.map +1 -0
  400. package/dist/messages/utils.d.ts +13 -8
  401. package/dist/messages/utils.d.ts.map +1 -0
  402. package/dist/messages/utils.js +170 -262
  403. package/dist/messages/utils.js.map +1 -0
  404. package/dist/output_parsers/base.cjs +104 -120
  405. package/dist/output_parsers/base.cjs.map +1 -0
  406. package/dist/output_parsers/base.d.cts +108 -0
  407. package/dist/output_parsers/base.d.cts.map +1 -0
  408. package/dist/output_parsers/base.d.ts +76 -71
  409. package/dist/output_parsers/base.d.ts.map +1 -0
  410. package/dist/output_parsers/base.js +102 -114
  411. package/dist/output_parsers/base.js.map +1 -0
  412. package/dist/output_parsers/bytes.cjs +27 -39
  413. package/dist/output_parsers/bytes.cjs.map +1 -0
  414. package/dist/output_parsers/bytes.d.cts +19 -0
  415. package/dist/output_parsers/bytes.d.cts.map +1 -0
  416. package/dist/output_parsers/bytes.d.ts +13 -7
  417. package/dist/output_parsers/bytes.d.ts.map +1 -0
  418. package/dist/output_parsers/bytes.js +27 -35
  419. package/dist/output_parsers/bytes.js.map +1 -0
  420. package/dist/output_parsers/index.cjs +66 -24
  421. package/dist/output_parsers/index.cjs.map +1 -0
  422. package/dist/output_parsers/index.d.cts +10 -0
  423. package/dist/output_parsers/index.d.ts +10 -8
  424. package/dist/output_parsers/index.js +40 -8
  425. package/dist/output_parsers/index.js.map +1 -0
  426. package/dist/output_parsers/json.cjs +36 -57
  427. package/dist/output_parsers/json.cjs.map +1 -0
  428. package/dist/output_parsers/json.d.cts +26 -0
  429. package/dist/output_parsers/json.d.cts.map +1 -0
  430. package/dist/output_parsers/json.d.ts +20 -13
  431. package/dist/output_parsers/json.d.ts.map +1 -0
  432. package/dist/output_parsers/json.js +36 -52
  433. package/dist/output_parsers/json.js.map +1 -0
  434. package/dist/output_parsers/list.cjs +155 -239
  435. package/dist/output_parsers/list.cjs.map +1 -0
  436. package/dist/output_parsers/list.d.cts +85 -0
  437. package/dist/output_parsers/list.d.cts.map +1 -0
  438. package/dist/output_parsers/list.d.ts +67 -58
  439. package/dist/output_parsers/list.d.ts.map +1 -0
  440. package/dist/output_parsers/list.js +151 -231
  441. package/dist/output_parsers/list.js.map +1 -0
  442. package/dist/output_parsers/openai_functions/index.cjs +22 -17
  443. package/dist/output_parsers/openai_functions/index.cjs.map +1 -0
  444. package/dist/output_parsers/openai_functions/index.d.cts +2 -0
  445. package/dist/output_parsers/openai_functions/index.d.ts +2 -1
  446. package/dist/output_parsers/openai_functions/index.js +14 -1
  447. package/dist/output_parsers/openai_functions/index.js.map +1 -0
  448. package/dist/output_parsers/openai_functions/json_output_functions_parsers.cjs +140 -203
  449. package/dist/output_parsers/openai_functions/json_output_functions_parsers.cjs.map +1 -0
  450. package/dist/output_parsers/openai_functions/json_output_functions_parsers.d.cts +90 -0
  451. package/dist/output_parsers/openai_functions/json_output_functions_parsers.d.cts.map +1 -0
  452. package/dist/output_parsers/openai_functions/json_output_functions_parsers.d.ts +68 -58
  453. package/dist/output_parsers/openai_functions/json_output_functions_parsers.d.ts.map +1 -0
  454. package/dist/output_parsers/openai_functions/json_output_functions_parsers.js +138 -197
  455. package/dist/output_parsers/openai_functions/json_output_functions_parsers.js.map +1 -0
  456. package/dist/output_parsers/openai_tools/index.cjs +26 -17
  457. package/dist/output_parsers/openai_tools/index.cjs.map +1 -0
  458. package/dist/output_parsers/openai_tools/index.d.cts +2 -0
  459. package/dist/output_parsers/openai_tools/index.d.ts +2 -1
  460. package/dist/output_parsers/openai_tools/index.js +16 -1
  461. package/dist/output_parsers/openai_tools/index.js.map +1 -0
  462. package/dist/output_parsers/openai_tools/json_output_tools_parsers.cjs +176 -256
  463. package/dist/output_parsers/openai_tools/json_output_tools_parsers.cjs.map +1 -0
  464. package/dist/output_parsers/openai_tools/json_output_tools_parsers.d.cts +120 -0
  465. package/dist/output_parsers/openai_tools/json_output_tools_parsers.d.cts.map +1 -0
  466. package/dist/output_parsers/openai_tools/json_output_tools_parsers.d.ts +98 -70
  467. package/dist/output_parsers/openai_tools/json_output_tools_parsers.d.ts.map +1 -0
  468. package/dist/output_parsers/openai_tools/json_output_tools_parsers.js +173 -249
  469. package/dist/output_parsers/openai_tools/json_output_tools_parsers.js.map +1 -0
  470. package/dist/output_parsers/string.cjs +70 -84
  471. package/dist/output_parsers/string.cjs.map +1 -0
  472. package/dist/output_parsers/string.d.cts +45 -0
  473. package/dist/output_parsers/string.d.cts.map +1 -0
  474. package/dist/output_parsers/string.d.ts +25 -19
  475. package/dist/output_parsers/string.d.ts.map +1 -0
  476. package/dist/output_parsers/string.js +70 -80
  477. package/dist/output_parsers/string.js.map +1 -0
  478. package/dist/output_parsers/structured.cjs +148 -181
  479. package/dist/output_parsers/structured.cjs.map +1 -0
  480. package/dist/output_parsers/structured.d.cts +97 -0
  481. package/dist/output_parsers/structured.d.cts.map +1 -0
  482. package/dist/output_parsers/structured.d.ts +82 -74
  483. package/dist/output_parsers/structured.d.ts.map +1 -0
  484. package/dist/output_parsers/structured.js +144 -174
  485. package/dist/output_parsers/structured.js.map +1 -0
  486. package/dist/output_parsers/transform.cjs +79 -109
  487. package/dist/output_parsers/transform.cjs.map +1 -0
  488. package/dist/output_parsers/transform.d.cts +41 -0
  489. package/dist/output_parsers/transform.d.cts.map +1 -0
  490. package/dist/output_parsers/transform.d.ts +29 -22
  491. package/dist/output_parsers/transform.d.ts.map +1 -0
  492. package/dist/output_parsers/transform.js +77 -104
  493. package/dist/output_parsers/transform.js.map +1 -0
  494. package/dist/output_parsers/xml.cjs +95 -129
  495. package/dist/output_parsers/xml.cjs.map +1 -0
  496. package/dist/output_parsers/xml.d.cts +34 -0
  497. package/dist/output_parsers/xml.d.cts.map +1 -0
  498. package/dist/output_parsers/xml.d.ts +29 -24
  499. package/dist/output_parsers/xml.d.ts.map +1 -0
  500. package/dist/output_parsers/xml.js +93 -124
  501. package/dist/output_parsers/xml.js.map +1 -0
  502. package/dist/outputs.cjs +57 -57
  503. package/dist/outputs.cjs.map +1 -0
  504. package/dist/outputs.d.cts +72 -0
  505. package/dist/outputs.d.cts.map +1 -0
  506. package/dist/outputs.d.ts +55 -44
  507. package/dist/outputs.d.ts.map +1 -0
  508. package/dist/outputs.js +50 -53
  509. package/dist/outputs.js.map +1 -0
  510. package/dist/prompt_values.cjs +101 -148
  511. package/dist/prompt_values.cjs.map +1 -0
  512. package/dist/prompt_values.d.cts +83 -0
  513. package/dist/prompt_values.d.cts.map +1 -0
  514. package/dist/prompt_values.d.ts +53 -48
  515. package/dist/prompt_values.d.ts.map +1 -0
  516. package/dist/prompt_values.js +90 -139
  517. package/dist/prompt_values.js.map +1 -0
  518. package/dist/prompts/base.cjs +106 -173
  519. package/dist/prompts/base.cjs.map +1 -0
  520. package/dist/prompts/base.d.cts +108 -0
  521. package/dist/prompts/base.d.cts.map +1 -0
  522. package/dist/prompts/base.d.ts +98 -85
  523. package/dist/prompts/base.d.ts.map +1 -0
  524. package/dist/prompts/base.js +106 -136
  525. package/dist/prompts/base.js.map +1 -0
  526. package/dist/prompts/chat.cjs +533 -786
  527. package/dist/prompts/chat.cjs.map +1 -0
  528. package/dist/prompts/chat.d.cts +296 -0
  529. package/dist/prompts/chat.d.cts.map +1 -0
  530. package/dist/prompts/chat.d.ts +191 -136
  531. package/dist/prompts/chat.d.ts.map +1 -0
  532. package/dist/prompts/chat.js +522 -771
  533. package/dist/prompts/chat.js.map +1 -0
  534. package/dist/prompts/dict.cjs +60 -110
  535. package/dist/prompts/dict.cjs.map +1 -0
  536. package/dist/prompts/dict.d.cts +23 -0
  537. package/dist/prompts/dict.d.cts.map +1 -0
  538. package/dist/prompts/dict.d.ts +19 -14
  539. package/dist/prompts/dict.d.ts.map +1 -0
  540. package/dist/prompts/dict.js +58 -104
  541. package/dist/prompts/dict.js.map +1 -0
  542. package/dist/prompts/few_shot.cjs +239 -352
  543. package/dist/prompts/few_shot.cjs.map +1 -0
  544. package/dist/prompts/few_shot.d.cts +204 -0
  545. package/dist/prompts/few_shot.d.cts.map +1 -0
  546. package/dist/prompts/few_shot.d.ts +157 -148
  547. package/dist/prompts/few_shot.d.ts.map +1 -0
  548. package/dist/prompts/few_shot.js +237 -346
  549. package/dist/prompts/few_shot.js.map +1 -0
  550. package/dist/prompts/image.cjs +92 -126
  551. package/dist/prompts/image.cjs.map +1 -0
  552. package/dist/prompts/image.d.cts +86 -0
  553. package/dist/prompts/image.d.cts.map +1 -0
  554. package/dist/prompts/image.d.ts +76 -60
  555. package/dist/prompts/image.d.ts.map +1 -0
  556. package/dist/prompts/image.js +92 -122
  557. package/dist/prompts/image.js.map +1 -0
  558. package/dist/prompts/index.cjs +79 -27
  559. package/dist/prompts/index.cjs.map +1 -0
  560. package/dist/prompts/index.d.cts +12 -0
  561. package/dist/prompts/index.d.ts +12 -11
  562. package/dist/prompts/index.js +47 -11
  563. package/dist/prompts/index.js.map +1 -0
  564. package/dist/prompts/pipeline.cjs +128 -142
  565. package/dist/prompts/pipeline.cjs.map +1 -0
  566. package/dist/prompts/pipeline.d.cts +104 -0
  567. package/dist/prompts/pipeline.d.cts.map +1 -0
  568. package/dist/prompts/pipeline.d.ts +48 -42
  569. package/dist/prompts/pipeline.d.ts.map +1 -0
  570. package/dist/prompts/pipeline.js +127 -137
  571. package/dist/prompts/pipeline.js.map +1 -0
  572. package/dist/prompts/prompt.cjs +131 -164
  573. package/dist/prompts/prompt.cjs.map +1 -0
  574. package/dist/prompts/prompt.d.cts +134 -0
  575. package/dist/prompts/prompt.d.cts.map +1 -0
  576. package/dist/prompts/prompt.d.ts +106 -79
  577. package/dist/prompts/prompt.d.ts.map +1 -0
  578. package/dist/prompts/prompt.js +131 -160
  579. package/dist/prompts/prompt.js.map +1 -0
  580. package/dist/prompts/serde.d.cts +50 -0
  581. package/dist/prompts/serde.d.cts.map +1 -0
  582. package/dist/prompts/serde.d.ts +24 -17
  583. package/dist/prompts/serde.d.ts.map +1 -0
  584. package/dist/prompts/string.cjs +23 -23
  585. package/dist/prompts/string.cjs.map +1 -0
  586. package/dist/prompts/string.d.cts +27 -0
  587. package/dist/prompts/string.d.cts.map +1 -0
  588. package/dist/prompts/string.d.ts +21 -11
  589. package/dist/prompts/string.d.ts.map +1 -0
  590. package/dist/prompts/string.js +23 -19
  591. package/dist/prompts/string.js.map +1 -0
  592. package/dist/prompts/structured.cjs +46 -70
  593. package/dist/prompts/structured.cjs.map +1 -0
  594. package/dist/prompts/structured.d.cts +40 -0
  595. package/dist/prompts/structured.d.cts.map +1 -0
  596. package/dist/prompts/structured.d.ts +33 -14
  597. package/dist/prompts/structured.d.ts.map +1 -0
  598. package/dist/prompts/structured.js +46 -66
  599. package/dist/prompts/structured.js.map +1 -0
  600. package/dist/prompts/template.cjs +138 -157
  601. package/dist/prompts/template.cjs.map +1 -0
  602. package/dist/prompts/template.d.cts +48 -0
  603. package/dist/prompts/template.d.cts.map +1 -0
  604. package/dist/prompts/template.d.ts +24 -19
  605. package/dist/prompts/template.d.ts.map +1 -0
  606. package/dist/prompts/template.js +135 -150
  607. package/dist/prompts/template.js.map +1 -0
  608. package/dist/retrievers/document_compressors/base.cjs +21 -11
  609. package/dist/retrievers/document_compressors/base.cjs.map +1 -0
  610. package/dist/retrievers/document_compressors/base.d.cts +25 -0
  611. package/dist/retrievers/document_compressors/base.d.cts.map +1 -0
  612. package/dist/retrievers/document_compressors/base.d.ts +20 -13
  613. package/dist/retrievers/document_compressors/base.d.ts.map +1 -0
  614. package/dist/retrievers/document_compressors/base.js +16 -8
  615. package/dist/retrievers/document_compressors/base.js.map +1 -0
  616. package/dist/retrievers/index.cjs +119 -129
  617. package/dist/retrievers/index.cjs.map +1 -0
  618. package/dist/retrievers/index.d.cts +144 -0
  619. package/dist/retrievers/index.d.cts.map +1 -0
  620. package/dist/retrievers/index.d.ts +98 -88
  621. package/dist/retrievers/index.d.ts.map +1 -0
  622. package/dist/retrievers/index.js +113 -125
  623. package/dist/retrievers/index.js.map +1 -0
  624. package/dist/runnables/base.cjs +1808 -2421
  625. package/dist/runnables/base.cjs.map +1 -0
  626. package/dist/runnables/base.d.cts +990 -0
  627. package/dist/runnables/base.d.cts.map +1 -0
  628. package/dist/runnables/base.d.ts +633 -592
  629. package/dist/runnables/base.d.ts.map +1 -0
  630. package/dist/runnables/base.js +1791 -2396
  631. package/dist/runnables/base.js.map +1 -0
  632. package/dist/runnables/branch.cjs +151 -205
  633. package/dist/runnables/branch.cjs.map +1 -0
  634. package/dist/runnables/branch.d.cts +94 -0
  635. package/dist/runnables/branch.d.cts.map +1 -0
  636. package/dist/runnables/branch.d.ts +50 -51
  637. package/dist/runnables/branch.d.ts.map +1 -0
  638. package/dist/runnables/branch.js +151 -201
  639. package/dist/runnables/branch.js.map +1 -0
  640. package/dist/runnables/config.cjs +136 -212
  641. package/dist/runnables/config.cjs.map +1 -0
  642. package/dist/runnables/config.d.cts +26 -0
  643. package/dist/runnables/config.d.cts.map +1 -0
  644. package/dist/runnables/config.d.ts +18 -7
  645. package/dist/runnables/config.d.ts.map +1 -0
  646. package/dist/runnables/config.js +134 -207
  647. package/dist/runnables/config.js.map +1 -0
  648. package/dist/runnables/graph.cjs +215 -260
  649. package/dist/runnables/graph.cjs.map +1 -0
  650. package/dist/runnables/graph.d.cts +52 -0
  651. package/dist/runnables/graph.d.cts.map +1 -0
  652. package/dist/runnables/graph.d.ts +49 -41
  653. package/dist/runnables/graph.d.ts.map +1 -0
  654. package/dist/runnables/graph.js +206 -253
  655. package/dist/runnables/graph.js.map +1 -0
  656. package/dist/runnables/graph_mermaid.cjs +86 -141
  657. package/dist/runnables/graph_mermaid.cjs.map +1 -0
  658. package/dist/runnables/graph_mermaid.js +86 -139
  659. package/dist/runnables/graph_mermaid.js.map +1 -0
  660. package/dist/runnables/history.cjs +160 -260
  661. package/dist/runnables/history.cjs.map +1 -0
  662. package/dist/runnables/history.d.cts +104 -0
  663. package/dist/runnables/history.d.cts.map +1 -0
  664. package/dist/runnables/history.d.ts +38 -26
  665. package/dist/runnables/history.d.ts.map +1 -0
  666. package/dist/runnables/history.js +160 -256
  667. package/dist/runnables/history.js.map +1 -0
  668. package/dist/runnables/index.cjs +65 -31
  669. package/dist/runnables/index.cjs.map +1 -0
  670. package/dist/runnables/index.d.cts +8 -0
  671. package/dist/runnables/index.d.ts +8 -7
  672. package/dist/runnables/index.js +38 -6
  673. package/dist/runnables/index.js.map +1 -0
  674. package/dist/runnables/iter.cjs +27 -42
  675. package/dist/runnables/iter.cjs.map +1 -0
  676. package/dist/runnables/iter.js +26 -37
  677. package/dist/runnables/iter.js.map +1 -0
  678. package/dist/runnables/passthrough.cjs +97 -125
  679. package/dist/runnables/passthrough.cjs.map +1 -0
  680. package/dist/runnables/passthrough.d.cts +76 -0
  681. package/dist/runnables/passthrough.d.cts.map +1 -0
  682. package/dist/runnables/passthrough.d.ts +46 -40
  683. package/dist/runnables/passthrough.d.ts.map +1 -0
  684. package/dist/runnables/passthrough.js +97 -121
  685. package/dist/runnables/passthrough.js.map +1 -0
  686. package/dist/runnables/remote.cjs +387 -508
  687. package/dist/runnables/remote.cjs.map +1 -0
  688. package/dist/runnables/remote.d.cts +73 -0
  689. package/dist/runnables/remote.d.cts.map +1 -0
  690. package/dist/runnables/remote.d.ts +52 -40
  691. package/dist/runnables/remote.d.ts.map +1 -0
  692. package/dist/runnables/remote.js +379 -502
  693. package/dist/runnables/remote.js.map +1 -0
  694. package/dist/runnables/router.cjs +74 -95
  695. package/dist/runnables/router.cjs.map +1 -0
  696. package/dist/runnables/router.d.cts +58 -0
  697. package/dist/runnables/router.d.cts.map +1 -0
  698. package/dist/runnables/router.d.ts +27 -21
  699. package/dist/runnables/router.d.ts.map +1 -0
  700. package/dist/runnables/router.js +74 -91
  701. package/dist/runnables/router.js.map +1 -0
  702. package/dist/runnables/types.d.cts +81 -0
  703. package/dist/runnables/types.d.cts.map +1 -0
  704. package/dist/runnables/types.d.ts +68 -55
  705. package/dist/runnables/types.d.ts.map +1 -0
  706. package/dist/runnables/utils.cjs +40 -85
  707. package/dist/runnables/utils.cjs.map +1 -0
  708. package/dist/runnables/utils.js +40 -82
  709. package/dist/runnables/utils.js.map +1 -0
  710. package/dist/runnables/wrappers.cjs +14 -15
  711. package/dist/runnables/wrappers.cjs.map +1 -0
  712. package/dist/runnables/wrappers.js +14 -12
  713. package/dist/runnables/wrappers.js.map +1 -0
  714. package/dist/singletons/async_local_storage/context.cjs +167 -177
  715. package/dist/singletons/async_local_storage/context.cjs.map +1 -0
  716. package/dist/singletons/async_local_storage/context.d.cts +163 -0
  717. package/dist/singletons/async_local_storage/context.d.cts.map +1 -0
  718. package/dist/singletons/async_local_storage/context.d.ts +17 -9
  719. package/dist/singletons/async_local_storage/context.d.ts.map +1 -0
  720. package/dist/singletons/async_local_storage/context.js +168 -175
  721. package/dist/singletons/async_local_storage/context.js.map +1 -0
  722. package/dist/singletons/async_local_storage/globals.cjs +11 -8
  723. package/dist/singletons/async_local_storage/globals.cjs.map +1 -0
  724. package/dist/singletons/async_local_storage/globals.d.cts +11 -0
  725. package/dist/singletons/async_local_storage/globals.d.cts.map +1 -0
  726. package/dist/singletons/async_local_storage/globals.d.ts +10 -8
  727. package/dist/singletons/async_local_storage/globals.d.ts.map +1 -0
  728. package/dist/singletons/async_local_storage/globals.js +11 -6
  729. package/dist/singletons/async_local_storage/globals.js.map +1 -0
  730. package/dist/singletons/async_local_storage/index.cjs +55 -65
  731. package/dist/singletons/async_local_storage/index.cjs.map +1 -0
  732. package/dist/singletons/async_local_storage/index.d.cts +18 -0
  733. package/dist/singletons/async_local_storage/index.d.cts.map +1 -0
  734. package/dist/singletons/async_local_storage/index.d.ts +13 -9
  735. package/dist/singletons/async_local_storage/index.d.ts.map +1 -0
  736. package/dist/singletons/async_local_storage/index.js +53 -61
  737. package/dist/singletons/async_local_storage/index.js.map +1 -0
  738. package/dist/singletons/callbacks.cjs +43 -60
  739. package/dist/singletons/callbacks.cjs.map +1 -0
  740. package/dist/singletons/callbacks.d.cts +16 -0
  741. package/dist/singletons/callbacks.d.cts.map +1 -0
  742. package/dist/singletons/callbacks.d.ts +8 -3
  743. package/dist/singletons/callbacks.d.ts.map +1 -0
  744. package/dist/singletons/callbacks.js +43 -54
  745. package/dist/singletons/callbacks.js.map +1 -0
  746. package/dist/singletons/index.cjs +23 -8
  747. package/dist/singletons/index.cjs.map +1 -0
  748. package/dist/singletons/index.d.cts +3 -0
  749. package/dist/singletons/index.d.ts +3 -4
  750. package/dist/singletons/index.js +14 -3
  751. package/dist/singletons/index.js.map +1 -0
  752. package/dist/singletons/tracer.cjs +13 -19
  753. package/dist/singletons/tracer.cjs.map +1 -0
  754. package/dist/singletons/tracer.js +13 -15
  755. package/dist/singletons/tracer.js.map +1 -0
  756. package/dist/stores.cjs +78 -87
  757. package/dist/stores.cjs.map +1 -0
  758. package/dist/stores.d.cts +111 -0
  759. package/dist/stores.d.cts.map +1 -0
  760. package/dist/stores.d.ts +84 -78
  761. package/dist/stores.d.ts.map +1 -0
  762. package/dist/stores.js +71 -82
  763. package/dist/stores.js.map +1 -0
  764. package/dist/structured_query/base.cjs +86 -136
  765. package/dist/structured_query/base.cjs.map +1 -0
  766. package/dist/structured_query/base.d.cts +75 -0
  767. package/dist/structured_query/base.d.cts.map +1 -0
  768. package/dist/structured_query/base.d.ts +53 -47
  769. package/dist/structured_query/base.d.ts.map +1 -0
  770. package/dist/structured_query/base.js +86 -132
  771. package/dist/structured_query/base.js.map +1 -0
  772. package/dist/structured_query/functional.cjs +163 -234
  773. package/dist/structured_query/functional.cjs.map +1 -0
  774. package/dist/structured_query/functional.d.cts +98 -0
  775. package/dist/structured_query/functional.d.cts.map +1 -0
  776. package/dist/structured_query/functional.d.ts +72 -67
  777. package/dist/structured_query/functional.d.ts.map +1 -0
  778. package/dist/structured_query/functional.js +163 -230
  779. package/dist/structured_query/functional.js.map +1 -0
  780. package/dist/structured_query/index.cjs +55 -20
  781. package/dist/structured_query/index.cjs.map +1 -0
  782. package/dist/structured_query/index.d.cts +5 -0
  783. package/dist/structured_query/index.d.ts +5 -4
  784. package/dist/structured_query/index.js +32 -4
  785. package/dist/structured_query/index.js.map +1 -0
  786. package/dist/structured_query/ir.cjs +76 -132
  787. package/dist/structured_query/ir.cjs.map +1 -0
  788. package/dist/structured_query/ir.d.cts +143 -0
  789. package/dist/structured_query/ir.d.cts.map +1 -0
  790. package/dist/structured_query/ir.d.ts +61 -56
  791. package/dist/structured_query/ir.d.ts.map +1 -0
  792. package/dist/structured_query/ir.js +69 -124
  793. package/dist/structured_query/ir.js.map +1 -0
  794. package/dist/structured_query/utils.cjs +58 -83
  795. package/dist/structured_query/utils.cjs.map +1 -0
  796. package/dist/structured_query/utils.d.cts +40 -0
  797. package/dist/structured_query/utils.d.cts.map +1 -0
  798. package/dist/structured_query/utils.d.ts +14 -7
  799. package/dist/structured_query/utils.d.ts.map +1 -0
  800. package/dist/structured_query/utils.js +57 -80
  801. package/dist/structured_query/utils.js.map +1 -0
  802. package/dist/tools/index.cjs +321 -437
  803. package/dist/tools/index.cjs.map +1 -0
  804. package/dist/tools/index.d.cts +209 -0
  805. package/dist/tools/index.d.cts.map +1 -0
  806. package/dist/tools/index.d.ts +153 -149
  807. package/dist/tools/index.d.ts.map +1 -0
  808. package/dist/tools/index.js +305 -424
  809. package/dist/tools/index.js.map +1 -0
  810. package/dist/tools/types.cjs +44 -52
  811. package/dist/tools/types.cjs.map +1 -0
  812. package/dist/tools/types.d.cts +283 -0
  813. package/dist/tools/types.d.cts.map +1 -0
  814. package/dist/tools/types.d.ts +149 -138
  815. package/dist/tools/types.d.ts.map +1 -0
  816. package/dist/tools/types.js +45 -50
  817. package/dist/tools/types.js.map +1 -0
  818. package/dist/tools/utils.cjs +20 -32
  819. package/dist/tools/utils.cjs.map +1 -0
  820. package/dist/tools/utils.d.cts +14 -0
  821. package/dist/tools/utils.d.cts.map +1 -0
  822. package/dist/tools/utils.d.ts +8 -10
  823. package/dist/tools/utils.d.ts.map +1 -0
  824. package/dist/tools/utils.js +20 -29
  825. package/dist/tools/utils.js.map +1 -0
  826. package/dist/tracers/base.cjs +441 -529
  827. package/dist/tracers/base.cjs.map +1 -0
  828. package/dist/tracers/base.d.cts +304 -0
  829. package/dist/tracers/base.d.cts.map +1 -0
  830. package/dist/tracers/base.d.ts +296 -271
  831. package/dist/tracers/base.d.ts.map +1 -0
  832. package/dist/tracers/base.js +435 -525
  833. package/dist/tracers/base.js.map +1 -0
  834. package/dist/tracers/console.cjs +206 -223
  835. package/dist/tracers/console.cjs.map +1 -0
  836. package/dist/tracers/console.d.cts +125 -0
  837. package/dist/tracers/console.d.cts.map +1 -0
  838. package/dist/tracers/console.d.ts +109 -101
  839. package/dist/tracers/console.d.ts.map +1 -0
  840. package/dist/tracers/console.js +199 -215
  841. package/dist/tracers/console.js.map +1 -0
  842. package/dist/tracers/event_stream.cjs +357 -529
  843. package/dist/tracers/event_stream.cjs.map +1 -0
  844. package/dist/tracers/event_stream.d.cts +98 -0
  845. package/dist/tracers/event_stream.d.cts.map +1 -0
  846. package/dist/tracers/event_stream.d.ts +87 -129
  847. package/dist/tracers/event_stream.d.ts.map +1 -0
  848. package/dist/tracers/event_stream.js +355 -523
  849. package/dist/tracers/event_stream.js.map +1 -0
  850. package/dist/tracers/initialize.cjs +40 -29
  851. package/dist/tracers/initialize.cjs.map +1 -0
  852. package/dist/tracers/initialize.d.cts +26 -0
  853. package/dist/tracers/initialize.d.cts.map +1 -0
  854. package/dist/tracers/initialize.d.ts +8 -2
  855. package/dist/tracers/initialize.d.ts.map +1 -0
  856. package/dist/tracers/initialize.js +33 -25
  857. package/dist/tracers/initialize.js.map +1 -0
  858. package/dist/tracers/log_stream.cjs +264 -425
  859. package/dist/tracers/log_stream.cjs.map +1 -0
  860. package/dist/tracers/log_stream.d.cts +129 -0
  861. package/dist/tracers/log_stream.d.cts.map +1 -0
  862. package/dist/tracers/log_stream.d.ts +103 -92
  863. package/dist/tracers/log_stream.d.ts.map +1 -0
  864. package/dist/tracers/log_stream.js +255 -418
  865. package/dist/tracers/log_stream.js.map +1 -0
  866. package/dist/tracers/root_listener.cjs +41 -80
  867. package/dist/tracers/root_listener.cjs.map +1 -0
  868. package/dist/tracers/root_listener.js +41 -76
  869. package/dist/tracers/root_listener.js.map +1 -0
  870. package/dist/tracers/run_collector.cjs +44 -48
  871. package/dist/tracers/run_collector.cjs.map +1 -0
  872. package/dist/tracers/run_collector.d.cts +34 -0
  873. package/dist/tracers/run_collector.d.cts.map +1 -0
  874. package/dist/tracers/run_collector.d.ts +27 -19
  875. package/dist/tracers/run_collector.d.ts.map +1 -0
  876. package/dist/tracers/run_collector.js +38 -44
  877. package/dist/tracers/run_collector.js.map +1 -0
  878. package/dist/tracers/tracer_langchain.cjs +91 -123
  879. package/dist/tracers/tracer_langchain.cjs.map +1 -0
  880. package/dist/tracers/tracer_langchain.d.cts +49 -0
  881. package/dist/tracers/tracer_langchain.d.cts.map +1 -0
  882. package/dist/tracers/tracer_langchain.d.ts +43 -38
  883. package/dist/tracers/tracer_langchain.d.ts.map +1 -0
  884. package/dist/tracers/tracer_langchain.js +84 -118
  885. package/dist/tracers/tracer_langchain.js.map +1 -0
  886. package/dist/tracers/tracer_langchain_v1.cjs +166 -198
  887. package/dist/tracers/tracer_langchain_v1.cjs.map +1 -0
  888. package/dist/tracers/tracer_langchain_v1.d.cts +64 -0
  889. package/dist/tracers/tracer_langchain_v1.d.cts.map +1 -0
  890. package/dist/tracers/tracer_langchain_v1.d.ts +56 -51
  891. package/dist/tracers/tracer_langchain_v1.d.ts.map +1 -0
  892. package/dist/tracers/tracer_langchain_v1.js +158 -192
  893. package/dist/tracers/tracer_langchain_v1.js.map +1 -0
  894. package/dist/types/_internal.d.cts +8 -0
  895. package/dist/types/_internal.d.cts.map +1 -0
  896. package/dist/types/_internal.d.ts +8 -1
  897. package/dist/types/_internal.d.ts.map +1 -0
  898. package/dist/types/stream.cjs +12 -2
  899. package/dist/types/stream.cjs.map +1 -0
  900. package/dist/types/stream.d.cts +3 -0
  901. package/dist/types/stream.d.ts +3 -2
  902. package/dist/types/stream.js +6 -1
  903. package/dist/types/stream.js.map +1 -0
  904. package/dist/types/type-utils.d.cts +7 -0
  905. package/dist/types/type-utils.d.cts.map +1 -0
  906. package/dist/types/type-utils.d.ts +7 -1
  907. package/dist/types/type-utils.d.ts.map +1 -0
  908. package/dist/utils/async_caller.cjs +81 -122
  909. package/dist/utils/async_caller.cjs.map +1 -0
  910. package/dist/utils/async_caller.d.cts +52 -0
  911. package/dist/utils/async_caller.d.cts.map +1 -0
  912. package/dist/utils/async_caller.d.ts +36 -29
  913. package/dist/utils/async_caller.d.ts.map +1 -0
  914. package/dist/utils/async_caller.js +74 -114
  915. package/dist/utils/async_caller.js.map +1 -0
  916. package/dist/utils/callbacks.cjs +14 -14
  917. package/dist/utils/callbacks.cjs.map +1 -0
  918. package/dist/utils/callbacks.js +15 -11
  919. package/dist/utils/callbacks.js.map +1 -0
  920. package/dist/utils/chunk_array.cjs +18 -8
  921. package/dist/utils/chunk_array.cjs.map +1 -0
  922. package/dist/utils/chunk_array.d.cts +5 -0
  923. package/dist/utils/chunk_array.d.cts.map +1 -0
  924. package/dist/utils/chunk_array.d.ts +5 -1
  925. package/dist/utils/chunk_array.d.ts.map +1 -0
  926. package/dist/utils/chunk_array.js +14 -6
  927. package/dist/utils/chunk_array.js.map +1 -0
  928. package/dist/utils/env.cjs +62 -72
  929. package/dist/utils/env.cjs.map +1 -0
  930. package/dist/utils/env.d.cts +36 -0
  931. package/dist/utils/env.d.cts.map +1 -0
  932. package/dist/utils/env.d.ts +30 -22
  933. package/dist/utils/env.d.ts.map +1 -0
  934. package/dist/utils/env.js +54 -66
  935. package/dist/utils/env.js.map +1 -0
  936. package/dist/utils/event_source_parse.cjs +172 -225
  937. package/dist/utils/event_source_parse.cjs.map +1 -0
  938. package/dist/utils/event_source_parse.d.cts +47 -0
  939. package/dist/utils/event_source_parse.d.cts.map +1 -0
  940. package/dist/utils/event_source_parse.d.ts +22 -14
  941. package/dist/utils/event_source_parse.d.ts.map +1 -0
  942. package/dist/utils/event_source_parse.js +164 -220
  943. package/dist/utils/event_source_parse.js.map +1 -0
  944. package/dist/utils/fast-json-patch/index.cjs +14 -58
  945. package/dist/utils/fast-json-patch/index.cjs.map +1 -0
  946. package/dist/utils/fast-json-patch/index.js +14 -15
  947. package/dist/utils/fast-json-patch/index.js.map +1 -0
  948. package/dist/utils/fast-json-patch/src/core.cjs +319 -445
  949. package/dist/utils/fast-json-patch/src/core.cjs.map +1 -0
  950. package/dist/utils/fast-json-patch/src/core.d.cts +80 -0
  951. package/dist/utils/fast-json-patch/src/core.d.cts.map +1 -0
  952. package/dist/utils/fast-json-patch/src/core.d.ts +38 -69
  953. package/dist/utils/fast-json-patch/src/core.d.ts.map +1 -0
  954. package/dist/utils/fast-json-patch/src/core.js +314 -442
  955. package/dist/utils/fast-json-patch/src/core.js.map +1 -0
  956. package/dist/utils/fast-json-patch/src/duplex.cjs +72 -231
  957. package/dist/utils/fast-json-patch/src/duplex.cjs.map +1 -0
  958. package/dist/utils/fast-json-patch/src/duplex.d.cts +11 -0
  959. package/dist/utils/fast-json-patch/src/duplex.d.cts.map +1 -0
  960. package/dist/utils/fast-json-patch/src/duplex.d.ts +7 -19
  961. package/dist/utils/fast-json-patch/src/duplex.d.ts.map +1 -0
  962. package/dist/utils/fast-json-patch/src/duplex.js +73 -226
  963. package/dist/utils/fast-json-patch/src/duplex.js.map +1 -0
  964. package/dist/utils/fast-json-patch/src/helpers.cjs +99 -171
  965. package/dist/utils/fast-json-patch/src/helpers.cjs.map +1 -0
  966. package/dist/utils/fast-json-patch/src/helpers.js +99 -166
  967. package/dist/utils/fast-json-patch/src/helpers.js.map +1 -0
  968. package/dist/utils/function_calling.cjs +62 -59
  969. package/dist/utils/function_calling.cjs.map +1 -0
  970. package/dist/utils/function_calling.d.cts +43 -0
  971. package/dist/utils/function_calling.d.cts.map +1 -0
  972. package/dist/utils/function_calling.d.ts +22 -15
  973. package/dist/utils/function_calling.d.ts.map +1 -0
  974. package/dist/utils/function_calling.js +51 -50
  975. package/dist/utils/function_calling.js.map +1 -0
  976. package/dist/utils/hash.cjs +21 -7
  977. package/dist/utils/hash.cjs.map +1 -0
  978. package/dist/utils/hash.d.cts +14 -0
  979. package/dist/utils/hash.d.cts.map +1 -0
  980. package/dist/utils/hash.d.ts +9 -3
  981. package/dist/utils/hash.d.ts.map +1 -0
  982. package/dist/utils/hash.js +14 -2
  983. package/dist/utils/hash.js.map +1 -0
  984. package/dist/utils/js-sha1/hash.cjs +272 -356
  985. package/dist/utils/js-sha1/hash.cjs.map +1 -0
  986. package/dist/utils/js-sha1/hash.d.cts +9 -0
  987. package/dist/utils/js-sha1/hash.d.cts.map +1 -0
  988. package/dist/utils/js-sha1/hash.d.ts +5 -1
  989. package/dist/utils/js-sha1/hash.d.ts.map +1 -0
  990. package/dist/utils/js-sha1/hash.js +268 -356
  991. package/dist/utils/js-sha1/hash.js.map +1 -0
  992. package/dist/utils/js-sha256/hash.cjs +332 -430
  993. package/dist/utils/js-sha256/hash.cjs.map +1 -0
  994. package/dist/utils/js-sha256/hash.d.cts +5 -0
  995. package/dist/utils/js-sha256/hash.d.cts.map +1 -0
  996. package/dist/utils/js-sha256/hash.d.ts +5 -1
  997. package/dist/utils/js-sha256/hash.d.ts.map +1 -0
  998. package/dist/utils/js-sha256/hash.js +328 -430
  999. package/dist/utils/js-sha256/hash.js.map +1 -0
  1000. package/dist/utils/json.cjs +47 -101
  1001. package/dist/utils/json.cjs.map +1 -0
  1002. package/dist/utils/json.d.cts +8 -0
  1003. package/dist/utils/json.d.cts.map +1 -0
  1004. package/dist/utils/json.d.ts +8 -2
  1005. package/dist/utils/json.d.ts.map +1 -0
  1006. package/dist/utils/json.js +47 -99
  1007. package/dist/utils/json.js.map +1 -0
  1008. package/dist/utils/json_patch.cjs +22 -6
  1009. package/dist/utils/json_patch.cjs.map +1 -0
  1010. package/dist/utils/json_patch.d.cts +3 -0
  1011. package/dist/utils/json_patch.d.ts +3 -1
  1012. package/dist/utils/json_patch.js +15 -1
  1013. package/dist/utils/json_patch.js.map +1 -0
  1014. package/dist/utils/json_schema.cjs +77 -92
  1015. package/dist/utils/json_schema.cjs.map +1 -0
  1016. package/dist/utils/json_schema.d.cts +28 -0
  1017. package/dist/utils/json_schema.d.cts.map +1 -0
  1018. package/dist/utils/json_schema.d.ts +15 -6
  1019. package/dist/utils/json_schema.d.ts.map +1 -0
  1020. package/dist/utils/json_schema.js +58 -85
  1021. package/dist/utils/json_schema.js.map +1 -0
  1022. package/dist/utils/math.cjs +112 -108
  1023. package/dist/utils/math.cjs.map +1 -0
  1024. package/dist/utils/math.d.cts +43 -0
  1025. package/dist/utils/math.d.cts.map +1 -0
  1026. package/dist/utils/math.d.ts +10 -7
  1027. package/dist/utils/math.d.ts.map +1 -0
  1028. package/dist/utils/math.js +103 -102
  1029. package/dist/utils/math.js.map +1 -0
  1030. package/dist/utils/ml-distance/distances.cjs +15 -14
  1031. package/dist/utils/ml-distance/distances.cjs.map +1 -0
  1032. package/dist/utils/ml-distance/distances.js +15 -12
  1033. package/dist/utils/ml-distance/distances.js.map +1 -0
  1034. package/dist/utils/ml-distance/similarities.cjs +20 -17
  1035. package/dist/utils/ml-distance/similarities.cjs.map +1 -0
  1036. package/dist/utils/ml-distance/similarities.d.cts +11 -0
  1037. package/dist/utils/ml-distance/similarities.d.cts.map +1 -0
  1038. package/dist/utils/ml-distance/similarities.d.ts +5 -1
  1039. package/dist/utils/ml-distance/similarities.d.ts.map +1 -0
  1040. package/dist/utils/ml-distance/similarities.js +20 -15
  1041. package/dist/utils/ml-distance/similarities.js.map +1 -0
  1042. package/dist/utils/ml-distance-euclidean/euclidean.cjs +10 -10
  1043. package/dist/utils/ml-distance-euclidean/euclidean.cjs.map +1 -0
  1044. package/dist/utils/ml-distance-euclidean/euclidean.js +11 -8
  1045. package/dist/utils/ml-distance-euclidean/euclidean.js.map +1 -0
  1046. package/dist/utils/sax-js/sax.cjs +1206 -1556
  1047. package/dist/utils/sax-js/sax.cjs.map +1 -0
  1048. package/dist/utils/sax-js/sax.js +1205 -1553
  1049. package/dist/utils/sax-js/sax.js.map +1 -0
  1050. package/dist/utils/signal.cjs +39 -27
  1051. package/dist/utils/signal.cjs.map +1 -0
  1052. package/dist/utils/signal.js +38 -25
  1053. package/dist/utils/signal.js.map +1 -0
  1054. package/dist/utils/stream.cjs +186 -268
  1055. package/dist/utils/stream.cjs.map +1 -0
  1056. package/dist/utils/stream.d.cts +54 -0
  1057. package/dist/utils/stream.d.cts.map +1 -0
  1058. package/dist/utils/stream.d.ts +49 -33
  1059. package/dist/utils/stream.d.ts.map +1 -0
  1060. package/dist/utils/stream.js +177 -261
  1061. package/dist/utils/stream.js.map +1 -0
  1062. package/dist/utils/testing/index.cjs +664 -888
  1063. package/dist/utils/testing/index.cjs.map +1 -0
  1064. package/dist/utils/testing/index.d.cts +383 -0
  1065. package/dist/utils/testing/index.d.cts.map +1 -0
  1066. package/dist/utils/testing/index.d.ts +280 -250
  1067. package/dist/utils/testing/index.d.ts.map +1 -0
  1068. package/dist/utils/testing/index.js +639 -865
  1069. package/dist/utils/testing/index.js.map +1 -0
  1070. package/dist/utils/tiktoken.cjs +28 -19
  1071. package/dist/utils/tiktoken.cjs.map +1 -0
  1072. package/dist/utils/tiktoken.d.cts +8 -0
  1073. package/dist/utils/tiktoken.d.cts.map +1 -0
  1074. package/dist/utils/tiktoken.d.ts +7 -2
  1075. package/dist/utils/tiktoken.d.ts.map +1 -0
  1076. package/dist/utils/tiktoken.js +22 -16
  1077. package/dist/utils/tiktoken.js.map +1 -0
  1078. package/dist/utils/types/index.cjs +60 -17
  1079. package/dist/utils/types/index.cjs.map +1 -0
  1080. package/dist/utils/types/index.d.cts +16 -0
  1081. package/dist/utils/types/index.d.cts.map +1 -0
  1082. package/dist/utils/types/index.d.ts +13 -5
  1083. package/dist/utils/types/index.d.ts.map +1 -0
  1084. package/dist/utils/types/index.js +33 -1
  1085. package/dist/utils/types/index.js.map +1 -0
  1086. package/dist/utils/types/zod.cjs +376 -554
  1087. package/dist/utils/types/zod.cjs.map +1 -0
  1088. package/dist/utils/types/zod.d.cts +213 -0
  1089. package/dist/utils/types/zod.d.cts.map +1 -0
  1090. package/dist/utils/types/zod.d.ts +49 -48
  1091. package/dist/utils/types/zod.d.ts.map +1 -0
  1092. package/dist/utils/types/zod.js +376 -552
  1093. package/dist/utils/types/zod.js.map +1 -0
  1094. package/dist/vectorstores.cjs +391 -424
  1095. package/dist/vectorstores.cjs.map +1 -0
  1096. package/dist/vectorstores.d.cts +661 -0
  1097. package/dist/vectorstores.d.cts.map +1 -0
  1098. package/dist/vectorstores.d.ts +488 -471
  1099. package/dist/vectorstores.d.ts.map +1 -0
  1100. package/dist/vectorstores.js +383 -418
  1101. package/dist/vectorstores.js.map +1 -0
  1102. package/package.json +536 -654
  1103. package/agents.cjs +0 -1
  1104. package/agents.d.cts +0 -1
  1105. package/agents.d.ts +0 -1
  1106. package/agents.js +0 -1
  1107. package/caches.cjs +0 -1
  1108. package/caches.d.cts +0 -1
  1109. package/caches.d.ts +0 -1
  1110. package/caches.js +0 -1
  1111. package/callbacks/base.cjs +0 -1
  1112. package/callbacks/base.d.cts +0 -1
  1113. package/callbacks/base.d.ts +0 -1
  1114. package/callbacks/base.js +0 -1
  1115. package/callbacks/dispatch/web.cjs +0 -1
  1116. package/callbacks/dispatch/web.d.cts +0 -1
  1117. package/callbacks/dispatch/web.d.ts +0 -1
  1118. package/callbacks/dispatch/web.js +0 -1
  1119. package/callbacks/dispatch.cjs +0 -1
  1120. package/callbacks/dispatch.d.cts +0 -1
  1121. package/callbacks/dispatch.d.ts +0 -1
  1122. package/callbacks/dispatch.js +0 -1
  1123. package/callbacks/manager.cjs +0 -1
  1124. package/callbacks/manager.d.cts +0 -1
  1125. package/callbacks/manager.d.ts +0 -1
  1126. package/callbacks/manager.js +0 -1
  1127. package/callbacks/promises.cjs +0 -1
  1128. package/callbacks/promises.d.cts +0 -1
  1129. package/callbacks/promises.d.ts +0 -1
  1130. package/callbacks/promises.js +0 -1
  1131. package/chat_history.cjs +0 -1
  1132. package/chat_history.d.cts +0 -1
  1133. package/chat_history.d.ts +0 -1
  1134. package/chat_history.js +0 -1
  1135. package/context.cjs +0 -1
  1136. package/context.d.cts +0 -1
  1137. package/context.d.ts +0 -1
  1138. package/context.js +0 -1
  1139. package/dist/errors/index.d.ts +0 -2
  1140. package/dist/load/import_constants.d.ts +0 -1
  1141. package/dist/load/import_map.d.ts +0 -43
  1142. package/dist/load/import_type.cjs +0 -3
  1143. package/dist/load/import_type.js +0 -2
  1144. package/dist/messages/content_blocks.cjs +0 -165
  1145. package/dist/messages/content_blocks.d.ts +0 -151
  1146. package/dist/messages/content_blocks.js +0 -154
  1147. package/dist/prompts/serde.cjs +0 -2
  1148. package/dist/prompts/serde.js +0 -1
  1149. package/dist/runnables/graph_mermaid.d.ts +0 -18
  1150. package/dist/runnables/iter.d.ts +0 -6
  1151. package/dist/runnables/types.cjs +0 -2
  1152. package/dist/runnables/types.js +0 -1
  1153. package/dist/runnables/utils.d.ts +0 -27
  1154. package/dist/runnables/wrappers.d.ts +0 -2
  1155. package/dist/singletons/tracer.d.ts +0 -3
  1156. package/dist/tracers/root_listener.d.ts +0 -25
  1157. package/dist/types/_internal.cjs +0 -2
  1158. package/dist/types/_internal.js +0 -1
  1159. package/dist/types/type-utils.cjs +0 -2
  1160. package/dist/types/type-utils.js +0 -1
  1161. package/dist/utils/callbacks.d.ts +0 -1
  1162. package/dist/utils/fast-json-patch/index.d.ts +0 -22
  1163. package/dist/utils/fast-json-patch/src/helpers.d.ts +0 -36
  1164. package/dist/utils/ml-distance/distances.d.ts +0 -8
  1165. package/dist/utils/ml-distance-euclidean/euclidean.d.ts +0 -2
  1166. package/dist/utils/sax-js/sax.d.ts +0 -2
  1167. package/dist/utils/signal.d.ts +0 -1
  1168. package/dist/utils/testing/helpers.cjs +0 -7
  1169. package/dist/utils/testing/helpers.d.ts +0 -3
  1170. package/dist/utils/testing/helpers.js +0 -3
  1171. package/document_loaders/base.cjs +0 -1
  1172. package/document_loaders/base.d.cts +0 -1
  1173. package/document_loaders/base.d.ts +0 -1
  1174. package/document_loaders/base.js +0 -1
  1175. package/document_loaders/langsmith.cjs +0 -1
  1176. package/document_loaders/langsmith.d.cts +0 -1
  1177. package/document_loaders/langsmith.d.ts +0 -1
  1178. package/document_loaders/langsmith.js +0 -1
  1179. package/documents.cjs +0 -1
  1180. package/documents.d.cts +0 -1
  1181. package/documents.d.ts +0 -1
  1182. package/documents.js +0 -1
  1183. package/embeddings.cjs +0 -1
  1184. package/embeddings.d.cts +0 -1
  1185. package/embeddings.d.ts +0 -1
  1186. package/embeddings.js +0 -1
  1187. package/example_selectors.cjs +0 -1
  1188. package/example_selectors.d.cts +0 -1
  1189. package/example_selectors.d.ts +0 -1
  1190. package/example_selectors.js +0 -1
  1191. package/indexing.cjs +0 -1
  1192. package/indexing.d.cts +0 -1
  1193. package/indexing.d.ts +0 -1
  1194. package/indexing.js +0 -1
  1195. package/language_models/base.cjs +0 -1
  1196. package/language_models/base.d.cts +0 -1
  1197. package/language_models/base.d.ts +0 -1
  1198. package/language_models/base.js +0 -1
  1199. package/language_models/chat_models.cjs +0 -1
  1200. package/language_models/chat_models.d.cts +0 -1
  1201. package/language_models/chat_models.d.ts +0 -1
  1202. package/language_models/chat_models.js +0 -1
  1203. package/language_models/llms.cjs +0 -1
  1204. package/language_models/llms.d.cts +0 -1
  1205. package/language_models/llms.d.ts +0 -1
  1206. package/language_models/llms.js +0 -1
  1207. package/load/serializable.cjs +0 -1
  1208. package/load/serializable.d.cts +0 -1
  1209. package/load/serializable.d.ts +0 -1
  1210. package/load/serializable.js +0 -1
  1211. package/load.cjs +0 -1
  1212. package/load.d.cts +0 -1
  1213. package/load.d.ts +0 -1
  1214. package/load.js +0 -1
  1215. package/memory.cjs +0 -1
  1216. package/memory.d.cts +0 -1
  1217. package/memory.d.ts +0 -1
  1218. package/memory.js +0 -1
  1219. package/messages/tool.cjs +0 -1
  1220. package/messages/tool.d.cts +0 -1
  1221. package/messages/tool.d.ts +0 -1
  1222. package/messages/tool.js +0 -1
  1223. package/messages.cjs +0 -1
  1224. package/messages.d.cts +0 -1
  1225. package/messages.d.ts +0 -1
  1226. package/messages.js +0 -1
  1227. package/output_parsers/openai_functions.cjs +0 -1
  1228. package/output_parsers/openai_functions.d.cts +0 -1
  1229. package/output_parsers/openai_functions.d.ts +0 -1
  1230. package/output_parsers/openai_functions.js +0 -1
  1231. package/output_parsers/openai_tools.cjs +0 -1
  1232. package/output_parsers/openai_tools.d.cts +0 -1
  1233. package/output_parsers/openai_tools.d.ts +0 -1
  1234. package/output_parsers/openai_tools.js +0 -1
  1235. package/output_parsers.cjs +0 -1
  1236. package/output_parsers.d.cts +0 -1
  1237. package/output_parsers.d.ts +0 -1
  1238. package/output_parsers.js +0 -1
  1239. package/outputs.cjs +0 -1
  1240. package/outputs.d.cts +0 -1
  1241. package/outputs.d.ts +0 -1
  1242. package/outputs.js +0 -1
  1243. package/prompt_values.cjs +0 -1
  1244. package/prompt_values.d.cts +0 -1
  1245. package/prompt_values.d.ts +0 -1
  1246. package/prompt_values.js +0 -1
  1247. package/prompts.cjs +0 -1
  1248. package/prompts.d.cts +0 -1
  1249. package/prompts.d.ts +0 -1
  1250. package/prompts.js +0 -1
  1251. package/retrievers/document_compressors.cjs +0 -1
  1252. package/retrievers/document_compressors.d.cts +0 -1
  1253. package/retrievers/document_compressors.d.ts +0 -1
  1254. package/retrievers/document_compressors.js +0 -1
  1255. package/retrievers.cjs +0 -1
  1256. package/retrievers.d.cts +0 -1
  1257. package/retrievers.d.ts +0 -1
  1258. package/retrievers.js +0 -1
  1259. package/runnables/graph.cjs +0 -1
  1260. package/runnables/graph.d.cts +0 -1
  1261. package/runnables/graph.d.ts +0 -1
  1262. package/runnables/graph.js +0 -1
  1263. package/runnables/remote.cjs +0 -1
  1264. package/runnables/remote.d.cts +0 -1
  1265. package/runnables/remote.d.ts +0 -1
  1266. package/runnables/remote.js +0 -1
  1267. package/runnables.cjs +0 -1
  1268. package/runnables.d.cts +0 -1
  1269. package/runnables.d.ts +0 -1
  1270. package/runnables.js +0 -1
  1271. package/singletons.cjs +0 -1
  1272. package/singletons.d.cts +0 -1
  1273. package/singletons.d.ts +0 -1
  1274. package/singletons.js +0 -1
  1275. package/stores.cjs +0 -1
  1276. package/stores.d.cts +0 -1
  1277. package/stores.d.ts +0 -1
  1278. package/stores.js +0 -1
  1279. package/structured_query.cjs +0 -1
  1280. package/structured_query.d.cts +0 -1
  1281. package/structured_query.d.ts +0 -1
  1282. package/structured_query.js +0 -1
  1283. package/tools.cjs +0 -1
  1284. package/tools.d.cts +0 -1
  1285. package/tools.d.ts +0 -1
  1286. package/tools.js +0 -1
  1287. package/tracers/base.cjs +0 -1
  1288. package/tracers/base.d.cts +0 -1
  1289. package/tracers/base.d.ts +0 -1
  1290. package/tracers/base.js +0 -1
  1291. package/tracers/console.cjs +0 -1
  1292. package/tracers/console.d.cts +0 -1
  1293. package/tracers/console.d.ts +0 -1
  1294. package/tracers/console.js +0 -1
  1295. package/tracers/initialize.cjs +0 -1
  1296. package/tracers/initialize.d.cts +0 -1
  1297. package/tracers/initialize.d.ts +0 -1
  1298. package/tracers/initialize.js +0 -1
  1299. package/tracers/log_stream.cjs +0 -1
  1300. package/tracers/log_stream.d.cts +0 -1
  1301. package/tracers/log_stream.d.ts +0 -1
  1302. package/tracers/log_stream.js +0 -1
  1303. package/tracers/run_collector.cjs +0 -1
  1304. package/tracers/run_collector.d.cts +0 -1
  1305. package/tracers/run_collector.d.ts +0 -1
  1306. package/tracers/run_collector.js +0 -1
  1307. package/tracers/tracer_langchain.cjs +0 -1
  1308. package/tracers/tracer_langchain.d.cts +0 -1
  1309. package/tracers/tracer_langchain.d.ts +0 -1
  1310. package/tracers/tracer_langchain.js +0 -1
  1311. package/tracers/tracer_langchain_v1.cjs +0 -1
  1312. package/tracers/tracer_langchain_v1.d.cts +0 -1
  1313. package/tracers/tracer_langchain_v1.d.ts +0 -1
  1314. package/tracers/tracer_langchain_v1.js +0 -1
  1315. package/types/stream.cjs +0 -1
  1316. package/types/stream.d.cts +0 -1
  1317. package/types/stream.d.ts +0 -1
  1318. package/types/stream.js +0 -1
  1319. package/utils/async_caller.cjs +0 -1
  1320. package/utils/async_caller.d.cts +0 -1
  1321. package/utils/async_caller.d.ts +0 -1
  1322. package/utils/async_caller.js +0 -1
  1323. package/utils/chunk_array.cjs +0 -1
  1324. package/utils/chunk_array.d.cts +0 -1
  1325. package/utils/chunk_array.d.ts +0 -1
  1326. package/utils/chunk_array.js +0 -1
  1327. package/utils/env.cjs +0 -1
  1328. package/utils/env.d.cts +0 -1
  1329. package/utils/env.d.ts +0 -1
  1330. package/utils/env.js +0 -1
  1331. package/utils/event_source_parse.cjs +0 -1
  1332. package/utils/event_source_parse.d.cts +0 -1
  1333. package/utils/event_source_parse.d.ts +0 -1
  1334. package/utils/event_source_parse.js +0 -1
  1335. package/utils/function_calling.cjs +0 -1
  1336. package/utils/function_calling.d.cts +0 -1
  1337. package/utils/function_calling.d.ts +0 -1
  1338. package/utils/function_calling.js +0 -1
  1339. package/utils/hash/insecure.cjs +0 -1
  1340. package/utils/hash/insecure.d.cts +0 -1
  1341. package/utils/hash/insecure.d.ts +0 -1
  1342. package/utils/hash/insecure.js +0 -1
  1343. package/utils/hash/sha256.cjs +0 -1
  1344. package/utils/hash/sha256.d.cts +0 -1
  1345. package/utils/hash/sha256.d.ts +0 -1
  1346. package/utils/hash/sha256.js +0 -1
  1347. package/utils/hash.cjs +0 -1
  1348. package/utils/hash.d.cts +0 -1
  1349. package/utils/hash.d.ts +0 -1
  1350. package/utils/hash.js +0 -1
  1351. package/utils/json_patch.cjs +0 -1
  1352. package/utils/json_patch.d.cts +0 -1
  1353. package/utils/json_patch.d.ts +0 -1
  1354. package/utils/json_patch.js +0 -1
  1355. package/utils/json_schema.cjs +0 -1
  1356. package/utils/json_schema.d.cts +0 -1
  1357. package/utils/json_schema.d.ts +0 -1
  1358. package/utils/json_schema.js +0 -1
  1359. package/utils/math.cjs +0 -1
  1360. package/utils/math.d.cts +0 -1
  1361. package/utils/math.d.ts +0 -1
  1362. package/utils/math.js +0 -1
  1363. package/utils/stream.cjs +0 -1
  1364. package/utils/stream.d.cts +0 -1
  1365. package/utils/stream.d.ts +0 -1
  1366. package/utils/stream.js +0 -1
  1367. package/utils/testing.cjs +0 -1
  1368. package/utils/testing.d.cts +0 -1
  1369. package/utils/testing.d.ts +0 -1
  1370. package/utils/testing.js +0 -1
  1371. package/utils/tiktoken.cjs +0 -1
  1372. package/utils/tiktoken.d.cts +0 -1
  1373. package/utils/tiktoken.d.ts +0 -1
  1374. package/utils/tiktoken.js +0 -1
  1375. package/utils/types.cjs +0 -1
  1376. package/utils/types.d.cts +0 -1
  1377. package/utils/types.d.ts +0 -1
  1378. package/utils/types.js +0 -1
  1379. package/vectorstores.cjs +0 -1
  1380. package/vectorstores.d.cts +0 -1
  1381. package/vectorstores.d.ts +0 -1
  1382. package/vectorstores.js +0 -1
package/README.md CHANGED
@@ -8,7 +8,7 @@ chat models, vectorstores, retrievers, and runnables.
8
8
  ## 💾 Quick Install
9
9
 
10
10
  ```bash
11
- $ yarn add @langchain/core
11
+ $ pnpm install @langchain/core
12
12
  ```
13
13
 
14
14
  ## 🤔 What is this?
@@ -21,7 +21,7 @@ The benefit of having these abstractions is that any provider can implement the
21
21
  For example, you can install other provider-specific packages like this:
22
22
 
23
23
  ```bash
24
- $ yarn add @langchain/openai
24
+ $ pnpm install @langchain/openai
25
25
  ```
26
26
 
27
27
  And use them as follows:
@@ -135,7 +135,7 @@ Because all used packages must share the same version of core, packages should n
135
135
  This recommendation will change to a caret once a major version (1.x.x) release has occurred.
136
136
 
137
137
  We suggest making all packages cross-compatible with ESM and CJS using a build step like the one in
138
- [@langchain/anthropic](https://github.com/langchain-ai/langchainjs/tree/main/libs/langchain-anthropic), then running `yarn build` before running `npm publish`.
138
+ [@langchain/anthropic](https://github.com/langchain-ai/langchainjs/tree/main/libs/langchain-anthropic), then running `pnpm build` before running `npm publish`.
139
139
 
140
140
  We will be exploring how to make this process easier in the future.
141
141
 
@@ -0,0 +1,32 @@
1
+ //#region rolldown:runtime
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all) __defProp(target, name, {
10
+ get: all[name],
11
+ enumerable: true
12
+ });
13
+ };
14
+ var __copyProps = (to, from, except, desc) => {
15
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
16
+ key = keys[i];
17
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
18
+ get: ((k) => from[k]).bind(null, key),
19
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
20
+ });
21
+ }
22
+ return to;
23
+ };
24
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
25
+ value: mod,
26
+ enumerable: true
27
+ }) : target, mod));
28
+
29
+ //#endregion
30
+
31
+ exports.__export = __export;
32
+ exports.__toESM = __toESM;
@@ -0,0 +1,11 @@
1
+ //#region rolldown:runtime
2
+ var __defProp = Object.defineProperty;
3
+ var __export = (target, all) => {
4
+ for (var name in all) __defProp(target, name, {
5
+ get: all[name],
6
+ enumerable: true
7
+ });
8
+ };
9
+
10
+ //#endregion
11
+ export { __export };
package/dist/agents.cjs CHANGED
@@ -1,2 +1,12 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+
2
+ //#region src/agents.ts
3
+ var agents_exports = {};
4
+
5
+ //#endregion
6
+ Object.defineProperty(exports, 'agents_exports', {
7
+ enumerable: true,
8
+ get: function () {
9
+ return agents_exports;
10
+ }
11
+ });
12
+ //# sourceMappingURL=agents.cjs.map
@@ -0,0 +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":""}
@@ -0,0 +1,19 @@
1
+ //#region src/agents.d.ts
2
+ type AgentAction = {
3
+ tool: string;
4
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
5
+ toolInput: string | Record<string, any>;
6
+ log: string;
7
+ };
8
+ type AgentFinish = {
9
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
10
+ returnValues: Record<string, any>;
11
+ log: string;
12
+ };
13
+ type AgentStep = {
14
+ action: AgentAction;
15
+ observation: string;
16
+ };
17
+ //#endregion
18
+ export { AgentAction, AgentFinish, AgentStep };
19
+ //# sourceMappingURL=agents.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agents.d.cts","names":["AgentAction","Record","AgentFinish","AgentStep"],"sources":["../src/agents.d.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};\nexport type AgentFinish = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n returnValues: Record<string, any>;\n log: string;\n};\nexport type AgentStep = {\n action: AgentAction;\n observation: string;\n};\n"],"mappings":";KAAYA,WAAAA;EAAAA,IAAAA,EAAAA,MAAAA;EAMAE;EAKAC,SAAAA,EAAAA,MAAS,GARGF,MASZD,CAAAA,MAAW,EAAA,GAAA,CAAA;;;KANXE,WAAAA;;gBAEMD;;;KAGNE,SAAAA;UACAH"}
package/dist/agents.d.ts CHANGED
@@ -1,13 +1,19 @@
1
- export type AgentAction = {
2
- tool: string;
3
- toolInput: string | Record<string, any>;
4
- log: string;
1
+ //#region src/agents.d.ts
2
+ type AgentAction = {
3
+ tool: string;
4
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
5
+ toolInput: string | Record<string, any>;
6
+ log: string;
5
7
  };
6
- export type AgentFinish = {
7
- returnValues: Record<string, any>;
8
- log: string;
8
+ type AgentFinish = {
9
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
10
+ returnValues: Record<string, any>;
11
+ log: string;
9
12
  };
10
- export type AgentStep = {
11
- action: AgentAction;
12
- observation: string;
13
+ type AgentStep = {
14
+ action: AgentAction;
15
+ observation: string;
13
16
  };
17
+ //#endregion
18
+ export { AgentAction, AgentFinish, AgentStep };
19
+ //# sourceMappingURL=agents.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agents.d.ts","names":["AgentAction","Record","AgentFinish","AgentStep"],"sources":["../src/agents.d.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};\nexport type AgentFinish = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n returnValues: Record<string, any>;\n log: string;\n};\nexport type AgentStep = {\n action: AgentAction;\n observation: string;\n};\n"],"mappings":";KAAYA,WAAAA;EAAAA,IAAAA,EAAAA,MAAAA;EAMAE;EAKAC,SAAAA,EAAAA,MAAS,GARGF,MASZD,CAAAA,MAAAA,EAAW,GAAA,CAAA;;;KANXE,WAAAA;;gBAEMD;;;KAGNE,SAAAA;UACAH"}
package/dist/agents.js CHANGED
@@ -1 +1,6 @@
1
- export {};
1
+ //#region src/agents.ts
2
+ var agents_exports = {};
3
+
4
+ //#endregion
5
+ export { agents_exports };
6
+ //# sourceMappingURL=agents.js.map
@@ -0,0 +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,112 +1,107 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.InMemoryCache = exports.BaseCache = exports.getCacheKey = void 0;
4
- exports.deserializeStoredGeneration = deserializeStoredGeneration;
5
- exports.serializeGeneration = serializeGeneration;
6
- const hash_js_1 = require("../utils/hash.cjs");
7
- const utils_js_1 = require("../messages/utils.cjs");
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ const require_utils = require('../messages/utils.cjs');
3
+ const require_utils_js_sha1_hash = require('../utils/js-sha1/hash.cjs');
4
+ require('../utils/hash.cjs');
5
+
6
+ //#region src/caches/base.ts
7
+ var base_exports = {};
8
+ require_rolldown_runtime.__export(base_exports, {
9
+ BaseCache: () => BaseCache,
10
+ InMemoryCache: () => InMemoryCache,
11
+ deserializeStoredGeneration: () => deserializeStoredGeneration,
12
+ getCacheKey: () => getCacheKey,
13
+ serializeGeneration: () => serializeGeneration
14
+ });
8
15
  /**
9
- * This cache key should be consistent across all versions of LangChain.
10
- * It is currently NOT consistent across versions of LangChain.
11
- *
12
- * A huge benefit of having a remote cache (like redis) is that you can
13
- * access the cache from different processes/machines. The allows you to
14
- * separate concerns and scale horizontally.
15
- *
16
- * TODO: Make cache key consistent across versions of LangChain.
17
- *
18
- * @deprecated Use `makeDefaultKeyEncoder()` to create a custom key encoder.
19
- * This function will be removed in a future version.
20
- */
21
- const getCacheKey = (...strings) => (0, hash_js_1.insecureHash)(strings.join("_"));
22
- exports.getCacheKey = getCacheKey;
16
+ * This cache key should be consistent across all versions of LangChain.
17
+ * It is currently NOT consistent across versions of LangChain.
18
+ *
19
+ * A huge benefit of having a remote cache (like redis) is that you can
20
+ * access the cache from different processes/machines. The allows you to
21
+ * separate concerns and scale horizontally.
22
+ *
23
+ * TODO: Make cache key consistent across versions of LangChain.
24
+ *
25
+ * @deprecated Use `makeDefaultKeyEncoder()` to create a custom key encoder.
26
+ * This function will be removed in a future version.
27
+ */
28
+ const getCacheKey = (...strings) => require_utils_js_sha1_hash.insecureHash(strings.join("_"));
23
29
  function deserializeStoredGeneration(storedGeneration) {
24
- if (storedGeneration.message !== undefined) {
25
- return {
26
- text: storedGeneration.text,
27
- message: (0, utils_js_1.mapStoredMessageToChatMessage)(storedGeneration.message),
28
- };
29
- }
30
- else {
31
- return { text: storedGeneration.text };
32
- }
30
+ if (storedGeneration.message !== void 0) return {
31
+ text: storedGeneration.text,
32
+ message: require_utils.mapStoredMessageToChatMessage(storedGeneration.message)
33
+ };
34
+ else return { text: storedGeneration.text };
33
35
  }
34
36
  function serializeGeneration(generation) {
35
- const serializedValue = {
36
- text: generation.text,
37
- };
38
- if (generation.message !== undefined) {
39
- serializedValue.message = generation.message.toDict();
40
- }
41
- return serializedValue;
37
+ const serializedValue = { text: generation.text };
38
+ if (generation.message !== void 0) serializedValue.message = generation.message.toDict();
39
+ return serializedValue;
42
40
  }
43
41
  /**
44
- * Base class for all caches. All caches should extend this class.
45
- */
46
- class BaseCache {
47
- constructor() {
48
- // For backwards compatibility, we use a default key encoder
49
- // that uses SHA-1 to hash the prompt and LLM key. This will also print a warning
50
- // about the security implications of using SHA-1 as a cache key.
51
- Object.defineProperty(this, "keyEncoder", {
52
- enumerable: true,
53
- configurable: true,
54
- writable: true,
55
- value: exports.getCacheKey
56
- });
57
- }
58
- /**
59
- * Sets a custom key encoder function for the cache.
60
- * This function should take a prompt and an LLM key and return a string
61
- * that will be used as the cache key.
62
- * @param keyEncoderFn The custom key encoder function.
63
- */
64
- makeDefaultKeyEncoder(keyEncoderFn) {
65
- this.keyEncoder = keyEncoderFn;
66
- }
67
- }
68
- exports.BaseCache = BaseCache;
69
- const GLOBAL_MAP = new Map();
42
+ * Base class for all caches. All caches should extend this class.
43
+ */
44
+ var BaseCache = class {
45
+ keyEncoder = getCacheKey;
46
+ /**
47
+ * Sets a custom key encoder function for the cache.
48
+ * This function should take a prompt and an LLM key and return a string
49
+ * that will be used as the cache key.
50
+ * @param keyEncoderFn The custom key encoder function.
51
+ */
52
+ makeDefaultKeyEncoder(keyEncoderFn) {
53
+ this.keyEncoder = keyEncoderFn;
54
+ }
55
+ };
56
+ const GLOBAL_MAP = /* @__PURE__ */ new Map();
70
57
  /**
71
- * A cache for storing LLM generations that stores data in memory.
72
- */
73
- class InMemoryCache extends BaseCache {
74
- constructor(map) {
75
- super();
76
- Object.defineProperty(this, "cache", {
77
- enumerable: true,
78
- configurable: true,
79
- writable: true,
80
- value: void 0
81
- });
82
- this.cache = map ?? new Map();
83
- }
84
- /**
85
- * Retrieves data from the cache using a prompt and an LLM key. If the
86
- * data is not found, it returns null.
87
- * @param prompt The prompt used to find the data.
88
- * @param llmKey The LLM key used to find the data.
89
- * @returns The data corresponding to the prompt and LLM key, or null if not found.
90
- */
91
- lookup(prompt, llmKey) {
92
- return Promise.resolve(this.cache.get(this.keyEncoder(prompt, llmKey)) ?? null);
93
- }
94
- /**
95
- * Updates the cache with new data using a prompt and an LLM key.
96
- * @param prompt The prompt used to store the data.
97
- * @param llmKey The LLM key used to store the data.
98
- * @param value The data to be stored.
99
- */
100
- async update(prompt, llmKey, value) {
101
- this.cache.set(this.keyEncoder(prompt, llmKey), value);
102
- }
103
- /**
104
- * Returns a global instance of InMemoryCache using a predefined global
105
- * map as the initial cache.
106
- * @returns A global instance of InMemoryCache.
107
- */
108
- static global() {
109
- return new InMemoryCache(GLOBAL_MAP);
110
- }
111
- }
58
+ * A cache for storing LLM generations that stores data in memory.
59
+ */
60
+ var InMemoryCache = class InMemoryCache extends BaseCache {
61
+ cache;
62
+ constructor(map) {
63
+ super();
64
+ this.cache = map ?? /* @__PURE__ */ new Map();
65
+ }
66
+ /**
67
+ * Retrieves data from the cache using a prompt and an LLM key. If the
68
+ * data is not found, it returns null.
69
+ * @param prompt The prompt used to find the data.
70
+ * @param llmKey The LLM key used to find the data.
71
+ * @returns The data corresponding to the prompt and LLM key, or null if not found.
72
+ */
73
+ lookup(prompt, llmKey) {
74
+ return Promise.resolve(this.cache.get(this.keyEncoder(prompt, llmKey)) ?? null);
75
+ }
76
+ /**
77
+ * Updates the cache with new data using a prompt and an LLM key.
78
+ * @param prompt The prompt used to store the data.
79
+ * @param llmKey The LLM key used to store the data.
80
+ * @param value The data to be stored.
81
+ */
82
+ async update(prompt, llmKey, value) {
83
+ this.cache.set(this.keyEncoder(prompt, llmKey), value);
84
+ }
85
+ /**
86
+ * Returns a global instance of InMemoryCache using a predefined global
87
+ * map as the initial cache.
88
+ * @returns A global instance of InMemoryCache.
89
+ */
90
+ static global() {
91
+ return new InMemoryCache(GLOBAL_MAP);
92
+ }
93
+ };
94
+
95
+ //#endregion
96
+ exports.BaseCache = BaseCache;
112
97
  exports.InMemoryCache = InMemoryCache;
98
+ Object.defineProperty(exports, 'base_exports', {
99
+ enumerable: true,
100
+ get: function () {
101
+ return base_exports;
102
+ }
103
+ });
104
+ exports.deserializeStoredGeneration = deserializeStoredGeneration;
105
+ exports.getCacheKey = getCacheKey;
106
+ exports.serializeGeneration = serializeGeneration;
107
+ //# sourceMappingURL=base.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.cjs","names":["getCacheKey: HashKeyEncoder","insecureHash","storedGeneration: StoredGeneration","mapStoredMessageToChatMessage","generation: Generation","serializedValue: StoredGeneration","keyEncoderFn: HashKeyEncoder","map?: Map<string, T>","prompt: string","llmKey: string","value: T"],"sources":["../../src/caches/base.ts"],"sourcesContent":["import { insecureHash, type HashKeyEncoder } from \"../utils/hash.js\";\nimport type { Generation, ChatGeneration } from \"../outputs.js\";\nimport { mapStoredMessageToChatMessage } from \"../messages/utils.js\";\nimport { type StoredGeneration } from \"../messages/base.js\";\n\n/**\n * This cache key should be consistent across all versions of LangChain.\n * It is currently NOT consistent across versions of LangChain.\n *\n * A huge benefit of having a remote cache (like redis) is that you can\n * access the cache from different processes/machines. The allows you to\n * separate concerns and scale horizontally.\n *\n * TODO: Make cache key consistent across versions of LangChain.\n *\n * @deprecated Use `makeDefaultKeyEncoder()` to create a custom key encoder.\n * This function will be removed in a future version.\n */\nexport const getCacheKey: HashKeyEncoder = (...strings) =>\n insecureHash(strings.join(\"_\"));\n\nexport function deserializeStoredGeneration(\n storedGeneration: StoredGeneration\n) {\n if (storedGeneration.message !== undefined) {\n return {\n text: storedGeneration.text,\n message: mapStoredMessageToChatMessage(storedGeneration.message),\n };\n } else {\n return { text: storedGeneration.text };\n }\n}\n\nexport function serializeGeneration(generation: Generation) {\n const serializedValue: StoredGeneration = {\n text: generation.text,\n };\n if ((generation as ChatGeneration).message !== undefined) {\n serializedValue.message = (generation as ChatGeneration).message.toDict();\n }\n return serializedValue;\n}\n\n/**\n * Base class for all caches. All caches should extend this class.\n */\nexport abstract class BaseCache<T = Generation[]> {\n // For backwards compatibility, we use a default key encoder\n // that uses SHA-1 to hash the prompt and LLM key. This will also print a warning\n // about the security implications of using SHA-1 as a cache key.\n protected keyEncoder: HashKeyEncoder = getCacheKey;\n\n /**\n * Sets a custom key encoder function for the cache.\n * This function should take a prompt and an LLM key and return a string\n * that will be used as the cache key.\n * @param keyEncoderFn The custom key encoder function.\n */\n makeDefaultKeyEncoder(keyEncoderFn: HashKeyEncoder): void {\n this.keyEncoder = keyEncoderFn;\n }\n\n abstract lookup(prompt: string, llmKey: string): Promise<T | null>;\n\n abstract update(prompt: string, llmKey: string, value: T): Promise<void>;\n}\n\nconst GLOBAL_MAP = new Map();\n\n/**\n * A cache for storing LLM generations that stores data in memory.\n */\nexport class InMemoryCache<T = Generation[]> extends BaseCache<T> {\n private cache: Map<string, T>;\n\n constructor(map?: Map<string, T>) {\n super();\n this.cache = map ?? new Map();\n }\n\n /**\n * Retrieves data from the cache using a prompt and an LLM key. If the\n * data is not found, it returns null.\n * @param prompt The prompt used to find the data.\n * @param llmKey The LLM key used to find the data.\n * @returns The data corresponding to the prompt and LLM key, or null if not found.\n */\n lookup(prompt: string, llmKey: string): Promise<T | null> {\n return Promise.resolve(\n this.cache.get(this.keyEncoder(prompt, llmKey)) ?? null\n );\n }\n\n /**\n * Updates the cache with new data using a prompt and an LLM key.\n * @param prompt The prompt used to store the data.\n * @param llmKey The LLM key used to store the data.\n * @param value The data to be stored.\n */\n async update(prompt: string, llmKey: string, value: T): Promise<void> {\n this.cache.set(this.keyEncoder(prompt, llmKey), value);\n }\n\n /**\n * Returns a global instance of InMemoryCache using a predefined global\n * map as the initial cache.\n * @returns A global instance of InMemoryCache.\n */\n static global(): InMemoryCache {\n return new InMemoryCache(GLOBAL_MAP);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,MAAaA,cAA8B,CAAC,GAAG,YAC7CC,wCAAa,QAAQ,KAAK,IAAI,CAAC;AAEjC,SAAgB,4BACdC,kBACA;AACA,KAAI,iBAAiB,YAAY,OAC/B,QAAO;EACL,MAAM,iBAAiB;EACvB,SAASC,4CAA8B,iBAAiB,QAAQ;CACjE;KAED,QAAO,EAAE,MAAM,iBAAiB,KAAM;AAEzC;AAED,SAAgB,oBAAoBC,YAAwB;CAC1D,MAAMC,kBAAoC,EACxC,MAAM,WAAW,KAClB;AACD,KAAK,WAA8B,YAAY,QAC7C,gBAAgB,UAAW,WAA8B,QAAQ,QAAQ;AAE3E,QAAO;AACR;;;;AAKD,IAAsB,YAAtB,MAAkD;CAIhD,AAAU,aAA6B;;;;;;;CAQvC,sBAAsBC,cAAoC;EACxD,KAAK,aAAa;CACnB;AAKF;AAED,MAAM,6BAAa,IAAI;;;;AAKvB,IAAa,gBAAb,MAAa,sBAAwC,UAAa;CAChE,AAAQ;CAER,YAAYC,KAAsB;EAChC,OAAO;EACP,KAAK,QAAQ,uBAAO,IAAI;CACzB;;;;;;;;CASD,OAAOC,QAAgBC,QAAmC;AACxD,SAAO,QAAQ,QACb,KAAK,MAAM,IAAI,KAAK,WAAW,QAAQ,OAAO,CAAC,IAAI,KACpD;CACF;;;;;;;CAQD,MAAM,OAAOD,QAAgBC,QAAgBC,OAAyB;EACpE,KAAK,MAAM,IAAI,KAAK,WAAW,QAAQ,OAAO,EAAE,MAAM;CACvD;;;;;;CAOD,OAAO,SAAwB;AAC7B,SAAO,IAAI,cAAc;CAC1B;AACF"}
@@ -0,0 +1,83 @@
1
+ import { StoredGeneration } from "../messages/base.cjs";
2
+ import { ToolMessage } from "../messages/tool.cjs";
3
+ import { AIMessage } from "../messages/ai.cjs";
4
+ import { ChatMessage } from "../messages/chat.cjs";
5
+ import { FunctionMessage } from "../messages/function.cjs";
6
+ import { HumanMessage } from "../messages/human.cjs";
7
+ import { SystemMessage } from "../messages/system.cjs";
8
+ import { HashKeyEncoder } from "../utils/hash.cjs";
9
+ import { Generation } from "../outputs.cjs";
10
+
11
+ //#region src/caches/base.d.ts
12
+
13
+ /**
14
+ * This cache key should be consistent across all versions of LangChain.
15
+ * It is currently NOT consistent across versions of LangChain.
16
+ *
17
+ * A huge benefit of having a remote cache (like redis) is that you can
18
+ * access the cache from different processes/machines. The allows you to
19
+ * separate concerns and scale horizontally.
20
+ *
21
+ * TODO: Make cache key consistent across versions of LangChain.
22
+ *
23
+ * @deprecated Use `makeDefaultKeyEncoder()` to create a custom key encoder.
24
+ * This function will be removed in a future version.
25
+ */
26
+ declare const getCacheKey: HashKeyEncoder;
27
+ declare function deserializeStoredGeneration(storedGeneration: StoredGeneration): {
28
+ text: string;
29
+ message: AIMessage | ChatMessage | FunctionMessage | HumanMessage | SystemMessage | ToolMessage;
30
+ } | {
31
+ message?: undefined;
32
+ text: string;
33
+ };
34
+ declare function serializeGeneration(generation: Generation): StoredGeneration;
35
+ /**
36
+ * Base class for all caches. All caches should extend this class.
37
+ */
38
+ declare abstract class BaseCache<T = Generation[]> {
39
+ // For backwards compatibility, we use a default key encoder
40
+ // that uses SHA-1 to hash the prompt and LLM key. This will also print a warning
41
+ // about the security implications of using SHA-1 as a cache key.
42
+ protected keyEncoder: HashKeyEncoder;
43
+ /**
44
+ * Sets a custom key encoder function for the cache.
45
+ * This function should take a prompt and an LLM key and return a string
46
+ * that will be used as the cache key.
47
+ * @param keyEncoderFn The custom key encoder function.
48
+ */
49
+ makeDefaultKeyEncoder(keyEncoderFn: HashKeyEncoder): void;
50
+ abstract lookup(prompt: string, llmKey: string): Promise<T | null>;
51
+ abstract update(prompt: string, llmKey: string, value: T): Promise<void>;
52
+ }
53
+ /**
54
+ * A cache for storing LLM generations that stores data in memory.
55
+ */
56
+ declare class InMemoryCache<T = Generation[]> extends BaseCache<T> {
57
+ private cache;
58
+ constructor(map?: Map<string, T>);
59
+ /**
60
+ * Retrieves data from the cache using a prompt and an LLM key. If the
61
+ * data is not found, it returns null.
62
+ * @param prompt The prompt used to find the data.
63
+ * @param llmKey The LLM key used to find the data.
64
+ * @returns The data corresponding to the prompt and LLM key, or null if not found.
65
+ */
66
+ lookup(prompt: string, llmKey: string): Promise<T | null>;
67
+ /**
68
+ * Updates the cache with new data using a prompt and an LLM key.
69
+ * @param prompt The prompt used to store the data.
70
+ * @param llmKey The LLM key used to store the data.
71
+ * @param value The data to be stored.
72
+ */
73
+ update(prompt: string, llmKey: string, value: T): Promise<void>;
74
+ /**
75
+ * Returns a global instance of InMemoryCache using a predefined global
76
+ * map as the initial cache.
77
+ * @returns A global instance of InMemoryCache.
78
+ */
79
+ static global(): InMemoryCache;
80
+ }
81
+ //#endregion
82
+ export { BaseCache, InMemoryCache, deserializeStoredGeneration, getCacheKey, serializeGeneration };
83
+ //# sourceMappingURL=base.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.d.cts","names":["___messages_chat_js0","___messages_function_js0","___messages_human_js0","___messages_system_js0","___messages_tool_js0","HashKeyEncoder","Generation","StoredGeneration","getCacheKey","deserializeStoredGeneration","___messages_ai_js0","AIMessage","ChatMessage","FunctionMessage","HumanMessage","SystemMessage","ToolMessage","serializeGeneration","BaseCache","T","Promise","InMemoryCache","Map"],"sources":["../../src/caches/base.d.ts"],"sourcesContent":["import { type HashKeyEncoder } from \"../utils/hash.js\";\nimport type { Generation } from \"../outputs.js\";\nimport { type StoredGeneration } from \"../messages/base.js\";\n/**\n * This cache key should be consistent across all versions of LangChain.\n * It is currently NOT consistent across versions of LangChain.\n *\n * A huge benefit of having a remote cache (like redis) is that you can\n * access the cache from different processes/machines. The allows you to\n * separate concerns and scale horizontally.\n *\n * TODO: Make cache key consistent across versions of LangChain.\n *\n * @deprecated Use `makeDefaultKeyEncoder()` to create a custom key encoder.\n * This function will be removed in a future version.\n */\nexport declare const getCacheKey: HashKeyEncoder;\nexport declare function deserializeStoredGeneration(storedGeneration: StoredGeneration): {\n text: string;\n message: import(\"../messages/ai.js\").AIMessage | import(\"../messages/chat.js\").ChatMessage | import(\"../messages/function.js\").FunctionMessage | import(\"../messages/human.js\").HumanMessage | import(\"../messages/system.js\").SystemMessage | import(\"../messages/tool.js\").ToolMessage;\n} | {\n message?: undefined;\n text: string;\n};\nexport declare function serializeGeneration(generation: Generation): StoredGeneration;\n/**\n * Base class for all caches. All caches should extend this class.\n */\nexport declare abstract class BaseCache<T = Generation[]> {\n // For backwards compatibility, we use a default key encoder\n // that uses SHA-1 to hash the prompt and LLM key. This will also print a warning\n // about the security implications of using SHA-1 as a cache key.\n protected keyEncoder: HashKeyEncoder;\n /**\n * Sets a custom key encoder function for the cache.\n * This function should take a prompt and an LLM key and return a string\n * that will be used as the cache key.\n * @param keyEncoderFn The custom key encoder function.\n */\n makeDefaultKeyEncoder(keyEncoderFn: HashKeyEncoder): void;\n abstract lookup(prompt: string, llmKey: string): Promise<T | null>;\n abstract update(prompt: string, llmKey: string, value: T): Promise<void>;\n}\n/**\n * A cache for storing LLM generations that stores data in memory.\n */\nexport declare class InMemoryCache<T = Generation[]> extends BaseCache<T> {\n private cache;\n constructor(map?: Map<string, T>);\n /**\n * Retrieves data from the cache using a prompt and an LLM key. If the\n * data is not found, it returns null.\n * @param prompt The prompt used to find the data.\n * @param llmKey The LLM key used to find the data.\n * @returns The data corresponding to the prompt and LLM key, or null if not found.\n */\n lookup(prompt: string, llmKey: string): Promise<T | null>;\n /**\n * Updates the cache with new data using a prompt and an LLM key.\n * @param prompt The prompt used to store the data.\n * @param llmKey The LLM key used to store the data.\n * @param value The data to be stored.\n */\n update(prompt: string, llmKey: string, value: T): Promise<void>;\n /**\n * Returns a global instance of InMemoryCache using a predefined global\n * map as the initial cache.\n * @returns A global instance of InMemoryCache.\n */\n static global(): InMemoryCache;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAgBA;AACA;;;;AAEkD,cAH7BQ,WAG6B,EAHhBH,cAGgB;AAA4C,iBAFtEI,2BAAAA,CAEsE,gBAAA,EAFxBF,gBAEwB,CAAA,EAAA;EAAoD,IAAA,EAAA,MAAA;EAA8C,OAAA,EAF1G,SAAA,GAEpC,WAAA,GAA4C,eAAA,GAAoD,YAAA,GAA8C,aAAA,GAAgD,WAAhD;CAAgD,GAAA;EAA4C,OAAA,CAAA,EAAA,SAAA;EAKpQU,IAAAA,EAAAA,MAAAA;CAAmB;AAAaX,iBAAhCW,mBAAAA,CAAgCX,UAAAA,EAAAA,UAAAA,CAAAA,EAAaC,gBAAbD;;AAA6B;AAIrF;AAAuC,uBAATY,SAAS,CAAA,IAAKZ,UAAL,EAAA,CAAA,CAAA;EAAA;EAAe;EAId;EAOc,UACOa,UAAAA,EARnCd,cAQmCc;EAAC;;;AACQ;AAKtE;;EAAkC,qBAAKb,CAAAA,YAAAA,EAPCD,cAODC,CAAAA,EAAAA,IAAAA;EAAU,SAAsBa,MAAAA,CAAAA,MAAAA,EAAAA,MAAAA,EAAAA,MAAAA,EAAAA,MAAAA,CAAAA,EANlBC,OAMkBD,CANVA,CAMUA,GAAAA,IAAAA,CAAAA;EAAC,SAEtCA,MAAAA,CAAAA,MAAAA,EAAAA,MAAAA,EAAAA,MAAAA,EAAAA,MAAAA,EAAAA,KAAAA,EAPyBA,CAOzBA,CAAAA,EAP6BC,OAO7BD,CAAAA,IAAAA,CAAAA;;;;;AAeoBC,cAjBjCC,aAiBiCD,CAAAA,IAjBfd,UAiBec,EAAAA,CAAAA,SAjBOF,SAiBPE,CAjBiBD,CAiBjBC,CAAAA,CAAAA;EAAO,QAMxCC,KAAAA;EAAa,WAvB2BH,CAAAA,GAAAA,CAAAA,EAEvCI,GAFuCJ,CAAAA,MAAAA,EAE3BC,CAF2BD,CAAAA;EAAS;;;;;;;0CAU1BE,QAAQD;;;;;;;gDAOFA,IAAIC;;;;;;mBAMjCC"}
@@ -1,6 +1,15 @@
1
- import { type HashKeyEncoder } from "../utils/hash.js";
2
- import type { Generation } from "../outputs.js";
3
- import { type StoredGeneration } from "../messages/base.js";
1
+ import { StoredGeneration } from "../messages/base.js";
2
+ import { ToolMessage } from "../messages/tool.js";
3
+ import { AIMessage } from "../messages/ai.js";
4
+ import { ChatMessage } from "../messages/chat.js";
5
+ import { FunctionMessage } from "../messages/function.js";
6
+ import { HumanMessage } from "../messages/human.js";
7
+ import { SystemMessage } from "../messages/system.js";
8
+ import { HashKeyEncoder } from "../utils/hash.js";
9
+ import { Generation } from "../outputs.js";
10
+
11
+ //#region src/caches/base.d.ts
12
+
4
13
  /**
5
14
  * This cache key should be consistent across all versions of LangChain.
6
15
  * It is currently NOT consistent across versions of LangChain.
@@ -14,55 +23,61 @@ import { type StoredGeneration } from "../messages/base.js";
14
23
  * @deprecated Use `makeDefaultKeyEncoder()` to create a custom key encoder.
15
24
  * This function will be removed in a future version.
16
25
  */
17
- export declare const getCacheKey: HashKeyEncoder;
18
- export declare function deserializeStoredGeneration(storedGeneration: StoredGeneration): {
19
- text: string;
20
- message: import("../messages/tool.js").ToolMessage | import("../messages/ai.js").AIMessage | import("../messages/chat.js").ChatMessage | import("../messages/function.js").FunctionMessage | import("../messages/human.js").HumanMessage | import("../messages/system.js").SystemMessage;
26
+ declare const getCacheKey: HashKeyEncoder;
27
+ declare function deserializeStoredGeneration(storedGeneration: StoredGeneration): {
28
+ text: string;
29
+ message: AIMessage | ChatMessage | FunctionMessage | HumanMessage | SystemMessage | ToolMessage;
21
30
  } | {
22
- text: string;
23
- message?: undefined;
31
+ message?: undefined;
32
+ text: string;
24
33
  };
25
- export declare function serializeGeneration(generation: Generation): StoredGeneration;
34
+ declare function serializeGeneration(generation: Generation): StoredGeneration;
26
35
  /**
27
36
  * Base class for all caches. All caches should extend this class.
28
37
  */
29
- export declare abstract class BaseCache<T = Generation[]> {
30
- protected keyEncoder: HashKeyEncoder;
31
- /**
32
- * Sets a custom key encoder function for the cache.
33
- * This function should take a prompt and an LLM key and return a string
34
- * that will be used as the cache key.
35
- * @param keyEncoderFn The custom key encoder function.
36
- */
37
- makeDefaultKeyEncoder(keyEncoderFn: HashKeyEncoder): void;
38
- abstract lookup(prompt: string, llmKey: string): Promise<T | null>;
39
- abstract update(prompt: string, llmKey: string, value: T): Promise<void>;
38
+ declare abstract class BaseCache<T = Generation[]> {
39
+ // For backwards compatibility, we use a default key encoder
40
+ // that uses SHA-1 to hash the prompt and LLM key. This will also print a warning
41
+ // about the security implications of using SHA-1 as a cache key.
42
+ protected keyEncoder: HashKeyEncoder;
43
+ /**
44
+ * Sets a custom key encoder function for the cache.
45
+ * This function should take a prompt and an LLM key and return a string
46
+ * that will be used as the cache key.
47
+ * @param keyEncoderFn The custom key encoder function.
48
+ */
49
+ makeDefaultKeyEncoder(keyEncoderFn: HashKeyEncoder): void;
50
+ abstract lookup(prompt: string, llmKey: string): Promise<T | null>;
51
+ abstract update(prompt: string, llmKey: string, value: T): Promise<void>;
40
52
  }
41
53
  /**
42
54
  * A cache for storing LLM generations that stores data in memory.
43
55
  */
44
- export declare class InMemoryCache<T = Generation[]> extends BaseCache<T> {
45
- private cache;
46
- constructor(map?: Map<string, T>);
47
- /**
48
- * Retrieves data from the cache using a prompt and an LLM key. If the
49
- * data is not found, it returns null.
50
- * @param prompt The prompt used to find the data.
51
- * @param llmKey The LLM key used to find the data.
52
- * @returns The data corresponding to the prompt and LLM key, or null if not found.
53
- */
54
- lookup(prompt: string, llmKey: string): Promise<T | null>;
55
- /**
56
- * Updates the cache with new data using a prompt and an LLM key.
57
- * @param prompt The prompt used to store the data.
58
- * @param llmKey The LLM key used to store the data.
59
- * @param value The data to be stored.
60
- */
61
- update(prompt: string, llmKey: string, value: T): Promise<void>;
62
- /**
63
- * Returns a global instance of InMemoryCache using a predefined global
64
- * map as the initial cache.
65
- * @returns A global instance of InMemoryCache.
66
- */
67
- static global(): InMemoryCache;
56
+ declare class InMemoryCache<T = Generation[]> extends BaseCache<T> {
57
+ private cache;
58
+ constructor(map?: Map<string, T>);
59
+ /**
60
+ * Retrieves data from the cache using a prompt and an LLM key. If the
61
+ * data is not found, it returns null.
62
+ * @param prompt The prompt used to find the data.
63
+ * @param llmKey The LLM key used to find the data.
64
+ * @returns The data corresponding to the prompt and LLM key, or null if not found.
65
+ */
66
+ lookup(prompt: string, llmKey: string): Promise<T | null>;
67
+ /**
68
+ * Updates the cache with new data using a prompt and an LLM key.
69
+ * @param prompt The prompt used to store the data.
70
+ * @param llmKey The LLM key used to store the data.
71
+ * @param value The data to be stored.
72
+ */
73
+ update(prompt: string, llmKey: string, value: T): Promise<void>;
74
+ /**
75
+ * Returns a global instance of InMemoryCache using a predefined global
76
+ * map as the initial cache.
77
+ * @returns A global instance of InMemoryCache.
78
+ */
79
+ static global(): InMemoryCache;
68
80
  }
81
+ //#endregion
82
+ export { BaseCache, InMemoryCache, deserializeStoredGeneration, getCacheKey, serializeGeneration };
83
+ //# sourceMappingURL=base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.d.ts","names":["___messages_chat_js0","___messages_function_js0","___messages_human_js0","___messages_system_js0","___messages_tool_js0","HashKeyEncoder","Generation","StoredGeneration","getCacheKey","deserializeStoredGeneration","___messages_ai_js0","AIMessage","ChatMessage","FunctionMessage","HumanMessage","SystemMessage","ToolMessage","serializeGeneration","BaseCache","T","Promise","InMemoryCache","Map"],"sources":["../../src/caches/base.d.ts"],"sourcesContent":["import { type HashKeyEncoder } from \"../utils/hash.js\";\nimport type { Generation } from \"../outputs.js\";\nimport { type StoredGeneration } from \"../messages/base.js\";\n/**\n * This cache key should be consistent across all versions of LangChain.\n * It is currently NOT consistent across versions of LangChain.\n *\n * A huge benefit of having a remote cache (like redis) is that you can\n * access the cache from different processes/machines. The allows you to\n * separate concerns and scale horizontally.\n *\n * TODO: Make cache key consistent across versions of LangChain.\n *\n * @deprecated Use `makeDefaultKeyEncoder()` to create a custom key encoder.\n * This function will be removed in a future version.\n */\nexport declare const getCacheKey: HashKeyEncoder;\nexport declare function deserializeStoredGeneration(storedGeneration: StoredGeneration): {\n text: string;\n message: import(\"../messages/ai.js\").AIMessage | import(\"../messages/chat.js\").ChatMessage | import(\"../messages/function.js\").FunctionMessage | import(\"../messages/human.js\").HumanMessage | import(\"../messages/system.js\").SystemMessage | import(\"../messages/tool.js\").ToolMessage;\n} | {\n message?: undefined;\n text: string;\n};\nexport declare function serializeGeneration(generation: Generation): StoredGeneration;\n/**\n * Base class for all caches. All caches should extend this class.\n */\nexport declare abstract class BaseCache<T = Generation[]> {\n // For backwards compatibility, we use a default key encoder\n // that uses SHA-1 to hash the prompt and LLM key. This will also print a warning\n // about the security implications of using SHA-1 as a cache key.\n protected keyEncoder: HashKeyEncoder;\n /**\n * Sets a custom key encoder function for the cache.\n * This function should take a prompt and an LLM key and return a string\n * that will be used as the cache key.\n * @param keyEncoderFn The custom key encoder function.\n */\n makeDefaultKeyEncoder(keyEncoderFn: HashKeyEncoder): void;\n abstract lookup(prompt: string, llmKey: string): Promise<T | null>;\n abstract update(prompt: string, llmKey: string, value: T): Promise<void>;\n}\n/**\n * A cache for storing LLM generations that stores data in memory.\n */\nexport declare class InMemoryCache<T = Generation[]> extends BaseCache<T> {\n private cache;\n constructor(map?: Map<string, T>);\n /**\n * Retrieves data from the cache using a prompt and an LLM key. If the\n * data is not found, it returns null.\n * @param prompt The prompt used to find the data.\n * @param llmKey The LLM key used to find the data.\n * @returns The data corresponding to the prompt and LLM key, or null if not found.\n */\n lookup(prompt: string, llmKey: string): Promise<T | null>;\n /**\n * Updates the cache with new data using a prompt and an LLM key.\n * @param prompt The prompt used to store the data.\n * @param llmKey The LLM key used to store the data.\n * @param value The data to be stored.\n */\n update(prompt: string, llmKey: string, value: T): Promise<void>;\n /**\n * Returns a global instance of InMemoryCache using a predefined global\n * map as the initial cache.\n * @returns A global instance of InMemoryCache.\n */\n static global(): InMemoryCache;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAgBA;AACA;;;;AAEkD,cAH7BQ,WAG6B,EAHhBH,cAGgB;AAA4C,iBAFtEI,2BAAAA,CAEsE,gBAAA,EAFxBF,gBAEwB,CAAA,EAAA;EAAoD,IAAA,EAAA,MAAA;EAA8C,OAAA,EAF1G,SAAA,GAEpC,WAAA,GAA4C,eAAA,GAAoD,YAAA,GAA8C,aAAA,GAAgD,WAAhD;CAAgD,GAAA;EAA4C,OAAA,CAAA,EAAA,SAAA;EAKpQU,IAAAA,EAAAA,MAAAA;CAAmB;AAAaX,iBAAhCW,mBAAAA,CAAgCX,UAAAA,EAAAA,UAAAA,CAAAA,EAAaC,gBAAbD;;AAA6B;AAIrF;AAAuC,uBAATY,SAAS,CAAA,IAAKZ,UAAL,EAAA,CAAA,CAAA;EAAA;EAAe;EAId;EAOc,UACOa,UAAAA,EARnCd,cAQmCc;EAAC;;;AACQ;AAKtE;;EAAkC,qBAAKb,CAAAA,YAAAA,EAPCD,cAODC,CAAAA,EAAAA,IAAAA;EAAU,SAAsBa,MAAAA,CAAAA,MAAAA,EAAAA,MAAAA,EAAAA,MAAAA,EAAAA,MAAAA,CAAAA,EANlBC,OAMkBD,CANVA,CAMUA,GAAAA,IAAAA,CAAAA;EAAC,SAEtCA,MAAAA,CAAAA,MAAAA,EAAAA,MAAAA,EAAAA,MAAAA,EAAAA,MAAAA,EAAAA,KAAAA,EAPyBA,CAOzBA,CAAAA,EAP6BC,OAO7BD,CAAAA,IAAAA,CAAAA;;;;;AAeoBC,cAjBjCC,aAiBiCD,CAAAA,IAjBfd,UAiBec,EAAAA,CAAAA,SAjBOF,SAiBPE,CAjBiBD,CAiBjBC,CAAAA,CAAAA;EAAO,QAMxCC,KAAAA;EAAa,WAvB2BH,CAAAA,GAAAA,CAAAA,EAEvCI,GAFuCJ,CAAAA,MAAAA,EAE3BC,CAF2BD,CAAAA;EAAS;;;;;;;0CAU1BE,QAAQD;;;;;;;gDAOFA,IAAIC;;;;;;mBAMjCC"}