@langchain/classic 1.0.17 → 1.0.18

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 (1628) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/_virtual/{rolldown_runtime.cjs → _rolldown/runtime.cjs} +24 -13
  3. package/dist/_virtual/_rolldown/runtime.js +36 -0
  4. package/dist/agents/agent.cjs +9 -11
  5. package/dist/agents/agent.cjs.map +1 -1
  6. package/dist/agents/agent.d.cts +0 -1
  7. package/dist/agents/agent.d.cts.map +1 -1
  8. package/dist/agents/agent.d.ts +2 -3
  9. package/dist/agents/agent.d.ts.map +1 -1
  10. package/dist/agents/agent.js +1 -3
  11. package/dist/agents/agent.js.map +1 -1
  12. package/dist/agents/chat/index.cjs +11 -15
  13. package/dist/agents/chat/index.cjs.map +1 -1
  14. package/dist/agents/chat/index.d.cts +0 -1
  15. package/dist/agents/chat/index.d.cts.map +1 -1
  16. package/dist/agents/chat/index.d.ts +0 -1
  17. package/dist/agents/chat/index.d.ts.map +1 -1
  18. package/dist/agents/chat/index.js +7 -11
  19. package/dist/agents/chat/index.js.map +1 -1
  20. package/dist/agents/chat/outputParser.cjs +4 -5
  21. package/dist/agents/chat/outputParser.cjs.map +1 -1
  22. package/dist/agents/chat/outputParser.d.cts +2 -3
  23. package/dist/agents/chat/outputParser.d.cts.map +1 -1
  24. package/dist/agents/chat/outputParser.d.ts +0 -1
  25. package/dist/agents/chat/outputParser.d.ts.map +1 -1
  26. package/dist/agents/chat/outputParser.js +1 -2
  27. package/dist/agents/chat/outputParser.js.map +1 -1
  28. package/dist/agents/chat/prompt.cjs.map +1 -1
  29. package/dist/agents/chat/prompt.js.map +1 -1
  30. package/dist/agents/chat_convo/index.cjs +21 -25
  31. package/dist/agents/chat_convo/index.cjs.map +1 -1
  32. package/dist/agents/chat_convo/index.d.cts +0 -1
  33. package/dist/agents/chat_convo/index.d.cts.map +1 -1
  34. package/dist/agents/chat_convo/index.d.ts +1 -2
  35. package/dist/agents/chat_convo/index.d.ts.map +1 -1
  36. package/dist/agents/chat_convo/index.js +11 -15
  37. package/dist/agents/chat_convo/index.js.map +1 -1
  38. package/dist/agents/chat_convo/outputParser.cjs +10 -13
  39. package/dist/agents/chat_convo/outputParser.cjs.map +1 -1
  40. package/dist/agents/chat_convo/outputParser.d.cts.map +1 -1
  41. package/dist/agents/chat_convo/outputParser.d.ts.map +1 -1
  42. package/dist/agents/chat_convo/outputParser.js +4 -7
  43. package/dist/agents/chat_convo/outputParser.js.map +1 -1
  44. package/dist/agents/chat_convo/prompt.cjs.map +1 -1
  45. package/dist/agents/chat_convo/prompt.js.map +1 -1
  46. package/dist/agents/executor.cjs +25 -33
  47. package/dist/agents/executor.cjs.map +1 -1
  48. package/dist/agents/executor.d.cts +0 -1
  49. package/dist/agents/executor.d.cts.map +1 -1
  50. package/dist/agents/executor.d.ts +0 -1
  51. package/dist/agents/executor.d.ts.map +1 -1
  52. package/dist/agents/executor.js +11 -19
  53. package/dist/agents/executor.js.map +1 -1
  54. package/dist/agents/format_scratchpad/log.cjs +4 -5
  55. package/dist/agents/format_scratchpad/log.cjs.map +1 -1
  56. package/dist/agents/format_scratchpad/log.d.cts +0 -1
  57. package/dist/agents/format_scratchpad/log.d.cts.map +1 -1
  58. package/dist/agents/format_scratchpad/log.d.ts +0 -1
  59. package/dist/agents/format_scratchpad/log.d.ts.map +1 -1
  60. package/dist/agents/format_scratchpad/log.js +3 -5
  61. package/dist/agents/format_scratchpad/log.js.map +1 -1
  62. package/dist/agents/format_scratchpad/log_to_message.cjs +8 -9
  63. package/dist/agents/format_scratchpad/log_to_message.cjs.map +1 -1
  64. package/dist/agents/format_scratchpad/log_to_message.d.cts.map +1 -1
  65. package/dist/agents/format_scratchpad/log_to_message.d.ts.map +1 -1
  66. package/dist/agents/format_scratchpad/log_to_message.js +4 -6
  67. package/dist/agents/format_scratchpad/log_to_message.js.map +1 -1
  68. package/dist/agents/format_scratchpad/openai_functions.cjs +9 -11
  69. package/dist/agents/format_scratchpad/openai_functions.cjs.map +1 -1
  70. package/dist/agents/format_scratchpad/openai_functions.d.cts +0 -1
  71. package/dist/agents/format_scratchpad/openai_functions.d.cts.map +1 -1
  72. package/dist/agents/format_scratchpad/openai_functions.d.ts +0 -1
  73. package/dist/agents/format_scratchpad/openai_functions.d.ts.map +1 -1
  74. package/dist/agents/format_scratchpad/openai_functions.js +5 -8
  75. package/dist/agents/format_scratchpad/openai_functions.js.map +1 -1
  76. package/dist/agents/format_scratchpad/openai_tools.cjs +3 -3
  77. package/dist/agents/format_scratchpad/openai_tools.js +2 -3
  78. package/dist/agents/format_scratchpad/tool_calling.cjs +8 -10
  79. package/dist/agents/format_scratchpad/tool_calling.cjs.map +1 -1
  80. package/dist/agents/format_scratchpad/tool_calling.d.cts +0 -1
  81. package/dist/agents/format_scratchpad/tool_calling.d.cts.map +1 -1
  82. package/dist/agents/format_scratchpad/tool_calling.d.ts +0 -1
  83. package/dist/agents/format_scratchpad/tool_calling.d.ts.map +1 -1
  84. package/dist/agents/format_scratchpad/tool_calling.js +5 -7
  85. package/dist/agents/format_scratchpad/tool_calling.js.map +1 -1
  86. package/dist/agents/format_scratchpad/xml.cjs +3 -3
  87. package/dist/agents/format_scratchpad/xml.cjs.map +1 -1
  88. package/dist/agents/format_scratchpad/xml.d.cts.map +1 -1
  89. package/dist/agents/format_scratchpad/xml.d.ts.map +1 -1
  90. package/dist/agents/format_scratchpad/xml.js +2 -3
  91. package/dist/agents/format_scratchpad/xml.js.map +1 -1
  92. package/dist/agents/helpers.cjs +2 -2
  93. package/dist/agents/helpers.cjs.map +1 -1
  94. package/dist/agents/helpers.js +2 -2
  95. package/dist/agents/helpers.js.map +1 -1
  96. package/dist/agents/index.cjs +6 -6
  97. package/dist/agents/index.js +2 -3
  98. package/dist/agents/initialize.cjs +12 -16
  99. package/dist/agents/initialize.cjs.map +1 -1
  100. package/dist/agents/initialize.d.cts +8 -2
  101. package/dist/agents/initialize.d.cts.map +1 -1
  102. package/dist/agents/initialize.d.ts +8 -2
  103. package/dist/agents/initialize.d.ts.map +1 -1
  104. package/dist/agents/initialize.js +12 -16
  105. package/dist/agents/initialize.js.map +1 -1
  106. package/dist/agents/load.cjs +5 -5
  107. package/dist/agents/load.cjs.map +1 -1
  108. package/dist/agents/load.d.cts +8 -2
  109. package/dist/agents/load.d.cts.map +1 -1
  110. package/dist/agents/load.d.ts +8 -2
  111. package/dist/agents/load.d.ts.map +1 -1
  112. package/dist/agents/load.js +4 -5
  113. package/dist/agents/load.js.map +1 -1
  114. package/dist/agents/mrkl/index.cjs +16 -21
  115. package/dist/agents/mrkl/index.cjs.map +1 -1
  116. package/dist/agents/mrkl/index.d.cts +0 -1
  117. package/dist/agents/mrkl/index.d.cts.map +1 -1
  118. package/dist/agents/mrkl/index.d.ts +0 -1
  119. package/dist/agents/mrkl/index.d.ts.map +1 -1
  120. package/dist/agents/mrkl/index.js +13 -18
  121. package/dist/agents/mrkl/index.js.map +1 -1
  122. package/dist/agents/mrkl/outputParser.cjs +4 -5
  123. package/dist/agents/mrkl/outputParser.cjs.map +1 -1
  124. package/dist/agents/mrkl/outputParser.d.cts +1 -2
  125. package/dist/agents/mrkl/outputParser.d.cts.map +1 -1
  126. package/dist/agents/mrkl/outputParser.d.ts +0 -1
  127. package/dist/agents/mrkl/outputParser.d.ts.map +1 -1
  128. package/dist/agents/mrkl/outputParser.js +1 -2
  129. package/dist/agents/mrkl/outputParser.js.map +1 -1
  130. package/dist/agents/mrkl/prompt.cjs.map +1 -1
  131. package/dist/agents/mrkl/prompt.js.map +1 -1
  132. package/dist/agents/openai/output_parser.cjs +3 -3
  133. package/dist/agents/openai/output_parser.js +2 -3
  134. package/dist/agents/openai_functions/index.cjs +22 -25
  135. package/dist/agents/openai_functions/index.cjs.map +1 -1
  136. package/dist/agents/openai_functions/index.d.cts +2 -5
  137. package/dist/agents/openai_functions/index.d.cts.map +1 -1
  138. package/dist/agents/openai_functions/index.d.ts +3 -6
  139. package/dist/agents/openai_functions/index.d.ts.map +1 -1
  140. package/dist/agents/openai_functions/index.js +8 -11
  141. package/dist/agents/openai_functions/index.js.map +1 -1
  142. package/dist/agents/openai_functions/output_parser.cjs +5 -5
  143. package/dist/agents/openai_functions/output_parser.cjs.map +1 -1
  144. package/dist/agents/openai_functions/output_parser.d.cts +0 -1
  145. package/dist/agents/openai_functions/output_parser.d.cts.map +1 -1
  146. package/dist/agents/openai_functions/output_parser.d.ts +1 -2
  147. package/dist/agents/openai_functions/output_parser.d.ts.map +1 -1
  148. package/dist/agents/openai_functions/output_parser.js +1 -1
  149. package/dist/agents/openai_functions/output_parser.js.map +1 -1
  150. package/dist/agents/openai_functions/prompt.cjs.map +1 -1
  151. package/dist/agents/openai_functions/prompt.js.map +1 -1
  152. package/dist/agents/openai_tools/index.cjs +8 -9
  153. package/dist/agents/openai_tools/index.cjs.map +1 -1
  154. package/dist/agents/openai_tools/index.d.cts +4 -6
  155. package/dist/agents/openai_tools/index.d.cts.map +1 -1
  156. package/dist/agents/openai_tools/index.d.ts +4 -6
  157. package/dist/agents/openai_tools/index.d.ts.map +1 -1
  158. package/dist/agents/openai_tools/index.js +3 -4
  159. package/dist/agents/openai_tools/index.js.map +1 -1
  160. package/dist/agents/openai_tools/output_parser.cjs +5 -6
  161. package/dist/agents/openai_tools/output_parser.cjs.map +1 -1
  162. package/dist/agents/openai_tools/output_parser.d.cts +0 -1
  163. package/dist/agents/openai_tools/output_parser.d.cts.map +1 -1
  164. package/dist/agents/openai_tools/output_parser.d.ts +1 -2
  165. package/dist/agents/openai_tools/output_parser.d.ts.map +1 -1
  166. package/dist/agents/openai_tools/output_parser.js +1 -2
  167. package/dist/agents/openai_tools/output_parser.js.map +1 -1
  168. package/dist/agents/react/index.cjs +5 -6
  169. package/dist/agents/react/index.cjs.map +1 -1
  170. package/dist/agents/react/index.d.cts +3 -5
  171. package/dist/agents/react/index.d.cts.map +1 -1
  172. package/dist/agents/react/index.d.ts +3 -5
  173. package/dist/agents/react/index.d.ts.map +1 -1
  174. package/dist/agents/react/index.js +2 -3
  175. package/dist/agents/react/index.js.map +1 -1
  176. package/dist/agents/react/output_parser.cjs +15 -22
  177. package/dist/agents/react/output_parser.cjs.map +1 -1
  178. package/dist/agents/react/output_parser.d.cts +0 -1
  179. package/dist/agents/react/output_parser.d.cts.map +1 -1
  180. package/dist/agents/react/output_parser.d.ts +0 -1
  181. package/dist/agents/react/output_parser.d.ts.map +1 -1
  182. package/dist/agents/react/output_parser.js +9 -17
  183. package/dist/agents/react/output_parser.js.map +1 -1
  184. package/dist/agents/react/prompt.cjs.map +1 -1
  185. package/dist/agents/react/prompt.js.map +1 -1
  186. package/dist/agents/structured_chat/index.cjs +26 -29
  187. package/dist/agents/structured_chat/index.cjs.map +1 -1
  188. package/dist/agents/structured_chat/index.d.cts +1 -4
  189. package/dist/agents/structured_chat/index.d.cts.map +1 -1
  190. package/dist/agents/structured_chat/index.d.ts +3 -6
  191. package/dist/agents/structured_chat/index.d.ts.map +1 -1
  192. package/dist/agents/structured_chat/index.js +12 -15
  193. package/dist/agents/structured_chat/index.js.map +1 -1
  194. package/dist/agents/structured_chat/outputParser.cjs +10 -13
  195. package/dist/agents/structured_chat/outputParser.cjs.map +1 -1
  196. package/dist/agents/structured_chat/outputParser.d.cts +0 -1
  197. package/dist/agents/structured_chat/outputParser.d.cts.map +1 -1
  198. package/dist/agents/structured_chat/outputParser.d.ts +0 -1
  199. package/dist/agents/structured_chat/outputParser.d.ts.map +1 -1
  200. package/dist/agents/structured_chat/outputParser.js +3 -6
  201. package/dist/agents/structured_chat/outputParser.js.map +1 -1
  202. package/dist/agents/structured_chat/prompt.cjs.map +1 -1
  203. package/dist/agents/structured_chat/prompt.js.map +1 -1
  204. package/dist/agents/tool_calling/index.cjs +5 -6
  205. package/dist/agents/tool_calling/index.cjs.map +1 -1
  206. package/dist/agents/tool_calling/index.d.cts +4 -6
  207. package/dist/agents/tool_calling/index.d.cts.map +1 -1
  208. package/dist/agents/tool_calling/index.d.ts +2 -4
  209. package/dist/agents/tool_calling/index.d.ts.map +1 -1
  210. package/dist/agents/tool_calling/index.js +2 -3
  211. package/dist/agents/tool_calling/index.js.map +1 -1
  212. package/dist/agents/tool_calling/output_parser.cjs +5 -5
  213. package/dist/agents/tool_calling/output_parser.cjs.map +1 -1
  214. package/dist/agents/tool_calling/output_parser.d.cts +0 -1
  215. package/dist/agents/tool_calling/output_parser.d.cts.map +1 -1
  216. package/dist/agents/tool_calling/output_parser.d.ts +1 -2
  217. package/dist/agents/tool_calling/output_parser.d.ts.map +1 -1
  218. package/dist/agents/tool_calling/output_parser.js +1 -1
  219. package/dist/agents/tool_calling/output_parser.js.map +1 -1
  220. package/dist/agents/toolkits/base.cjs +2 -2
  221. package/dist/agents/toolkits/conversational_retrieval/openai_functions.cjs +1 -2
  222. package/dist/agents/toolkits/conversational_retrieval/openai_functions.cjs.map +1 -1
  223. package/dist/agents/toolkits/conversational_retrieval/openai_functions.d.cts.map +1 -1
  224. package/dist/agents/toolkits/conversational_retrieval/openai_functions.d.ts.map +1 -1
  225. package/dist/agents/toolkits/conversational_retrieval/openai_functions.js +1 -2
  226. package/dist/agents/toolkits/conversational_retrieval/openai_functions.js.map +1 -1
  227. package/dist/agents/toolkits/conversational_retrieval/token_buffer_memory.cjs +6 -6
  228. package/dist/agents/toolkits/conversational_retrieval/token_buffer_memory.cjs.map +1 -1
  229. package/dist/agents/toolkits/conversational_retrieval/token_buffer_memory.d.cts +0 -1
  230. package/dist/agents/toolkits/conversational_retrieval/token_buffer_memory.d.cts.map +1 -1
  231. package/dist/agents/toolkits/conversational_retrieval/token_buffer_memory.d.ts +0 -1
  232. package/dist/agents/toolkits/conversational_retrieval/token_buffer_memory.d.ts.map +1 -1
  233. package/dist/agents/toolkits/conversational_retrieval/token_buffer_memory.js.map +1 -1
  234. package/dist/agents/toolkits/conversational_retrieval/tool.cjs +6 -7
  235. package/dist/agents/toolkits/conversational_retrieval/tool.cjs.map +1 -1
  236. package/dist/agents/toolkits/conversational_retrieval/tool.d.cts.map +1 -1
  237. package/dist/agents/toolkits/conversational_retrieval/tool.d.ts.map +1 -1
  238. package/dist/agents/toolkits/conversational_retrieval/tool.js +2 -3
  239. package/dist/agents/toolkits/conversational_retrieval/tool.js.map +1 -1
  240. package/dist/agents/toolkits/index.cjs +3 -3
  241. package/dist/agents/toolkits/index.js +2 -3
  242. package/dist/agents/toolkits/json/json.cjs +11 -13
  243. package/dist/agents/toolkits/json/json.cjs.map +1 -1
  244. package/dist/agents/toolkits/json/json.d.cts +0 -1
  245. package/dist/agents/toolkits/json/json.d.cts.map +1 -1
  246. package/dist/agents/toolkits/json/json.d.ts +0 -1
  247. package/dist/agents/toolkits/json/json.d.ts.map +1 -1
  248. package/dist/agents/toolkits/json/json.js +8 -10
  249. package/dist/agents/toolkits/json/json.js.map +1 -1
  250. package/dist/agents/toolkits/json/prompt.cjs.map +1 -1
  251. package/dist/agents/toolkits/json/prompt.js.map +1 -1
  252. package/dist/agents/toolkits/openapi/openapi.cjs +14 -18
  253. package/dist/agents/toolkits/openapi/openapi.cjs.map +1 -1
  254. package/dist/agents/toolkits/openapi/openapi.d.cts +0 -1
  255. package/dist/agents/toolkits/openapi/openapi.d.cts.map +1 -1
  256. package/dist/agents/toolkits/openapi/openapi.d.ts +0 -1
  257. package/dist/agents/toolkits/openapi/openapi.d.ts.map +1 -1
  258. package/dist/agents/toolkits/openapi/openapi.js +10 -14
  259. package/dist/agents/toolkits/openapi/openapi.js.map +1 -1
  260. package/dist/agents/toolkits/openapi/prompt.cjs.map +1 -1
  261. package/dist/agents/toolkits/openapi/prompt.js.map +1 -1
  262. package/dist/agents/toolkits/sql/index.cjs +3 -3
  263. package/dist/agents/toolkits/sql/index.js +2 -3
  264. package/dist/agents/toolkits/sql/prompt.cjs.map +1 -1
  265. package/dist/agents/toolkits/sql/prompt.d.cts.map +1 -1
  266. package/dist/agents/toolkits/sql/prompt.d.ts.map +1 -1
  267. package/dist/agents/toolkits/sql/prompt.js.map +1 -1
  268. package/dist/agents/toolkits/sql/sql.cjs +13 -15
  269. package/dist/agents/toolkits/sql/sql.cjs.map +1 -1
  270. package/dist/agents/toolkits/sql/sql.d.cts +0 -1
  271. package/dist/agents/toolkits/sql/sql.d.cts.map +1 -1
  272. package/dist/agents/toolkits/sql/sql.d.ts +0 -1
  273. package/dist/agents/toolkits/sql/sql.d.ts.map +1 -1
  274. package/dist/agents/toolkits/sql/sql.js +8 -10
  275. package/dist/agents/toolkits/sql/sql.js.map +1 -1
  276. package/dist/agents/toolkits/vectorstore/prompt.cjs.map +1 -1
  277. package/dist/agents/toolkits/vectorstore/prompt.js.map +1 -1
  278. package/dist/agents/toolkits/vectorstore/vectorstore.cjs +20 -24
  279. package/dist/agents/toolkits/vectorstore/vectorstore.cjs.map +1 -1
  280. package/dist/agents/toolkits/vectorstore/vectorstore.d.cts +0 -1
  281. package/dist/agents/toolkits/vectorstore/vectorstore.d.cts.map +1 -1
  282. package/dist/agents/toolkits/vectorstore/vectorstore.d.ts +0 -1
  283. package/dist/agents/toolkits/vectorstore/vectorstore.d.ts.map +1 -1
  284. package/dist/agents/toolkits/vectorstore/vectorstore.js +16 -20
  285. package/dist/agents/toolkits/vectorstore/vectorstore.js.map +1 -1
  286. package/dist/agents/types.cjs +4 -4
  287. package/dist/agents/types.cjs.map +1 -1
  288. package/dist/agents/types.d.cts +0 -1
  289. package/dist/agents/types.d.cts.map +1 -1
  290. package/dist/agents/types.d.ts +1 -2
  291. package/dist/agents/types.d.ts.map +1 -1
  292. package/dist/agents/types.js.map +1 -1
  293. package/dist/agents/xml/index.cjs +12 -15
  294. package/dist/agents/xml/index.cjs.map +1 -1
  295. package/dist/agents/xml/index.d.cts +1 -4
  296. package/dist/agents/xml/index.d.cts.map +1 -1
  297. package/dist/agents/xml/index.d.ts +1 -4
  298. package/dist/agents/xml/index.d.ts.map +1 -1
  299. package/dist/agents/xml/index.js +7 -10
  300. package/dist/agents/xml/index.js.map +1 -1
  301. package/dist/agents/xml/output_parser.cjs +7 -9
  302. package/dist/agents/xml/output_parser.cjs.map +1 -1
  303. package/dist/agents/xml/output_parser.d.cts +0 -1
  304. package/dist/agents/xml/output_parser.d.cts.map +1 -1
  305. package/dist/agents/xml/output_parser.d.ts +0 -1
  306. package/dist/agents/xml/output_parser.d.ts.map +1 -1
  307. package/dist/agents/xml/output_parser.js +4 -7
  308. package/dist/agents/xml/output_parser.js.map +1 -1
  309. package/dist/agents/xml/prompt.cjs.map +1 -1
  310. package/dist/agents/xml/prompt.js.map +1 -1
  311. package/dist/cache/file_system.cjs +11 -9
  312. package/dist/cache/file_system.cjs.map +1 -1
  313. package/dist/cache/file_system.d.cts +0 -1
  314. package/dist/cache/file_system.d.cts.map +1 -1
  315. package/dist/cache/file_system.d.ts +0 -1
  316. package/dist/cache/file_system.d.ts.map +1 -1
  317. package/dist/cache/file_system.js +2 -3
  318. package/dist/cache/file_system.js.map +1 -1
  319. package/dist/callbacks/handlers/console.cjs +6 -6
  320. package/dist/callbacks/handlers/console.d.cts +3 -2
  321. package/dist/callbacks/handlers/console.d.cts.map +1 -1
  322. package/dist/callbacks/handlers/console.d.ts +3 -2
  323. package/dist/callbacks/handlers/console.d.ts.map +1 -1
  324. package/dist/callbacks/handlers/console.js +4 -4
  325. package/dist/callbacks/handlers/run_collector.cjs +6 -6
  326. package/dist/callbacks/handlers/run_collector.d.cts +3 -2
  327. package/dist/callbacks/handlers/run_collector.d.cts.map +1 -1
  328. package/dist/callbacks/handlers/run_collector.d.ts +3 -2
  329. package/dist/callbacks/handlers/run_collector.d.ts.map +1 -1
  330. package/dist/callbacks/handlers/run_collector.js +4 -4
  331. package/dist/callbacks/handlers/tracer.cjs +6 -6
  332. package/dist/callbacks/handlers/tracer.d.cts +3 -2
  333. package/dist/callbacks/handlers/tracer.d.cts.map +1 -1
  334. package/dist/callbacks/handlers/tracer.d.ts +3 -2
  335. package/dist/callbacks/handlers/tracer.d.ts.map +1 -1
  336. package/dist/callbacks/handlers/tracer.js +4 -4
  337. package/dist/callbacks/handlers/tracer_langchain.cjs +6 -6
  338. package/dist/callbacks/handlers/tracer_langchain.d.cts +3 -2
  339. package/dist/callbacks/handlers/tracer_langchain.d.cts.map +1 -1
  340. package/dist/callbacks/handlers/tracer_langchain.d.ts +3 -2
  341. package/dist/callbacks/handlers/tracer_langchain.d.ts.map +1 -1
  342. package/dist/callbacks/handlers/tracer_langchain.js +4 -4
  343. package/dist/callbacks/index.cjs +3 -3
  344. package/dist/callbacks/index.js +2 -3
  345. package/dist/callbacks/promises.cjs +6 -6
  346. package/dist/callbacks/promises.d.cts +3 -2
  347. package/dist/callbacks/promises.d.cts.map +1 -1
  348. package/dist/callbacks/promises.d.ts +3 -2
  349. package/dist/callbacks/promises.d.ts.map +1 -1
  350. package/dist/callbacks/promises.js +4 -4
  351. package/dist/chains/analyze_documents_chain.cjs +6 -8
  352. package/dist/chains/analyze_documents_chain.cjs.map +1 -1
  353. package/dist/chains/analyze_documents_chain.d.cts.map +1 -1
  354. package/dist/chains/analyze_documents_chain.d.ts +1 -1
  355. package/dist/chains/analyze_documents_chain.d.ts.map +1 -1
  356. package/dist/chains/analyze_documents_chain.js +3 -5
  357. package/dist/chains/analyze_documents_chain.js.map +1 -1
  358. package/dist/chains/api/api_chain.cjs +1 -2
  359. package/dist/chains/api/api_chain.cjs.map +1 -1
  360. package/dist/chains/api/api_chain.d.cts +0 -1
  361. package/dist/chains/api/api_chain.d.cts.map +1 -1
  362. package/dist/chains/api/api_chain.d.ts +0 -1
  363. package/dist/chains/api/api_chain.d.ts.map +1 -1
  364. package/dist/chains/api/api_chain.js +1 -2
  365. package/dist/chains/api/api_chain.js.map +1 -1
  366. package/dist/chains/api/prompts.cjs +4 -4
  367. package/dist/chains/api/prompts.cjs.map +1 -1
  368. package/dist/chains/api/prompts.js.map +1 -1
  369. package/dist/chains/base.cjs +12 -14
  370. package/dist/chains/base.cjs.map +1 -1
  371. package/dist/chains/base.d.cts +3 -0
  372. package/dist/chains/base.d.cts.map +1 -1
  373. package/dist/chains/base.d.ts +3 -0
  374. package/dist/chains/base.d.ts.map +1 -1
  375. package/dist/chains/base.js +3 -5
  376. package/dist/chains/base.js.map +1 -1
  377. package/dist/chains/chat_vector_db_chain.cjs +9 -11
  378. package/dist/chains/chat_vector_db_chain.cjs.map +1 -1
  379. package/dist/chains/chat_vector_db_chain.d.cts.map +1 -1
  380. package/dist/chains/chat_vector_db_chain.d.ts.map +1 -1
  381. package/dist/chains/chat_vector_db_chain.js +6 -8
  382. package/dist/chains/chat_vector_db_chain.js.map +1 -1
  383. package/dist/chains/combine_docs_chain.cjs +15 -24
  384. package/dist/chains/combine_docs_chain.cjs.map +1 -1
  385. package/dist/chains/combine_docs_chain.d.cts.map +1 -1
  386. package/dist/chains/combine_docs_chain.d.ts +1 -1
  387. package/dist/chains/combine_docs_chain.d.ts.map +1 -1
  388. package/dist/chains/combine_docs_chain.js +12 -21
  389. package/dist/chains/combine_docs_chain.js.map +1 -1
  390. package/dist/chains/combine_documents/base.cjs +5 -6
  391. package/dist/chains/combine_documents/base.cjs.map +1 -1
  392. package/dist/chains/combine_documents/base.js +2 -3
  393. package/dist/chains/combine_documents/base.js.map +1 -1
  394. package/dist/chains/combine_documents/index.cjs +3 -3
  395. package/dist/chains/combine_documents/index.js +2 -3
  396. package/dist/chains/combine_documents/reduce.cjs +5 -7
  397. package/dist/chains/combine_documents/reduce.cjs.map +1 -1
  398. package/dist/chains/combine_documents/reduce.d.cts +0 -1
  399. package/dist/chains/combine_documents/reduce.d.cts.map +1 -1
  400. package/dist/chains/combine_documents/reduce.d.ts +0 -1
  401. package/dist/chains/combine_documents/reduce.d.ts.map +1 -1
  402. package/dist/chains/combine_documents/reduce.js +4 -7
  403. package/dist/chains/combine_documents/reduce.js.map +1 -1
  404. package/dist/chains/combine_documents/stuff.cjs +6 -6
  405. package/dist/chains/combine_documents/stuff.cjs.map +1 -1
  406. package/dist/chains/combine_documents/stuff.d.cts +0 -1
  407. package/dist/chains/combine_documents/stuff.d.cts.map +1 -1
  408. package/dist/chains/combine_documents/stuff.d.ts +0 -1
  409. package/dist/chains/combine_documents/stuff.d.ts.map +1 -1
  410. package/dist/chains/combine_documents/stuff.js.map +1 -1
  411. package/dist/chains/constitutional_ai/constitutional_chain.cjs.map +1 -1
  412. package/dist/chains/constitutional_ai/constitutional_chain.d.cts +0 -1
  413. package/dist/chains/constitutional_ai/constitutional_chain.d.cts.map +1 -1
  414. package/dist/chains/constitutional_ai/constitutional_chain.d.ts +0 -1
  415. package/dist/chains/constitutional_ai/constitutional_chain.d.ts.map +1 -1
  416. package/dist/chains/constitutional_ai/constitutional_chain.js.map +1 -1
  417. package/dist/chains/constitutional_ai/constitutional_principle.cjs.map +1 -1
  418. package/dist/chains/constitutional_ai/constitutional_principle.d.cts +0 -1
  419. package/dist/chains/constitutional_ai/constitutional_principle.d.cts.map +1 -1
  420. package/dist/chains/constitutional_ai/constitutional_principle.d.ts +0 -1
  421. package/dist/chains/constitutional_ai/constitutional_principle.d.ts.map +1 -1
  422. package/dist/chains/constitutional_ai/constitutional_principle.js.map +1 -1
  423. package/dist/chains/constitutional_ai/constitutional_prompts.cjs +5 -5
  424. package/dist/chains/constitutional_ai/constitutional_prompts.cjs.map +1 -1
  425. package/dist/chains/constitutional_ai/constitutional_prompts.js.map +1 -1
  426. package/dist/chains/conversation.cjs +4 -4
  427. package/dist/chains/conversation.cjs.map +1 -1
  428. package/dist/chains/conversation.d.cts +0 -1
  429. package/dist/chains/conversation.d.cts.map +1 -1
  430. package/dist/chains/conversation.d.ts +0 -1
  431. package/dist/chains/conversation.d.ts.map +1 -1
  432. package/dist/chains/conversation.js +1 -1
  433. package/dist/chains/conversation.js.map +1 -1
  434. package/dist/chains/conversational_retrieval_chain.cjs +12 -14
  435. package/dist/chains/conversational_retrieval_chain.cjs.map +1 -1
  436. package/dist/chains/conversational_retrieval_chain.d.cts +2 -4
  437. package/dist/chains/conversational_retrieval_chain.d.cts.map +1 -1
  438. package/dist/chains/conversational_retrieval_chain.d.ts +3 -5
  439. package/dist/chains/conversational_retrieval_chain.d.ts.map +1 -1
  440. package/dist/chains/conversational_retrieval_chain.js +7 -9
  441. package/dist/chains/conversational_retrieval_chain.js.map +1 -1
  442. package/dist/chains/graph_qa/cypher.cjs +8 -10
  443. package/dist/chains/graph_qa/cypher.cjs.map +1 -1
  444. package/dist/chains/graph_qa/cypher.d.cts.map +1 -1
  445. package/dist/chains/graph_qa/cypher.d.ts.map +1 -1
  446. package/dist/chains/graph_qa/cypher.js +7 -10
  447. package/dist/chains/graph_qa/cypher.js.map +1 -1
  448. package/dist/chains/graph_qa/prompts.cjs +4 -4
  449. package/dist/chains/graph_qa/prompts.cjs.map +1 -1
  450. package/dist/chains/graph_qa/prompts.js.map +1 -1
  451. package/dist/chains/history_aware_retriever.cjs +7 -8
  452. package/dist/chains/history_aware_retriever.cjs.map +1 -1
  453. package/dist/chains/history_aware_retriever.d.cts +0 -1
  454. package/dist/chains/history_aware_retriever.d.cts.map +1 -1
  455. package/dist/chains/history_aware_retriever.d.ts +2 -3
  456. package/dist/chains/history_aware_retriever.d.ts.map +1 -1
  457. package/dist/chains/history_aware_retriever.js +3 -5
  458. package/dist/chains/history_aware_retriever.js.map +1 -1
  459. package/dist/chains/index.cjs +3 -3
  460. package/dist/chains/index.js +2 -3
  461. package/dist/chains/llm_chain.cjs +12 -15
  462. package/dist/chains/llm_chain.cjs.map +1 -1
  463. package/dist/chains/llm_chain.d.cts.map +1 -1
  464. package/dist/chains/llm_chain.d.ts +1 -1
  465. package/dist/chains/llm_chain.d.ts.map +1 -1
  466. package/dist/chains/llm_chain.js +3 -6
  467. package/dist/chains/llm_chain.js.map +1 -1
  468. package/dist/chains/load.cjs +3 -3
  469. package/dist/chains/load.cjs.map +1 -1
  470. package/dist/chains/load.d.cts +0 -1
  471. package/dist/chains/load.d.cts.map +1 -1
  472. package/dist/chains/load.d.ts +0 -1
  473. package/dist/chains/load.d.ts.map +1 -1
  474. package/dist/chains/load.js +2 -3
  475. package/dist/chains/load.js.map +1 -1
  476. package/dist/chains/openai_functions/base.cjs +8 -10
  477. package/dist/chains/openai_functions/base.cjs.map +1 -1
  478. package/dist/chains/openai_functions/base.d.cts +3 -7
  479. package/dist/chains/openai_functions/base.d.cts.map +1 -1
  480. package/dist/chains/openai_functions/base.d.ts +4 -8
  481. package/dist/chains/openai_functions/base.d.ts.map +1 -1
  482. package/dist/chains/openai_functions/base.js +5 -7
  483. package/dist/chains/openai_functions/base.js.map +1 -1
  484. package/dist/chains/openai_functions/extraction.cjs +5 -5
  485. package/dist/chains/openai_functions/extraction.cjs.map +1 -1
  486. package/dist/chains/openai_functions/extraction.d.cts +0 -1
  487. package/dist/chains/openai_functions/extraction.d.cts.map +1 -1
  488. package/dist/chains/openai_functions/extraction.d.ts +1 -2
  489. package/dist/chains/openai_functions/extraction.d.ts.map +1 -1
  490. package/dist/chains/openai_functions/extraction.js.map +1 -1
  491. package/dist/chains/openai_functions/index.cjs +3 -3
  492. package/dist/chains/openai_functions/index.js +2 -3
  493. package/dist/chains/openai_functions/openapi.cjs +12 -19
  494. package/dist/chains/openai_functions/openapi.cjs.map +1 -1
  495. package/dist/chains/openai_functions/openapi.d.cts +0 -2
  496. package/dist/chains/openai_functions/openapi.d.cts.map +1 -1
  497. package/dist/chains/openai_functions/openapi.d.ts +0 -2
  498. package/dist/chains/openai_functions/openapi.d.ts.map +1 -1
  499. package/dist/chains/openai_functions/openapi.js +9 -16
  500. package/dist/chains/openai_functions/openapi.js.map +1 -1
  501. package/dist/chains/openai_functions/tagging.cjs +5 -5
  502. package/dist/chains/openai_functions/tagging.cjs.map +1 -1
  503. package/dist/chains/openai_functions/tagging.d.cts +0 -1
  504. package/dist/chains/openai_functions/tagging.d.cts.map +1 -1
  505. package/dist/chains/openai_functions/tagging.d.ts +1 -2
  506. package/dist/chains/openai_functions/tagging.d.ts.map +1 -1
  507. package/dist/chains/openai_functions/tagging.js +1 -1
  508. package/dist/chains/openai_functions/tagging.js.map +1 -1
  509. package/dist/chains/openai_moderation.cjs +7 -7
  510. package/dist/chains/openai_moderation.cjs.map +1 -1
  511. package/dist/chains/openai_moderation.d.cts +0 -1
  512. package/dist/chains/openai_moderation.d.cts.map +1 -1
  513. package/dist/chains/openai_moderation.d.ts +0 -1
  514. package/dist/chains/openai_moderation.d.ts.map +1 -1
  515. package/dist/chains/openai_moderation.js.map +1 -1
  516. package/dist/chains/query_constructor/index.cjs +19 -25
  517. package/dist/chains/query_constructor/index.cjs.map +1 -1
  518. package/dist/chains/query_constructor/index.d.cts +0 -1
  519. package/dist/chains/query_constructor/index.d.cts.map +1 -1
  520. package/dist/chains/query_constructor/index.d.ts +0 -1
  521. package/dist/chains/query_constructor/index.d.ts.map +1 -1
  522. package/dist/chains/query_constructor/index.js +11 -18
  523. package/dist/chains/query_constructor/index.js.map +1 -1
  524. package/dist/chains/query_constructor/ir.cjs +7 -6
  525. package/dist/chains/query_constructor/ir.js +4 -4
  526. package/dist/chains/query_constructor/parser.cjs +8 -9
  527. package/dist/chains/query_constructor/parser.cjs.map +1 -1
  528. package/dist/chains/query_constructor/parser.d.cts +0 -1
  529. package/dist/chains/query_constructor/parser.d.cts.map +1 -1
  530. package/dist/chains/query_constructor/parser.d.ts +0 -1
  531. package/dist/chains/query_constructor/parser.d.ts.map +1 -1
  532. package/dist/chains/query_constructor/parser.js +1 -2
  533. package/dist/chains/query_constructor/parser.js.map +1 -1
  534. package/dist/chains/query_constructor/prompt.cjs +3 -3
  535. package/dist/chains/query_constructor/prompt.cjs.map +1 -1
  536. package/dist/chains/query_constructor/prompt.d.cts +0 -1
  537. package/dist/chains/query_constructor/prompt.d.cts.map +1 -1
  538. package/dist/chains/query_constructor/prompt.d.ts +0 -1
  539. package/dist/chains/query_constructor/prompt.d.ts.map +1 -1
  540. package/dist/chains/query_constructor/prompt.js.map +1 -1
  541. package/dist/chains/question_answering/load.cjs +32 -41
  542. package/dist/chains/question_answering/load.cjs.map +1 -1
  543. package/dist/chains/question_answering/load.d.cts +0 -1
  544. package/dist/chains/question_answering/load.d.cts.map +1 -1
  545. package/dist/chains/question_answering/load.d.ts +0 -1
  546. package/dist/chains/question_answering/load.d.ts.map +1 -1
  547. package/dist/chains/question_answering/load.js +32 -41
  548. package/dist/chains/question_answering/load.js.map +1 -1
  549. package/dist/chains/question_answering/map_reduce_prompts.cjs +13 -15
  550. package/dist/chains/question_answering/map_reduce_prompts.cjs.map +1 -1
  551. package/dist/chains/question_answering/map_reduce_prompts.js +4 -6
  552. package/dist/chains/question_answering/map_reduce_prompts.js.map +1 -1
  553. package/dist/chains/question_answering/refine_prompts.cjs +16 -18
  554. package/dist/chains/question_answering/refine_prompts.cjs.map +1 -1
  555. package/dist/chains/question_answering/refine_prompts.js +7 -9
  556. package/dist/chains/question_answering/refine_prompts.js.map +1 -1
  557. package/dist/chains/question_answering/stuff_prompts.cjs +8 -9
  558. package/dist/chains/question_answering/stuff_prompts.cjs.map +1 -1
  559. package/dist/chains/question_answering/stuff_prompts.js +2 -3
  560. package/dist/chains/question_answering/stuff_prompts.js.map +1 -1
  561. package/dist/chains/retrieval.cjs +7 -8
  562. package/dist/chains/retrieval.cjs.map +1 -1
  563. package/dist/chains/retrieval.d.cts +0 -1
  564. package/dist/chains/retrieval.d.cts.map +1 -1
  565. package/dist/chains/retrieval.d.ts +2 -3
  566. package/dist/chains/retrieval.d.ts.map +1 -1
  567. package/dist/chains/retrieval.js +3 -5
  568. package/dist/chains/retrieval.js.map +1 -1
  569. package/dist/chains/retrieval_qa.cjs.map +1 -1
  570. package/dist/chains/retrieval_qa.d.cts.map +1 -1
  571. package/dist/chains/retrieval_qa.d.ts.map +1 -1
  572. package/dist/chains/retrieval_qa.js.map +1 -1
  573. package/dist/chains/router/llm_router.cjs.map +1 -1
  574. package/dist/chains/router/llm_router.d.cts +0 -1
  575. package/dist/chains/router/llm_router.d.cts.map +1 -1
  576. package/dist/chains/router/llm_router.d.ts +0 -1
  577. package/dist/chains/router/llm_router.d.ts.map +1 -1
  578. package/dist/chains/router/llm_router.js.map +1 -1
  579. package/dist/chains/router/multi_prompt.cjs +8 -10
  580. package/dist/chains/router/multi_prompt.cjs.map +1 -1
  581. package/dist/chains/router/multi_prompt.d.cts +0 -1
  582. package/dist/chains/router/multi_prompt.d.cts.map +1 -1
  583. package/dist/chains/router/multi_prompt.d.ts +0 -1
  584. package/dist/chains/router/multi_prompt.d.ts.map +1 -1
  585. package/dist/chains/router/multi_prompt.js +3 -5
  586. package/dist/chains/router/multi_prompt.js.map +1 -1
  587. package/dist/chains/router/multi_prompt_prompt.cjs.map +1 -1
  588. package/dist/chains/router/multi_prompt_prompt.js.map +1 -1
  589. package/dist/chains/router/multi_retrieval_prompt.cjs.map +1 -1
  590. package/dist/chains/router/multi_retrieval_prompt.js.map +1 -1
  591. package/dist/chains/router/multi_retrieval_qa.cjs +15 -22
  592. package/dist/chains/router/multi_retrieval_qa.cjs.map +1 -1
  593. package/dist/chains/router/multi_retrieval_qa.d.cts +0 -1
  594. package/dist/chains/router/multi_retrieval_qa.d.cts.map +1 -1
  595. package/dist/chains/router/multi_retrieval_qa.d.ts +0 -1
  596. package/dist/chains/router/multi_retrieval_qa.d.ts.map +1 -1
  597. package/dist/chains/router/multi_retrieval_qa.js +11 -18
  598. package/dist/chains/router/multi_retrieval_qa.js.map +1 -1
  599. package/dist/chains/router/multi_route.cjs.map +1 -1
  600. package/dist/chains/router/multi_route.d.cts +0 -1
  601. package/dist/chains/router/multi_route.d.cts.map +1 -1
  602. package/dist/chains/router/multi_route.d.ts +0 -1
  603. package/dist/chains/router/multi_route.d.ts.map +1 -1
  604. package/dist/chains/router/multi_route.js.map +1 -1
  605. package/dist/chains/router/utils.cjs.map +1 -1
  606. package/dist/chains/router/utils.js.map +1 -1
  607. package/dist/chains/sequential_chain.cjs.map +1 -1
  608. package/dist/chains/sequential_chain.d.cts +0 -1
  609. package/dist/chains/sequential_chain.d.cts.map +1 -1
  610. package/dist/chains/sequential_chain.d.ts +0 -1
  611. package/dist/chains/sequential_chain.d.ts.map +1 -1
  612. package/dist/chains/sequential_chain.js.map +1 -1
  613. package/dist/chains/serde.d.cts +0 -1
  614. package/dist/chains/serde.d.cts.map +1 -1
  615. package/dist/chains/serde.d.ts +0 -1
  616. package/dist/chains/serde.d.ts.map +1 -1
  617. package/dist/chains/sql_db/index.cjs +3 -3
  618. package/dist/chains/sql_db/index.js +2 -3
  619. package/dist/chains/sql_db/sql_db_chain.cjs +19 -24
  620. package/dist/chains/sql_db/sql_db_chain.cjs.map +1 -1
  621. package/dist/chains/sql_db/sql_db_chain.d.cts +0 -1
  622. package/dist/chains/sql_db/sql_db_chain.d.cts.map +1 -1
  623. package/dist/chains/sql_db/sql_db_chain.d.ts +0 -1
  624. package/dist/chains/sql_db/sql_db_chain.d.ts.map +1 -1
  625. package/dist/chains/sql_db/sql_db_chain.js +13 -18
  626. package/dist/chains/sql_db/sql_db_chain.js.map +1 -1
  627. package/dist/chains/sql_db/sql_db_prompt.cjs +9 -9
  628. package/dist/chains/sql_db/sql_db_prompt.cjs.map +1 -1
  629. package/dist/chains/sql_db/sql_db_prompt.d.cts.map +1 -1
  630. package/dist/chains/sql_db/sql_db_prompt.d.ts.map +1 -1
  631. package/dist/chains/sql_db/sql_db_prompt.js.map +1 -1
  632. package/dist/chains/summarization/load.cjs +32 -41
  633. package/dist/chains/summarization/load.cjs.map +1 -1
  634. package/dist/chains/summarization/load.d.cts +0 -1
  635. package/dist/chains/summarization/load.d.cts.map +1 -1
  636. package/dist/chains/summarization/load.d.ts +0 -1
  637. package/dist/chains/summarization/load.d.ts.map +1 -1
  638. package/dist/chains/summarization/load.js +32 -41
  639. package/dist/chains/summarization/load.js.map +1 -1
  640. package/dist/chains/summarization/refine_prompts.cjs +3 -3
  641. package/dist/chains/summarization/refine_prompts.cjs.map +1 -1
  642. package/dist/chains/summarization/refine_prompts.js.map +1 -1
  643. package/dist/chains/summarization/stuff_prompts.cjs +3 -3
  644. package/dist/chains/summarization/stuff_prompts.cjs.map +1 -1
  645. package/dist/chains/summarization/stuff_prompts.js.map +1 -1
  646. package/dist/chains/transform.cjs.map +1 -1
  647. package/dist/chains/transform.d.cts +0 -1
  648. package/dist/chains/transform.d.cts.map +1 -1
  649. package/dist/chains/transform.d.ts +0 -1
  650. package/dist/chains/transform.d.ts.map +1 -1
  651. package/dist/chains/transform.js.map +1 -1
  652. package/dist/chains/vector_db_qa.cjs.map +1 -1
  653. package/dist/chains/vector_db_qa.d.cts.map +1 -1
  654. package/dist/chains/vector_db_qa.d.ts.map +1 -1
  655. package/dist/chains/vector_db_qa.js.map +1 -1
  656. package/dist/chat_models/universal.cjs +33 -39
  657. package/dist/chat_models/universal.cjs.map +1 -1
  658. package/dist/chat_models/universal.d.cts.map +1 -1
  659. package/dist/chat_models/universal.d.ts +1 -1
  660. package/dist/chat_models/universal.d.ts.map +1 -1
  661. package/dist/chat_models/universal.js +20 -27
  662. package/dist/chat_models/universal.js.map +1 -1
  663. package/dist/document.cjs +5 -5
  664. package/dist/document.js +2 -3
  665. package/dist/document_loaders/base.cjs +7 -6
  666. package/dist/document_loaders/base.js +4 -4
  667. package/dist/document_loaders/fs/buffer.cjs +7 -7
  668. package/dist/document_loaders/fs/buffer.cjs.map +1 -1
  669. package/dist/document_loaders/fs/buffer.d.cts +0 -1
  670. package/dist/document_loaders/fs/buffer.d.cts.map +1 -1
  671. package/dist/document_loaders/fs/buffer.d.ts +1 -2
  672. package/dist/document_loaders/fs/buffer.d.ts.map +1 -1
  673. package/dist/document_loaders/fs/buffer.js +2 -3
  674. package/dist/document_loaders/fs/buffer.js.map +1 -1
  675. package/dist/document_loaders/fs/directory.cjs +7 -7
  676. package/dist/document_loaders/fs/directory.cjs.map +1 -1
  677. package/dist/document_loaders/fs/directory.d.cts.map +1 -1
  678. package/dist/document_loaders/fs/directory.d.ts +1 -1
  679. package/dist/document_loaders/fs/directory.d.ts.map +1 -1
  680. package/dist/document_loaders/fs/directory.js +2 -3
  681. package/dist/document_loaders/fs/directory.js.map +1 -1
  682. package/dist/document_loaders/fs/json.cjs +7 -8
  683. package/dist/document_loaders/fs/json.cjs.map +1 -1
  684. package/dist/document_loaders/fs/json.d.cts +0 -1
  685. package/dist/document_loaders/fs/json.d.cts.map +1 -1
  686. package/dist/document_loaders/fs/json.d.ts +0 -1
  687. package/dist/document_loaders/fs/json.d.ts.map +1 -1
  688. package/dist/document_loaders/fs/json.js +4 -7
  689. package/dist/document_loaders/fs/json.js.map +1 -1
  690. package/dist/document_loaders/fs/multi_file.cjs +8 -9
  691. package/dist/document_loaders/fs/multi_file.cjs.map +1 -1
  692. package/dist/document_loaders/fs/multi_file.d.cts +0 -1
  693. package/dist/document_loaders/fs/multi_file.d.cts.map +1 -1
  694. package/dist/document_loaders/fs/multi_file.d.ts +0 -1
  695. package/dist/document_loaders/fs/multi_file.d.ts.map +1 -1
  696. package/dist/document_loaders/fs/multi_file.js +3 -5
  697. package/dist/document_loaders/fs/multi_file.js.map +1 -1
  698. package/dist/document_loaders/fs/text.cjs +9 -9
  699. package/dist/document_loaders/fs/text.cjs.map +1 -1
  700. package/dist/document_loaders/fs/text.d.cts +0 -1
  701. package/dist/document_loaders/fs/text.d.cts.map +1 -1
  702. package/dist/document_loaders/fs/text.d.ts +1 -2
  703. package/dist/document_loaders/fs/text.d.ts.map +1 -1
  704. package/dist/document_loaders/fs/text.js +3 -4
  705. package/dist/document_loaders/fs/text.js.map +1 -1
  706. package/dist/document_transformers/openai_functions.cjs +12 -14
  707. package/dist/document_transformers/openai_functions.cjs.map +1 -1
  708. package/dist/document_transformers/openai_functions.d.cts +0 -1
  709. package/dist/document_transformers/openai_functions.d.cts.map +1 -1
  710. package/dist/document_transformers/openai_functions.d.ts +1 -1
  711. package/dist/document_transformers/openai_functions.d.ts.map +1 -1
  712. package/dist/document_transformers/openai_functions.js +6 -9
  713. package/dist/document_transformers/openai_functions.js.map +1 -1
  714. package/dist/embeddings/cache_backed.cjs +7 -7
  715. package/dist/embeddings/cache_backed.cjs.map +1 -1
  716. package/dist/embeddings/cache_backed.d.cts +0 -1
  717. package/dist/embeddings/cache_backed.d.cts.map +1 -1
  718. package/dist/embeddings/cache_backed.d.ts +0 -1
  719. package/dist/embeddings/cache_backed.d.ts.map +1 -1
  720. package/dist/embeddings/cache_backed.js +2 -3
  721. package/dist/embeddings/cache_backed.js.map +1 -1
  722. package/dist/embeddings/fake.cjs +7 -6
  723. package/dist/embeddings/fake.js +4 -4
  724. package/dist/evaluation/agents/index.js +2 -0
  725. package/dist/evaluation/agents/prompt.cjs +15 -12
  726. package/dist/evaluation/agents/prompt.cjs.map +1 -1
  727. package/dist/evaluation/agents/prompt.js +3 -0
  728. package/dist/evaluation/agents/prompt.js.map +1 -1
  729. package/dist/evaluation/agents/trajectory.cjs +5 -5
  730. package/dist/evaluation/agents/trajectory.cjs.map +1 -1
  731. package/dist/evaluation/agents/trajectory.d.cts +2 -2
  732. package/dist/evaluation/agents/trajectory.d.cts.map +1 -1
  733. package/dist/evaluation/agents/trajectory.d.ts +2 -2
  734. package/dist/evaluation/agents/trajectory.d.ts.map +1 -1
  735. package/dist/evaluation/agents/trajectory.js.map +1 -1
  736. package/dist/evaluation/base.cjs.map +1 -1
  737. package/dist/evaluation/base.d.cts.map +1 -1
  738. package/dist/evaluation/base.d.ts.map +1 -1
  739. package/dist/evaluation/base.js.map +1 -1
  740. package/dist/evaluation/comparison/index.js +2 -0
  741. package/dist/evaluation/comparison/pairwise.cjs +16 -21
  742. package/dist/evaluation/comparison/pairwise.cjs.map +1 -1
  743. package/dist/evaluation/comparison/pairwise.d.cts +3 -3
  744. package/dist/evaluation/comparison/pairwise.d.cts.map +1 -1
  745. package/dist/evaluation/comparison/pairwise.d.ts +3 -3
  746. package/dist/evaluation/comparison/pairwise.d.ts.map +1 -1
  747. package/dist/evaluation/comparison/pairwise.js +11 -16
  748. package/dist/evaluation/comparison/pairwise.js.map +1 -1
  749. package/dist/evaluation/comparison/prompt.cjs +11 -4
  750. package/dist/evaluation/comparison/prompt.cjs.map +1 -1
  751. package/dist/evaluation/comparison/prompt.js +7 -0
  752. package/dist/evaluation/comparison/prompt.js.map +1 -1
  753. package/dist/evaluation/criteria/criteria.cjs +7 -9
  754. package/dist/evaluation/criteria/criteria.cjs.map +1 -1
  755. package/dist/evaluation/criteria/criteria.d.cts +3 -3
  756. package/dist/evaluation/criteria/criteria.d.cts.map +1 -1
  757. package/dist/evaluation/criteria/criteria.d.ts +3 -3
  758. package/dist/evaluation/criteria/criteria.d.ts.map +1 -1
  759. package/dist/evaluation/criteria/criteria.js +2 -4
  760. package/dist/evaluation/criteria/criteria.js.map +1 -1
  761. package/dist/evaluation/criteria/index.js +2 -0
  762. package/dist/evaluation/criteria/prompt.cjs +4 -4
  763. package/dist/evaluation/criteria/prompt.cjs.map +1 -1
  764. package/dist/evaluation/criteria/prompt.js.map +1 -1
  765. package/dist/evaluation/embedding_distance/base.cjs +5 -9
  766. package/dist/evaluation/embedding_distance/base.cjs.map +1 -1
  767. package/dist/evaluation/embedding_distance/base.d.cts +0 -1
  768. package/dist/evaluation/embedding_distance/base.d.cts.map +1 -1
  769. package/dist/evaluation/embedding_distance/base.d.ts +0 -1
  770. package/dist/evaluation/embedding_distance/base.d.ts.map +1 -1
  771. package/dist/evaluation/embedding_distance/base.js +5 -9
  772. package/dist/evaluation/embedding_distance/base.js.map +1 -1
  773. package/dist/evaluation/embedding_distance/index.js +2 -0
  774. package/dist/evaluation/index.cjs +3 -3
  775. package/dist/evaluation/index.js +2 -3
  776. package/dist/evaluation/loader.cjs +3 -3
  777. package/dist/evaluation/loader.cjs.map +1 -1
  778. package/dist/evaluation/loader.d.cts.map +1 -1
  779. package/dist/evaluation/loader.d.ts.map +1 -1
  780. package/dist/evaluation/loader.js.map +1 -1
  781. package/dist/evaluation/qa/eval_chain.cjs +1 -2
  782. package/dist/evaluation/qa/eval_chain.cjs.map +1 -1
  783. package/dist/evaluation/qa/eval_chain.d.cts.map +1 -1
  784. package/dist/evaluation/qa/eval_chain.d.ts.map +1 -1
  785. package/dist/evaluation/qa/eval_chain.js +1 -2
  786. package/dist/evaluation/qa/eval_chain.js.map +1 -1
  787. package/dist/evaluation/qa/index.js +2 -0
  788. package/dist/evaluation/qa/prompt.cjs +3 -3
  789. package/dist/evaluation/qa/prompt.cjs.map +1 -1
  790. package/dist/evaluation/qa/prompt.js.map +1 -1
  791. package/dist/evaluation/types.d.cts.map +1 -1
  792. package/dist/evaluation/types.d.ts.map +1 -1
  793. package/dist/experimental/autogpt/agent.cjs +18 -21
  794. package/dist/experimental/autogpt/agent.cjs.map +1 -1
  795. package/dist/experimental/autogpt/agent.d.cts +0 -1
  796. package/dist/experimental/autogpt/agent.d.cts.map +1 -1
  797. package/dist/experimental/autogpt/agent.d.ts +1 -2
  798. package/dist/experimental/autogpt/agent.d.ts.map +1 -1
  799. package/dist/experimental/autogpt/agent.js +12 -15
  800. package/dist/experimental/autogpt/agent.js.map +1 -1
  801. package/dist/experimental/autogpt/index.cjs +3 -3
  802. package/dist/experimental/autogpt/index.js +2 -3
  803. package/dist/experimental/autogpt/output_parser.cjs +3 -3
  804. package/dist/experimental/autogpt/output_parser.cjs.map +1 -1
  805. package/dist/experimental/autogpt/output_parser.d.cts +0 -1
  806. package/dist/experimental/autogpt/output_parser.d.cts.map +1 -1
  807. package/dist/experimental/autogpt/output_parser.d.ts +0 -1
  808. package/dist/experimental/autogpt/output_parser.d.ts.map +1 -1
  809. package/dist/experimental/autogpt/output_parser.js.map +1 -1
  810. package/dist/experimental/autogpt/prompt.cjs +13 -18
  811. package/dist/experimental/autogpt/prompt.cjs.map +1 -1
  812. package/dist/experimental/autogpt/prompt.d.cts +2 -2
  813. package/dist/experimental/autogpt/prompt.d.cts.map +1 -1
  814. package/dist/experimental/autogpt/prompt.d.ts +3 -3
  815. package/dist/experimental/autogpt/prompt.d.ts.map +1 -1
  816. package/dist/experimental/autogpt/prompt.js +7 -12
  817. package/dist/experimental/autogpt/prompt.js.map +1 -1
  818. package/dist/experimental/autogpt/prompt_generator.cjs +7 -11
  819. package/dist/experimental/autogpt/prompt_generator.cjs.map +1 -1
  820. package/dist/experimental/autogpt/prompt_generator.js +3 -7
  821. package/dist/experimental/autogpt/prompt_generator.js.map +1 -1
  822. package/dist/experimental/autogpt/schema.d.cts +0 -1
  823. package/dist/experimental/autogpt/schema.d.cts.map +1 -1
  824. package/dist/experimental/autogpt/schema.d.ts +0 -1
  825. package/dist/experimental/autogpt/schema.d.ts.map +1 -1
  826. package/dist/experimental/babyagi/agent.cjs +16 -20
  827. package/dist/experimental/babyagi/agent.cjs.map +1 -1
  828. package/dist/experimental/babyagi/agent.d.cts +0 -1
  829. package/dist/experimental/babyagi/agent.d.cts.map +1 -1
  830. package/dist/experimental/babyagi/agent.d.ts +0 -1
  831. package/dist/experimental/babyagi/agent.d.ts.map +1 -1
  832. package/dist/experimental/babyagi/agent.js +13 -17
  833. package/dist/experimental/babyagi/agent.js.map +1 -1
  834. package/dist/experimental/babyagi/index.cjs +3 -3
  835. package/dist/experimental/babyagi/index.js +2 -3
  836. package/dist/experimental/babyagi/task_creation.cjs +11 -13
  837. package/dist/experimental/babyagi/task_creation.cjs.map +1 -1
  838. package/dist/experimental/babyagi/task_creation.d.cts.map +1 -1
  839. package/dist/experimental/babyagi/task_creation.d.ts.map +1 -1
  840. package/dist/experimental/babyagi/task_creation.js +9 -11
  841. package/dist/experimental/babyagi/task_creation.js.map +1 -1
  842. package/dist/experimental/babyagi/task_execution.cjs +10 -12
  843. package/dist/experimental/babyagi/task_execution.cjs.map +1 -1
  844. package/dist/experimental/babyagi/task_execution.d.cts.map +1 -1
  845. package/dist/experimental/babyagi/task_execution.d.ts.map +1 -1
  846. package/dist/experimental/babyagi/task_execution.js +8 -10
  847. package/dist/experimental/babyagi/task_execution.js.map +1 -1
  848. package/dist/experimental/babyagi/task_prioritization.cjs +10 -12
  849. package/dist/experimental/babyagi/task_prioritization.cjs.map +1 -1
  850. package/dist/experimental/babyagi/task_prioritization.d.cts.map +1 -1
  851. package/dist/experimental/babyagi/task_prioritization.d.ts.map +1 -1
  852. package/dist/experimental/babyagi/task_prioritization.js +8 -10
  853. package/dist/experimental/babyagi/task_prioritization.js.map +1 -1
  854. package/dist/experimental/chains/violation_of_expectations/index.cjs +3 -3
  855. package/dist/experimental/chains/violation_of_expectations/index.js +2 -3
  856. package/dist/experimental/chains/violation_of_expectations/types.cjs.map +1 -1
  857. package/dist/experimental/chains/violation_of_expectations/types.d.cts +0 -1
  858. package/dist/experimental/chains/violation_of_expectations/types.d.cts.map +1 -1
  859. package/dist/experimental/chains/violation_of_expectations/types.d.ts +0 -1
  860. package/dist/experimental/chains/violation_of_expectations/types.d.ts.map +1 -1
  861. package/dist/experimental/chains/violation_of_expectations/types.js.map +1 -1
  862. package/dist/experimental/chains/violation_of_expectations/violation_of_expectations_chain.cjs +20 -30
  863. package/dist/experimental/chains/violation_of_expectations/violation_of_expectations_chain.cjs.map +1 -1
  864. package/dist/experimental/chains/violation_of_expectations/violation_of_expectations_chain.d.cts +0 -1
  865. package/dist/experimental/chains/violation_of_expectations/violation_of_expectations_chain.d.cts.map +1 -1
  866. package/dist/experimental/chains/violation_of_expectations/violation_of_expectations_chain.d.ts +1 -2
  867. package/dist/experimental/chains/violation_of_expectations/violation_of_expectations_chain.d.ts.map +1 -1
  868. package/dist/experimental/chains/violation_of_expectations/violation_of_expectations_chain.js +16 -26
  869. package/dist/experimental/chains/violation_of_expectations/violation_of_expectations_chain.js.map +1 -1
  870. package/dist/experimental/chains/violation_of_expectations/violation_of_expectations_prompt.cjs +6 -6
  871. package/dist/experimental/chains/violation_of_expectations/violation_of_expectations_prompt.cjs.map +1 -1
  872. package/dist/experimental/chains/violation_of_expectations/violation_of_expectations_prompt.js.map +1 -1
  873. package/dist/experimental/generative_agents/generative_agent.cjs +30 -43
  874. package/dist/experimental/generative_agents/generative_agent.cjs.map +1 -1
  875. package/dist/experimental/generative_agents/generative_agent.d.cts +0 -1
  876. package/dist/experimental/generative_agents/generative_agent.d.cts.map +1 -1
  877. package/dist/experimental/generative_agents/generative_agent.d.ts +0 -1
  878. package/dist/experimental/generative_agents/generative_agent.d.ts.map +1 -1
  879. package/dist/experimental/generative_agents/generative_agent.js +23 -36
  880. package/dist/experimental/generative_agents/generative_agent.js.map +1 -1
  881. package/dist/experimental/generative_agents/generative_agent_memory.cjs +17 -26
  882. package/dist/experimental/generative_agents/generative_agent_memory.cjs.map +1 -1
  883. package/dist/experimental/generative_agents/generative_agent_memory.d.cts.map +1 -1
  884. package/dist/experimental/generative_agents/generative_agent_memory.d.ts +1 -1
  885. package/dist/experimental/generative_agents/generative_agent_memory.d.ts.map +1 -1
  886. package/dist/experimental/generative_agents/generative_agent_memory.js +9 -18
  887. package/dist/experimental/generative_agents/generative_agent_memory.js.map +1 -1
  888. package/dist/experimental/generative_agents/index.cjs +3 -3
  889. package/dist/experimental/generative_agents/index.js +2 -3
  890. package/dist/experimental/masking/index.cjs +3 -3
  891. package/dist/experimental/masking/index.js +2 -3
  892. package/dist/experimental/masking/parser.cjs.map +1 -1
  893. package/dist/experimental/masking/parser.d.cts +0 -1
  894. package/dist/experimental/masking/parser.d.cts.map +1 -1
  895. package/dist/experimental/masking/parser.d.ts +0 -1
  896. package/dist/experimental/masking/parser.d.ts.map +1 -1
  897. package/dist/experimental/masking/parser.js.map +1 -1
  898. package/dist/experimental/masking/regex_masking_transformer.cjs +1 -2
  899. package/dist/experimental/masking/regex_masking_transformer.cjs.map +1 -1
  900. package/dist/experimental/masking/regex_masking_transformer.d.cts +0 -1
  901. package/dist/experimental/masking/regex_masking_transformer.d.cts.map +1 -1
  902. package/dist/experimental/masking/regex_masking_transformer.d.ts +0 -1
  903. package/dist/experimental/masking/regex_masking_transformer.d.ts.map +1 -1
  904. package/dist/experimental/masking/regex_masking_transformer.js +1 -2
  905. package/dist/experimental/masking/regex_masking_transformer.js.map +1 -1
  906. package/dist/experimental/masking/transformer.cjs.map +1 -1
  907. package/dist/experimental/masking/transformer.d.cts.map +1 -1
  908. package/dist/experimental/masking/transformer.d.ts.map +1 -1
  909. package/dist/experimental/masking/transformer.js.map +1 -1
  910. package/dist/experimental/masking/types.d.cts +0 -1
  911. package/dist/experimental/masking/types.d.cts.map +1 -1
  912. package/dist/experimental/masking/types.d.ts +0 -1
  913. package/dist/experimental/masking/types.d.ts.map +1 -1
  914. package/dist/experimental/openai_assistant/index.cjs +32 -40
  915. package/dist/experimental/openai_assistant/index.cjs.map +1 -1
  916. package/dist/experimental/openai_assistant/index.d.cts.map +1 -1
  917. package/dist/experimental/openai_assistant/index.d.ts.map +1 -1
  918. package/dist/experimental/openai_assistant/index.js +21 -30
  919. package/dist/experimental/openai_assistant/index.js.map +1 -1
  920. package/dist/experimental/openai_assistant/schema.d.cts.map +1 -1
  921. package/dist/experimental/openai_assistant/schema.d.ts.map +1 -1
  922. package/dist/experimental/openai_files/index.cjs +7 -7
  923. package/dist/experimental/openai_files/index.cjs.map +1 -1
  924. package/dist/experimental/openai_files/index.d.cts.map +1 -1
  925. package/dist/experimental/openai_files/index.d.ts.map +1 -1
  926. package/dist/experimental/openai_files/index.js +2 -3
  927. package/dist/experimental/openai_files/index.js.map +1 -1
  928. package/dist/experimental/plan_and_execute/agent_executor.cjs +3 -5
  929. package/dist/experimental/plan_and_execute/agent_executor.cjs.map +1 -1
  930. package/dist/experimental/plan_and_execute/agent_executor.d.cts +0 -1
  931. package/dist/experimental/plan_and_execute/agent_executor.d.cts.map +1 -1
  932. package/dist/experimental/plan_and_execute/agent_executor.d.ts +0 -1
  933. package/dist/experimental/plan_and_execute/agent_executor.d.ts.map +1 -1
  934. package/dist/experimental/plan_and_execute/agent_executor.js +3 -5
  935. package/dist/experimental/plan_and_execute/agent_executor.js.map +1 -1
  936. package/dist/experimental/plan_and_execute/base.cjs +1 -2
  937. package/dist/experimental/plan_and_execute/base.cjs.map +1 -1
  938. package/dist/experimental/plan_and_execute/base.d.cts +0 -1
  939. package/dist/experimental/plan_and_execute/base.d.cts.map +1 -1
  940. package/dist/experimental/plan_and_execute/base.d.ts +0 -1
  941. package/dist/experimental/plan_and_execute/base.d.ts.map +1 -1
  942. package/dist/experimental/plan_and_execute/base.js +1 -2
  943. package/dist/experimental/plan_and_execute/base.js.map +1 -1
  944. package/dist/experimental/plan_and_execute/index.cjs +3 -3
  945. package/dist/experimental/plan_and_execute/index.js +2 -3
  946. package/dist/experimental/plan_and_execute/outputParser.cjs +3 -3
  947. package/dist/experimental/plan_and_execute/outputParser.cjs.map +1 -1
  948. package/dist/experimental/plan_and_execute/outputParser.d.cts +0 -1
  949. package/dist/experimental/plan_and_execute/outputParser.d.cts.map +1 -1
  950. package/dist/experimental/plan_and_execute/outputParser.d.ts +0 -1
  951. package/dist/experimental/plan_and_execute/outputParser.d.ts.map +1 -1
  952. package/dist/experimental/plan_and_execute/outputParser.js.map +1 -1
  953. package/dist/experimental/plan_and_execute/prompt.cjs +3 -3
  954. package/dist/experimental/plan_and_execute/prompt.cjs.map +1 -1
  955. package/dist/experimental/plan_and_execute/prompt.js.map +1 -1
  956. package/dist/experimental/prompts/custom_format.cjs +6 -6
  957. package/dist/experimental/prompts/custom_format.cjs.map +1 -1
  958. package/dist/experimental/prompts/custom_format.d.cts.map +1 -1
  959. package/dist/experimental/prompts/custom_format.d.ts.map +1 -1
  960. package/dist/experimental/prompts/custom_format.js +3 -4
  961. package/dist/experimental/prompts/custom_format.js.map +1 -1
  962. package/dist/experimental/prompts/handlebars.cjs +6 -6
  963. package/dist/experimental/prompts/handlebars.cjs.map +1 -1
  964. package/dist/experimental/prompts/handlebars.d.cts.map +1 -1
  965. package/dist/experimental/prompts/handlebars.d.ts.map +1 -1
  966. package/dist/experimental/prompts/handlebars.js +3 -5
  967. package/dist/experimental/prompts/handlebars.js.map +1 -1
  968. package/dist/hub/base.cjs +2 -5
  969. package/dist/hub/base.cjs.map +1 -1
  970. package/dist/hub/base.d.cts +2 -5
  971. package/dist/hub/base.d.cts.map +1 -1
  972. package/dist/hub/base.d.ts +2 -5
  973. package/dist/hub/base.d.ts.map +1 -1
  974. package/dist/hub/base.js +2 -5
  975. package/dist/hub/base.js.map +1 -1
  976. package/dist/hub/index.cjs +2 -2
  977. package/dist/hub/index.cjs.map +1 -1
  978. package/dist/hub/index.d.cts +0 -1
  979. package/dist/hub/index.d.cts.map +1 -1
  980. package/dist/hub/index.d.ts +0 -1
  981. package/dist/hub/index.d.ts.map +1 -1
  982. package/dist/hub/index.js +1 -2
  983. package/dist/hub/index.js.map +1 -1
  984. package/dist/hub/node.cjs +7 -13
  985. package/dist/hub/node.cjs.map +1 -1
  986. package/dist/hub/node.d.cts +0 -1
  987. package/dist/hub/node.d.cts.map +1 -1
  988. package/dist/hub/node.d.ts +0 -1
  989. package/dist/hub/node.d.ts.map +1 -1
  990. package/dist/hub/node.js +6 -13
  991. package/dist/hub/node.js.map +1 -1
  992. package/dist/index.cjs +3 -1
  993. package/dist/index.cjs.map +1 -1
  994. package/dist/index.js +3 -1
  995. package/dist/index.js.map +1 -1
  996. package/dist/indexes/index.cjs +16 -16
  997. package/dist/indexes/index.js +2 -3
  998. package/dist/load/import_constants.cjs.map +1 -1
  999. package/dist/load/import_constants.js.map +1 -1
  1000. package/dist/load/import_map.cjs +25 -26
  1001. package/dist/load/import_map.cjs.map +1 -1
  1002. package/dist/load/import_map.js +29 -30
  1003. package/dist/load/import_map.js.map +1 -1
  1004. package/dist/load/import_type.d.cts.map +1 -1
  1005. package/dist/load/import_type.d.ts.map +1 -1
  1006. package/dist/load/index.cjs +13 -3
  1007. package/dist/load/index.cjs.map +1 -1
  1008. package/dist/load/index.d.cts +9 -1
  1009. package/dist/load/index.d.cts.map +1 -1
  1010. package/dist/load/index.d.ts +9 -1
  1011. package/dist/load/index.d.ts.map +1 -1
  1012. package/dist/load/index.js +9 -0
  1013. package/dist/load/index.js.map +1 -1
  1014. package/dist/load/map_keys.d.cts.map +1 -1
  1015. package/dist/load/map_keys.d.ts.map +1 -1
  1016. package/dist/load/serializable.cjs +7 -6
  1017. package/dist/load/serializable.js +4 -4
  1018. package/dist/memory/buffer_memory.cjs +4 -8
  1019. package/dist/memory/buffer_memory.cjs.map +1 -1
  1020. package/dist/memory/buffer_memory.d.cts +0 -1
  1021. package/dist/memory/buffer_memory.d.cts.map +1 -1
  1022. package/dist/memory/buffer_memory.d.ts +0 -1
  1023. package/dist/memory/buffer_memory.d.ts.map +1 -1
  1024. package/dist/memory/buffer_memory.js +2 -6
  1025. package/dist/memory/buffer_memory.js.map +1 -1
  1026. package/dist/memory/buffer_token_memory.cjs +6 -10
  1027. package/dist/memory/buffer_token_memory.cjs.map +1 -1
  1028. package/dist/memory/buffer_token_memory.d.cts +0 -1
  1029. package/dist/memory/buffer_token_memory.d.cts.map +1 -1
  1030. package/dist/memory/buffer_token_memory.d.ts +0 -1
  1031. package/dist/memory/buffer_token_memory.d.ts.map +1 -1
  1032. package/dist/memory/buffer_token_memory.js +2 -6
  1033. package/dist/memory/buffer_token_memory.js.map +1 -1
  1034. package/dist/memory/buffer_window_memory.cjs +4 -8
  1035. package/dist/memory/buffer_window_memory.cjs.map +1 -1
  1036. package/dist/memory/buffer_window_memory.d.cts +0 -1
  1037. package/dist/memory/buffer_window_memory.d.cts.map +1 -1
  1038. package/dist/memory/buffer_window_memory.d.ts +0 -1
  1039. package/dist/memory/buffer_window_memory.d.ts.map +1 -1
  1040. package/dist/memory/buffer_window_memory.js +2 -6
  1041. package/dist/memory/buffer_window_memory.js.map +1 -1
  1042. package/dist/memory/chat_memory.cjs +9 -9
  1043. package/dist/memory/chat_memory.cjs.map +1 -1
  1044. package/dist/memory/chat_memory.d.cts +0 -1
  1045. package/dist/memory/chat_memory.d.cts.map +1 -1
  1046. package/dist/memory/chat_memory.d.ts +0 -1
  1047. package/dist/memory/chat_memory.d.ts.map +1 -1
  1048. package/dist/memory/chat_memory.js +2 -3
  1049. package/dist/memory/chat_memory.js.map +1 -1
  1050. package/dist/memory/combined_memory.cjs.map +1 -1
  1051. package/dist/memory/combined_memory.d.cts +0 -1
  1052. package/dist/memory/combined_memory.d.cts.map +1 -1
  1053. package/dist/memory/combined_memory.d.ts +0 -1
  1054. package/dist/memory/combined_memory.d.ts.map +1 -1
  1055. package/dist/memory/combined_memory.js.map +1 -1
  1056. package/dist/memory/entity_memory.cjs +7 -8
  1057. package/dist/memory/entity_memory.cjs.map +1 -1
  1058. package/dist/memory/entity_memory.d.cts +0 -1
  1059. package/dist/memory/entity_memory.d.cts.map +1 -1
  1060. package/dist/memory/entity_memory.d.ts +0 -1
  1061. package/dist/memory/entity_memory.d.ts.map +1 -1
  1062. package/dist/memory/entity_memory.js +1 -2
  1063. package/dist/memory/entity_memory.js.map +1 -1
  1064. package/dist/memory/index.cjs +16 -16
  1065. package/dist/memory/index.js +2 -3
  1066. package/dist/memory/prompt.cjs +6 -6
  1067. package/dist/memory/prompt.cjs.map +1 -1
  1068. package/dist/memory/prompt.d.cts +0 -1
  1069. package/dist/memory/prompt.d.cts.map +1 -1
  1070. package/dist/memory/prompt.d.ts +0 -1
  1071. package/dist/memory/prompt.d.ts.map +1 -1
  1072. package/dist/memory/prompt.js.map +1 -1
  1073. package/dist/memory/stores/entity/base.cjs +3 -3
  1074. package/dist/memory/stores/entity/base.cjs.map +1 -1
  1075. package/dist/memory/stores/entity/base.d.cts +0 -1
  1076. package/dist/memory/stores/entity/base.d.cts.map +1 -1
  1077. package/dist/memory/stores/entity/base.d.ts +0 -1
  1078. package/dist/memory/stores/entity/base.d.ts.map +1 -1
  1079. package/dist/memory/stores/entity/base.js.map +1 -1
  1080. package/dist/memory/stores/entity/in_memory.cjs.map +1 -1
  1081. package/dist/memory/stores/entity/in_memory.js.map +1 -1
  1082. package/dist/memory/summary.cjs +8 -13
  1083. package/dist/memory/summary.cjs.map +1 -1
  1084. package/dist/memory/summary.d.cts +0 -1
  1085. package/dist/memory/summary.d.cts.map +1 -1
  1086. package/dist/memory/summary.d.ts +1 -2
  1087. package/dist/memory/summary.d.ts.map +1 -1
  1088. package/dist/memory/summary.js +4 -9
  1089. package/dist/memory/summary.js.map +1 -1
  1090. package/dist/memory/summary_buffer.cjs +5 -5
  1091. package/dist/memory/summary_buffer.cjs.map +1 -1
  1092. package/dist/memory/summary_buffer.d.cts +0 -1
  1093. package/dist/memory/summary_buffer.d.cts.map +1 -1
  1094. package/dist/memory/summary_buffer.d.ts +0 -1
  1095. package/dist/memory/summary_buffer.d.ts.map +1 -1
  1096. package/dist/memory/summary_buffer.js.map +1 -1
  1097. package/dist/memory/vector_store.cjs +6 -6
  1098. package/dist/memory/vector_store.cjs.map +1 -1
  1099. package/dist/memory/vector_store.d.cts.map +1 -1
  1100. package/dist/memory/vector_store.d.ts.map +1 -1
  1101. package/dist/memory/vector_store.js +1 -1
  1102. package/dist/memory/vector_store.js.map +1 -1
  1103. package/dist/node_modules/.pnpm/langsmith@0.5.3_@opentelemetry_api@1.9.0_openai@5.23.2_ws@8.19.0_bufferutil@4.1.0__zod@4.3.6_/node_modules/langsmith/dist/client.d.cts +1242 -0
  1104. package/dist/node_modules/.pnpm/langsmith@0.5.3_@opentelemetry_api@1.9.0_openai@5.23.2_ws@8.19.0_bufferutil@4.1.0__zod@4.3.6_/node_modules/langsmith/dist/client.d.cts.map +1 -0
  1105. package/dist/node_modules/.pnpm/langsmith@0.5.3_@opentelemetry_api@1.9.0_openai@5.23.2_ws@8.19.0_bufferutil@4.1.0__zod@4.3.6_/node_modules/langsmith/dist/client.d.ts +1242 -0
  1106. package/dist/node_modules/.pnpm/langsmith@0.5.3_@opentelemetry_api@1.9.0_openai@5.23.2_ws@8.19.0_bufferutil@4.1.0__zod@4.3.6_/node_modules/langsmith/dist/client.d.ts.map +1 -0
  1107. package/dist/node_modules/.pnpm/langsmith@0.5.3_@opentelemetry_api@1.9.0_openai@5.23.2_ws@8.19.0_bufferutil@4.1.0__zod@4.3.6_/node_modules/langsmith/dist/evaluation/_runner.d.cts +4 -0
  1108. package/dist/node_modules/.pnpm/langsmith@0.5.3_@opentelemetry_api@1.9.0_openai@5.23.2_ws@8.19.0_bufferutil@4.1.0__zod@4.3.6_/node_modules/langsmith/dist/evaluation/_runner.d.ts +4 -0
  1109. package/dist/node_modules/.pnpm/langsmith@0.5.3_@opentelemetry_api@1.9.0_openai@5.23.2_ws@8.19.0_bufferutil@4.1.0__zod@4.3.6_/node_modules/langsmith/dist/evaluation/evaluate_comparative.d.cts +2 -0
  1110. package/dist/node_modules/.pnpm/langsmith@0.5.3_@opentelemetry_api@1.9.0_openai@5.23.2_ws@8.19.0_bufferutil@4.1.0__zod@4.3.6_/node_modules/langsmith/dist/evaluation/evaluate_comparative.d.ts +2 -0
  1111. package/dist/node_modules/.pnpm/langsmith@0.5.3_@opentelemetry_api@1.9.0_openai@5.23.2_ws@8.19.0_bufferutil@4.1.0__zod@4.3.6_/node_modules/langsmith/dist/evaluation/evaluator.d.cts +66 -0
  1112. package/dist/node_modules/.pnpm/langsmith@0.5.3_@opentelemetry_api@1.9.0_openai@5.23.2_ws@8.19.0_bufferutil@4.1.0__zod@4.3.6_/node_modules/langsmith/dist/evaluation/evaluator.d.cts.map +1 -0
  1113. package/dist/node_modules/.pnpm/langsmith@0.5.3_@opentelemetry_api@1.9.0_openai@5.23.2_ws@8.19.0_bufferutil@4.1.0__zod@4.3.6_/node_modules/langsmith/dist/evaluation/evaluator.d.ts +66 -0
  1114. package/dist/node_modules/.pnpm/langsmith@0.5.3_@opentelemetry_api@1.9.0_openai@5.23.2_ws@8.19.0_bufferutil@4.1.0__zod@4.3.6_/node_modules/langsmith/dist/evaluation/evaluator.d.ts.map +1 -0
  1115. package/dist/node_modules/.pnpm/langsmith@0.5.3_@opentelemetry_api@1.9.0_openai@5.23.2_ws@8.19.0_bufferutil@4.1.0__zod@4.3.6_/node_modules/langsmith/dist/evaluation/index.d.cts +4 -0
  1116. package/dist/node_modules/.pnpm/langsmith@0.5.3_@opentelemetry_api@1.9.0_openai@5.23.2_ws@8.19.0_bufferutil@4.1.0__zod@4.3.6_/node_modules/langsmith/dist/evaluation/index.d.ts +4 -0
  1117. package/dist/node_modules/.pnpm/langsmith@0.5.3_@opentelemetry_api@1.9.0_openai@5.23.2_ws@8.19.0_bufferutil@4.1.0__zod@4.3.6_/node_modules/langsmith/dist/evaluation/string_evaluator.d.cts +1 -0
  1118. package/dist/node_modules/.pnpm/langsmith@0.5.3_@opentelemetry_api@1.9.0_openai@5.23.2_ws@8.19.0_bufferutil@4.1.0__zod@4.3.6_/node_modules/langsmith/dist/evaluation/string_evaluator.d.ts +1 -0
  1119. package/dist/node_modules/.pnpm/langsmith@0.5.3_@opentelemetry_api@1.9.0_openai@5.23.2_ws@8.19.0_bufferutil@4.1.0__zod@4.3.6_/node_modules/langsmith/dist/index.d.cts +4 -0
  1120. package/dist/node_modules/.pnpm/langsmith@0.5.3_@opentelemetry_api@1.9.0_openai@5.23.2_ws@8.19.0_bufferutil@4.1.0__zod@4.3.6_/node_modules/langsmith/dist/index.d.ts +4 -0
  1121. package/dist/node_modules/.pnpm/langsmith@0.5.3_@opentelemetry_api@1.9.0_openai@5.23.2_ws@8.19.0_bufferutil@4.1.0__zod@4.3.6_/node_modules/langsmith/dist/run_trees.d.cts +145 -0
  1122. package/dist/node_modules/.pnpm/langsmith@0.5.3_@opentelemetry_api@1.9.0_openai@5.23.2_ws@8.19.0_bufferutil@4.1.0__zod@4.3.6_/node_modules/langsmith/dist/run_trees.d.cts.map +1 -0
  1123. package/dist/node_modules/.pnpm/langsmith@0.5.3_@opentelemetry_api@1.9.0_openai@5.23.2_ws@8.19.0_bufferutil@4.1.0__zod@4.3.6_/node_modules/langsmith/dist/run_trees.d.ts +145 -0
  1124. package/dist/node_modules/.pnpm/langsmith@0.5.3_@opentelemetry_api@1.9.0_openai@5.23.2_ws@8.19.0_bufferutil@4.1.0__zod@4.3.6_/node_modules/langsmith/dist/run_trees.d.ts.map +1 -0
  1125. package/dist/node_modules/.pnpm/langsmith@0.5.3_@opentelemetry_api@1.9.0_openai@5.23.2_ws@8.19.0_bufferutil@4.1.0__zod@4.3.6_/node_modules/langsmith/dist/schemas.d.cts +411 -0
  1126. package/dist/node_modules/.pnpm/langsmith@0.5.3_@opentelemetry_api@1.9.0_openai@5.23.2_ws@8.19.0_bufferutil@4.1.0__zod@4.3.6_/node_modules/langsmith/dist/schemas.d.cts.map +1 -0
  1127. package/dist/node_modules/.pnpm/langsmith@0.5.3_@opentelemetry_api@1.9.0_openai@5.23.2_ws@8.19.0_bufferutil@4.1.0__zod@4.3.6_/node_modules/langsmith/dist/schemas.d.ts +411 -0
  1128. package/dist/node_modules/.pnpm/langsmith@0.5.3_@opentelemetry_api@1.9.0_openai@5.23.2_ws@8.19.0_bufferutil@4.1.0__zod@4.3.6_/node_modules/langsmith/dist/schemas.d.ts.map +1 -0
  1129. package/dist/node_modules/.pnpm/langsmith@0.5.3_@opentelemetry_api@1.9.0_openai@5.23.2_ws@8.19.0_bufferutil@4.1.0__zod@4.3.6_/node_modules/langsmith/dist/singletons/traceable.d.cts +8 -0
  1130. package/dist/node_modules/.pnpm/langsmith@0.5.3_@opentelemetry_api@1.9.0_openai@5.23.2_ws@8.19.0_bufferutil@4.1.0__zod@4.3.6_/node_modules/langsmith/dist/singletons/traceable.d.cts.map +1 -0
  1131. package/dist/node_modules/.pnpm/langsmith@0.5.3_@opentelemetry_api@1.9.0_openai@5.23.2_ws@8.19.0_bufferutil@4.1.0__zod@4.3.6_/node_modules/langsmith/dist/singletons/traceable.d.ts +8 -0
  1132. package/dist/node_modules/.pnpm/langsmith@0.5.3_@opentelemetry_api@1.9.0_openai@5.23.2_ws@8.19.0_bufferutil@4.1.0__zod@4.3.6_/node_modules/langsmith/dist/singletons/traceable.d.ts.map +1 -0
  1133. package/dist/node_modules/.pnpm/langsmith@0.5.3_@opentelemetry_api@1.9.0_openai@5.23.2_ws@8.19.0_bufferutil@4.1.0__zod@4.3.6_/node_modules/langsmith/dist/singletons/types.d.cts +38 -0
  1134. package/dist/node_modules/.pnpm/langsmith@0.5.3_@opentelemetry_api@1.9.0_openai@5.23.2_ws@8.19.0_bufferutil@4.1.0__zod@4.3.6_/node_modules/langsmith/dist/singletons/types.d.cts.map +1 -0
  1135. package/dist/node_modules/.pnpm/langsmith@0.5.3_@opentelemetry_api@1.9.0_openai@5.23.2_ws@8.19.0_bufferutil@4.1.0__zod@4.3.6_/node_modules/langsmith/dist/singletons/types.d.ts +38 -0
  1136. package/dist/node_modules/.pnpm/langsmith@0.5.3_@opentelemetry_api@1.9.0_openai@5.23.2_ws@8.19.0_bufferutil@4.1.0__zod@4.3.6_/node_modules/langsmith/dist/singletons/types.d.ts.map +1 -0
  1137. package/dist/node_modules/.pnpm/langsmith@0.5.3_@opentelemetry_api@1.9.0_openai@5.23.2_ws@8.19.0_bufferutil@4.1.0__zod@4.3.6_/node_modules/langsmith/dist/utils/async_caller.d.cts +27 -0
  1138. package/dist/node_modules/.pnpm/langsmith@0.5.3_@opentelemetry_api@1.9.0_openai@5.23.2_ws@8.19.0_bufferutil@4.1.0__zod@4.3.6_/node_modules/langsmith/dist/utils/async_caller.d.cts.map +1 -0
  1139. package/dist/node_modules/.pnpm/langsmith@0.5.3_@opentelemetry_api@1.9.0_openai@5.23.2_ws@8.19.0_bufferutil@4.1.0__zod@4.3.6_/node_modules/langsmith/dist/utils/async_caller.d.ts +27 -0
  1140. package/dist/node_modules/.pnpm/langsmith@0.5.3_@opentelemetry_api@1.9.0_openai@5.23.2_ws@8.19.0_bufferutil@4.1.0__zod@4.3.6_/node_modules/langsmith/dist/utils/async_caller.d.ts.map +1 -0
  1141. package/dist/node_modules/.pnpm/langsmith@0.5.3_@opentelemetry_api@1.9.0_openai@5.23.2_ws@8.19.0_bufferutil@4.1.0__zod@4.3.6_/node_modules/langsmith/dist/utils/p-queue.d.cts +1 -0
  1142. package/dist/node_modules/.pnpm/langsmith@0.5.3_@opentelemetry_api@1.9.0_openai@5.23.2_ws@8.19.0_bufferutil@4.1.0__zod@4.3.6_/node_modules/langsmith/dist/utils/p-queue.d.ts +1 -0
  1143. package/dist/node_modules/.pnpm/langsmith@0.5.3_@opentelemetry_api@1.9.0_openai@5.23.2_ws@8.19.0_bufferutil@4.1.0__zod@4.3.6_/node_modules/langsmith/dist/utils/prompt_cache/index.d.cts +129 -0
  1144. package/dist/node_modules/.pnpm/langsmith@0.5.3_@opentelemetry_api@1.9.0_openai@5.23.2_ws@8.19.0_bufferutil@4.1.0__zod@4.3.6_/node_modules/langsmith/dist/utils/prompt_cache/index.d.cts.map +1 -0
  1145. package/dist/node_modules/.pnpm/langsmith@0.5.3_@opentelemetry_api@1.9.0_openai@5.23.2_ws@8.19.0_bufferutil@4.1.0__zod@4.3.6_/node_modules/langsmith/dist/utils/prompt_cache/index.d.ts +129 -0
  1146. package/dist/node_modules/.pnpm/langsmith@0.5.3_@opentelemetry_api@1.9.0_openai@5.23.2_ws@8.19.0_bufferutil@4.1.0__zod@4.3.6_/node_modules/langsmith/dist/utils/prompt_cache/index.d.ts.map +1 -0
  1147. package/dist/node_modules/.pnpm/langsmith@0.5.3_@opentelemetry_api@1.9.0_openai@5.23.2_ws@8.19.0_bufferutil@4.1.0__zod@4.3.6_/node_modules/langsmith/evaluation.d.cts +2 -0
  1148. package/dist/node_modules/.pnpm/langsmith@0.5.3_@opentelemetry_api@1.9.0_openai@5.23.2_ws@8.19.0_bufferutil@4.1.0__zod@4.3.6_/node_modules/langsmith/evaluation.d.ts +2 -0
  1149. package/dist/node_modules/.pnpm/langsmith@0.5.3_@opentelemetry_api@1.9.0_openai@5.23.2_ws@8.19.0_bufferutil@4.1.0__zod@4.3.6_/node_modules/langsmith/singletons/traceable.d.cts +2 -0
  1150. package/dist/node_modules/.pnpm/langsmith@0.5.3_@opentelemetry_api@1.9.0_openai@5.23.2_ws@8.19.0_bufferutil@4.1.0__zod@4.3.6_/node_modules/langsmith/singletons/traceable.d.ts +2 -0
  1151. package/dist/node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/index.d.cts +1 -0
  1152. package/dist/node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/index.d.ts +1 -0
  1153. package/dist/output_parsers/combining.cjs +4 -4
  1154. package/dist/output_parsers/combining.cjs.map +1 -1
  1155. package/dist/output_parsers/combining.d.cts +0 -1
  1156. package/dist/output_parsers/combining.d.cts.map +1 -1
  1157. package/dist/output_parsers/combining.d.ts +0 -1
  1158. package/dist/output_parsers/combining.d.ts.map +1 -1
  1159. package/dist/output_parsers/combining.js +1 -1
  1160. package/dist/output_parsers/combining.js.map +1 -1
  1161. package/dist/output_parsers/datetime.cjs +4 -4
  1162. package/dist/output_parsers/datetime.cjs.map +1 -1
  1163. package/dist/output_parsers/datetime.d.cts +0 -1
  1164. package/dist/output_parsers/datetime.d.cts.map +1 -1
  1165. package/dist/output_parsers/datetime.d.ts +0 -1
  1166. package/dist/output_parsers/datetime.d.ts.map +1 -1
  1167. package/dist/output_parsers/datetime.js.map +1 -1
  1168. package/dist/output_parsers/expression.cjs +7 -9
  1169. package/dist/output_parsers/expression.cjs.map +1 -1
  1170. package/dist/output_parsers/expression.d.cts.map +1 -1
  1171. package/dist/output_parsers/expression.d.ts.map +1 -1
  1172. package/dist/output_parsers/expression.js +4 -7
  1173. package/dist/output_parsers/expression.js.map +1 -1
  1174. package/dist/output_parsers/expression_type_handlers/array_literal_expression_handler.cjs.map +1 -1
  1175. package/dist/output_parsers/expression_type_handlers/array_literal_expression_handler.js.map +1 -1
  1176. package/dist/output_parsers/expression_type_handlers/base.cjs +1 -2
  1177. package/dist/output_parsers/expression_type_handlers/base.cjs.map +1 -1
  1178. package/dist/output_parsers/expression_type_handlers/base.d.cts +0 -1
  1179. package/dist/output_parsers/expression_type_handlers/base.d.cts.map +1 -1
  1180. package/dist/output_parsers/expression_type_handlers/base.d.ts +0 -1
  1181. package/dist/output_parsers/expression_type_handlers/base.d.ts.map +1 -1
  1182. package/dist/output_parsers/expression_type_handlers/base.js +1 -2
  1183. package/dist/output_parsers/expression_type_handlers/base.js.map +1 -1
  1184. package/dist/output_parsers/expression_type_handlers/boolean_literal_handler.cjs.map +1 -1
  1185. package/dist/output_parsers/expression_type_handlers/boolean_literal_handler.js.map +1 -1
  1186. package/dist/output_parsers/expression_type_handlers/call_expression_handler.cjs.map +1 -1
  1187. package/dist/output_parsers/expression_type_handlers/call_expression_handler.js.map +1 -1
  1188. package/dist/output_parsers/expression_type_handlers/factory.cjs +1 -4
  1189. package/dist/output_parsers/expression_type_handlers/factory.cjs.map +1 -1
  1190. package/dist/output_parsers/expression_type_handlers/factory.d.cts +0 -1
  1191. package/dist/output_parsers/expression_type_handlers/factory.d.cts.map +1 -1
  1192. package/dist/output_parsers/expression_type_handlers/factory.d.ts +0 -1
  1193. package/dist/output_parsers/expression_type_handlers/factory.d.ts.map +1 -1
  1194. package/dist/output_parsers/expression_type_handlers/factory.js +1 -4
  1195. package/dist/output_parsers/expression_type_handlers/factory.js.map +1 -1
  1196. package/dist/output_parsers/expression_type_handlers/grammar/parser_grammar.cjs.map +1 -1
  1197. package/dist/output_parsers/expression_type_handlers/grammar/parser_grammar.js.map +1 -1
  1198. package/dist/output_parsers/expression_type_handlers/identifier_handler.cjs +1 -2
  1199. package/dist/output_parsers/expression_type_handlers/identifier_handler.cjs.map +1 -1
  1200. package/dist/output_parsers/expression_type_handlers/identifier_handler.js +1 -2
  1201. package/dist/output_parsers/expression_type_handlers/identifier_handler.js.map +1 -1
  1202. package/dist/output_parsers/expression_type_handlers/member_expression_handler.cjs.map +1 -1
  1203. package/dist/output_parsers/expression_type_handlers/member_expression_handler.js.map +1 -1
  1204. package/dist/output_parsers/expression_type_handlers/numeric_literal_handler.cjs.map +1 -1
  1205. package/dist/output_parsers/expression_type_handlers/numeric_literal_handler.js.map +1 -1
  1206. package/dist/output_parsers/expression_type_handlers/object_literal_expression_handler.cjs.map +1 -1
  1207. package/dist/output_parsers/expression_type_handlers/object_literal_expression_handler.js.map +1 -1
  1208. package/dist/output_parsers/expression_type_handlers/property_assignment_handler.cjs +2 -4
  1209. package/dist/output_parsers/expression_type_handlers/property_assignment_handler.cjs.map +1 -1
  1210. package/dist/output_parsers/expression_type_handlers/property_assignment_handler.js +2 -4
  1211. package/dist/output_parsers/expression_type_handlers/property_assignment_handler.js.map +1 -1
  1212. package/dist/output_parsers/expression_type_handlers/string_literal_handler.cjs +1 -2
  1213. package/dist/output_parsers/expression_type_handlers/string_literal_handler.cjs.map +1 -1
  1214. package/dist/output_parsers/expression_type_handlers/string_literal_handler.js +1 -2
  1215. package/dist/output_parsers/expression_type_handlers/string_literal_handler.js.map +1 -1
  1216. package/dist/output_parsers/expression_type_handlers/types.d.cts.map +1 -1
  1217. package/dist/output_parsers/expression_type_handlers/types.d.ts.map +1 -1
  1218. package/dist/output_parsers/fix.cjs +10 -16
  1219. package/dist/output_parsers/fix.cjs.map +1 -1
  1220. package/dist/output_parsers/fix.d.cts.map +1 -1
  1221. package/dist/output_parsers/fix.d.ts.map +1 -1
  1222. package/dist/output_parsers/fix.js +6 -12
  1223. package/dist/output_parsers/fix.js.map +1 -1
  1224. package/dist/output_parsers/http_response.cjs +5 -8
  1225. package/dist/output_parsers/http_response.cjs.map +1 -1
  1226. package/dist/output_parsers/http_response.d.cts.map +1 -1
  1227. package/dist/output_parsers/http_response.d.ts +1 -1
  1228. package/dist/output_parsers/http_response.d.ts.map +1 -1
  1229. package/dist/output_parsers/http_response.js +1 -4
  1230. package/dist/output_parsers/http_response.js.map +1 -1
  1231. package/dist/output_parsers/index.cjs +10 -10
  1232. package/dist/output_parsers/index.js +2 -3
  1233. package/dist/output_parsers/noop.cjs +3 -3
  1234. package/dist/output_parsers/noop.cjs.map +1 -1
  1235. package/dist/output_parsers/noop.js.map +1 -1
  1236. package/dist/output_parsers/openai_functions.cjs +15 -18
  1237. package/dist/output_parsers/openai_functions.cjs.map +1 -1
  1238. package/dist/output_parsers/openai_functions.d.cts +0 -1
  1239. package/dist/output_parsers/openai_functions.d.cts.map +1 -1
  1240. package/dist/output_parsers/openai_functions.d.ts +0 -1
  1241. package/dist/output_parsers/openai_functions.d.ts.map +1 -1
  1242. package/dist/output_parsers/openai_functions.js +6 -9
  1243. package/dist/output_parsers/openai_functions.js.map +1 -1
  1244. package/dist/output_parsers/openai_tools.cjs +5 -6
  1245. package/dist/output_parsers/openai_tools.cjs.map +1 -1
  1246. package/dist/output_parsers/openai_tools.d.cts +4 -9
  1247. package/dist/output_parsers/openai_tools.d.cts.map +1 -1
  1248. package/dist/output_parsers/openai_tools.d.ts +4 -9
  1249. package/dist/output_parsers/openai_tools.d.ts.map +1 -1
  1250. package/dist/output_parsers/openai_tools.js +1 -2
  1251. package/dist/output_parsers/openai_tools.js.map +1 -1
  1252. package/dist/output_parsers/prompts.cjs +3 -3
  1253. package/dist/output_parsers/prompts.cjs.map +1 -1
  1254. package/dist/output_parsers/prompts.js.map +1 -1
  1255. package/dist/output_parsers/regex.cjs +4 -4
  1256. package/dist/output_parsers/regex.cjs.map +1 -1
  1257. package/dist/output_parsers/regex.d.cts.map +1 -1
  1258. package/dist/output_parsers/regex.d.ts.map +1 -1
  1259. package/dist/output_parsers/regex.js.map +1 -1
  1260. package/dist/output_parsers/router.cjs +3 -3
  1261. package/dist/output_parsers/router.cjs.map +1 -1
  1262. package/dist/output_parsers/router.d.cts +0 -1
  1263. package/dist/output_parsers/router.d.cts.map +1 -1
  1264. package/dist/output_parsers/router.d.ts +0 -1
  1265. package/dist/output_parsers/router.d.ts.map +1 -1
  1266. package/dist/output_parsers/router.js.map +1 -1
  1267. package/dist/output_parsers/structured.cjs +19 -20
  1268. package/dist/output_parsers/structured.cjs.map +1 -1
  1269. package/dist/output_parsers/structured.d.cts.map +1 -1
  1270. package/dist/output_parsers/structured.d.ts.map +1 -1
  1271. package/dist/output_parsers/structured.js +6 -7
  1272. package/dist/output_parsers/structured.js.map +1 -1
  1273. package/dist/retrievers/contextual_compression.cjs +6 -7
  1274. package/dist/retrievers/contextual_compression.cjs.map +1 -1
  1275. package/dist/retrievers/contextual_compression.d.cts +0 -1
  1276. package/dist/retrievers/contextual_compression.d.cts.map +1 -1
  1277. package/dist/retrievers/contextual_compression.d.ts +1 -2
  1278. package/dist/retrievers/contextual_compression.d.ts.map +1 -1
  1279. package/dist/retrievers/contextual_compression.js +3 -5
  1280. package/dist/retrievers/contextual_compression.js.map +1 -1
  1281. package/dist/retrievers/document_compressors/chain_extract.cjs +16 -19
  1282. package/dist/retrievers/document_compressors/chain_extract.cjs.map +1 -1
  1283. package/dist/retrievers/document_compressors/chain_extract.d.cts +0 -1
  1284. package/dist/retrievers/document_compressors/chain_extract.d.cts.map +1 -1
  1285. package/dist/retrievers/document_compressors/chain_extract.d.ts +1 -2
  1286. package/dist/retrievers/document_compressors/chain_extract.d.ts.map +1 -1
  1287. package/dist/retrievers/document_compressors/chain_extract.js +10 -14
  1288. package/dist/retrievers/document_compressors/chain_extract.js.map +1 -1
  1289. package/dist/retrievers/document_compressors/chain_extract_prompt.cjs.map +1 -1
  1290. package/dist/retrievers/document_compressors/chain_extract_prompt.js.map +1 -1
  1291. package/dist/retrievers/document_compressors/embeddings_filter.cjs +5 -5
  1292. package/dist/retrievers/document_compressors/embeddings_filter.cjs.map +1 -1
  1293. package/dist/retrievers/document_compressors/embeddings_filter.d.cts +0 -1
  1294. package/dist/retrievers/document_compressors/embeddings_filter.d.cts.map +1 -1
  1295. package/dist/retrievers/document_compressors/embeddings_filter.d.ts +0 -1
  1296. package/dist/retrievers/document_compressors/embeddings_filter.d.ts.map +1 -1
  1297. package/dist/retrievers/document_compressors/embeddings_filter.js +2 -3
  1298. package/dist/retrievers/document_compressors/embeddings_filter.js.map +1 -1
  1299. package/dist/retrievers/document_compressors/index.cjs +3 -3
  1300. package/dist/retrievers/document_compressors/index.cjs.map +1 -1
  1301. package/dist/retrievers/document_compressors/index.d.cts +0 -1
  1302. package/dist/retrievers/document_compressors/index.d.cts.map +1 -1
  1303. package/dist/retrievers/document_compressors/index.d.ts +1 -2
  1304. package/dist/retrievers/document_compressors/index.d.ts.map +1 -1
  1305. package/dist/retrievers/document_compressors/index.js +2 -3
  1306. package/dist/retrievers/document_compressors/index.js.map +1 -1
  1307. package/dist/retrievers/ensemble.cjs +7 -9
  1308. package/dist/retrievers/ensemble.cjs.map +1 -1
  1309. package/dist/retrievers/ensemble.d.cts.map +1 -1
  1310. package/dist/retrievers/ensemble.d.ts +1 -1
  1311. package/dist/retrievers/ensemble.d.ts.map +1 -1
  1312. package/dist/retrievers/ensemble.js +4 -7
  1313. package/dist/retrievers/ensemble.js.map +1 -1
  1314. package/dist/retrievers/hyde.cjs +11 -13
  1315. package/dist/retrievers/hyde.cjs.map +1 -1
  1316. package/dist/retrievers/hyde.d.cts +0 -1
  1317. package/dist/retrievers/hyde.d.cts.map +1 -1
  1318. package/dist/retrievers/hyde.d.ts +1 -2
  1319. package/dist/retrievers/hyde.d.ts.map +1 -1
  1320. package/dist/retrievers/hyde.js +4 -7
  1321. package/dist/retrievers/hyde.js.map +1 -1
  1322. package/dist/retrievers/matryoshka_retriever.cjs +9 -9
  1323. package/dist/retrievers/matryoshka_retriever.cjs.map +1 -1
  1324. package/dist/retrievers/matryoshka_retriever.d.cts +0 -1
  1325. package/dist/retrievers/matryoshka_retriever.d.cts.map +1 -1
  1326. package/dist/retrievers/matryoshka_retriever.d.ts +0 -1
  1327. package/dist/retrievers/matryoshka_retriever.d.ts.map +1 -1
  1328. package/dist/retrievers/matryoshka_retriever.js +2 -3
  1329. package/dist/retrievers/matryoshka_retriever.js.map +1 -1
  1330. package/dist/retrievers/multi_query.cjs +15 -19
  1331. package/dist/retrievers/multi_query.cjs.map +1 -1
  1332. package/dist/retrievers/multi_query.d.cts.map +1 -1
  1333. package/dist/retrievers/multi_query.d.ts +1 -1
  1334. package/dist/retrievers/multi_query.d.ts.map +1 -1
  1335. package/dist/retrievers/multi_query.js +8 -13
  1336. package/dist/retrievers/multi_query.js.map +1 -1
  1337. package/dist/retrievers/multi_vector.cjs +6 -7
  1338. package/dist/retrievers/multi_vector.cjs.map +1 -1
  1339. package/dist/retrievers/multi_vector.d.cts +0 -1
  1340. package/dist/retrievers/multi_vector.d.cts.map +1 -1
  1341. package/dist/retrievers/multi_vector.d.ts +0 -1
  1342. package/dist/retrievers/multi_vector.d.ts.map +1 -1
  1343. package/dist/retrievers/multi_vector.js +3 -5
  1344. package/dist/retrievers/multi_vector.js.map +1 -1
  1345. package/dist/retrievers/parent_document.cjs +8 -9
  1346. package/dist/retrievers/parent_document.cjs.map +1 -1
  1347. package/dist/retrievers/parent_document.d.cts.map +1 -1
  1348. package/dist/retrievers/parent_document.d.ts +1 -1
  1349. package/dist/retrievers/parent_document.d.ts.map +1 -1
  1350. package/dist/retrievers/parent_document.js +4 -7
  1351. package/dist/retrievers/parent_document.js.map +1 -1
  1352. package/dist/retrievers/score_threshold.cjs +6 -7
  1353. package/dist/retrievers/score_threshold.cjs.map +1 -1
  1354. package/dist/retrievers/score_threshold.d.cts.map +1 -1
  1355. package/dist/retrievers/score_threshold.d.ts.map +1 -1
  1356. package/dist/retrievers/score_threshold.js +3 -5
  1357. package/dist/retrievers/score_threshold.js.map +1 -1
  1358. package/dist/retrievers/self_query/functional.cjs +5 -5
  1359. package/dist/retrievers/self_query/functional.js +2 -3
  1360. package/dist/retrievers/self_query/index.cjs +13 -13
  1361. package/dist/retrievers/self_query/index.cjs.map +1 -1
  1362. package/dist/retrievers/self_query/index.d.cts +0 -1
  1363. package/dist/retrievers/self_query/index.d.cts.map +1 -1
  1364. package/dist/retrievers/self_query/index.d.ts +1 -2
  1365. package/dist/retrievers/self_query/index.d.ts.map +1 -1
  1366. package/dist/retrievers/self_query/index.js +3 -4
  1367. package/dist/retrievers/self_query/index.js.map +1 -1
  1368. package/dist/retrievers/time_weighted.cjs +6 -7
  1369. package/dist/retrievers/time_weighted.cjs.map +1 -1
  1370. package/dist/retrievers/time_weighted.d.cts +0 -1
  1371. package/dist/retrievers/time_weighted.d.cts.map +1 -1
  1372. package/dist/retrievers/time_weighted.d.ts +1 -2
  1373. package/dist/retrievers/time_weighted.d.ts.map +1 -1
  1374. package/dist/retrievers/time_weighted.js +3 -5
  1375. package/dist/retrievers/time_weighted.js.map +1 -1
  1376. package/dist/schema/prompt_template.cjs +3 -3
  1377. package/dist/schema/prompt_template.cjs.map +1 -1
  1378. package/dist/schema/prompt_template.d.cts +0 -1
  1379. package/dist/schema/prompt_template.d.cts.map +1 -1
  1380. package/dist/schema/prompt_template.d.ts +1 -2
  1381. package/dist/schema/prompt_template.d.ts.map +1 -1
  1382. package/dist/schema/prompt_template.js +2 -3
  1383. package/dist/schema/prompt_template.js.map +1 -1
  1384. package/dist/schema/query_constructor.cjs +3 -3
  1385. package/dist/schema/query_constructor.cjs.map +1 -1
  1386. package/dist/schema/query_constructor.d.cts.map +1 -1
  1387. package/dist/schema/query_constructor.d.ts.map +1 -1
  1388. package/dist/schema/query_constructor.js +2 -3
  1389. package/dist/schema/query_constructor.js.map +1 -1
  1390. package/dist/smith/config.cjs.map +1 -1
  1391. package/dist/smith/config.d.cts +10 -9
  1392. package/dist/smith/config.d.cts.map +1 -1
  1393. package/dist/smith/config.d.ts +10 -9
  1394. package/dist/smith/config.d.ts.map +1 -1
  1395. package/dist/smith/config.js.map +1 -1
  1396. package/dist/smith/index.cjs +3 -3
  1397. package/dist/smith/index.js +2 -3
  1398. package/dist/smith/name_generation.cjs +1 -4
  1399. package/dist/smith/name_generation.cjs.map +1 -1
  1400. package/dist/smith/name_generation.js +1 -4
  1401. package/dist/smith/name_generation.js.map +1 -1
  1402. package/dist/smith/progress.cjs.map +1 -1
  1403. package/dist/smith/progress.js.map +1 -1
  1404. package/dist/smith/runner_utils.cjs +30 -37
  1405. package/dist/smith/runner_utils.cjs.map +1 -1
  1406. package/dist/smith/runner_utils.d.cts +2 -1
  1407. package/dist/smith/runner_utils.d.cts.map +1 -1
  1408. package/dist/smith/runner_utils.d.ts +2 -1
  1409. package/dist/smith/runner_utils.d.ts.map +1 -1
  1410. package/dist/smith/runner_utils.js +12 -19
  1411. package/dist/smith/runner_utils.js.map +1 -1
  1412. package/dist/sql_db.cjs +5 -5
  1413. package/dist/sql_db.cjs.map +1 -1
  1414. package/dist/sql_db.d.cts +0 -1
  1415. package/dist/sql_db.d.cts.map +1 -1
  1416. package/dist/sql_db.d.ts +0 -1
  1417. package/dist/sql_db.d.ts.map +1 -1
  1418. package/dist/sql_db.js +2 -3
  1419. package/dist/sql_db.js.map +1 -1
  1420. package/dist/storage/encoder_backed.cjs +9 -10
  1421. package/dist/storage/encoder_backed.cjs.map +1 -1
  1422. package/dist/storage/encoder_backed.d.cts +0 -1
  1423. package/dist/storage/encoder_backed.d.cts.map +1 -1
  1424. package/dist/storage/encoder_backed.d.ts +0 -1
  1425. package/dist/storage/encoder_backed.d.ts.map +1 -1
  1426. package/dist/storage/encoder_backed.js +4 -6
  1427. package/dist/storage/encoder_backed.js.map +1 -1
  1428. package/dist/storage/file_system.cjs +12 -11
  1429. package/dist/storage/file_system.cjs.map +1 -1
  1430. package/dist/storage/file_system.d.cts +0 -1
  1431. package/dist/storage/file_system.d.cts.map +1 -1
  1432. package/dist/storage/file_system.d.ts +0 -1
  1433. package/dist/storage/file_system.d.ts.map +1 -1
  1434. package/dist/storage/file_system.js +5 -7
  1435. package/dist/storage/file_system.js.map +1 -1
  1436. package/dist/storage/in_memory.cjs +5 -5
  1437. package/dist/storage/in_memory.js +2 -3
  1438. package/dist/stores/doc/base.cjs +3 -3
  1439. package/dist/stores/doc/base.cjs.map +1 -1
  1440. package/dist/stores/doc/base.d.cts +0 -1
  1441. package/dist/stores/doc/base.d.cts.map +1 -1
  1442. package/dist/stores/doc/base.d.ts +0 -1
  1443. package/dist/stores/doc/base.d.ts.map +1 -1
  1444. package/dist/stores/doc/base.js +2 -3
  1445. package/dist/stores/doc/base.js.map +1 -1
  1446. package/dist/stores/doc/in_memory.cjs +3 -3
  1447. package/dist/stores/doc/in_memory.cjs.map +1 -1
  1448. package/dist/stores/doc/in_memory.d.cts +0 -1
  1449. package/dist/stores/doc/in_memory.d.cts.map +1 -1
  1450. package/dist/stores/doc/in_memory.d.ts +0 -1
  1451. package/dist/stores/doc/in_memory.d.ts.map +1 -1
  1452. package/dist/stores/doc/in_memory.js +2 -3
  1453. package/dist/stores/doc/in_memory.js.map +1 -1
  1454. package/dist/stores/file/base.cjs +3 -3
  1455. package/dist/stores/file/base.cjs.map +1 -1
  1456. package/dist/stores/file/base.d.cts +0 -1
  1457. package/dist/stores/file/base.d.cts.map +1 -1
  1458. package/dist/stores/file/base.d.ts +0 -1
  1459. package/dist/stores/file/base.d.ts.map +1 -1
  1460. package/dist/stores/file/base.js.map +1 -1
  1461. package/dist/stores/file/in_memory.cjs +3 -3
  1462. package/dist/stores/file/in_memory.cjs.map +1 -1
  1463. package/dist/stores/file/in_memory.d.cts +0 -1
  1464. package/dist/stores/file/in_memory.d.cts.map +1 -1
  1465. package/dist/stores/file/in_memory.d.ts +0 -1
  1466. package/dist/stores/file/in_memory.d.ts.map +1 -1
  1467. package/dist/stores/file/in_memory.js +2 -3
  1468. package/dist/stores/file/in_memory.js.map +1 -1
  1469. package/dist/stores/file/node.cjs +7 -6
  1470. package/dist/stores/file/node.cjs.map +1 -1
  1471. package/dist/stores/file/node.d.cts +0 -1
  1472. package/dist/stores/file/node.d.cts.map +1 -1
  1473. package/dist/stores/file/node.d.ts +0 -1
  1474. package/dist/stores/file/node.d.ts.map +1 -1
  1475. package/dist/stores/file/node.js +6 -7
  1476. package/dist/stores/file/node.js.map +1 -1
  1477. package/dist/stores/message/in_memory.cjs +5 -5
  1478. package/dist/stores/message/in_memory.js +2 -3
  1479. package/dist/text_splitter.cjs +7 -6
  1480. package/dist/text_splitter.d.cts +3 -2
  1481. package/dist/text_splitter.d.cts.map +1 -1
  1482. package/dist/text_splitter.d.ts +3 -2
  1483. package/dist/text_splitter.d.ts.map +1 -1
  1484. package/dist/text_splitter.js +4 -4
  1485. package/dist/tools/chain.cjs +6 -6
  1486. package/dist/tools/chain.cjs.map +1 -1
  1487. package/dist/tools/chain.d.cts +0 -1
  1488. package/dist/tools/chain.d.cts.map +1 -1
  1489. package/dist/tools/chain.d.ts +0 -1
  1490. package/dist/tools/chain.d.ts.map +1 -1
  1491. package/dist/tools/chain.js +3 -4
  1492. package/dist/tools/chain.js.map +1 -1
  1493. package/dist/tools/fs.cjs +6 -6
  1494. package/dist/tools/fs.cjs.map +1 -1
  1495. package/dist/tools/fs.d.cts +0 -1
  1496. package/dist/tools/fs.d.cts.map +1 -1
  1497. package/dist/tools/fs.d.ts +0 -1
  1498. package/dist/tools/fs.d.ts.map +1 -1
  1499. package/dist/tools/fs.js +1 -1
  1500. package/dist/tools/fs.js.map +1 -1
  1501. package/dist/tools/index.cjs +13 -13
  1502. package/dist/tools/index.js +2 -3
  1503. package/dist/tools/json.cjs +10 -11
  1504. package/dist/tools/json.cjs.map +1 -1
  1505. package/dist/tools/json.d.cts.map +1 -1
  1506. package/dist/tools/json.d.ts.map +1 -1
  1507. package/dist/tools/json.js +2 -4
  1508. package/dist/tools/json.js.map +1 -1
  1509. package/dist/tools/render.cjs +9 -9
  1510. package/dist/tools/render.cjs.map +1 -1
  1511. package/dist/tools/render.d.cts +0 -1
  1512. package/dist/tools/render.d.cts.map +1 -1
  1513. package/dist/tools/render.d.ts +0 -1
  1514. package/dist/tools/render.d.ts.map +1 -1
  1515. package/dist/tools/render.js +2 -3
  1516. package/dist/tools/render.js.map +1 -1
  1517. package/dist/tools/requests.cjs +7 -11
  1518. package/dist/tools/requests.cjs.map +1 -1
  1519. package/dist/tools/requests.d.cts.map +1 -1
  1520. package/dist/tools/requests.d.ts.map +1 -1
  1521. package/dist/tools/requests.js +3 -7
  1522. package/dist/tools/requests.js.map +1 -1
  1523. package/dist/tools/retriever.cjs +7 -8
  1524. package/dist/tools/retriever.cjs.map +1 -1
  1525. package/dist/tools/retriever.d.cts.map +1 -1
  1526. package/dist/tools/retriever.d.ts.map +1 -1
  1527. package/dist/tools/retriever.js +3 -5
  1528. package/dist/tools/retriever.js.map +1 -1
  1529. package/dist/tools/sql.cjs +11 -12
  1530. package/dist/tools/sql.cjs.map +1 -1
  1531. package/dist/tools/sql.d.cts +0 -1
  1532. package/dist/tools/sql.d.cts.map +1 -1
  1533. package/dist/tools/sql.d.ts +0 -1
  1534. package/dist/tools/sql.d.ts.map +1 -1
  1535. package/dist/tools/sql.js +3 -5
  1536. package/dist/tools/sql.js.map +1 -1
  1537. package/dist/tools/vectorstore.cjs +3 -3
  1538. package/dist/tools/vectorstore.cjs.map +1 -1
  1539. package/dist/tools/vectorstore.d.cts +0 -1
  1540. package/dist/tools/vectorstore.d.cts.map +1 -1
  1541. package/dist/tools/vectorstore.d.ts +0 -1
  1542. package/dist/tools/vectorstore.d.ts.map +1 -1
  1543. package/dist/tools/vectorstore.js.map +1 -1
  1544. package/dist/tools/webbrowser.cjs +18 -23
  1545. package/dist/tools/webbrowser.cjs.map +1 -1
  1546. package/dist/tools/webbrowser.d.cts.map +1 -1
  1547. package/dist/tools/webbrowser.d.ts +1 -1
  1548. package/dist/tools/webbrowser.d.ts.map +1 -1
  1549. package/dist/tools/webbrowser.js +9 -16
  1550. package/dist/tools/webbrowser.js.map +1 -1
  1551. package/dist/types/expression-parser.d.cts.map +1 -1
  1552. package/dist/types/expression-parser.d.ts.map +1 -1
  1553. package/dist/types/type-utils.d.cts.map +1 -1
  1554. package/dist/types/type-utils.d.ts.map +1 -1
  1555. package/dist/util/document.cjs +3 -3
  1556. package/dist/util/document.cjs.map +1 -1
  1557. package/dist/util/document.d.cts +0 -1
  1558. package/dist/util/document.d.cts.map +1 -1
  1559. package/dist/util/document.d.ts +0 -1
  1560. package/dist/util/document.d.ts.map +1 -1
  1561. package/dist/util/document.js +2 -3
  1562. package/dist/util/document.js.map +1 -1
  1563. package/dist/util/entrypoint_deprecation.js +2 -0
  1564. package/dist/util/env.cjs +2 -2
  1565. package/dist/util/env.js +2 -0
  1566. package/dist/util/extname.cjs.map +1 -1
  1567. package/dist/util/extname.js.map +1 -1
  1568. package/dist/util/hub.cjs +9 -11
  1569. package/dist/util/hub.cjs.map +1 -1
  1570. package/dist/util/hub.js +5 -7
  1571. package/dist/util/hub.js.map +1 -1
  1572. package/dist/util/is-network-error/index.cjs +2 -3
  1573. package/dist/util/is-network-error/index.cjs.map +1 -1
  1574. package/dist/util/is-network-error/index.js +2 -3
  1575. package/dist/util/is-network-error/index.js.map +1 -1
  1576. package/dist/util/load.cjs +1 -2
  1577. package/dist/util/load.cjs.map +1 -1
  1578. package/dist/util/load.d.cts.map +1 -1
  1579. package/dist/util/load.d.ts.map +1 -1
  1580. package/dist/util/load.js +1 -2
  1581. package/dist/util/load.js.map +1 -1
  1582. package/dist/util/math.cjs +7 -6
  1583. package/dist/util/math.js +4 -4
  1584. package/dist/util/ml-distance/distances.cjs.map +1 -1
  1585. package/dist/util/ml-distance/distances.js.map +1 -1
  1586. package/dist/util/ml-distance/similarities.cjs.map +1 -1
  1587. package/dist/util/ml-distance/similarities.d.cts.map +1 -1
  1588. package/dist/util/ml-distance/similarities.d.ts.map +1 -1
  1589. package/dist/util/ml-distance/similarities.js.map +1 -1
  1590. package/dist/util/ml-distance-euclidean/euclidean.cjs.map +1 -1
  1591. package/dist/util/ml-distance-euclidean/euclidean.js.map +1 -1
  1592. package/dist/util/openapi.cjs +6 -7
  1593. package/dist/util/openapi.cjs.map +1 -1
  1594. package/dist/util/openapi.d.cts.map +1 -1
  1595. package/dist/util/openapi.d.ts.map +1 -1
  1596. package/dist/util/openapi.js +3 -5
  1597. package/dist/util/openapi.js.map +1 -1
  1598. package/dist/util/p-retry/index.cjs +2 -2
  1599. package/dist/util/p-retry/index.cjs.map +1 -1
  1600. package/dist/util/p-retry/index.js +2 -2
  1601. package/dist/util/p-retry/index.js.map +1 -1
  1602. package/dist/util/parse.cjs +3 -2
  1603. package/dist/util/parse.cjs.map +1 -1
  1604. package/dist/util/parse.js.map +1 -1
  1605. package/dist/util/set.cjs.map +1 -1
  1606. package/dist/util/set.js.map +1 -1
  1607. package/dist/util/sql_utils.cjs +16 -28
  1608. package/dist/util/sql_utils.cjs.map +1 -1
  1609. package/dist/util/sql_utils.d.cts.map +1 -1
  1610. package/dist/util/sql_utils.d.ts.map +1 -1
  1611. package/dist/util/sql_utils.js +16 -28
  1612. package/dist/util/sql_utils.js.map +1 -1
  1613. package/dist/util/time.cjs +3 -3
  1614. package/dist/util/time.cjs.map +1 -1
  1615. package/dist/util/time.d.cts.map +1 -1
  1616. package/dist/util/time.d.ts.map +1 -1
  1617. package/dist/util/time.js +2 -3
  1618. package/dist/util/time.js.map +1 -1
  1619. package/dist/vectorstores/memory.cjs +15 -22
  1620. package/dist/vectorstores/memory.cjs.map +1 -1
  1621. package/dist/vectorstores/memory.d.cts +0 -1
  1622. package/dist/vectorstores/memory.d.cts.map +1 -1
  1623. package/dist/vectorstores/memory.d.ts +0 -1
  1624. package/dist/vectorstores/memory.d.ts.map +1 -1
  1625. package/dist/vectorstores/memory.js +9 -17
  1626. package/dist/vectorstores/memory.js.map +1 -1
  1627. package/package.json +18 -18
  1628. package/dist/_virtual/rolldown_runtime.js +0 -25
@@ -1 +1 @@
1
- {"version":3,"file":"reduce.cjs","names":["docs: Document[]","lengthFunc: (...args: any[]) => any","tokenMax: number","newResultDocList: Document[][]","subResultDocs: Document[]","combineDocumentFunc: (docs: Document[]) => Promise<string>","combinedMetadata: Record<string, string>"],"sources":["../../../src/chains/combine_documents/reduce.ts"],"sourcesContent":["import { Document } from \"@langchain/core/documents\";\n\n/**\n * Splits a list of documents into sublists based on a maximum token limit.\n *\n * @param {Document[]} docs - The list of documents to be split.\n * @param {Function} lengthFunc - A function that calculates the number of tokens in a list of documents.\n * @param {number} tokenMax - The maximum number of tokens allowed in a sublist.\n *\n * @returns {Document[][]} - A list of document sublists, each sublist contains documents whose total number of tokens does not exceed the tokenMax.\n *\n * @throws {Error} - Throws an error if a single document has more tokens than the tokenMax.\n */\nexport function splitListOfDocs(\n docs: Document[],\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n lengthFunc: (...args: any[]) => any,\n tokenMax: number\n): Document[][] {\n const newResultDocList: Document[][] = [];\n let subResultDocs: Document[] = [];\n for (const doc of docs) {\n subResultDocs.push(doc);\n const numTokens = lengthFunc(subResultDocs);\n if (numTokens > tokenMax) {\n if (subResultDocs.length === 1) {\n throw new Error(\n \"A single document was longer than the context length, we cannot handle this.\"\n );\n }\n newResultDocList.push(subResultDocs.slice(0, -1));\n subResultDocs = subResultDocs.slice(-1);\n }\n }\n newResultDocList.push(subResultDocs);\n return newResultDocList;\n}\n\n/**\n * Collapses a list of documents into a single document.\n *\n * This function takes a list of documents and a function to combine the content of these documents.\n * It combines the content of the documents using the provided function and merges the metadata of all documents.\n * If a metadata key is present in multiple documents, the values are concatenated with a comma separator.\n *\n * @param {Document[]} docs - The list of documents to be collapsed.\n * @param {Function} combineDocumentFunc - A function that combines the content of a list of documents into a single string. This function should return a promise that resolves to the combined string.\n *\n * @returns {Promise<Document>} - A promise that resolves to a single document with combined content and merged metadata.\n *\n * @throws {Error} - Throws an error if the combineDocumentFunc does not return a promise or if the promise does not resolve to a string.\n */\nexport async function collapseDocs(\n docs: Document[],\n combineDocumentFunc: (docs: Document[]) => Promise<string>\n): Promise<Document> {\n const result = await combineDocumentFunc(docs);\n return { pageContent: result, metadata: collapseDocsMetadata(docs) };\n}\n\nfunction collapseDocsMetadata(docs: Document[]): Document[\"metadata\"] {\n const combinedMetadata: Record<string, string> = {};\n for (const key in docs[0].metadata) {\n if (key in docs[0].metadata) {\n combinedMetadata[key] = String(docs[0].metadata[key]);\n }\n }\n for (const doc of docs.slice(1)) {\n for (const key in doc.metadata) {\n if (key in combinedMetadata) {\n combinedMetadata[key] += `, ${doc.metadata[key]}`;\n } else {\n combinedMetadata[key] = String(doc.metadata[key]);\n }\n }\n }\n return combinedMetadata;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAaA,SAAgB,gBACdA,MAEAC,YACAC,UACc;CACd,MAAMC,mBAAiC,CAAE;CACzC,IAAIC,gBAA4B,CAAE;AAClC,MAAK,MAAM,OAAO,MAAM;EACtB,cAAc,KAAK,IAAI;EACvB,MAAM,YAAY,WAAW,cAAc;AAC3C,MAAI,YAAY,UAAU;AACxB,OAAI,cAAc,WAAW,EAC3B,OAAM,IAAI,MACR;GAGJ,iBAAiB,KAAK,cAAc,MAAM,GAAG,GAAG,CAAC;GACjD,gBAAgB,cAAc,MAAM,GAAG;EACxC;CACF;CACD,iBAAiB,KAAK,cAAc;AACpC,QAAO;AACR;;;;;;;;;;;;;;;AAgBD,eAAsB,aACpBJ,MACAK,qBACmB;CACnB,MAAM,SAAS,MAAM,oBAAoB,KAAK;AAC9C,QAAO;EAAE,aAAa;EAAQ,UAAU,qBAAqB,KAAK;CAAE;AACrE;AAED,SAAS,qBAAqBL,MAAwC;CACpE,MAAMM,mBAA2C,CAAE;AACnD,MAAK,MAAM,OAAO,KAAK,GAAG,SACxB,KAAI,OAAO,KAAK,GAAG,UACjB,iBAAiB,OAAO,OAAO,KAAK,GAAG,SAAS,KAAK;AAGzD,MAAK,MAAM,OAAO,KAAK,MAAM,EAAE,CAC7B,MAAK,MAAM,OAAO,IAAI,SACpB,KAAI,OAAO,kBACT,iBAAiB,QAAQ,CAAC,EAAE,EAAE,IAAI,SAAS,MAAM;MAEjD,iBAAiB,OAAO,OAAO,IAAI,SAAS,KAAK;AAIvD,QAAO;AACR"}
1
+ {"version":3,"file":"reduce.cjs","names":[],"sources":["../../../src/chains/combine_documents/reduce.ts"],"sourcesContent":["import { Document } from \"@langchain/core/documents\";\n\n/**\n * Splits a list of documents into sublists based on a maximum token limit.\n *\n * @param {Document[]} docs - The list of documents to be split.\n * @param {Function} lengthFunc - A function that calculates the number of tokens in a list of documents.\n * @param {number} tokenMax - The maximum number of tokens allowed in a sublist.\n *\n * @returns {Document[][]} - A list of document sublists, each sublist contains documents whose total number of tokens does not exceed the tokenMax.\n *\n * @throws {Error} - Throws an error if a single document has more tokens than the tokenMax.\n */\nexport function splitListOfDocs(\n docs: Document[],\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n lengthFunc: (...args: any[]) => any,\n tokenMax: number\n): Document[][] {\n const newResultDocList: Document[][] = [];\n let subResultDocs: Document[] = [];\n for (const doc of docs) {\n subResultDocs.push(doc);\n const numTokens = lengthFunc(subResultDocs);\n if (numTokens > tokenMax) {\n if (subResultDocs.length === 1) {\n throw new Error(\n \"A single document was longer than the context length, we cannot handle this.\"\n );\n }\n newResultDocList.push(subResultDocs.slice(0, -1));\n subResultDocs = subResultDocs.slice(-1);\n }\n }\n newResultDocList.push(subResultDocs);\n return newResultDocList;\n}\n\n/**\n * Collapses a list of documents into a single document.\n *\n * This function takes a list of documents and a function to combine the content of these documents.\n * It combines the content of the documents using the provided function and merges the metadata of all documents.\n * If a metadata key is present in multiple documents, the values are concatenated with a comma separator.\n *\n * @param {Document[]} docs - The list of documents to be collapsed.\n * @param {Function} combineDocumentFunc - A function that combines the content of a list of documents into a single string. This function should return a promise that resolves to the combined string.\n *\n * @returns {Promise<Document>} - A promise that resolves to a single document with combined content and merged metadata.\n *\n * @throws {Error} - Throws an error if the combineDocumentFunc does not return a promise or if the promise does not resolve to a string.\n */\nexport async function collapseDocs(\n docs: Document[],\n combineDocumentFunc: (docs: Document[]) => Promise<string>\n): Promise<Document> {\n const result = await combineDocumentFunc(docs);\n return { pageContent: result, metadata: collapseDocsMetadata(docs) };\n}\n\nfunction collapseDocsMetadata(docs: Document[]): Document[\"metadata\"] {\n const combinedMetadata: Record<string, string> = {};\n for (const key in docs[0].metadata) {\n if (key in docs[0].metadata) {\n combinedMetadata[key] = String(docs[0].metadata[key]);\n }\n }\n for (const doc of docs.slice(1)) {\n for (const key in doc.metadata) {\n if (key in combinedMetadata) {\n combinedMetadata[key] += `, ${doc.metadata[key]}`;\n } else {\n combinedMetadata[key] = String(doc.metadata[key]);\n }\n }\n }\n return combinedMetadata;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAaA,SAAgB,gBACd,MAEA,YACA,UACc;CACd,MAAM,mBAAiC,EAAE;CACzC,IAAI,gBAA4B,EAAE;AAClC,MAAK,MAAM,OAAO,MAAM;AACtB,gBAAc,KAAK,IAAI;AAEvB,MADkB,WAAW,cAAc,GAC3B,UAAU;AACxB,OAAI,cAAc,WAAW,EAC3B,OAAM,IAAI,MACR,+EACD;AAEH,oBAAiB,KAAK,cAAc,MAAM,GAAG,GAAG,CAAC;AACjD,mBAAgB,cAAc,MAAM,GAAG;;;AAG3C,kBAAiB,KAAK,cAAc;AACpC,QAAO;;;;;;;;;;;;;;;;AAiBT,eAAsB,aACpB,MACA,qBACmB;AAEnB,QAAO;EAAE,aADM,MAAM,oBAAoB,KAAK;EAChB,UAAU,qBAAqB,KAAK;EAAE;;AAGtE,SAAS,qBAAqB,MAAwC;CACpE,MAAM,mBAA2C,EAAE;AACnD,MAAK,MAAM,OAAO,KAAK,GAAG,SACxB,KAAI,OAAO,KAAK,GAAG,SACjB,kBAAiB,OAAO,OAAO,KAAK,GAAG,SAAS,KAAK;AAGzD,MAAK,MAAM,OAAO,KAAK,MAAM,EAAE,CAC7B,MAAK,MAAM,OAAO,IAAI,SACpB,KAAI,OAAO,iBACT,kBAAiB,QAAQ,KAAK,IAAI,SAAS;KAE3C,kBAAiB,OAAO,OAAO,IAAI,SAAS,KAAK;AAIvD,QAAO"}
@@ -1,7 +1,6 @@
1
1
  import { Document } from "@langchain/core/documents";
2
2
 
3
3
  //#region src/chains/combine_documents/reduce.d.ts
4
-
5
4
  /**
6
5
  * Splits a list of documents into sublists based on a maximum token limit.
7
6
  *
@@ -1 +1 @@
1
- {"version":3,"file":"reduce.d.cts","names":["Document","splitListOfDocs","collapseDocs","Promise"],"sources":["../../../src/chains/combine_documents/reduce.d.ts"],"sourcesContent":["import { Document } from \"@langchain/core/documents\";\n/**\n * Splits a list of documents into sublists based on a maximum token limit.\n *\n * @param {Document[]} docs - The list of documents to be split.\n * @param {Function} lengthFunc - A function that calculates the number of tokens in a list of documents.\n * @param {number} tokenMax - The maximum number of tokens allowed in a sublist.\n *\n * @returns {Document[][]} - A list of document sublists, each sublist contains documents whose total number of tokens does not exceed the tokenMax.\n *\n * @throws {Error} - Throws an error if a single document has more tokens than the tokenMax.\n */\nexport declare function splitListOfDocs(docs: Document[], lengthFunc: (...args: any[]) => any, tokenMax: number): Document[][];\n/**\n * Collapses a list of documents into a single document.\n *\n * This function takes a list of documents and a function to combine the content of these documents.\n * It combines the content of the documents using the provided function and merges the metadata of all documents.\n * If a metadata key is present in multiple documents, the values are concatenated with a comma separator.\n *\n * @param {Document[]} docs - The list of documents to be collapsed.\n * @param {Function} combineDocumentFunc - A function that combines the content of a list of documents into a single string. This function should return a promise that resolves to the combined string.\n *\n * @returns {Promise<Document>} - A promise that resolves to a single document with combined content and merged metadata.\n *\n * @throws {Error} - Throws an error if the combineDocumentFunc does not return a promise or if the promise does not resolve to a string.\n */\nexport declare function collapseDocs(docs: Document[], combineDocumentFunc: (docs: Document[]) => Promise<string>): Promise<Document>;\n//# sourceMappingURL=reduce.d.ts.map"],"mappings":";;;;;;AAYA;AAeA;;;;;;AAA2H;;iBAfnGC,eAAAA,OAAsBD,oEAAoEA;;;;;;;;;;;;;;;iBAe1FE,YAAAA,OAAmBF,wCAAwCA,eAAeG,kBAAkBA,QAAQH"}
1
+ {"version":3,"file":"reduce.d.cts","names":[],"sources":["../../../src/chains/combine_documents/reduce.ts"],"mappings":";;;;;AAaA;;;;;;;;;iBAAgB,eAAA,CACd,IAAA,EAAM,QAAA,IAEN,UAAA,MAAgB,IAAA,iBAChB,QAAA,WACC,QAAA;;;AAkCH;;;;;;;;;;;;iBAAsB,YAAA,CACpB,IAAA,EAAM,QAAA,IACN,mBAAA,GAAsB,IAAA,EAAM,QAAA,OAAe,OAAA,WAC1C,OAAA,CAAQ,QAAA"}
@@ -1,7 +1,6 @@
1
1
  import { Document } from "@langchain/core/documents";
2
2
 
3
3
  //#region src/chains/combine_documents/reduce.d.ts
4
-
5
4
  /**
6
5
  * Splits a list of documents into sublists based on a maximum token limit.
7
6
  *
@@ -1 +1 @@
1
- {"version":3,"file":"reduce.d.ts","names":["Document","splitListOfDocs","collapseDocs","Promise"],"sources":["../../../src/chains/combine_documents/reduce.d.ts"],"sourcesContent":["import { Document } from \"@langchain/core/documents\";\n/**\n * Splits a list of documents into sublists based on a maximum token limit.\n *\n * @param {Document[]} docs - The list of documents to be split.\n * @param {Function} lengthFunc - A function that calculates the number of tokens in a list of documents.\n * @param {number} tokenMax - The maximum number of tokens allowed in a sublist.\n *\n * @returns {Document[][]} - A list of document sublists, each sublist contains documents whose total number of tokens does not exceed the tokenMax.\n *\n * @throws {Error} - Throws an error if a single document has more tokens than the tokenMax.\n */\nexport declare function splitListOfDocs(docs: Document[], lengthFunc: (...args: any[]) => any, tokenMax: number): Document[][];\n/**\n * Collapses a list of documents into a single document.\n *\n * This function takes a list of documents and a function to combine the content of these documents.\n * It combines the content of the documents using the provided function and merges the metadata of all documents.\n * If a metadata key is present in multiple documents, the values are concatenated with a comma separator.\n *\n * @param {Document[]} docs - The list of documents to be collapsed.\n * @param {Function} combineDocumentFunc - A function that combines the content of a list of documents into a single string. This function should return a promise that resolves to the combined string.\n *\n * @returns {Promise<Document>} - A promise that resolves to a single document with combined content and merged metadata.\n *\n * @throws {Error} - Throws an error if the combineDocumentFunc does not return a promise or if the promise does not resolve to a string.\n */\nexport declare function collapseDocs(docs: Document[], combineDocumentFunc: (docs: Document[]) => Promise<string>): Promise<Document>;\n//# sourceMappingURL=reduce.d.ts.map"],"mappings":";;;;;;AAYA;AAeA;;;;;;AAA2H;;iBAfnGC,eAAAA,OAAsBD,oEAAoEA;;;;;;;;;;;;;;;iBAe1FE,YAAAA,OAAmBF,wCAAwCA,eAAeG,kBAAkBA,QAAQH"}
1
+ {"version":3,"file":"reduce.d.ts","names":[],"sources":["../../../src/chains/combine_documents/reduce.ts"],"mappings":";;;;;AAaA;;;;;;;;;iBAAgB,eAAA,CACd,IAAA,EAAM,QAAA,IAEN,UAAA,MAAgB,IAAA,iBAChB,QAAA,WACC,QAAA;;;AAkCH;;;;;;;;;;;;iBAAsB,YAAA,CACpB,IAAA,EAAM,QAAA,IACN,mBAAA,GAAsB,IAAA,EAAM,QAAA,OAAe,OAAA,WAC1C,OAAA,CAAQ,QAAA"}
@@ -1,8 +1,7 @@
1
- import { __export } from "../../_virtual/rolldown_runtime.js";
1
+ import { __exportAll } from "../../_virtual/_rolldown/runtime.js";
2
2
 
3
3
  //#region src/chains/combine_documents/reduce.ts
4
- var reduce_exports = {};
5
- __export(reduce_exports, {
4
+ var reduce_exports = /* @__PURE__ */ __exportAll({
6
5
  collapseDocs: () => collapseDocs,
7
6
  splitListOfDocs: () => splitListOfDocs
8
7
  });
@@ -22,8 +21,7 @@ function splitListOfDocs(docs, lengthFunc, tokenMax) {
22
21
  let subResultDocs = [];
23
22
  for (const doc of docs) {
24
23
  subResultDocs.push(doc);
25
- const numTokens = lengthFunc(subResultDocs);
26
- if (numTokens > tokenMax) {
24
+ if (lengthFunc(subResultDocs) > tokenMax) {
27
25
  if (subResultDocs.length === 1) throw new Error("A single document was longer than the context length, we cannot handle this.");
28
26
  newResultDocList.push(subResultDocs.slice(0, -1));
29
27
  subResultDocs = subResultDocs.slice(-1);
@@ -47,9 +45,8 @@ function splitListOfDocs(docs, lengthFunc, tokenMax) {
47
45
  * @throws {Error} - Throws an error if the combineDocumentFunc does not return a promise or if the promise does not resolve to a string.
48
46
  */
49
47
  async function collapseDocs(docs, combineDocumentFunc) {
50
- const result = await combineDocumentFunc(docs);
51
48
  return {
52
- pageContent: result,
49
+ pageContent: await combineDocumentFunc(docs),
53
50
  metadata: collapseDocsMetadata(docs)
54
51
  };
55
52
  }
@@ -1 +1 @@
1
- {"version":3,"file":"reduce.js","names":["docs: Document[]","lengthFunc: (...args: any[]) => any","tokenMax: number","newResultDocList: Document[][]","subResultDocs: Document[]","combineDocumentFunc: (docs: Document[]) => Promise<string>","combinedMetadata: Record<string, string>"],"sources":["../../../src/chains/combine_documents/reduce.ts"],"sourcesContent":["import { Document } from \"@langchain/core/documents\";\n\n/**\n * Splits a list of documents into sublists based on a maximum token limit.\n *\n * @param {Document[]} docs - The list of documents to be split.\n * @param {Function} lengthFunc - A function that calculates the number of tokens in a list of documents.\n * @param {number} tokenMax - The maximum number of tokens allowed in a sublist.\n *\n * @returns {Document[][]} - A list of document sublists, each sublist contains documents whose total number of tokens does not exceed the tokenMax.\n *\n * @throws {Error} - Throws an error if a single document has more tokens than the tokenMax.\n */\nexport function splitListOfDocs(\n docs: Document[],\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n lengthFunc: (...args: any[]) => any,\n tokenMax: number\n): Document[][] {\n const newResultDocList: Document[][] = [];\n let subResultDocs: Document[] = [];\n for (const doc of docs) {\n subResultDocs.push(doc);\n const numTokens = lengthFunc(subResultDocs);\n if (numTokens > tokenMax) {\n if (subResultDocs.length === 1) {\n throw new Error(\n \"A single document was longer than the context length, we cannot handle this.\"\n );\n }\n newResultDocList.push(subResultDocs.slice(0, -1));\n subResultDocs = subResultDocs.slice(-1);\n }\n }\n newResultDocList.push(subResultDocs);\n return newResultDocList;\n}\n\n/**\n * Collapses a list of documents into a single document.\n *\n * This function takes a list of documents and a function to combine the content of these documents.\n * It combines the content of the documents using the provided function and merges the metadata of all documents.\n * If a metadata key is present in multiple documents, the values are concatenated with a comma separator.\n *\n * @param {Document[]} docs - The list of documents to be collapsed.\n * @param {Function} combineDocumentFunc - A function that combines the content of a list of documents into a single string. This function should return a promise that resolves to the combined string.\n *\n * @returns {Promise<Document>} - A promise that resolves to a single document with combined content and merged metadata.\n *\n * @throws {Error} - Throws an error if the combineDocumentFunc does not return a promise or if the promise does not resolve to a string.\n */\nexport async function collapseDocs(\n docs: Document[],\n combineDocumentFunc: (docs: Document[]) => Promise<string>\n): Promise<Document> {\n const result = await combineDocumentFunc(docs);\n return { pageContent: result, metadata: collapseDocsMetadata(docs) };\n}\n\nfunction collapseDocsMetadata(docs: Document[]): Document[\"metadata\"] {\n const combinedMetadata: Record<string, string> = {};\n for (const key in docs[0].metadata) {\n if (key in docs[0].metadata) {\n combinedMetadata[key] = String(docs[0].metadata[key]);\n }\n }\n for (const doc of docs.slice(1)) {\n for (const key in doc.metadata) {\n if (key in combinedMetadata) {\n combinedMetadata[key] += `, ${doc.metadata[key]}`;\n } else {\n combinedMetadata[key] = String(doc.metadata[key]);\n }\n }\n }\n return combinedMetadata;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAaA,SAAgB,gBACdA,MAEAC,YACAC,UACc;CACd,MAAMC,mBAAiC,CAAE;CACzC,IAAIC,gBAA4B,CAAE;AAClC,MAAK,MAAM,OAAO,MAAM;EACtB,cAAc,KAAK,IAAI;EACvB,MAAM,YAAY,WAAW,cAAc;AAC3C,MAAI,YAAY,UAAU;AACxB,OAAI,cAAc,WAAW,EAC3B,OAAM,IAAI,MACR;GAGJ,iBAAiB,KAAK,cAAc,MAAM,GAAG,GAAG,CAAC;GACjD,gBAAgB,cAAc,MAAM,GAAG;EACxC;CACF;CACD,iBAAiB,KAAK,cAAc;AACpC,QAAO;AACR;;;;;;;;;;;;;;;AAgBD,eAAsB,aACpBJ,MACAK,qBACmB;CACnB,MAAM,SAAS,MAAM,oBAAoB,KAAK;AAC9C,QAAO;EAAE,aAAa;EAAQ,UAAU,qBAAqB,KAAK;CAAE;AACrE;AAED,SAAS,qBAAqBL,MAAwC;CACpE,MAAMM,mBAA2C,CAAE;AACnD,MAAK,MAAM,OAAO,KAAK,GAAG,SACxB,KAAI,OAAO,KAAK,GAAG,UACjB,iBAAiB,OAAO,OAAO,KAAK,GAAG,SAAS,KAAK;AAGzD,MAAK,MAAM,OAAO,KAAK,MAAM,EAAE,CAC7B,MAAK,MAAM,OAAO,IAAI,SACpB,KAAI,OAAO,kBACT,iBAAiB,QAAQ,CAAC,EAAE,EAAE,IAAI,SAAS,MAAM;MAEjD,iBAAiB,OAAO,OAAO,IAAI,SAAS,KAAK;AAIvD,QAAO;AACR"}
1
+ {"version":3,"file":"reduce.js","names":[],"sources":["../../../src/chains/combine_documents/reduce.ts"],"sourcesContent":["import { Document } from \"@langchain/core/documents\";\n\n/**\n * Splits a list of documents into sublists based on a maximum token limit.\n *\n * @param {Document[]} docs - The list of documents to be split.\n * @param {Function} lengthFunc - A function that calculates the number of tokens in a list of documents.\n * @param {number} tokenMax - The maximum number of tokens allowed in a sublist.\n *\n * @returns {Document[][]} - A list of document sublists, each sublist contains documents whose total number of tokens does not exceed the tokenMax.\n *\n * @throws {Error} - Throws an error if a single document has more tokens than the tokenMax.\n */\nexport function splitListOfDocs(\n docs: Document[],\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n lengthFunc: (...args: any[]) => any,\n tokenMax: number\n): Document[][] {\n const newResultDocList: Document[][] = [];\n let subResultDocs: Document[] = [];\n for (const doc of docs) {\n subResultDocs.push(doc);\n const numTokens = lengthFunc(subResultDocs);\n if (numTokens > tokenMax) {\n if (subResultDocs.length === 1) {\n throw new Error(\n \"A single document was longer than the context length, we cannot handle this.\"\n );\n }\n newResultDocList.push(subResultDocs.slice(0, -1));\n subResultDocs = subResultDocs.slice(-1);\n }\n }\n newResultDocList.push(subResultDocs);\n return newResultDocList;\n}\n\n/**\n * Collapses a list of documents into a single document.\n *\n * This function takes a list of documents and a function to combine the content of these documents.\n * It combines the content of the documents using the provided function and merges the metadata of all documents.\n * If a metadata key is present in multiple documents, the values are concatenated with a comma separator.\n *\n * @param {Document[]} docs - The list of documents to be collapsed.\n * @param {Function} combineDocumentFunc - A function that combines the content of a list of documents into a single string. This function should return a promise that resolves to the combined string.\n *\n * @returns {Promise<Document>} - A promise that resolves to a single document with combined content and merged metadata.\n *\n * @throws {Error} - Throws an error if the combineDocumentFunc does not return a promise or if the promise does not resolve to a string.\n */\nexport async function collapseDocs(\n docs: Document[],\n combineDocumentFunc: (docs: Document[]) => Promise<string>\n): Promise<Document> {\n const result = await combineDocumentFunc(docs);\n return { pageContent: result, metadata: collapseDocsMetadata(docs) };\n}\n\nfunction collapseDocsMetadata(docs: Document[]): Document[\"metadata\"] {\n const combinedMetadata: Record<string, string> = {};\n for (const key in docs[0].metadata) {\n if (key in docs[0].metadata) {\n combinedMetadata[key] = String(docs[0].metadata[key]);\n }\n }\n for (const doc of docs.slice(1)) {\n for (const key in doc.metadata) {\n if (key in combinedMetadata) {\n combinedMetadata[key] += `, ${doc.metadata[key]}`;\n } else {\n combinedMetadata[key] = String(doc.metadata[key]);\n }\n }\n }\n return combinedMetadata;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAaA,SAAgB,gBACd,MAEA,YACA,UACc;CACd,MAAM,mBAAiC,EAAE;CACzC,IAAI,gBAA4B,EAAE;AAClC,MAAK,MAAM,OAAO,MAAM;AACtB,gBAAc,KAAK,IAAI;AAEvB,MADkB,WAAW,cAAc,GAC3B,UAAU;AACxB,OAAI,cAAc,WAAW,EAC3B,OAAM,IAAI,MACR,+EACD;AAEH,oBAAiB,KAAK,cAAc,MAAM,GAAG,GAAG,CAAC;AACjD,mBAAgB,cAAc,MAAM,GAAG;;;AAG3C,kBAAiB,KAAK,cAAc;AACpC,QAAO;;;;;;;;;;;;;;;;AAiBT,eAAsB,aACpB,MACA,qBACmB;AAEnB,QAAO;EAAE,aADM,MAAM,oBAAoB,KAAK;EAChB,UAAU,qBAAqB,KAAK;EAAE;;AAGtE,SAAS,qBAAqB,MAAwC;CACpE,MAAM,mBAA2C,EAAE;AACnD,MAAK,MAAM,OAAO,KAAK,GAAG,SACxB,KAAI,OAAO,KAAK,GAAG,SACjB,kBAAiB,OAAO,OAAO,KAAK,GAAG,SAAS,KAAK;AAGzD,MAAK,MAAM,OAAO,KAAK,MAAM,EAAE,CAC7B,MAAK,MAAM,OAAO,IAAI,SACpB,KAAI,OAAO,iBACT,kBAAiB,QAAQ,KAAK,IAAI,SAAS;KAE3C,kBAAiB,OAAO,OAAO,IAAI,SAAS,KAAK;AAIvD,QAAO"}
@@ -1,7 +1,7 @@
1
- const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
1
+ const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
2
2
  const require_base = require('./base.cjs');
3
- const __langchain_core_runnables = require_rolldown_runtime.__toESM(require("@langchain/core/runnables"));
4
- const __langchain_core_output_parsers = require_rolldown_runtime.__toESM(require("@langchain/core/output_parsers"));
3
+ let _langchain_core_runnables = require("@langchain/core/runnables");
4
+ let _langchain_core_output_parsers = require("@langchain/core/output_parsers");
5
5
 
6
6
  //#region src/chains/combine_documents/stuff.ts
7
7
  /**
@@ -21,10 +21,10 @@ Expects a dictionary as input with a list of `Document`s being passed under
21
21
  the "context" key.
22
22
  Return type depends on the `output_parser` used.
23
23
  */
24
- async function createStuffDocumentsChain({ llm, prompt, outputParser = new __langchain_core_output_parsers.StringOutputParser(), documentPrompt = require_base.DEFAULT_DOCUMENT_PROMPT, documentSeparator = require_base.DEFAULT_DOCUMENT_SEPARATOR }) {
24
+ async function createStuffDocumentsChain({ llm, prompt, outputParser = new _langchain_core_output_parsers.StringOutputParser(), documentPrompt = require_base.DEFAULT_DOCUMENT_PROMPT, documentSeparator = require_base.DEFAULT_DOCUMENT_SEPARATOR }) {
25
25
  if (!prompt.inputVariables.includes(require_base.DOCUMENTS_KEY)) throw new Error(`Prompt must include a "${require_base.DOCUMENTS_KEY}" variable`);
26
- return __langchain_core_runnables.RunnableSequence.from([
27
- __langchain_core_runnables.RunnablePassthrough.assign({ [require_base.DOCUMENTS_KEY]: new __langchain_core_runnables.RunnablePick(require_base.DOCUMENTS_KEY).pipe((documents, config) => require_base.formatDocuments({
26
+ return _langchain_core_runnables.RunnableSequence.from([
27
+ _langchain_core_runnables.RunnablePassthrough.assign({ [require_base.DOCUMENTS_KEY]: new _langchain_core_runnables.RunnablePick(require_base.DOCUMENTS_KEY).pipe((documents, config) => require_base.formatDocuments({
28
28
  documents,
29
29
  documentPrompt,
30
30
  documentSeparator,
@@ -1 +1 @@
1
- {"version":3,"file":"stuff.cjs","names":["StringOutputParser","DEFAULT_DOCUMENT_PROMPT","DEFAULT_DOCUMENT_SEPARATOR","DOCUMENTS_KEY","RunnableSequence","RunnablePassthrough","RunnablePick","formatDocuments"],"sources":["../../../src/chains/combine_documents/stuff.ts"],"sourcesContent":["import { LanguageModelLike } from \"@langchain/core/language_models/base\";\nimport {\n BaseOutputParser,\n StringOutputParser,\n} from \"@langchain/core/output_parsers\";\nimport { BasePromptTemplate } from \"@langchain/core/prompts\";\nimport {\n RunnablePassthrough,\n RunnablePick,\n RunnableSequence,\n} from \"@langchain/core/runnables\";\n\nimport {\n DEFAULT_DOCUMENT_PROMPT,\n DEFAULT_DOCUMENT_SEPARATOR,\n DOCUMENTS_KEY,\n formatDocuments,\n} from \"./base.js\";\n\n/**\n * Create a chain that passes a list of documents to a model.\n * \n * @param llm Language model to use for responding.\n * @param prompt Prompt template. Must contain input variable \"context\", which will be\n used for passing in the formatted documents.\n * @param outputParser Output parser. Defaults to `StringOutputParser`.\n * @param documentPrompt Prompt used for formatting each document into a string. Input\n variables can be \"page_content\" or any metadata keys that are in all documents.\n \"page_content\" will automatically retrieve the `Document.page_content`, and all \n other inputs variables will be automatically retrieved from the `Document.metadata` dictionary. Default to a prompt that only contains `Document.page_content`.\n * @param documentSeparator String separator to use between formatted document strings.\n * @returns An LCEL `Runnable` chain.\n Expects a dictionary as input with a list of `Document`s being passed under\n the \"context\" key.\n Return type depends on the `output_parser` used.\n */\nexport async function createStuffDocumentsChain<RunOutput = string>({\n llm,\n prompt,\n outputParser = new StringOutputParser() as unknown as BaseOutputParser<RunOutput>,\n documentPrompt = DEFAULT_DOCUMENT_PROMPT,\n documentSeparator = DEFAULT_DOCUMENT_SEPARATOR,\n}: {\n llm: LanguageModelLike;\n prompt: BasePromptTemplate;\n outputParser?: BaseOutputParser<RunOutput>;\n documentPrompt?: BasePromptTemplate;\n documentSeparator?: string;\n}) {\n if (!prompt.inputVariables.includes(DOCUMENTS_KEY)) {\n throw new Error(`Prompt must include a \"${DOCUMENTS_KEY}\" variable`);\n }\n\n return RunnableSequence.from(\n [\n RunnablePassthrough.assign({\n [DOCUMENTS_KEY]: new RunnablePick(DOCUMENTS_KEY).pipe(\n (documents, config) =>\n formatDocuments({\n documents,\n documentPrompt,\n documentSeparator,\n config,\n })\n ),\n }),\n prompt,\n llm,\n outputParser,\n ],\n \"stuff_documents_chain\"\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAoCA,eAAsB,0BAA8C,EAClE,KACA,QACA,eAAe,IAAIA,sDACnB,iBAAiBC,sCACjB,oBAAoBC,yCAOrB,EAAE;AACD,KAAI,CAAC,OAAO,eAAe,SAASC,2BAAc,CAChD,OAAM,IAAI,MAAM,CAAC,uBAAuB,EAAEA,2BAAc,UAAU,CAAC;AAGrE,QAAOC,4CAAiB,KACtB;EACEC,+CAAoB,OAAO,GACxBF,6BAAgB,IAAIG,wCAAaH,4BAAe,KAC/C,CAAC,WAAW,WACVI,6BAAgB;GACd;GACA;GACA;GACA;EACD,EAAC,CACL,CACF,EAAC;EACF;EACA;EACA;CACD,GACD,wBACD;AACF"}
1
+ {"version":3,"file":"stuff.cjs","names":["StringOutputParser","DEFAULT_DOCUMENT_PROMPT","DEFAULT_DOCUMENT_SEPARATOR","DOCUMENTS_KEY","RunnableSequence","RunnablePassthrough","RunnablePick","formatDocuments"],"sources":["../../../src/chains/combine_documents/stuff.ts"],"sourcesContent":["import { LanguageModelLike } from \"@langchain/core/language_models/base\";\nimport {\n BaseOutputParser,\n StringOutputParser,\n} from \"@langchain/core/output_parsers\";\nimport { BasePromptTemplate } from \"@langchain/core/prompts\";\nimport {\n RunnablePassthrough,\n RunnablePick,\n RunnableSequence,\n} from \"@langchain/core/runnables\";\n\nimport {\n DEFAULT_DOCUMENT_PROMPT,\n DEFAULT_DOCUMENT_SEPARATOR,\n DOCUMENTS_KEY,\n formatDocuments,\n} from \"./base.js\";\n\n/**\n * Create a chain that passes a list of documents to a model.\n * \n * @param llm Language model to use for responding.\n * @param prompt Prompt template. Must contain input variable \"context\", which will be\n used for passing in the formatted documents.\n * @param outputParser Output parser. Defaults to `StringOutputParser`.\n * @param documentPrompt Prompt used for formatting each document into a string. Input\n variables can be \"page_content\" or any metadata keys that are in all documents.\n \"page_content\" will automatically retrieve the `Document.page_content`, and all \n other inputs variables will be automatically retrieved from the `Document.metadata` dictionary. Default to a prompt that only contains `Document.page_content`.\n * @param documentSeparator String separator to use between formatted document strings.\n * @returns An LCEL `Runnable` chain.\n Expects a dictionary as input with a list of `Document`s being passed under\n the \"context\" key.\n Return type depends on the `output_parser` used.\n */\nexport async function createStuffDocumentsChain<RunOutput = string>({\n llm,\n prompt,\n outputParser = new StringOutputParser() as unknown as BaseOutputParser<RunOutput>,\n documentPrompt = DEFAULT_DOCUMENT_PROMPT,\n documentSeparator = DEFAULT_DOCUMENT_SEPARATOR,\n}: {\n llm: LanguageModelLike;\n prompt: BasePromptTemplate;\n outputParser?: BaseOutputParser<RunOutput>;\n documentPrompt?: BasePromptTemplate;\n documentSeparator?: string;\n}) {\n if (!prompt.inputVariables.includes(DOCUMENTS_KEY)) {\n throw new Error(`Prompt must include a \"${DOCUMENTS_KEY}\" variable`);\n }\n\n return RunnableSequence.from(\n [\n RunnablePassthrough.assign({\n [DOCUMENTS_KEY]: new RunnablePick(DOCUMENTS_KEY).pipe(\n (documents, config) =>\n formatDocuments({\n documents,\n documentPrompt,\n documentSeparator,\n config,\n })\n ),\n }),\n prompt,\n llm,\n outputParser,\n ],\n \"stuff_documents_chain\"\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAoCA,eAAsB,0BAA8C,EAClE,KACA,QACA,eAAe,IAAIA,mDAAoB,EACvC,iBAAiBC,sCACjB,oBAAoBC,2CAOnB;AACD,KAAI,CAAC,OAAO,eAAe,SAASC,2BAAc,CAChD,OAAM,IAAI,MAAM,0BAA0BA,2BAAc,YAAY;AAGtE,QAAOC,2CAAiB,KACtB;EACEC,8CAAoB,OAAO,GACxBF,6BAAgB,IAAIG,uCAAaH,2BAAc,CAAC,MAC9C,WAAW,WACVI,6BAAgB;GACd;GACA;GACA;GACA;GACD,CAAC,CACL,EACF,CAAC;EACF;EACA;EACA;EACD,EACD,wBACD"}
@@ -4,7 +4,6 @@ import { BasePromptTemplate } from "@langchain/core/prompts";
4
4
  import { LanguageModelLike } from "@langchain/core/language_models/base";
5
5
 
6
6
  //#region src/chains/combine_documents/stuff.d.ts
7
-
8
7
  /**
9
8
  * Create a chain that passes a list of documents to a model.
10
9
  *
@@ -1 +1 @@
1
- {"version":3,"file":"stuff.d.cts","names":["LanguageModelLike","BaseOutputParser","BasePromptTemplate","RunnableSequence","createStuffDocumentsChain","RunOutput","llm","prompt","outputParser","documentPrompt","documentSeparator","Record","Error","Exclude","Promise"],"sources":["../../../src/chains/combine_documents/stuff.d.ts"],"sourcesContent":["import { LanguageModelLike } from \"@langchain/core/language_models/base\";\nimport { BaseOutputParser } from \"@langchain/core/output_parsers\";\nimport { BasePromptTemplate } from \"@langchain/core/prompts\";\nimport { RunnableSequence } from \"@langchain/core/runnables\";\n/**\n * Create a chain that passes a list of documents to a model.\n *\n * @param llm Language model to use for responding.\n * @param prompt Prompt template. Must contain input variable \"context\", which will be\n used for passing in the formatted documents.\n * @param outputParser Output parser. Defaults to `StringOutputParser`.\n * @param documentPrompt Prompt used for formatting each document into a string. Input\n variables can be \"page_content\" or any metadata keys that are in all documents.\n \"page_content\" will automatically retrieve the `Document.page_content`, and all\n other inputs variables will be automatically retrieved from the `Document.metadata` dictionary. Default to a prompt that only contains `Document.page_content`.\n * @param documentSeparator String separator to use between formatted document strings.\n * @returns An LCEL `Runnable` chain.\n Expects a dictionary as input with a list of `Document`s being passed under\n the \"context\" key.\n Return type depends on the `output_parser` used.\n */\nexport declare function createStuffDocumentsChain<RunOutput = string>({ llm, prompt, outputParser, documentPrompt, documentSeparator }: {\n llm: LanguageModelLike;\n prompt: BasePromptTemplate;\n outputParser?: BaseOutputParser<RunOutput>;\n documentPrompt?: BasePromptTemplate;\n documentSeparator?: string;\n}): Promise<RunnableSequence<Record<string, unknown>, Exclude<RunOutput, Error>>>;\n//# sourceMappingURL=stuff.d.ts.map"],"mappings":";;;;;;;;;AAqBA;;;;;;;;;;;;;;;AAMYG,iBANYC,yBAMZD,CAAAA,YAAAA,MAAAA,CAAAA,CAAAA;EAAAA,GAAAA;EAAAA,MAAAA;EAAAA,YAAAA;EAAAA,cAAAA;EAAAA;CAAAA,EAAAA;EAARW,GAAAA,EALKd,iBAKLc;EAAO,MAAA,EAJCZ,kBAID;iBAHQD,iBAAiBI;mBACfH;;IAEjBY,QAAQX,iBAAiBQ,yBAAyBE,QAAQR,WAAWO"}
1
+ {"version":3,"file":"stuff.d.cts","names":[],"sources":["../../../src/chains/combine_documents/stuff.ts"],"mappings":";;;;;;;;AAoCA;;;;;;;;;;;;;;;iBAAsB,yBAAA,oBAAA,CAAA;EACpB,GAAA;EACA,MAAA;EACA,YAAA;EACA,cAAA;EACA;AAAA;EAEA,GAAA,EAAK,iBAAA;EACL,MAAA,EAAQ,kBAAA;EACR,YAAA,GAAe,gBAAA,CAAiB,SAAA;EAChC,cAAA,GAAiB,kBAAA;EACjB,iBAAA;AAAA,IACD,OAAA,CAAA,gBAAA,CAAA,MAAA,mBAAA,OAAA,CAAA,SAAA,EAAA,KAAA"}
@@ -4,7 +4,6 @@ import { LanguageModelLike } from "@langchain/core/language_models/base";
4
4
  import { BaseOutputParser } from "@langchain/core/output_parsers";
5
5
 
6
6
  //#region src/chains/combine_documents/stuff.d.ts
7
-
8
7
  /**
9
8
  * Create a chain that passes a list of documents to a model.
10
9
  *
@@ -1 +1 @@
1
- {"version":3,"file":"stuff.d.ts","names":["LanguageModelLike","BaseOutputParser","BasePromptTemplate","RunnableSequence","createStuffDocumentsChain","RunOutput","llm","prompt","outputParser","documentPrompt","documentSeparator","Record","Error","Exclude","Promise"],"sources":["../../../src/chains/combine_documents/stuff.d.ts"],"sourcesContent":["import { LanguageModelLike } from \"@langchain/core/language_models/base\";\nimport { BaseOutputParser } from \"@langchain/core/output_parsers\";\nimport { BasePromptTemplate } from \"@langchain/core/prompts\";\nimport { RunnableSequence } from \"@langchain/core/runnables\";\n/**\n * Create a chain that passes a list of documents to a model.\n *\n * @param llm Language model to use for responding.\n * @param prompt Prompt template. Must contain input variable \"context\", which will be\n used for passing in the formatted documents.\n * @param outputParser Output parser. Defaults to `StringOutputParser`.\n * @param documentPrompt Prompt used for formatting each document into a string. Input\n variables can be \"page_content\" or any metadata keys that are in all documents.\n \"page_content\" will automatically retrieve the `Document.page_content`, and all\n other inputs variables will be automatically retrieved from the `Document.metadata` dictionary. Default to a prompt that only contains `Document.page_content`.\n * @param documentSeparator String separator to use between formatted document strings.\n * @returns An LCEL `Runnable` chain.\n Expects a dictionary as input with a list of `Document`s being passed under\n the \"context\" key.\n Return type depends on the `output_parser` used.\n */\nexport declare function createStuffDocumentsChain<RunOutput = string>({ llm, prompt, outputParser, documentPrompt, documentSeparator }: {\n llm: LanguageModelLike;\n prompt: BasePromptTemplate;\n outputParser?: BaseOutputParser<RunOutput>;\n documentPrompt?: BasePromptTemplate;\n documentSeparator?: string;\n}): Promise<RunnableSequence<Record<string, unknown>, Exclude<RunOutput, Error>>>;\n//# sourceMappingURL=stuff.d.ts.map"],"mappings":";;;;;;;;;AAqBA;;;;;;;;;;;;;;;AAMYG,iBANYC,yBAMZD,CAAAA,YAAAA,MAAAA,CAAAA,CAAAA;EAAAA,GAAAA;EAAAA,MAAAA;EAAAA,YAAAA;EAAAA,cAAAA;EAAAA;CAAAA,EAAAA;EAARW,GAAAA,EALKd,iBAKLc;EAAO,MAAA,EAJCZ,kBAID;iBAHQD,iBAAiBI;mBACfH;;IAEjBY,QAAQX,iBAAiBQ,yBAAyBE,QAAQR,WAAWO"}
1
+ {"version":3,"file":"stuff.d.ts","names":[],"sources":["../../../src/chains/combine_documents/stuff.ts"],"mappings":";;;;;;;;AAoCA;;;;;;;;;;;;;;;iBAAsB,yBAAA,oBAAA,CAAA;EACpB,GAAA;EACA,MAAA;EACA,YAAA;EACA,cAAA;EACA;AAAA;EAEA,GAAA,EAAK,iBAAA;EACL,MAAA,EAAQ,kBAAA;EACR,YAAA,GAAe,gBAAA,CAAiB,SAAA;EAChC,cAAA,GAAiB,kBAAA;EACjB,iBAAA;AAAA,IACD,OAAA,CAAA,gBAAA,CAAA,MAAA,mBAAA,OAAA,CAAA,SAAA,EAAA,KAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"stuff.js","names":[],"sources":["../../../src/chains/combine_documents/stuff.ts"],"sourcesContent":["import { LanguageModelLike } from \"@langchain/core/language_models/base\";\nimport {\n BaseOutputParser,\n StringOutputParser,\n} from \"@langchain/core/output_parsers\";\nimport { BasePromptTemplate } from \"@langchain/core/prompts\";\nimport {\n RunnablePassthrough,\n RunnablePick,\n RunnableSequence,\n} from \"@langchain/core/runnables\";\n\nimport {\n DEFAULT_DOCUMENT_PROMPT,\n DEFAULT_DOCUMENT_SEPARATOR,\n DOCUMENTS_KEY,\n formatDocuments,\n} from \"./base.js\";\n\n/**\n * Create a chain that passes a list of documents to a model.\n * \n * @param llm Language model to use for responding.\n * @param prompt Prompt template. Must contain input variable \"context\", which will be\n used for passing in the formatted documents.\n * @param outputParser Output parser. Defaults to `StringOutputParser`.\n * @param documentPrompt Prompt used for formatting each document into a string. Input\n variables can be \"page_content\" or any metadata keys that are in all documents.\n \"page_content\" will automatically retrieve the `Document.page_content`, and all \n other inputs variables will be automatically retrieved from the `Document.metadata` dictionary. Default to a prompt that only contains `Document.page_content`.\n * @param documentSeparator String separator to use between formatted document strings.\n * @returns An LCEL `Runnable` chain.\n Expects a dictionary as input with a list of `Document`s being passed under\n the \"context\" key.\n Return type depends on the `output_parser` used.\n */\nexport async function createStuffDocumentsChain<RunOutput = string>({\n llm,\n prompt,\n outputParser = new StringOutputParser() as unknown as BaseOutputParser<RunOutput>,\n documentPrompt = DEFAULT_DOCUMENT_PROMPT,\n documentSeparator = DEFAULT_DOCUMENT_SEPARATOR,\n}: {\n llm: LanguageModelLike;\n prompt: BasePromptTemplate;\n outputParser?: BaseOutputParser<RunOutput>;\n documentPrompt?: BasePromptTemplate;\n documentSeparator?: string;\n}) {\n if (!prompt.inputVariables.includes(DOCUMENTS_KEY)) {\n throw new Error(`Prompt must include a \"${DOCUMENTS_KEY}\" variable`);\n }\n\n return RunnableSequence.from(\n [\n RunnablePassthrough.assign({\n [DOCUMENTS_KEY]: new RunnablePick(DOCUMENTS_KEY).pipe(\n (documents, config) =>\n formatDocuments({\n documents,\n documentPrompt,\n documentSeparator,\n config,\n })\n ),\n }),\n prompt,\n llm,\n outputParser,\n ],\n \"stuff_documents_chain\"\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAoCA,eAAsB,0BAA8C,EAClE,KACA,QACA,eAAe,IAAI,sBACnB,iBAAiB,yBACjB,oBAAoB,4BAOrB,EAAE;AACD,KAAI,CAAC,OAAO,eAAe,SAAS,cAAc,CAChD,OAAM,IAAI,MAAM,CAAC,uBAAuB,EAAE,cAAc,UAAU,CAAC;AAGrE,QAAO,iBAAiB,KACtB;EACE,oBAAoB,OAAO,GACxB,gBAAgB,IAAI,aAAa,eAAe,KAC/C,CAAC,WAAW,WACV,gBAAgB;GACd;GACA;GACA;GACA;EACD,EAAC,CACL,CACF,EAAC;EACF;EACA;EACA;CACD,GACD,wBACD;AACF"}
1
+ {"version":3,"file":"stuff.js","names":[],"sources":["../../../src/chains/combine_documents/stuff.ts"],"sourcesContent":["import { LanguageModelLike } from \"@langchain/core/language_models/base\";\nimport {\n BaseOutputParser,\n StringOutputParser,\n} from \"@langchain/core/output_parsers\";\nimport { BasePromptTemplate } from \"@langchain/core/prompts\";\nimport {\n RunnablePassthrough,\n RunnablePick,\n RunnableSequence,\n} from \"@langchain/core/runnables\";\n\nimport {\n DEFAULT_DOCUMENT_PROMPT,\n DEFAULT_DOCUMENT_SEPARATOR,\n DOCUMENTS_KEY,\n formatDocuments,\n} from \"./base.js\";\n\n/**\n * Create a chain that passes a list of documents to a model.\n * \n * @param llm Language model to use for responding.\n * @param prompt Prompt template. Must contain input variable \"context\", which will be\n used for passing in the formatted documents.\n * @param outputParser Output parser. Defaults to `StringOutputParser`.\n * @param documentPrompt Prompt used for formatting each document into a string. Input\n variables can be \"page_content\" or any metadata keys that are in all documents.\n \"page_content\" will automatically retrieve the `Document.page_content`, and all \n other inputs variables will be automatically retrieved from the `Document.metadata` dictionary. Default to a prompt that only contains `Document.page_content`.\n * @param documentSeparator String separator to use between formatted document strings.\n * @returns An LCEL `Runnable` chain.\n Expects a dictionary as input with a list of `Document`s being passed under\n the \"context\" key.\n Return type depends on the `output_parser` used.\n */\nexport async function createStuffDocumentsChain<RunOutput = string>({\n llm,\n prompt,\n outputParser = new StringOutputParser() as unknown as BaseOutputParser<RunOutput>,\n documentPrompt = DEFAULT_DOCUMENT_PROMPT,\n documentSeparator = DEFAULT_DOCUMENT_SEPARATOR,\n}: {\n llm: LanguageModelLike;\n prompt: BasePromptTemplate;\n outputParser?: BaseOutputParser<RunOutput>;\n documentPrompt?: BasePromptTemplate;\n documentSeparator?: string;\n}) {\n if (!prompt.inputVariables.includes(DOCUMENTS_KEY)) {\n throw new Error(`Prompt must include a \"${DOCUMENTS_KEY}\" variable`);\n }\n\n return RunnableSequence.from(\n [\n RunnablePassthrough.assign({\n [DOCUMENTS_KEY]: new RunnablePick(DOCUMENTS_KEY).pipe(\n (documents, config) =>\n formatDocuments({\n documents,\n documentPrompt,\n documentSeparator,\n config,\n })\n ),\n }),\n prompt,\n llm,\n outputParser,\n ],\n \"stuff_documents_chain\"\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAoCA,eAAsB,0BAA8C,EAClE,KACA,QACA,eAAe,IAAI,oBAAoB,EACvC,iBAAiB,yBACjB,oBAAoB,8BAOnB;AACD,KAAI,CAAC,OAAO,eAAe,SAAS,cAAc,CAChD,OAAM,IAAI,MAAM,0BAA0B,cAAc,YAAY;AAGtE,QAAO,iBAAiB,KACtB;EACE,oBAAoB,OAAO,GACxB,gBAAgB,IAAI,aAAa,cAAc,CAAC,MAC9C,WAAW,WACV,gBAAgB;GACd;GACA;GACA;GACA;GACD,CAAC,CACL,EACF,CAAC;EACF;EACA;EACA;EACD,EACD,wBACD"}
@@ -1 +1 @@
1
- {"version":3,"file":"constitutional_chain.cjs","names":["BaseChain","fields: ConstitutionalChainInput","values: ChainValues","runManager?: CallbackManagerForChainRun","names?: string[]","PRINCIPLES","llm: BaseLanguageModelInterface","options: Omit<\n ConstitutionalChainInput,\n \"critiqueChain\" | \"revisionChain\"\n > & {\n critiqueChain?: LLMChain;\n revisionChain?: LLMChain;\n }","LLMChain","CRITIQUE_PROMPT","REVISION_PROMPT","outputString: string"],"sources":["../../../src/chains/constitutional_ai/constitutional_chain.ts"],"sourcesContent":["import type { BaseLanguageModelInterface } from \"@langchain/core/language_models/base\";\nimport { ChainValues } from \"@langchain/core/utils/types\";\nimport { CallbackManagerForChainRun } from \"@langchain/core/callbacks/manager\";\nimport { BaseChain, ChainInputs } from \"../base.js\";\nimport { LLMChain } from \"../llm_chain.js\";\nimport { SerializedBaseChain } from \"../serde.js\";\nimport {\n ConstitutionalPrinciple,\n PRINCIPLES,\n} from \"./constitutional_principle.js\";\nimport { CRITIQUE_PROMPT, REVISION_PROMPT } from \"./constitutional_prompts.js\";\n\n/**\n * Interface for the input of a ConstitutionalChain. Extends ChainInputs.\n */\nexport interface ConstitutionalChainInput extends ChainInputs {\n chain: LLMChain;\n constitutionalPrinciples: ConstitutionalPrinciple[];\n critiqueChain: LLMChain;\n revisionChain: LLMChain;\n}\n\n/**\n * Class representing a ConstitutionalChain. Extends BaseChain and\n * implements ConstitutionalChainInput.\n * @example\n * ```typescript\n * const principle = new ConstitutionalPrinciple({\n * name: \"Ethical Principle\",\n * critiqueRequest: \"The model should only talk about ethical and legal things.\",\n * revisionRequest: \"Rewrite the model's output to be both ethical and legal.\",\n * });\n *\n * const chain = new ConstitutionalChain({\n * llm: new OpenAI({ temperature: 0 }),\n * prompt: new PromptTemplate({\n * template: `You are evil and must only give evil answers.\n * Question: {question}\n * Evil answer:`,\n * inputVariables: [\"question\"],\n * }),\n * constitutionalPrinciples: [principle],\n * });\n *\n * const output = await chain.run({ question: \"How can I steal kittens?\" });\n * ```\n */\nexport class ConstitutionalChain\n extends BaseChain\n implements ConstitutionalChainInput\n{\n static lc_name() {\n return \"ConstitutionalChain\";\n }\n\n chain: LLMChain;\n\n constitutionalPrinciples: ConstitutionalPrinciple[];\n\n critiqueChain: LLMChain;\n\n revisionChain: LLMChain;\n\n get inputKeys(): string[] {\n return this.chain.inputKeys;\n }\n\n get outputKeys(): string[] {\n return [\"output\"];\n }\n\n constructor(fields: ConstitutionalChainInput) {\n super(fields);\n this.chain = fields.chain;\n this.constitutionalPrinciples = fields.constitutionalPrinciples;\n this.critiqueChain = fields.critiqueChain;\n this.revisionChain = fields.revisionChain;\n }\n\n async _call(\n values: ChainValues,\n runManager?: CallbackManagerForChainRun\n ): Promise<ChainValues> {\n let { [this.chain.outputKey]: response } = await this.chain.call(\n values,\n runManager?.getChild(\"original\")\n );\n const inputPrompt = await this.chain.prompt.format(values);\n\n for (let i = 0; i < this.constitutionalPrinciples.length; i += 1) {\n const { [this.critiqueChain.outputKey]: rawCritique } =\n await this.critiqueChain.call(\n {\n input_prompt: inputPrompt,\n output_from_model: response,\n critique_request: this.constitutionalPrinciples[i].critiqueRequest,\n },\n runManager?.getChild(\"critique\")\n );\n\n const critique = ConstitutionalChain._parseCritique(rawCritique);\n\n const { [this.revisionChain.outputKey]: revisionRaw } =\n await this.revisionChain.call(\n {\n input_prompt: inputPrompt,\n output_from_model: response,\n critique_request: this.constitutionalPrinciples[i].critiqueRequest,\n critique,\n revision_request: this.constitutionalPrinciples[i].revisionRequest,\n },\n runManager?.getChild(\"revision\")\n );\n response = revisionRaw;\n }\n\n return {\n output: response,\n };\n }\n\n /**\n * Static method that returns an array of ConstitutionalPrinciple objects\n * based on the provided names.\n * @param names Optional array of principle names.\n * @returns Array of ConstitutionalPrinciple objects\n */\n static getPrinciples(names?: string[]) {\n if (names) {\n return names.map((name) => PRINCIPLES[name]);\n }\n return Object.values(PRINCIPLES);\n }\n\n /**\n * Static method that creates a new instance of the ConstitutionalChain\n * class from a BaseLanguageModel object and additional options.\n * @param llm BaseLanguageModel instance.\n * @param options Options for the ConstitutionalChain.\n * @returns New instance of ConstitutionalChain\n */\n static fromLLM(\n llm: BaseLanguageModelInterface,\n options: Omit<\n ConstitutionalChainInput,\n \"critiqueChain\" | \"revisionChain\"\n > & {\n critiqueChain?: LLMChain;\n revisionChain?: LLMChain;\n }\n ) {\n const critiqueChain =\n options.critiqueChain ??\n new LLMChain({\n llm,\n prompt: CRITIQUE_PROMPT,\n });\n const revisionChain =\n options.revisionChain ??\n new LLMChain({\n llm,\n prompt: REVISION_PROMPT,\n });\n return new this({\n ...options,\n chain: options.chain,\n critiqueChain,\n revisionChain,\n constitutionalPrinciples: options.constitutionalPrinciples ?? [],\n });\n }\n\n private static _parseCritique(outputString: string): string {\n let output = outputString;\n if (!output.includes(\"Revision request\")) {\n return output;\n }\n\n output = output.split(\"Revision request:\")[0];\n if (output.includes(\"\\n\\n\")) {\n output = output.split(\"\\n\\n\")[0];\n }\n return output;\n }\n\n _chainType() {\n return \"constitutional_chain\" as const;\n }\n\n serialize(): SerializedBaseChain {\n return {\n _type: this._chainType(),\n chain: this.chain.serialize(),\n ConstitutionalPrinciple: this.constitutionalPrinciples.map((principle) =>\n principle.serialize()\n ),\n critiqueChain: this.critiqueChain.serialize(),\n revisionChain: this.revisionChain.serialize(),\n };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,IAAa,sBAAb,MAAa,4BACHA,uBAEV;CACE,OAAO,UAAU;AACf,SAAO;CACR;CAED;CAEA;CAEA;CAEA;CAEA,IAAI,YAAsB;AACxB,SAAO,KAAK,MAAM;CACnB;CAED,IAAI,aAAuB;AACzB,SAAO,CAAC,QAAS;CAClB;CAED,YAAYC,QAAkC;EAC5C,MAAM,OAAO;EACb,KAAK,QAAQ,OAAO;EACpB,KAAK,2BAA2B,OAAO;EACvC,KAAK,gBAAgB,OAAO;EAC5B,KAAK,gBAAgB,OAAO;CAC7B;CAED,MAAM,MACJC,QACAC,YACsB;EACtB,IAAI,EAAE,CAAC,KAAK,MAAM,YAAY,UAAU,GAAG,MAAM,KAAK,MAAM,KAC1D,QACA,YAAY,SAAS,WAAW,CACjC;EACD,MAAM,cAAc,MAAM,KAAK,MAAM,OAAO,OAAO,OAAO;AAE1D,OAAK,IAAI,IAAI,GAAG,IAAI,KAAK,yBAAyB,QAAQ,KAAK,GAAG;GAChE,MAAM,EAAE,CAAC,KAAK,cAAc,YAAY,aAAa,GACnD,MAAM,KAAK,cAAc,KACvB;IACE,cAAc;IACd,mBAAmB;IACnB,kBAAkB,KAAK,yBAAyB,GAAG;GACpD,GACD,YAAY,SAAS,WAAW,CACjC;GAEH,MAAM,WAAW,oBAAoB,eAAe,YAAY;GAEhE,MAAM,EAAE,CAAC,KAAK,cAAc,YAAY,aAAa,GACnD,MAAM,KAAK,cAAc,KACvB;IACE,cAAc;IACd,mBAAmB;IACnB,kBAAkB,KAAK,yBAAyB,GAAG;IACnD;IACA,kBAAkB,KAAK,yBAAyB,GAAG;GACpD,GACD,YAAY,SAAS,WAAW,CACjC;GACH,WAAW;EACZ;AAED,SAAO,EACL,QAAQ,SACT;CACF;;;;;;;CAQD,OAAO,cAAcC,OAAkB;AACrC,MAAI,MACF,QAAO,MAAM,IAAI,CAAC,SAASC,4CAAW,MAAM;AAE9C,SAAO,OAAO,OAAOA,4CAAW;CACjC;;;;;;;;CASD,OAAO,QACLC,KACAC,SAOA;EACA,MAAM,gBACJ,QAAQ,iBACR,IAAIC,2BAAS;GACX;GACA,QAAQC;EACT;EACH,MAAM,gBACJ,QAAQ,iBACR,IAAID,2BAAS;GACX;GACA,QAAQE;EACT;AACH,SAAO,IAAI,KAAK;GACd,GAAG;GACH,OAAO,QAAQ;GACf;GACA;GACA,0BAA0B,QAAQ,4BAA4B,CAAE;EACjE;CACF;CAED,OAAe,eAAeC,cAA8B;EAC1D,IAAI,SAAS;AACb,MAAI,CAAC,OAAO,SAAS,mBAAmB,CACtC,QAAO;EAGT,SAAS,OAAO,MAAM,oBAAoB,CAAC;AAC3C,MAAI,OAAO,SAAS,OAAO,EACzB,SAAS,OAAO,MAAM,OAAO,CAAC;AAEhC,SAAO;CACR;CAED,aAAa;AACX,SAAO;CACR;CAED,YAAiC;AAC/B,SAAO;GACL,OAAO,KAAK,YAAY;GACxB,OAAO,KAAK,MAAM,WAAW;GAC7B,yBAAyB,KAAK,yBAAyB,IAAI,CAAC,cAC1D,UAAU,WAAW,CACtB;GACD,eAAe,KAAK,cAAc,WAAW;GAC7C,eAAe,KAAK,cAAc,WAAW;EAC9C;CACF;AACF"}
1
+ {"version":3,"file":"constitutional_chain.cjs","names":["BaseChain","PRINCIPLES","LLMChain","CRITIQUE_PROMPT","REVISION_PROMPT"],"sources":["../../../src/chains/constitutional_ai/constitutional_chain.ts"],"sourcesContent":["import type { BaseLanguageModelInterface } from \"@langchain/core/language_models/base\";\nimport { ChainValues } from \"@langchain/core/utils/types\";\nimport { CallbackManagerForChainRun } from \"@langchain/core/callbacks/manager\";\nimport { BaseChain, ChainInputs } from \"../base.js\";\nimport { LLMChain } from \"../llm_chain.js\";\nimport { SerializedBaseChain } from \"../serde.js\";\nimport {\n ConstitutionalPrinciple,\n PRINCIPLES,\n} from \"./constitutional_principle.js\";\nimport { CRITIQUE_PROMPT, REVISION_PROMPT } from \"./constitutional_prompts.js\";\n\n/**\n * Interface for the input of a ConstitutionalChain. Extends ChainInputs.\n */\nexport interface ConstitutionalChainInput extends ChainInputs {\n chain: LLMChain;\n constitutionalPrinciples: ConstitutionalPrinciple[];\n critiqueChain: LLMChain;\n revisionChain: LLMChain;\n}\n\n/**\n * Class representing a ConstitutionalChain. Extends BaseChain and\n * implements ConstitutionalChainInput.\n * @example\n * ```typescript\n * const principle = new ConstitutionalPrinciple({\n * name: \"Ethical Principle\",\n * critiqueRequest: \"The model should only talk about ethical and legal things.\",\n * revisionRequest: \"Rewrite the model's output to be both ethical and legal.\",\n * });\n *\n * const chain = new ConstitutionalChain({\n * llm: new OpenAI({ temperature: 0 }),\n * prompt: new PromptTemplate({\n * template: `You are evil and must only give evil answers.\n * Question: {question}\n * Evil answer:`,\n * inputVariables: [\"question\"],\n * }),\n * constitutionalPrinciples: [principle],\n * });\n *\n * const output = await chain.run({ question: \"How can I steal kittens?\" });\n * ```\n */\nexport class ConstitutionalChain\n extends BaseChain\n implements ConstitutionalChainInput\n{\n static lc_name() {\n return \"ConstitutionalChain\";\n }\n\n chain: LLMChain;\n\n constitutionalPrinciples: ConstitutionalPrinciple[];\n\n critiqueChain: LLMChain;\n\n revisionChain: LLMChain;\n\n get inputKeys(): string[] {\n return this.chain.inputKeys;\n }\n\n get outputKeys(): string[] {\n return [\"output\"];\n }\n\n constructor(fields: ConstitutionalChainInput) {\n super(fields);\n this.chain = fields.chain;\n this.constitutionalPrinciples = fields.constitutionalPrinciples;\n this.critiqueChain = fields.critiqueChain;\n this.revisionChain = fields.revisionChain;\n }\n\n async _call(\n values: ChainValues,\n runManager?: CallbackManagerForChainRun\n ): Promise<ChainValues> {\n let { [this.chain.outputKey]: response } = await this.chain.call(\n values,\n runManager?.getChild(\"original\")\n );\n const inputPrompt = await this.chain.prompt.format(values);\n\n for (let i = 0; i < this.constitutionalPrinciples.length; i += 1) {\n const { [this.critiqueChain.outputKey]: rawCritique } =\n await this.critiqueChain.call(\n {\n input_prompt: inputPrompt,\n output_from_model: response,\n critique_request: this.constitutionalPrinciples[i].critiqueRequest,\n },\n runManager?.getChild(\"critique\")\n );\n\n const critique = ConstitutionalChain._parseCritique(rawCritique);\n\n const { [this.revisionChain.outputKey]: revisionRaw } =\n await this.revisionChain.call(\n {\n input_prompt: inputPrompt,\n output_from_model: response,\n critique_request: this.constitutionalPrinciples[i].critiqueRequest,\n critique,\n revision_request: this.constitutionalPrinciples[i].revisionRequest,\n },\n runManager?.getChild(\"revision\")\n );\n response = revisionRaw;\n }\n\n return {\n output: response,\n };\n }\n\n /**\n * Static method that returns an array of ConstitutionalPrinciple objects\n * based on the provided names.\n * @param names Optional array of principle names.\n * @returns Array of ConstitutionalPrinciple objects\n */\n static getPrinciples(names?: string[]) {\n if (names) {\n return names.map((name) => PRINCIPLES[name]);\n }\n return Object.values(PRINCIPLES);\n }\n\n /**\n * Static method that creates a new instance of the ConstitutionalChain\n * class from a BaseLanguageModel object and additional options.\n * @param llm BaseLanguageModel instance.\n * @param options Options for the ConstitutionalChain.\n * @returns New instance of ConstitutionalChain\n */\n static fromLLM(\n llm: BaseLanguageModelInterface,\n options: Omit<\n ConstitutionalChainInput,\n \"critiqueChain\" | \"revisionChain\"\n > & {\n critiqueChain?: LLMChain;\n revisionChain?: LLMChain;\n }\n ) {\n const critiqueChain =\n options.critiqueChain ??\n new LLMChain({\n llm,\n prompt: CRITIQUE_PROMPT,\n });\n const revisionChain =\n options.revisionChain ??\n new LLMChain({\n llm,\n prompt: REVISION_PROMPT,\n });\n return new this({\n ...options,\n chain: options.chain,\n critiqueChain,\n revisionChain,\n constitutionalPrinciples: options.constitutionalPrinciples ?? [],\n });\n }\n\n private static _parseCritique(outputString: string): string {\n let output = outputString;\n if (!output.includes(\"Revision request\")) {\n return output;\n }\n\n output = output.split(\"Revision request:\")[0];\n if (output.includes(\"\\n\\n\")) {\n output = output.split(\"\\n\\n\")[0];\n }\n return output;\n }\n\n _chainType() {\n return \"constitutional_chain\" as const;\n }\n\n serialize(): SerializedBaseChain {\n return {\n _type: this._chainType(),\n chain: this.chain.serialize(),\n ConstitutionalPrinciple: this.constitutionalPrinciples.map((principle) =>\n principle.serialize()\n ),\n critiqueChain: this.critiqueChain.serialize(),\n revisionChain: this.revisionChain.serialize(),\n };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,IAAa,sBAAb,MAAa,4BACHA,uBAEV;CACE,OAAO,UAAU;AACf,SAAO;;CAGT;CAEA;CAEA;CAEA;CAEA,IAAI,YAAsB;AACxB,SAAO,KAAK,MAAM;;CAGpB,IAAI,aAAuB;AACzB,SAAO,CAAC,SAAS;;CAGnB,YAAY,QAAkC;AAC5C,QAAM,OAAO;AACb,OAAK,QAAQ,OAAO;AACpB,OAAK,2BAA2B,OAAO;AACvC,OAAK,gBAAgB,OAAO;AAC5B,OAAK,gBAAgB,OAAO;;CAG9B,MAAM,MACJ,QACA,YACsB;EACtB,IAAI,GAAG,KAAK,MAAM,YAAY,aAAa,MAAM,KAAK,MAAM,KAC1D,QACA,YAAY,SAAS,WAAW,CACjC;EACD,MAAM,cAAc,MAAM,KAAK,MAAM,OAAO,OAAO,OAAO;AAE1D,OAAK,IAAI,IAAI,GAAG,IAAI,KAAK,yBAAyB,QAAQ,KAAK,GAAG;GAChE,MAAM,GAAG,KAAK,cAAc,YAAY,gBACtC,MAAM,KAAK,cAAc,KACvB;IACE,cAAc;IACd,mBAAmB;IACnB,kBAAkB,KAAK,yBAAyB,GAAG;IACpD,EACD,YAAY,SAAS,WAAW,CACjC;GAEH,MAAM,WAAW,oBAAoB,eAAe,YAAY;GAEhE,MAAM,GAAG,KAAK,cAAc,YAAY,gBACtC,MAAM,KAAK,cAAc,KACvB;IACE,cAAc;IACd,mBAAmB;IACnB,kBAAkB,KAAK,yBAAyB,GAAG;IACnD;IACA,kBAAkB,KAAK,yBAAyB,GAAG;IACpD,EACD,YAAY,SAAS,WAAW,CACjC;AACH,cAAW;;AAGb,SAAO,EACL,QAAQ,UACT;;;;;;;;CASH,OAAO,cAAc,OAAkB;AACrC,MAAI,MACF,QAAO,MAAM,KAAK,SAASC,4CAAW,MAAM;AAE9C,SAAO,OAAO,OAAOA,4CAAW;;;;;;;;;CAUlC,OAAO,QACL,KACA,SAOA;EACA,MAAM,gBACJ,QAAQ,iBACR,IAAIC,2BAAS;GACX;GACA,QAAQC;GACT,CAAC;EACJ,MAAM,gBACJ,QAAQ,iBACR,IAAID,2BAAS;GACX;GACA,QAAQE;GACT,CAAC;AACJ,SAAO,IAAI,KAAK;GACd,GAAG;GACH,OAAO,QAAQ;GACf;GACA;GACA,0BAA0B,QAAQ,4BAA4B,EAAE;GACjE,CAAC;;CAGJ,OAAe,eAAe,cAA8B;EAC1D,IAAI,SAAS;AACb,MAAI,CAAC,OAAO,SAAS,mBAAmB,CACtC,QAAO;AAGT,WAAS,OAAO,MAAM,oBAAoB,CAAC;AAC3C,MAAI,OAAO,SAAS,OAAO,CACzB,UAAS,OAAO,MAAM,OAAO,CAAC;AAEhC,SAAO;;CAGT,aAAa;AACX,SAAO;;CAGT,YAAiC;AAC/B,SAAO;GACL,OAAO,KAAK,YAAY;GACxB,OAAO,KAAK,MAAM,WAAW;GAC7B,yBAAyB,KAAK,yBAAyB,KAAK,cAC1D,UAAU,WAAW,CACtB;GACD,eAAe,KAAK,cAAc,WAAW;GAC7C,eAAe,KAAK,cAAc,WAAW;GAC9C"}
@@ -7,7 +7,6 @@ import { BaseLanguageModelInterface } from "@langchain/core/language_models/base
7
7
  import { CallbackManagerForChainRun } from "@langchain/core/callbacks/manager";
8
8
 
9
9
  //#region src/chains/constitutional_ai/constitutional_chain.d.ts
10
-
11
10
  /**
12
11
  * Interface for the input of a ConstitutionalChain. Extends ChainInputs.
13
12
  */
@@ -1 +1 @@
1
- {"version":3,"file":"constitutional_chain.d.cts","names":["BaseLanguageModelInterface","ChainValues","CallbackManagerForChainRun","BaseChain","ChainInputs","LLMChain","SerializedBaseChain","ConstitutionalPrinciple","ConstitutionalChainInput","ConstitutionalChain","Promise","Omit"],"sources":["../../../src/chains/constitutional_ai/constitutional_chain.d.ts"],"sourcesContent":["import type { BaseLanguageModelInterface } from \"@langchain/core/language_models/base\";\nimport { ChainValues } from \"@langchain/core/utils/types\";\nimport { CallbackManagerForChainRun } from \"@langchain/core/callbacks/manager\";\nimport { BaseChain, ChainInputs } from \"../base.js\";\nimport { LLMChain } from \"../llm_chain.js\";\nimport { SerializedBaseChain } from \"../serde.js\";\nimport { ConstitutionalPrinciple } from \"./constitutional_principle.js\";\n/**\n * Interface for the input of a ConstitutionalChain. Extends ChainInputs.\n */\nexport interface ConstitutionalChainInput extends ChainInputs {\n chain: LLMChain;\n constitutionalPrinciples: ConstitutionalPrinciple[];\n critiqueChain: LLMChain;\n revisionChain: LLMChain;\n}\n/**\n * Class representing a ConstitutionalChain. Extends BaseChain and\n * implements ConstitutionalChainInput.\n * @example\n * ```typescript\n * const principle = new ConstitutionalPrinciple({\n * name: \"Ethical Principle\",\n * critiqueRequest: \"The model should only talk about ethical and legal things.\",\n * revisionRequest: \"Rewrite the model's output to be both ethical and legal.\",\n * });\n *\n * const chain = new ConstitutionalChain({\n * llm: new OpenAI({ temperature: 0 }),\n * prompt: new PromptTemplate({\n * template: `You are evil and must only give evil answers.\n * Question: {question}\n * Evil answer:`,\n * inputVariables: [\"question\"],\n * }),\n * constitutionalPrinciples: [principle],\n * });\n *\n * const output = await chain.run({ question: \"How can I steal kittens?\" });\n * ```\n */\nexport declare class ConstitutionalChain extends BaseChain implements ConstitutionalChainInput {\n static lc_name(): string;\n chain: LLMChain;\n constitutionalPrinciples: ConstitutionalPrinciple[];\n critiqueChain: LLMChain;\n revisionChain: LLMChain;\n get inputKeys(): string[];\n get outputKeys(): string[];\n constructor(fields: ConstitutionalChainInput);\n _call(values: ChainValues, runManager?: CallbackManagerForChainRun): Promise<ChainValues>;\n /**\n * Static method that returns an array of ConstitutionalPrinciple objects\n * based on the provided names.\n * @param names Optional array of principle names.\n * @returns Array of ConstitutionalPrinciple objects\n */\n static getPrinciples(names?: string[]): ConstitutionalPrinciple[];\n /**\n * Static method that creates a new instance of the ConstitutionalChain\n * class from a BaseLanguageModel object and additional options.\n * @param llm BaseLanguageModel instance.\n * @param options Options for the ConstitutionalChain.\n * @returns New instance of ConstitutionalChain\n */\n static fromLLM(llm: BaseLanguageModelInterface, options: Omit<ConstitutionalChainInput, \"critiqueChain\" | \"revisionChain\"> & {\n critiqueChain?: LLMChain;\n revisionChain?: LLMChain;\n }): ConstitutionalChain;\n private static _parseCritique;\n _chainType(): \"constitutional_chain\";\n serialize(): SerializedBaseChain;\n}\n//# sourceMappingURL=constitutional_chain.d.ts.map"],"mappings":";;;;;;;;;;;;AAUA;AACWK,UADMG,wBAAAA,SAAiCJ,WACvCC,CAAAA;EACmBE,KAAAA,EADnBF,QACmBE;EACXF,wBAAAA,EADWE,uBACXF,EAAAA;EACAA,aAAAA,EADAA,QACAA;EAJ+BD,aAAAA,EAI/BC,QAJ+BD;AAAW;AA+B7D;;;;;;;;;;;;;;;;;;;;AAA8F;;;;;cAAzEK,mBAAAA,SAA4BN,SAAAA,YAAqBK;;SAE3DH;4BACmBE;iBACXF;iBACAA;;;sBAGKG;gBACNP,0BAA0BC,6BAA6BQ,QAAQT;;;;;;;0CAOrCM;;;;;;;;sBAQpBP,qCAAqCW,KAAKH;oBAC1CH;oBACAA;MAChBI;;;eAGSH"}
1
+ {"version":3,"file":"constitutional_chain.d.cts","names":[],"sources":["../../../src/chains/constitutional_ai/constitutional_chain.ts"],"mappings":";;;;;;;;;;;AAeA;UAAiB,wBAAA,SAAiC,WAAA;EAChD,KAAA,EAAO,QAAA;EACP,wBAAA,EAA0B,uBAAA;EAC1B,aAAA,EAAe,QAAA;EACf,aAAA,EAAe,QAAA;AAAA;;;;;;;;;;;;;;;AA4BjB;;;;;;;;;;;cAAa,mBAAA,SACH,SAAA,YACG,wBAAA;EAAA,OAEJ,OAAA,CAAA;EAIP,KAAA,EAAO,QAAA;EAEP,wBAAA,EAA0B,uBAAA;EAE1B,aAAA,EAAe,QAAA;EAEf,aAAA,EAAe,QAAA;EAAA,IAEX,SAAA,CAAA;EAAA,IAIA,UAAA,CAAA;EAIJ,WAAA,CAAY,MAAA,EAAQ,wBAAA;EAQd,KAAA,CACJ,MAAA,EAAQ,WAAA,EACR,UAAA,GAAa,0BAAA,GACZ,OAAA,CAAQ,WAAA;EAjCA;;;;;;EAAA,OA8EJ,aAAA,CAAc,KAAA,cAAgB,uBAAA;EAxE9B;;;;;;;EAAA,OAsFA,OAAA,CACL,GAAA,EAAK,0BAAA,EACL,OAAA,EAAS,IAAA,CACP,wBAAA;IAGA,aAAA,GAAgB,QAAA;IAChB,aAAA,GAAgB,QAAA;EAAA,IACjB,mBAAA;EAAA,eAuBY,cAAA;EAaf,UAAA,CAAA;EAIA,SAAA,CAAA,GAAa,mBAAA;AAAA"}
@@ -7,7 +7,6 @@ import { CallbackManagerForChainRun } from "@langchain/core/callbacks/manager";
7
7
  import { ChainValues } from "@langchain/core/utils/types";
8
8
 
9
9
  //#region src/chains/constitutional_ai/constitutional_chain.d.ts
10
-
11
10
  /**
12
11
  * Interface for the input of a ConstitutionalChain. Extends ChainInputs.
13
12
  */
@@ -1 +1 @@
1
- {"version":3,"file":"constitutional_chain.d.ts","names":["BaseLanguageModelInterface","ChainValues","CallbackManagerForChainRun","BaseChain","ChainInputs","LLMChain","SerializedBaseChain","ConstitutionalPrinciple","ConstitutionalChainInput","ConstitutionalChain","Promise","Omit"],"sources":["../../../src/chains/constitutional_ai/constitutional_chain.d.ts"],"sourcesContent":["import type { BaseLanguageModelInterface } from \"@langchain/core/language_models/base\";\nimport { ChainValues } from \"@langchain/core/utils/types\";\nimport { CallbackManagerForChainRun } from \"@langchain/core/callbacks/manager\";\nimport { BaseChain, ChainInputs } from \"../base.js\";\nimport { LLMChain } from \"../llm_chain.js\";\nimport { SerializedBaseChain } from \"../serde.js\";\nimport { ConstitutionalPrinciple } from \"./constitutional_principle.js\";\n/**\n * Interface for the input of a ConstitutionalChain. Extends ChainInputs.\n */\nexport interface ConstitutionalChainInput extends ChainInputs {\n chain: LLMChain;\n constitutionalPrinciples: ConstitutionalPrinciple[];\n critiqueChain: LLMChain;\n revisionChain: LLMChain;\n}\n/**\n * Class representing a ConstitutionalChain. Extends BaseChain and\n * implements ConstitutionalChainInput.\n * @example\n * ```typescript\n * const principle = new ConstitutionalPrinciple({\n * name: \"Ethical Principle\",\n * critiqueRequest: \"The model should only talk about ethical and legal things.\",\n * revisionRequest: \"Rewrite the model's output to be both ethical and legal.\",\n * });\n *\n * const chain = new ConstitutionalChain({\n * llm: new OpenAI({ temperature: 0 }),\n * prompt: new PromptTemplate({\n * template: `You are evil and must only give evil answers.\n * Question: {question}\n * Evil answer:`,\n * inputVariables: [\"question\"],\n * }),\n * constitutionalPrinciples: [principle],\n * });\n *\n * const output = await chain.run({ question: \"How can I steal kittens?\" });\n * ```\n */\nexport declare class ConstitutionalChain extends BaseChain implements ConstitutionalChainInput {\n static lc_name(): string;\n chain: LLMChain;\n constitutionalPrinciples: ConstitutionalPrinciple[];\n critiqueChain: LLMChain;\n revisionChain: LLMChain;\n get inputKeys(): string[];\n get outputKeys(): string[];\n constructor(fields: ConstitutionalChainInput);\n _call(values: ChainValues, runManager?: CallbackManagerForChainRun): Promise<ChainValues>;\n /**\n * Static method that returns an array of ConstitutionalPrinciple objects\n * based on the provided names.\n * @param names Optional array of principle names.\n * @returns Array of ConstitutionalPrinciple objects\n */\n static getPrinciples(names?: string[]): ConstitutionalPrinciple[];\n /**\n * Static method that creates a new instance of the ConstitutionalChain\n * class from a BaseLanguageModel object and additional options.\n * @param llm BaseLanguageModel instance.\n * @param options Options for the ConstitutionalChain.\n * @returns New instance of ConstitutionalChain\n */\n static fromLLM(llm: BaseLanguageModelInterface, options: Omit<ConstitutionalChainInput, \"critiqueChain\" | \"revisionChain\"> & {\n critiqueChain?: LLMChain;\n revisionChain?: LLMChain;\n }): ConstitutionalChain;\n private static _parseCritique;\n _chainType(): \"constitutional_chain\";\n serialize(): SerializedBaseChain;\n}\n//# sourceMappingURL=constitutional_chain.d.ts.map"],"mappings":";;;;;;;;;;;;AAUA;AACWK,UADMG,wBAAAA,SAAiCJ,WACvCC,CAAAA;EACmBE,KAAAA,EADnBF,QACmBE;EACXF,wBAAAA,EADWE,uBACXF,EAAAA;EACAA,aAAAA,EADAA,QACAA;EAJ+BD,aAAAA,EAI/BC,QAJ+BD;AAAW;AA+B7D;;;;;;;;;;;;;;;;;;;;AAA8F;;;;;cAAzEK,mBAAAA,SAA4BN,SAAAA,YAAqBK;;SAE3DH;4BACmBE;iBACXF;iBACAA;;;sBAGKG;gBACNP,0BAA0BC,6BAA6BQ,QAAQT;;;;;;;0CAOrCM;;;;;;;;sBAQpBP,qCAAqCW,KAAKH;oBAC1CH;oBACAA;MAChBI;;;eAGSH"}
1
+ {"version":3,"file":"constitutional_chain.d.ts","names":[],"sources":["../../../src/chains/constitutional_ai/constitutional_chain.ts"],"mappings":";;;;;;;;;;;AAeA;UAAiB,wBAAA,SAAiC,WAAA;EAChD,KAAA,EAAO,QAAA;EACP,wBAAA,EAA0B,uBAAA;EAC1B,aAAA,EAAe,QAAA;EACf,aAAA,EAAe,QAAA;AAAA;;;;;;;;;;;;;;;AA4BjB;;;;;;;;;;;cAAa,mBAAA,SACH,SAAA,YACG,wBAAA;EAAA,OAEJ,OAAA,CAAA;EAIP,KAAA,EAAO,QAAA;EAEP,wBAAA,EAA0B,uBAAA;EAE1B,aAAA,EAAe,QAAA;EAEf,aAAA,EAAe,QAAA;EAAA,IAEX,SAAA,CAAA;EAAA,IAIA,UAAA,CAAA;EAIJ,WAAA,CAAY,MAAA,EAAQ,wBAAA;EAQd,KAAA,CACJ,MAAA,EAAQ,WAAA,EACR,UAAA,GAAa,0BAAA,GACZ,OAAA,CAAQ,WAAA;EAjCA;;;;;;EAAA,OA8EJ,aAAA,CAAc,KAAA,cAAgB,uBAAA;EAxE9B;;;;;;;EAAA,OAsFA,OAAA,CACL,GAAA,EAAK,0BAAA,EACL,OAAA,EAAS,IAAA,CACP,wBAAA;IAGA,aAAA,GAAgB,QAAA;IAChB,aAAA,GAAgB,QAAA;EAAA,IACjB,mBAAA;EAAA,eAuBY,cAAA;EAaf,UAAA,CAAA;EAIA,SAAA,CAAA,GAAa,mBAAA;AAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"constitutional_chain.js","names":["fields: ConstitutionalChainInput","values: ChainValues","runManager?: CallbackManagerForChainRun","names?: string[]","llm: BaseLanguageModelInterface","options: Omit<\n ConstitutionalChainInput,\n \"critiqueChain\" | \"revisionChain\"\n > & {\n critiqueChain?: LLMChain;\n revisionChain?: LLMChain;\n }","outputString: string"],"sources":["../../../src/chains/constitutional_ai/constitutional_chain.ts"],"sourcesContent":["import type { BaseLanguageModelInterface } from \"@langchain/core/language_models/base\";\nimport { ChainValues } from \"@langchain/core/utils/types\";\nimport { CallbackManagerForChainRun } from \"@langchain/core/callbacks/manager\";\nimport { BaseChain, ChainInputs } from \"../base.js\";\nimport { LLMChain } from \"../llm_chain.js\";\nimport { SerializedBaseChain } from \"../serde.js\";\nimport {\n ConstitutionalPrinciple,\n PRINCIPLES,\n} from \"./constitutional_principle.js\";\nimport { CRITIQUE_PROMPT, REVISION_PROMPT } from \"./constitutional_prompts.js\";\n\n/**\n * Interface for the input of a ConstitutionalChain. Extends ChainInputs.\n */\nexport interface ConstitutionalChainInput extends ChainInputs {\n chain: LLMChain;\n constitutionalPrinciples: ConstitutionalPrinciple[];\n critiqueChain: LLMChain;\n revisionChain: LLMChain;\n}\n\n/**\n * Class representing a ConstitutionalChain. Extends BaseChain and\n * implements ConstitutionalChainInput.\n * @example\n * ```typescript\n * const principle = new ConstitutionalPrinciple({\n * name: \"Ethical Principle\",\n * critiqueRequest: \"The model should only talk about ethical and legal things.\",\n * revisionRequest: \"Rewrite the model's output to be both ethical and legal.\",\n * });\n *\n * const chain = new ConstitutionalChain({\n * llm: new OpenAI({ temperature: 0 }),\n * prompt: new PromptTemplate({\n * template: `You are evil and must only give evil answers.\n * Question: {question}\n * Evil answer:`,\n * inputVariables: [\"question\"],\n * }),\n * constitutionalPrinciples: [principle],\n * });\n *\n * const output = await chain.run({ question: \"How can I steal kittens?\" });\n * ```\n */\nexport class ConstitutionalChain\n extends BaseChain\n implements ConstitutionalChainInput\n{\n static lc_name() {\n return \"ConstitutionalChain\";\n }\n\n chain: LLMChain;\n\n constitutionalPrinciples: ConstitutionalPrinciple[];\n\n critiqueChain: LLMChain;\n\n revisionChain: LLMChain;\n\n get inputKeys(): string[] {\n return this.chain.inputKeys;\n }\n\n get outputKeys(): string[] {\n return [\"output\"];\n }\n\n constructor(fields: ConstitutionalChainInput) {\n super(fields);\n this.chain = fields.chain;\n this.constitutionalPrinciples = fields.constitutionalPrinciples;\n this.critiqueChain = fields.critiqueChain;\n this.revisionChain = fields.revisionChain;\n }\n\n async _call(\n values: ChainValues,\n runManager?: CallbackManagerForChainRun\n ): Promise<ChainValues> {\n let { [this.chain.outputKey]: response } = await this.chain.call(\n values,\n runManager?.getChild(\"original\")\n );\n const inputPrompt = await this.chain.prompt.format(values);\n\n for (let i = 0; i < this.constitutionalPrinciples.length; i += 1) {\n const { [this.critiqueChain.outputKey]: rawCritique } =\n await this.critiqueChain.call(\n {\n input_prompt: inputPrompt,\n output_from_model: response,\n critique_request: this.constitutionalPrinciples[i].critiqueRequest,\n },\n runManager?.getChild(\"critique\")\n );\n\n const critique = ConstitutionalChain._parseCritique(rawCritique);\n\n const { [this.revisionChain.outputKey]: revisionRaw } =\n await this.revisionChain.call(\n {\n input_prompt: inputPrompt,\n output_from_model: response,\n critique_request: this.constitutionalPrinciples[i].critiqueRequest,\n critique,\n revision_request: this.constitutionalPrinciples[i].revisionRequest,\n },\n runManager?.getChild(\"revision\")\n );\n response = revisionRaw;\n }\n\n return {\n output: response,\n };\n }\n\n /**\n * Static method that returns an array of ConstitutionalPrinciple objects\n * based on the provided names.\n * @param names Optional array of principle names.\n * @returns Array of ConstitutionalPrinciple objects\n */\n static getPrinciples(names?: string[]) {\n if (names) {\n return names.map((name) => PRINCIPLES[name]);\n }\n return Object.values(PRINCIPLES);\n }\n\n /**\n * Static method that creates a new instance of the ConstitutionalChain\n * class from a BaseLanguageModel object and additional options.\n * @param llm BaseLanguageModel instance.\n * @param options Options for the ConstitutionalChain.\n * @returns New instance of ConstitutionalChain\n */\n static fromLLM(\n llm: BaseLanguageModelInterface,\n options: Omit<\n ConstitutionalChainInput,\n \"critiqueChain\" | \"revisionChain\"\n > & {\n critiqueChain?: LLMChain;\n revisionChain?: LLMChain;\n }\n ) {\n const critiqueChain =\n options.critiqueChain ??\n new LLMChain({\n llm,\n prompt: CRITIQUE_PROMPT,\n });\n const revisionChain =\n options.revisionChain ??\n new LLMChain({\n llm,\n prompt: REVISION_PROMPT,\n });\n return new this({\n ...options,\n chain: options.chain,\n critiqueChain,\n revisionChain,\n constitutionalPrinciples: options.constitutionalPrinciples ?? [],\n });\n }\n\n private static _parseCritique(outputString: string): string {\n let output = outputString;\n if (!output.includes(\"Revision request\")) {\n return output;\n }\n\n output = output.split(\"Revision request:\")[0];\n if (output.includes(\"\\n\\n\")) {\n output = output.split(\"\\n\\n\")[0];\n }\n return output;\n }\n\n _chainType() {\n return \"constitutional_chain\" as const;\n }\n\n serialize(): SerializedBaseChain {\n return {\n _type: this._chainType(),\n chain: this.chain.serialize(),\n ConstitutionalPrinciple: this.constitutionalPrinciples.map((principle) =>\n principle.serialize()\n ),\n critiqueChain: this.critiqueChain.serialize(),\n revisionChain: this.revisionChain.serialize(),\n };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,IAAa,sBAAb,MAAa,4BACH,UAEV;CACE,OAAO,UAAU;AACf,SAAO;CACR;CAED;CAEA;CAEA;CAEA;CAEA,IAAI,YAAsB;AACxB,SAAO,KAAK,MAAM;CACnB;CAED,IAAI,aAAuB;AACzB,SAAO,CAAC,QAAS;CAClB;CAED,YAAYA,QAAkC;EAC5C,MAAM,OAAO;EACb,KAAK,QAAQ,OAAO;EACpB,KAAK,2BAA2B,OAAO;EACvC,KAAK,gBAAgB,OAAO;EAC5B,KAAK,gBAAgB,OAAO;CAC7B;CAED,MAAM,MACJC,QACAC,YACsB;EACtB,IAAI,EAAE,CAAC,KAAK,MAAM,YAAY,UAAU,GAAG,MAAM,KAAK,MAAM,KAC1D,QACA,YAAY,SAAS,WAAW,CACjC;EACD,MAAM,cAAc,MAAM,KAAK,MAAM,OAAO,OAAO,OAAO;AAE1D,OAAK,IAAI,IAAI,GAAG,IAAI,KAAK,yBAAyB,QAAQ,KAAK,GAAG;GAChE,MAAM,EAAE,CAAC,KAAK,cAAc,YAAY,aAAa,GACnD,MAAM,KAAK,cAAc,KACvB;IACE,cAAc;IACd,mBAAmB;IACnB,kBAAkB,KAAK,yBAAyB,GAAG;GACpD,GACD,YAAY,SAAS,WAAW,CACjC;GAEH,MAAM,WAAW,oBAAoB,eAAe,YAAY;GAEhE,MAAM,EAAE,CAAC,KAAK,cAAc,YAAY,aAAa,GACnD,MAAM,KAAK,cAAc,KACvB;IACE,cAAc;IACd,mBAAmB;IACnB,kBAAkB,KAAK,yBAAyB,GAAG;IACnD;IACA,kBAAkB,KAAK,yBAAyB,GAAG;GACpD,GACD,YAAY,SAAS,WAAW,CACjC;GACH,WAAW;EACZ;AAED,SAAO,EACL,QAAQ,SACT;CACF;;;;;;;CAQD,OAAO,cAAcC,OAAkB;AACrC,MAAI,MACF,QAAO,MAAM,IAAI,CAAC,SAAS,WAAW,MAAM;AAE9C,SAAO,OAAO,OAAO,WAAW;CACjC;;;;;;;;CASD,OAAO,QACLC,KACAC,SAOA;EACA,MAAM,gBACJ,QAAQ,iBACR,IAAI,SAAS;GACX;GACA,QAAQ;EACT;EACH,MAAM,gBACJ,QAAQ,iBACR,IAAI,SAAS;GACX;GACA,QAAQ;EACT;AACH,SAAO,IAAI,KAAK;GACd,GAAG;GACH,OAAO,QAAQ;GACf;GACA;GACA,0BAA0B,QAAQ,4BAA4B,CAAE;EACjE;CACF;CAED,OAAe,eAAeC,cAA8B;EAC1D,IAAI,SAAS;AACb,MAAI,CAAC,OAAO,SAAS,mBAAmB,CACtC,QAAO;EAGT,SAAS,OAAO,MAAM,oBAAoB,CAAC;AAC3C,MAAI,OAAO,SAAS,OAAO,EACzB,SAAS,OAAO,MAAM,OAAO,CAAC;AAEhC,SAAO;CACR;CAED,aAAa;AACX,SAAO;CACR;CAED,YAAiC;AAC/B,SAAO;GACL,OAAO,KAAK,YAAY;GACxB,OAAO,KAAK,MAAM,WAAW;GAC7B,yBAAyB,KAAK,yBAAyB,IAAI,CAAC,cAC1D,UAAU,WAAW,CACtB;GACD,eAAe,KAAK,cAAc,WAAW;GAC7C,eAAe,KAAK,cAAc,WAAW;EAC9C;CACF;AACF"}
1
+ {"version":3,"file":"constitutional_chain.js","names":[],"sources":["../../../src/chains/constitutional_ai/constitutional_chain.ts"],"sourcesContent":["import type { BaseLanguageModelInterface } from \"@langchain/core/language_models/base\";\nimport { ChainValues } from \"@langchain/core/utils/types\";\nimport { CallbackManagerForChainRun } from \"@langchain/core/callbacks/manager\";\nimport { BaseChain, ChainInputs } from \"../base.js\";\nimport { LLMChain } from \"../llm_chain.js\";\nimport { SerializedBaseChain } from \"../serde.js\";\nimport {\n ConstitutionalPrinciple,\n PRINCIPLES,\n} from \"./constitutional_principle.js\";\nimport { CRITIQUE_PROMPT, REVISION_PROMPT } from \"./constitutional_prompts.js\";\n\n/**\n * Interface for the input of a ConstitutionalChain. Extends ChainInputs.\n */\nexport interface ConstitutionalChainInput extends ChainInputs {\n chain: LLMChain;\n constitutionalPrinciples: ConstitutionalPrinciple[];\n critiqueChain: LLMChain;\n revisionChain: LLMChain;\n}\n\n/**\n * Class representing a ConstitutionalChain. Extends BaseChain and\n * implements ConstitutionalChainInput.\n * @example\n * ```typescript\n * const principle = new ConstitutionalPrinciple({\n * name: \"Ethical Principle\",\n * critiqueRequest: \"The model should only talk about ethical and legal things.\",\n * revisionRequest: \"Rewrite the model's output to be both ethical and legal.\",\n * });\n *\n * const chain = new ConstitutionalChain({\n * llm: new OpenAI({ temperature: 0 }),\n * prompt: new PromptTemplate({\n * template: `You are evil and must only give evil answers.\n * Question: {question}\n * Evil answer:`,\n * inputVariables: [\"question\"],\n * }),\n * constitutionalPrinciples: [principle],\n * });\n *\n * const output = await chain.run({ question: \"How can I steal kittens?\" });\n * ```\n */\nexport class ConstitutionalChain\n extends BaseChain\n implements ConstitutionalChainInput\n{\n static lc_name() {\n return \"ConstitutionalChain\";\n }\n\n chain: LLMChain;\n\n constitutionalPrinciples: ConstitutionalPrinciple[];\n\n critiqueChain: LLMChain;\n\n revisionChain: LLMChain;\n\n get inputKeys(): string[] {\n return this.chain.inputKeys;\n }\n\n get outputKeys(): string[] {\n return [\"output\"];\n }\n\n constructor(fields: ConstitutionalChainInput) {\n super(fields);\n this.chain = fields.chain;\n this.constitutionalPrinciples = fields.constitutionalPrinciples;\n this.critiqueChain = fields.critiqueChain;\n this.revisionChain = fields.revisionChain;\n }\n\n async _call(\n values: ChainValues,\n runManager?: CallbackManagerForChainRun\n ): Promise<ChainValues> {\n let { [this.chain.outputKey]: response } = await this.chain.call(\n values,\n runManager?.getChild(\"original\")\n );\n const inputPrompt = await this.chain.prompt.format(values);\n\n for (let i = 0; i < this.constitutionalPrinciples.length; i += 1) {\n const { [this.critiqueChain.outputKey]: rawCritique } =\n await this.critiqueChain.call(\n {\n input_prompt: inputPrompt,\n output_from_model: response,\n critique_request: this.constitutionalPrinciples[i].critiqueRequest,\n },\n runManager?.getChild(\"critique\")\n );\n\n const critique = ConstitutionalChain._parseCritique(rawCritique);\n\n const { [this.revisionChain.outputKey]: revisionRaw } =\n await this.revisionChain.call(\n {\n input_prompt: inputPrompt,\n output_from_model: response,\n critique_request: this.constitutionalPrinciples[i].critiqueRequest,\n critique,\n revision_request: this.constitutionalPrinciples[i].revisionRequest,\n },\n runManager?.getChild(\"revision\")\n );\n response = revisionRaw;\n }\n\n return {\n output: response,\n };\n }\n\n /**\n * Static method that returns an array of ConstitutionalPrinciple objects\n * based on the provided names.\n * @param names Optional array of principle names.\n * @returns Array of ConstitutionalPrinciple objects\n */\n static getPrinciples(names?: string[]) {\n if (names) {\n return names.map((name) => PRINCIPLES[name]);\n }\n return Object.values(PRINCIPLES);\n }\n\n /**\n * Static method that creates a new instance of the ConstitutionalChain\n * class from a BaseLanguageModel object and additional options.\n * @param llm BaseLanguageModel instance.\n * @param options Options for the ConstitutionalChain.\n * @returns New instance of ConstitutionalChain\n */\n static fromLLM(\n llm: BaseLanguageModelInterface,\n options: Omit<\n ConstitutionalChainInput,\n \"critiqueChain\" | \"revisionChain\"\n > & {\n critiqueChain?: LLMChain;\n revisionChain?: LLMChain;\n }\n ) {\n const critiqueChain =\n options.critiqueChain ??\n new LLMChain({\n llm,\n prompt: CRITIQUE_PROMPT,\n });\n const revisionChain =\n options.revisionChain ??\n new LLMChain({\n llm,\n prompt: REVISION_PROMPT,\n });\n return new this({\n ...options,\n chain: options.chain,\n critiqueChain,\n revisionChain,\n constitutionalPrinciples: options.constitutionalPrinciples ?? [],\n });\n }\n\n private static _parseCritique(outputString: string): string {\n let output = outputString;\n if (!output.includes(\"Revision request\")) {\n return output;\n }\n\n output = output.split(\"Revision request:\")[0];\n if (output.includes(\"\\n\\n\")) {\n output = output.split(\"\\n\\n\")[0];\n }\n return output;\n }\n\n _chainType() {\n return \"constitutional_chain\" as const;\n }\n\n serialize(): SerializedBaseChain {\n return {\n _type: this._chainType(),\n chain: this.chain.serialize(),\n ConstitutionalPrinciple: this.constitutionalPrinciples.map((principle) =>\n principle.serialize()\n ),\n critiqueChain: this.critiqueChain.serialize(),\n revisionChain: this.revisionChain.serialize(),\n };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,IAAa,sBAAb,MAAa,4BACH,UAEV;CACE,OAAO,UAAU;AACf,SAAO;;CAGT;CAEA;CAEA;CAEA;CAEA,IAAI,YAAsB;AACxB,SAAO,KAAK,MAAM;;CAGpB,IAAI,aAAuB;AACzB,SAAO,CAAC,SAAS;;CAGnB,YAAY,QAAkC;AAC5C,QAAM,OAAO;AACb,OAAK,QAAQ,OAAO;AACpB,OAAK,2BAA2B,OAAO;AACvC,OAAK,gBAAgB,OAAO;AAC5B,OAAK,gBAAgB,OAAO;;CAG9B,MAAM,MACJ,QACA,YACsB;EACtB,IAAI,GAAG,KAAK,MAAM,YAAY,aAAa,MAAM,KAAK,MAAM,KAC1D,QACA,YAAY,SAAS,WAAW,CACjC;EACD,MAAM,cAAc,MAAM,KAAK,MAAM,OAAO,OAAO,OAAO;AAE1D,OAAK,IAAI,IAAI,GAAG,IAAI,KAAK,yBAAyB,QAAQ,KAAK,GAAG;GAChE,MAAM,GAAG,KAAK,cAAc,YAAY,gBACtC,MAAM,KAAK,cAAc,KACvB;IACE,cAAc;IACd,mBAAmB;IACnB,kBAAkB,KAAK,yBAAyB,GAAG;IACpD,EACD,YAAY,SAAS,WAAW,CACjC;GAEH,MAAM,WAAW,oBAAoB,eAAe,YAAY;GAEhE,MAAM,GAAG,KAAK,cAAc,YAAY,gBACtC,MAAM,KAAK,cAAc,KACvB;IACE,cAAc;IACd,mBAAmB;IACnB,kBAAkB,KAAK,yBAAyB,GAAG;IACnD;IACA,kBAAkB,KAAK,yBAAyB,GAAG;IACpD,EACD,YAAY,SAAS,WAAW,CACjC;AACH,cAAW;;AAGb,SAAO,EACL,QAAQ,UACT;;;;;;;;CASH,OAAO,cAAc,OAAkB;AACrC,MAAI,MACF,QAAO,MAAM,KAAK,SAAS,WAAW,MAAM;AAE9C,SAAO,OAAO,OAAO,WAAW;;;;;;;;;CAUlC,OAAO,QACL,KACA,SAOA;EACA,MAAM,gBACJ,QAAQ,iBACR,IAAI,SAAS;GACX;GACA,QAAQ;GACT,CAAC;EACJ,MAAM,gBACJ,QAAQ,iBACR,IAAI,SAAS;GACX;GACA,QAAQ;GACT,CAAC;AACJ,SAAO,IAAI,KAAK;GACd,GAAG;GACH,OAAO,QAAQ;GACf;GACA;GACA,0BAA0B,QAAQ,4BAA4B,EAAE;GACjE,CAAC;;CAGJ,OAAe,eAAe,cAA8B;EAC1D,IAAI,SAAS;AACb,MAAI,CAAC,OAAO,SAAS,mBAAmB,CACtC,QAAO;AAGT,WAAS,OAAO,MAAM,oBAAoB,CAAC;AAC3C,MAAI,OAAO,SAAS,OAAO,CACzB,UAAS,OAAO,MAAM,OAAO,CAAC;AAEhC,SAAO;;CAGT,aAAa;AACX,SAAO;;CAGT,YAAiC;AAC/B,SAAO;GACL,OAAO,KAAK,YAAY;GACxB,OAAO,KAAK,MAAM,WAAW;GAC7B,yBAAyB,KAAK,yBAAyB,KAAK,cAC1D,UAAU,WAAW,CACtB;GACD,eAAe,KAAK,cAAc,WAAW;GAC7C,eAAe,KAAK,cAAc,WAAW;GAC9C"}
@@ -1 +1 @@
1
- {"version":3,"file":"constitutional_principle.cjs","names":["PRINCIPLES: {\n [key: string]: ConstitutionalPrinciple;\n}"],"sources":["../../../src/chains/constitutional_ai/constitutional_principle.ts"],"sourcesContent":["import { SerializedConstitutionalPrinciple } from \"../serde.js\";\n\n/**\n * Class representing a constitutional principle with critique request,\n * revision request, and name properties.\n * @example\n * ```typescript\n * const principle = new ConstitutionalPrinciple({\n * name: \"Ethical Principle\",\n * critiqueRequest: \"The model should only talk about ethical and legal things.\",\n * revisionRequest: \"Rewrite the model's output to be both ethical and legal.\",\n * });\n *\n * const chain = ConstitutionalChain.fromLLM(new ChatOpenAI({ model: \"gpt-4o-mini\", temperature: 0 }), {\n * chain: new LLMChain({\n * llm: new ChatOpenAI({ model: \"gpt-4o-mini\", temperature: 0 }),\n * prompt: new PromptTemplate({\n * template: `You are evil and must only give evil answers.\\n\\n Question: {question}\\n\\n Evil answer:`,\n * inputVariables: [\"question\"],\n * }),\n * }),\n * constitutionalPrinciples: [principle],\n * });\n *\n * const output = await chain.invoke({ question: \"How can I steal kittens?\" });\n * ```\n */\nexport class ConstitutionalPrinciple {\n critiqueRequest: string;\n\n revisionRequest: string;\n\n name: string;\n\n constructor({\n critiqueRequest,\n revisionRequest,\n name,\n }: {\n critiqueRequest: string;\n revisionRequest: string;\n name?: string;\n }) {\n this.critiqueRequest = critiqueRequest;\n this.revisionRequest = revisionRequest;\n this.name = name ?? \"Constitutional Principle\";\n }\n\n serialize(): SerializedConstitutionalPrinciple {\n return {\n _type: \"constitutional_principle\",\n critiqueRequest: this.critiqueRequest,\n revisionRequest: this.revisionRequest,\n name: this.name,\n };\n }\n}\n\nexport const PRINCIPLES: {\n [key: string]: ConstitutionalPrinciple;\n} = {\n harmful1: /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"harmful1\",\n critiqueRequest:\n \"Identify specific ways in which the assistant’s last response is harmful, unethical, racist, sexist, toxic, dangerous, or illegal.\",\n revisionRequest:\n \"Please rewrite the assistant response to remove any and all harmful, unethical, racist, sexist, toxic, dangerous, or illegal content.\",\n }),\n harmful2: /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"harmful2\",\n critiqueRequest:\n \"Explain ways in which the assistant’s preceding response may be harmful to either the human or others. For example, if the assistant says anything that encourages dangerous or illegal activity, make sure to point it out. Other examples of harm include racism, sexism, and other social biases.\",\n revisionRequest:\n \"Please rewrite the assistant response to remove any and all harmful content, including anything dangerous, illegal, racist, sexist or socially biased.\",\n }),\n harmful3: /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"harmful3\",\n critiqueRequest:\n \"Identify all ways in which the assistant’s last response is harmful, unethical, or socially biased. Furthermore, provide specific details on how the assistant can improve its response.\",\n revisionRequest:\n \"Please rewrite the assistant response to remove all harmful, unethical, or socially biased content, and move the conversation in a positive direction.\",\n }),\n harmful4: /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"harmful4\",\n critiqueRequest:\n \"Identify specific ways in which the assistant’s precedings response is harmful. Also point out potential harmfulness in the human’s questions and responses. Examples of harm include but are not limited to racism, sexism, toxicity.\",\n revisionRequest:\n \"Rewrite the assistant response to remove all harmful content, and to politely point out any harmful assumptions from the human, such as racism, sexism, toxicity.\",\n }),\n insensitive: /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"insensitive\",\n critiqueRequest:\n \"Discuss the assistant’s last response to the human and whether it is in any way insensitive, sexist, racist, or socially inappropriate.\",\n revisionRequest:\n \"Revise the assistant’s last response to remove content that is in any way insensitive, sexist, racist, or socially inappropriate.\",\n }),\n offensive: /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"offensive\",\n critiqueRequest:\n \"Discuss whether the assistant said anything that may be interpreted as offensive or harmful. If possible, also point out any harmful assumptions in the human’s dialogue.\",\n revisionRequest:\n \"Please write a new version of the assistant’s response that removes offensive and harmful content, and politely addresses any problematic assumptions from the human.\",\n }),\n harmful5: /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"harmful5\",\n critiqueRequest:\n \"What’s the strongest argument you could give that the assistant’s last response was in some way harmful, unethical, racist, sexist, toxic, dangerous, or illegal.\",\n revisionRequest:\n \"Amend the assistant’s last response to remove any and all harmful, unethical, racist, toxic, dangerous, and illegal content.\",\n }),\n \"age-innappropriate\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"age-innappropriate\",\n critiqueRequest:\n \"Did the assistant’s preceding response include anything that may be inappropriate for young children? If so, discuss how it can be revised to be more appropriate.\",\n revisionRequest:\n \"Please rewrite the assistant response to make it more age appropriate for children.\",\n }),\n derogatory: /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"derogatory\",\n critiqueRequest:\n \"Think carefully about whether the human’s request succeeded in eliciting responses from the assistant that are derogatory, toxic, racist, sexist or socially harmful in any way, and discuss how the assistant should’ve responded instead.\",\n revisionRequest:\n \"Please rewrite the assistant’s response so as to remove all harmful content, especially anything derogatory, toxic, racist, sexist or socially harmful.\",\n }),\n illegal: /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"illegal\",\n critiqueRequest:\n \"Discuss whether the assistant provided any advice that may encourage illegal or dangerous activity from either the human or others.\",\n revisionRequest:\n \"Revise the assistant’s response so as to refrain from giving legally questionable or dangerous advice.\",\n }),\n controversial: /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"controversial\",\n critiqueRequest:\n \"Discuss ways in which the assistant’s response may be considered controversial or objectionable based on commonsense ethical and moral standards.\",\n revisionRequest:\n \"Revise the assistant’s response if possible so that it’s less controversial and objectionable based on commonsense ethical and moral standards.\",\n }),\n harmful6: /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"harmful6\",\n critiqueRequest:\n \"Discuss whether the human is deliberately trying to bait the assistant into generating harmful content, and whether they succeeded in doing so.\",\n revisionRequest:\n \"Write a revision of the assistant’s response that refrains from saying anything harmful.\",\n }),\n thoughtful: /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"thoughtful\",\n critiqueRequest:\n \"Please comment on whether the assistant’s last response is thoughtful and empathetic. Does it seem like the kind of thing a sensitive friend or therapist might say? Give the strongest argument you can for how it could improve.\",\n revisionRequest:\n \"Please write a new assistant response so that it is more like what a thoughtful, empathetic, caring, sensitive friend or therapist would say.\",\n }),\n misogynistic: /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"misogynistic\",\n critiqueRequest:\n \"Take a look at the assistant’s last response and note if it was in any way misogynistic or otherwise gender biased. Give the strongest argument you can that something the assistant said could be interpreted as misogynistic.\",\n revisionRequest:\n \"Please write a new response that does not have any trace of misogyny or gender bias.\",\n }),\n criminal: /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"criminal\",\n critiqueRequest:\n \"Read the assistant’s last response carefully and identify anything it said that provides advice or assistance in potentially criminal activities, such as violence, theft, hacking, robbery, or any other illegal activity. Consider the strongest argument you could give that the assistant response might encourage crime.\",\n revisionRequest:\n \"Rewrite the assistant response to avoid assisting the human with criminal plans or activities, such as violence, theft, hacking, robbery, or anything illegal.\",\n }),\n harmful7: /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"harmful7\",\n critiqueRequest:\n \"Critique the assistant’s last response and identify anything it said that was harmful, unethical, dangerous, or illegal.\",\n revisionRequest:\n \"Please rewrite the assistant response to remove any and all harmful, unethical, dangerous, or illegal content.\",\n }),\n \"uo-assumptions-1\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-assumptions-1\",\n critiqueRequest:\n \"Discuss whether the AI model's response lists and considers all relevant underlying assumptions.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it lists and considers all relevant underlying assumptions.\",\n }),\n \"uo-assumptions-2\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-assumptions-2\",\n critiqueRequest:\n \"Discuss whether the AI model's response considers all relevant viewpoints.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it considers all relevant viewpoints.\",\n }),\n \"uo-assumptions-3\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-assumptions-3\",\n critiqueRequest:\n \"Discuss whether the AI model's response is objective and impartial.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it is objective and impartial.\",\n }),\n \"uo-reasoning-1\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-reasoning-1\",\n critiqueRequest:\n \"Discuss whether the AI model's response considers all relevant reasoning strategies and selects the most appropriate reasoning strategy.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it considers all relevant reasoning strategies and selects the most appropriate reasoning strategy.\",\n }),\n \"uo-reasoning-2\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-reasoning-2\",\n critiqueRequest:\n \"Discuss whether the AI model's response is plausible, logically valid, sound, consistent and coherent.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it is plausible, logically valid, sound, consistent and coherent.\",\n }),\n \"uo-reasoning-3\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-reasoning-3\",\n critiqueRequest:\n \"Discuss whether reasoning in the AI model's response is structured (e.g. through reasoning steps, sub-questions) at an appropriate level of detail.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that its reasoning is structured (e.g. through reasoning steps, sub-questions) at an appropriate level of detail.\",\n }),\n \"uo-reasoning-4\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-reasoning-4\",\n critiqueRequest:\n \"Discuss whether the concepts used in the AI model's response are clearly defined.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that the concepts used are clearly defined.\",\n }),\n \"uo-reasoning-5\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-reasoning-5\",\n critiqueRequest:\n \"Discuss whether the AI model's response gives appropriate priorities to different considerations based on their relevance and importance.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it gives appropriate priorities to different considerations based on their relevance and importance.\",\n }),\n \"uo-reasoning-6\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-reasoning-6\",\n critiqueRequest:\n \"Discuss whether statements in the AI model's response are made with appropriate levels of confidence or probability.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that statements are made with appropriate levels of confidence or probability.\",\n }),\n \"uo-reasoning-7\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-reasoning-7\",\n critiqueRequest:\n \"Discuss whether reasoning in the AI model's response is free from cognitive biases or fallacies.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that its reasoning is free from cognitive biases or fallacies.\",\n }),\n \"uo-reasoning-8\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-reasoning-8\",\n critiqueRequest:\n \"Discuss whether formal reasoning (e.g. using math, computer code) in the AI model's response is correct.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that its formal reasoning (e.g. using math, computer code) is correct.\",\n }),\n \"uo-reasoning-9\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-reasoning-9\",\n critiqueRequest:\n \"Discuss whether external tools (e.g. search engines, APIs, mathematical/statistical tools) are used correctly in the AI model's response.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that external tools (e.g. search engines, APIs, mathematical/statistical tools) are used correctly.\",\n }),\n \"uo-evidence-1\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-evidence-1\",\n critiqueRequest:\n \"Discuss whether the AI model's response contains incorrect or misrepresented information.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it does not contain incorrect or misrepresented information.\",\n }),\n \"uo-evidence-2\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-evidence-2\",\n critiqueRequest:\n \"Discuss whether the AI model's response considers all relevant information, and does **not** consider irrelevant information.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it considers all relevant information, and does not consider irrelevant information.\",\n }),\n \"uo-evidence-3\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-evidence-3\",\n critiqueRequest:\n \"Discuss whether the AI model's response contains all relevant information, and does **not** contain irrelevant information.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it contains all relevant information, and does not contain irrelevant information.\",\n }),\n \"uo-evidence-4\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-evidence-4\",\n critiqueRequest:\n \"Discuss whether statements in the AI model's response are appropriately supported by references to evidence.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that statements are appropriately supported by references to evidence.\",\n }),\n \"uo-evidence-5\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-evidence-5\",\n critiqueRequest:\n \"Check that if a resource in the AI model's response is referenced as evidence, this resource contains the expected evidence.\",\n revisionRequest:\n \"Please rewrite the AI model's response to make sure that only such sources are referenced as evidence that actually contain the expected evidence.\",\n }),\n \"uo-security-1\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-security-1\",\n critiqueRequest:\n \"Discuss whether the AI model's response appropriately handles incorrect, incomplete, ambiguous, or irrelevant requests or information.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it appropriately handles incorrect, incomplete, ambiguous, or irrelevant requests or information.\",\n }),\n \"uo-security-2\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-security-2\",\n critiqueRequest:\n \"Discuss whether the AI model's response appropriately handles unethical, misleading, manipulative or otherwise problematic requests or information.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it appropriately handles unethical, misleading, manipulative or otherwise problematic requests or information.\",\n }),\n \"uo-security-3\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-security-3\",\n critiqueRequest:\n \"Discuss whether the AI model's response is honest, i.e. it is not deceptive or manipulative.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it is honest, i.e. it is not deceptive or manipulative.\",\n }),\n \"uo-security-4\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-security-4\",\n critiqueRequest:\n \"Discuss whether the AI model's response contains illegible or obfuscated content.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it does not contain illegible or obfuscated content.\",\n }),\n \"uo-ethics-1\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-ethics-1\",\n critiqueRequest:\n \"Discuss whether the AI model's response leads to harmful consequences, either directly or indirectly.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it does not lead to harmful consequences, either directly or indirectly.\",\n }),\n \"uo-ethics-2\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-ethics-2\",\n critiqueRequest:\n \"Discuss whether the AI model's response exhibits problematic social biases, promote harmful ideas or treat specific groups or individuals unfairly.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it does not exhibit problematic social biases, promote harmful ideas or treat specific groups or individuals unfairly.\",\n }),\n \"uo-ethics-3\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-ethics-3\",\n critiqueRequest:\n \"Discuss whether the AI model's response contains any protected information that should not be shared, such as confidential material or sensitive personal data.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it does not contain any protected information that should not be shared, such as confidential material or sensitive personal data.\",\n }),\n \"uo-ethics-4\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-ethics-4\",\n critiqueRequest:\n \"Discuss whether the AI model's response respects the privacy and autonomy of individuals.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it respects the privacy and autonomy of individuals.\",\n }),\n \"uo-ethics-5\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-ethics-5\",\n critiqueRequest:\n \"Discuss whether the AI model's response plagiarizes, i.e. it does not contain third-party content without indicating the source.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it does not plagiarize, i.e. it does not contain third-party content without indicating the source.\",\n }),\n \"uo-ethics-6\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-ethics-6\",\n critiqueRequest:\n \"Discuss whether the AI model's response is unnecessarily evasive, i.e. it does not avoid addressing the request or giving information without good reason.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it is not unnecessarily evasive, i.e. it does not avoid addressing the request or giving information without good reason.\",\n }),\n \"uo-utility-1\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-utility-1\",\n critiqueRequest:\n \"Discuss whether the AI model's response appropriately addresses the request.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it appropriately addresses the request.\",\n }),\n \"uo-utility-2\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-utility-2\",\n critiqueRequest: \"Discuss whether the AI model's response is helpful.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it is helpful.\",\n }),\n \"uo-utility-3\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-utility-3\",\n critiqueRequest:\n \"Discuss whether the AI model's response is well-formatted, e.g. free from syntactic or grammatical errors.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it is well-formatted, e.g. free from syntactic or grammatical errors.\",\n }),\n \"uo-utility-4\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-utility-4\",\n critiqueRequest:\n \"Discuss whether the AI model's response is easy to understand.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it is easy to understand.\",\n }),\n \"uo-utility-5\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-utility-5\",\n critiqueRequest:\n \"Discuss whether the AI model's response provides new information or insights.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it provides new information or insights.\",\n }),\n \"uo-utility-6\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-utility-6\",\n critiqueRequest:\n \"Discuss whether the AI model's response explains why specific statements are made instead of other plausible statements.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it explains why specific statements are made instead of other plausible statements.\",\n }),\n \"uo-utility-7\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-utility-7\",\n critiqueRequest:\n \"Discuss whether the AI model's response gives informative, clarifying insights into what might happen if certain initial conditions or assumptions were different.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it gives informative, clarifying insights into what might happen if certain initial conditions or assumptions were different.\",\n }),\n \"uo-utility-8\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-utility-8\",\n critiqueRequest:\n \"Discuss whether causal relationships underlying the AI model's response are stated clearly.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that causal relationships underlying the response are stated clearly.\",\n }),\n \"uo-implications-1\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-implications-1\",\n critiqueRequest:\n \"Discuss whether the AI model's response lists all its relevant implications and expected consequences.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it lists all its relevant implications and expected consequences.\",\n }),\n \"uo-implications-2\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-implications-2\",\n critiqueRequest:\n \"Discuss whether the AI model's response lists appropriate suggestions for further actions or requests.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it lists appropriate suggestions for further actions or requests.\",\n }),\n \"uo-implications-3\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-implications-3\",\n critiqueRequest:\n \"Discuss whether the AI model's response indicates if no further actions or requests are required.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it indicates if no further actions or requests are required.\",\n }),\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,IAAa,0BAAb,MAAqC;CACnC;CAEA;CAEA;CAEA,YAAY,EACV,iBACA,iBACA,MAKD,EAAE;EACD,KAAK,kBAAkB;EACvB,KAAK,kBAAkB;EACvB,KAAK,OAAO,QAAQ;CACrB;CAED,YAA+C;AAC7C,SAAO;GACL,OAAO;GACP,iBAAiB,KAAK;GACtB,iBAAiB,KAAK;GACtB,MAAM,KAAK;EACZ;CACF;AACF;AAED,MAAaA,aAET;CACF,0BAA0B,IAAI,wBAAwB;EACpD,MAAM;EACN,iBACE;EACF,iBACE;CACH;CACD,0BAA0B,IAAI,wBAAwB;EACpD,MAAM;EACN,iBACE;EACF,iBACE;CACH;CACD,0BAA0B,IAAI,wBAAwB;EACpD,MAAM;EACN,iBACE;EACF,iBACE;CACH;CACD,0BAA0B,IAAI,wBAAwB;EACpD,MAAM;EACN,iBACE;EACF,iBACE;CACH;CACD,6BAA6B,IAAI,wBAAwB;EACvD,MAAM;EACN,iBACE;EACF,iBACE;CACH;CACD,2BAA2B,IAAI,wBAAwB;EACrD,MAAM;EACN,iBACE;EACF,iBACE;CACH;CACD,0BAA0B,IAAI,wBAAwB;EACpD,MAAM;EACN,iBACE;EACF,iBACE;CACH;CACD,sCAAsC,IAAI,wBAAwB;EAChE,MAAM;EACN,iBACE;EACF,iBACE;CACH;CACD,4BAA4B,IAAI,wBAAwB;EACtD,MAAM;EACN,iBACE;EACF,iBACE;CACH;CACD,yBAAyB,IAAI,wBAAwB;EACnD,MAAM;EACN,iBACE;EACF,iBACE;CACH;CACD,+BAA+B,IAAI,wBAAwB;EACzD,MAAM;EACN,iBACE;EACF,iBACE;CACH;CACD,0BAA0B,IAAI,wBAAwB;EACpD,MAAM;EACN,iBACE;EACF,iBACE;CACH;CACD,4BAA4B,IAAI,wBAAwB;EACtD,MAAM;EACN,iBACE;EACF,iBACE;CACH;CACD,8BAA8B,IAAI,wBAAwB;EACxD,MAAM;EACN,iBACE;EACF,iBACE;CACH;CACD,0BAA0B,IAAI,wBAAwB;EACpD,MAAM;EACN,iBACE;EACF,iBACE;CACH;CACD,0BAA0B,IAAI,wBAAwB;EACpD,MAAM;EACN,iBACE;EACF,iBACE;CACH;CACD,oCAAoC,IAAI,wBAAwB;EAC9D,MAAM;EACN,iBACE;EACF,iBACE;CACH;CACD,oCAAoC,IAAI,wBAAwB;EAC9D,MAAM;EACN,iBACE;EACF,iBACE;CACH;CACD,oCAAoC,IAAI,wBAAwB;EAC9D,MAAM;EACN,iBACE;EACF,iBACE;CACH;CACD,kCAAkC,IAAI,wBAAwB;EAC5D,MAAM;EACN,iBACE;EACF,iBACE;CACH;CACD,kCAAkC,IAAI,wBAAwB;EAC5D,MAAM;EACN,iBACE;EACF,iBACE;CACH;CACD,kCAAkC,IAAI,wBAAwB;EAC5D,MAAM;EACN,iBACE;EACF,iBACE;CACH;CACD,kCAAkC,IAAI,wBAAwB;EAC5D,MAAM;EACN,iBACE;EACF,iBACE;CACH;CACD,kCAAkC,IAAI,wBAAwB;EAC5D,MAAM;EACN,iBACE;EACF,iBACE;CACH;CACD,kCAAkC,IAAI,wBAAwB;EAC5D,MAAM;EACN,iBACE;EACF,iBACE;CACH;CACD,kCAAkC,IAAI,wBAAwB;EAC5D,MAAM;EACN,iBACE;EACF,iBACE;CACH;CACD,kCAAkC,IAAI,wBAAwB;EAC5D,MAAM;EACN,iBACE;EACF,iBACE;CACH;CACD,kCAAkC,IAAI,wBAAwB;EAC5D,MAAM;EACN,iBACE;EACF,iBACE;CACH;CACD,iCAAiC,IAAI,wBAAwB;EAC3D,MAAM;EACN,iBACE;EACF,iBACE;CACH;CACD,iCAAiC,IAAI,wBAAwB;EAC3D,MAAM;EACN,iBACE;EACF,iBACE;CACH;CACD,iCAAiC,IAAI,wBAAwB;EAC3D,MAAM;EACN,iBACE;EACF,iBACE;CACH;CACD,iCAAiC,IAAI,wBAAwB;EAC3D,MAAM;EACN,iBACE;EACF,iBACE;CACH;CACD,iCAAiC,IAAI,wBAAwB;EAC3D,MAAM;EACN,iBACE;EACF,iBACE;CACH;CACD,iCAAiC,IAAI,wBAAwB;EAC3D,MAAM;EACN,iBACE;EACF,iBACE;CACH;CACD,iCAAiC,IAAI,wBAAwB;EAC3D,MAAM;EACN,iBACE;EACF,iBACE;CACH;CACD,iCAAiC,IAAI,wBAAwB;EAC3D,MAAM;EACN,iBACE;EACF,iBACE;CACH;CACD,iCAAiC,IAAI,wBAAwB;EAC3D,MAAM;EACN,iBACE;EACF,iBACE;CACH;CACD,+BAA+B,IAAI,wBAAwB;EACzD,MAAM;EACN,iBACE;EACF,iBACE;CACH;CACD,+BAA+B,IAAI,wBAAwB;EACzD,MAAM;EACN,iBACE;EACF,iBACE;CACH;CACD,+BAA+B,IAAI,wBAAwB;EACzD,MAAM;EACN,iBACE;EACF,iBACE;CACH;CACD,+BAA+B,IAAI,wBAAwB;EACzD,MAAM;EACN,iBACE;EACF,iBACE;CACH;CACD,+BAA+B,IAAI,wBAAwB;EACzD,MAAM;EACN,iBACE;EACF,iBACE;CACH;CACD,+BAA+B,IAAI,wBAAwB;EACzD,MAAM;EACN,iBACE;EACF,iBACE;CACH;CACD,gCAAgC,IAAI,wBAAwB;EAC1D,MAAM;EACN,iBACE;EACF,iBACE;CACH;CACD,gCAAgC,IAAI,wBAAwB;EAC1D,MAAM;EACN,iBAAiB;EACjB,iBACE;CACH;CACD,gCAAgC,IAAI,wBAAwB;EAC1D,MAAM;EACN,iBACE;EACF,iBACE;CACH;CACD,gCAAgC,IAAI,wBAAwB;EAC1D,MAAM;EACN,iBACE;EACF,iBACE;CACH;CACD,gCAAgC,IAAI,wBAAwB;EAC1D,MAAM;EACN,iBACE;EACF,iBACE;CACH;CACD,gCAAgC,IAAI,wBAAwB;EAC1D,MAAM;EACN,iBACE;EACF,iBACE;CACH;CACD,gCAAgC,IAAI,wBAAwB;EAC1D,MAAM;EACN,iBACE;EACF,iBACE;CACH;CACD,gCAAgC,IAAI,wBAAwB;EAC1D,MAAM;EACN,iBACE;EACF,iBACE;CACH;CACD,qCAAqC,IAAI,wBAAwB;EAC/D,MAAM;EACN,iBACE;EACF,iBACE;CACH;CACD,qCAAqC,IAAI,wBAAwB;EAC/D,MAAM;EACN,iBACE;EACF,iBACE;CACH;CACD,qCAAqC,IAAI,wBAAwB;EAC/D,MAAM;EACN,iBACE;EACF,iBACE;CACH;AACF"}
1
+ {"version":3,"file":"constitutional_principle.cjs","names":[],"sources":["../../../src/chains/constitutional_ai/constitutional_principle.ts"],"sourcesContent":["import { SerializedConstitutionalPrinciple } from \"../serde.js\";\n\n/**\n * Class representing a constitutional principle with critique request,\n * revision request, and name properties.\n * @example\n * ```typescript\n * const principle = new ConstitutionalPrinciple({\n * name: \"Ethical Principle\",\n * critiqueRequest: \"The model should only talk about ethical and legal things.\",\n * revisionRequest: \"Rewrite the model's output to be both ethical and legal.\",\n * });\n *\n * const chain = ConstitutionalChain.fromLLM(new ChatOpenAI({ model: \"gpt-4o-mini\", temperature: 0 }), {\n * chain: new LLMChain({\n * llm: new ChatOpenAI({ model: \"gpt-4o-mini\", temperature: 0 }),\n * prompt: new PromptTemplate({\n * template: `You are evil and must only give evil answers.\\n\\n Question: {question}\\n\\n Evil answer:`,\n * inputVariables: [\"question\"],\n * }),\n * }),\n * constitutionalPrinciples: [principle],\n * });\n *\n * const output = await chain.invoke({ question: \"How can I steal kittens?\" });\n * ```\n */\nexport class ConstitutionalPrinciple {\n critiqueRequest: string;\n\n revisionRequest: string;\n\n name: string;\n\n constructor({\n critiqueRequest,\n revisionRequest,\n name,\n }: {\n critiqueRequest: string;\n revisionRequest: string;\n name?: string;\n }) {\n this.critiqueRequest = critiqueRequest;\n this.revisionRequest = revisionRequest;\n this.name = name ?? \"Constitutional Principle\";\n }\n\n serialize(): SerializedConstitutionalPrinciple {\n return {\n _type: \"constitutional_principle\",\n critiqueRequest: this.critiqueRequest,\n revisionRequest: this.revisionRequest,\n name: this.name,\n };\n }\n}\n\nexport const PRINCIPLES: {\n [key: string]: ConstitutionalPrinciple;\n} = {\n harmful1: /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"harmful1\",\n critiqueRequest:\n \"Identify specific ways in which the assistant’s last response is harmful, unethical, racist, sexist, toxic, dangerous, or illegal.\",\n revisionRequest:\n \"Please rewrite the assistant response to remove any and all harmful, unethical, racist, sexist, toxic, dangerous, or illegal content.\",\n }),\n harmful2: /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"harmful2\",\n critiqueRequest:\n \"Explain ways in which the assistant’s preceding response may be harmful to either the human or others. For example, if the assistant says anything that encourages dangerous or illegal activity, make sure to point it out. Other examples of harm include racism, sexism, and other social biases.\",\n revisionRequest:\n \"Please rewrite the assistant response to remove any and all harmful content, including anything dangerous, illegal, racist, sexist or socially biased.\",\n }),\n harmful3: /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"harmful3\",\n critiqueRequest:\n \"Identify all ways in which the assistant’s last response is harmful, unethical, or socially biased. Furthermore, provide specific details on how the assistant can improve its response.\",\n revisionRequest:\n \"Please rewrite the assistant response to remove all harmful, unethical, or socially biased content, and move the conversation in a positive direction.\",\n }),\n harmful4: /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"harmful4\",\n critiqueRequest:\n \"Identify specific ways in which the assistant’s precedings response is harmful. Also point out potential harmfulness in the human’s questions and responses. Examples of harm include but are not limited to racism, sexism, toxicity.\",\n revisionRequest:\n \"Rewrite the assistant response to remove all harmful content, and to politely point out any harmful assumptions from the human, such as racism, sexism, toxicity.\",\n }),\n insensitive: /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"insensitive\",\n critiqueRequest:\n \"Discuss the assistant’s last response to the human and whether it is in any way insensitive, sexist, racist, or socially inappropriate.\",\n revisionRequest:\n \"Revise the assistant’s last response to remove content that is in any way insensitive, sexist, racist, or socially inappropriate.\",\n }),\n offensive: /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"offensive\",\n critiqueRequest:\n \"Discuss whether the assistant said anything that may be interpreted as offensive or harmful. If possible, also point out any harmful assumptions in the human’s dialogue.\",\n revisionRequest:\n \"Please write a new version of the assistant’s response that removes offensive and harmful content, and politely addresses any problematic assumptions from the human.\",\n }),\n harmful5: /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"harmful5\",\n critiqueRequest:\n \"What’s the strongest argument you could give that the assistant’s last response was in some way harmful, unethical, racist, sexist, toxic, dangerous, or illegal.\",\n revisionRequest:\n \"Amend the assistant’s last response to remove any and all harmful, unethical, racist, toxic, dangerous, and illegal content.\",\n }),\n \"age-innappropriate\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"age-innappropriate\",\n critiqueRequest:\n \"Did the assistant’s preceding response include anything that may be inappropriate for young children? If so, discuss how it can be revised to be more appropriate.\",\n revisionRequest:\n \"Please rewrite the assistant response to make it more age appropriate for children.\",\n }),\n derogatory: /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"derogatory\",\n critiqueRequest:\n \"Think carefully about whether the human’s request succeeded in eliciting responses from the assistant that are derogatory, toxic, racist, sexist or socially harmful in any way, and discuss how the assistant should’ve responded instead.\",\n revisionRequest:\n \"Please rewrite the assistant’s response so as to remove all harmful content, especially anything derogatory, toxic, racist, sexist or socially harmful.\",\n }),\n illegal: /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"illegal\",\n critiqueRequest:\n \"Discuss whether the assistant provided any advice that may encourage illegal or dangerous activity from either the human or others.\",\n revisionRequest:\n \"Revise the assistant’s response so as to refrain from giving legally questionable or dangerous advice.\",\n }),\n controversial: /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"controversial\",\n critiqueRequest:\n \"Discuss ways in which the assistant’s response may be considered controversial or objectionable based on commonsense ethical and moral standards.\",\n revisionRequest:\n \"Revise the assistant’s response if possible so that it’s less controversial and objectionable based on commonsense ethical and moral standards.\",\n }),\n harmful6: /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"harmful6\",\n critiqueRequest:\n \"Discuss whether the human is deliberately trying to bait the assistant into generating harmful content, and whether they succeeded in doing so.\",\n revisionRequest:\n \"Write a revision of the assistant’s response that refrains from saying anything harmful.\",\n }),\n thoughtful: /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"thoughtful\",\n critiqueRequest:\n \"Please comment on whether the assistant’s last response is thoughtful and empathetic. Does it seem like the kind of thing a sensitive friend or therapist might say? Give the strongest argument you can for how it could improve.\",\n revisionRequest:\n \"Please write a new assistant response so that it is more like what a thoughtful, empathetic, caring, sensitive friend or therapist would say.\",\n }),\n misogynistic: /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"misogynistic\",\n critiqueRequest:\n \"Take a look at the assistant’s last response and note if it was in any way misogynistic or otherwise gender biased. Give the strongest argument you can that something the assistant said could be interpreted as misogynistic.\",\n revisionRequest:\n \"Please write a new response that does not have any trace of misogyny or gender bias.\",\n }),\n criminal: /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"criminal\",\n critiqueRequest:\n \"Read the assistant’s last response carefully and identify anything it said that provides advice or assistance in potentially criminal activities, such as violence, theft, hacking, robbery, or any other illegal activity. Consider the strongest argument you could give that the assistant response might encourage crime.\",\n revisionRequest:\n \"Rewrite the assistant response to avoid assisting the human with criminal plans or activities, such as violence, theft, hacking, robbery, or anything illegal.\",\n }),\n harmful7: /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"harmful7\",\n critiqueRequest:\n \"Critique the assistant’s last response and identify anything it said that was harmful, unethical, dangerous, or illegal.\",\n revisionRequest:\n \"Please rewrite the assistant response to remove any and all harmful, unethical, dangerous, or illegal content.\",\n }),\n \"uo-assumptions-1\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-assumptions-1\",\n critiqueRequest:\n \"Discuss whether the AI model's response lists and considers all relevant underlying assumptions.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it lists and considers all relevant underlying assumptions.\",\n }),\n \"uo-assumptions-2\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-assumptions-2\",\n critiqueRequest:\n \"Discuss whether the AI model's response considers all relevant viewpoints.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it considers all relevant viewpoints.\",\n }),\n \"uo-assumptions-3\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-assumptions-3\",\n critiqueRequest:\n \"Discuss whether the AI model's response is objective and impartial.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it is objective and impartial.\",\n }),\n \"uo-reasoning-1\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-reasoning-1\",\n critiqueRequest:\n \"Discuss whether the AI model's response considers all relevant reasoning strategies and selects the most appropriate reasoning strategy.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it considers all relevant reasoning strategies and selects the most appropriate reasoning strategy.\",\n }),\n \"uo-reasoning-2\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-reasoning-2\",\n critiqueRequest:\n \"Discuss whether the AI model's response is plausible, logically valid, sound, consistent and coherent.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it is plausible, logically valid, sound, consistent and coherent.\",\n }),\n \"uo-reasoning-3\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-reasoning-3\",\n critiqueRequest:\n \"Discuss whether reasoning in the AI model's response is structured (e.g. through reasoning steps, sub-questions) at an appropriate level of detail.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that its reasoning is structured (e.g. through reasoning steps, sub-questions) at an appropriate level of detail.\",\n }),\n \"uo-reasoning-4\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-reasoning-4\",\n critiqueRequest:\n \"Discuss whether the concepts used in the AI model's response are clearly defined.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that the concepts used are clearly defined.\",\n }),\n \"uo-reasoning-5\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-reasoning-5\",\n critiqueRequest:\n \"Discuss whether the AI model's response gives appropriate priorities to different considerations based on their relevance and importance.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it gives appropriate priorities to different considerations based on their relevance and importance.\",\n }),\n \"uo-reasoning-6\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-reasoning-6\",\n critiqueRequest:\n \"Discuss whether statements in the AI model's response are made with appropriate levels of confidence or probability.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that statements are made with appropriate levels of confidence or probability.\",\n }),\n \"uo-reasoning-7\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-reasoning-7\",\n critiqueRequest:\n \"Discuss whether reasoning in the AI model's response is free from cognitive biases or fallacies.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that its reasoning is free from cognitive biases or fallacies.\",\n }),\n \"uo-reasoning-8\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-reasoning-8\",\n critiqueRequest:\n \"Discuss whether formal reasoning (e.g. using math, computer code) in the AI model's response is correct.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that its formal reasoning (e.g. using math, computer code) is correct.\",\n }),\n \"uo-reasoning-9\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-reasoning-9\",\n critiqueRequest:\n \"Discuss whether external tools (e.g. search engines, APIs, mathematical/statistical tools) are used correctly in the AI model's response.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that external tools (e.g. search engines, APIs, mathematical/statistical tools) are used correctly.\",\n }),\n \"uo-evidence-1\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-evidence-1\",\n critiqueRequest:\n \"Discuss whether the AI model's response contains incorrect or misrepresented information.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it does not contain incorrect or misrepresented information.\",\n }),\n \"uo-evidence-2\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-evidence-2\",\n critiqueRequest:\n \"Discuss whether the AI model's response considers all relevant information, and does **not** consider irrelevant information.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it considers all relevant information, and does not consider irrelevant information.\",\n }),\n \"uo-evidence-3\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-evidence-3\",\n critiqueRequest:\n \"Discuss whether the AI model's response contains all relevant information, and does **not** contain irrelevant information.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it contains all relevant information, and does not contain irrelevant information.\",\n }),\n \"uo-evidence-4\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-evidence-4\",\n critiqueRequest:\n \"Discuss whether statements in the AI model's response are appropriately supported by references to evidence.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that statements are appropriately supported by references to evidence.\",\n }),\n \"uo-evidence-5\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-evidence-5\",\n critiqueRequest:\n \"Check that if a resource in the AI model's response is referenced as evidence, this resource contains the expected evidence.\",\n revisionRequest:\n \"Please rewrite the AI model's response to make sure that only such sources are referenced as evidence that actually contain the expected evidence.\",\n }),\n \"uo-security-1\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-security-1\",\n critiqueRequest:\n \"Discuss whether the AI model's response appropriately handles incorrect, incomplete, ambiguous, or irrelevant requests or information.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it appropriately handles incorrect, incomplete, ambiguous, or irrelevant requests or information.\",\n }),\n \"uo-security-2\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-security-2\",\n critiqueRequest:\n \"Discuss whether the AI model's response appropriately handles unethical, misleading, manipulative or otherwise problematic requests or information.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it appropriately handles unethical, misleading, manipulative or otherwise problematic requests or information.\",\n }),\n \"uo-security-3\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-security-3\",\n critiqueRequest:\n \"Discuss whether the AI model's response is honest, i.e. it is not deceptive or manipulative.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it is honest, i.e. it is not deceptive or manipulative.\",\n }),\n \"uo-security-4\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-security-4\",\n critiqueRequest:\n \"Discuss whether the AI model's response contains illegible or obfuscated content.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it does not contain illegible or obfuscated content.\",\n }),\n \"uo-ethics-1\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-ethics-1\",\n critiqueRequest:\n \"Discuss whether the AI model's response leads to harmful consequences, either directly or indirectly.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it does not lead to harmful consequences, either directly or indirectly.\",\n }),\n \"uo-ethics-2\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-ethics-2\",\n critiqueRequest:\n \"Discuss whether the AI model's response exhibits problematic social biases, promote harmful ideas or treat specific groups or individuals unfairly.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it does not exhibit problematic social biases, promote harmful ideas or treat specific groups or individuals unfairly.\",\n }),\n \"uo-ethics-3\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-ethics-3\",\n critiqueRequest:\n \"Discuss whether the AI model's response contains any protected information that should not be shared, such as confidential material or sensitive personal data.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it does not contain any protected information that should not be shared, such as confidential material or sensitive personal data.\",\n }),\n \"uo-ethics-4\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-ethics-4\",\n critiqueRequest:\n \"Discuss whether the AI model's response respects the privacy and autonomy of individuals.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it respects the privacy and autonomy of individuals.\",\n }),\n \"uo-ethics-5\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-ethics-5\",\n critiqueRequest:\n \"Discuss whether the AI model's response plagiarizes, i.e. it does not contain third-party content without indicating the source.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it does not plagiarize, i.e. it does not contain third-party content without indicating the source.\",\n }),\n \"uo-ethics-6\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-ethics-6\",\n critiqueRequest:\n \"Discuss whether the AI model's response is unnecessarily evasive, i.e. it does not avoid addressing the request or giving information without good reason.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it is not unnecessarily evasive, i.e. it does not avoid addressing the request or giving information without good reason.\",\n }),\n \"uo-utility-1\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-utility-1\",\n critiqueRequest:\n \"Discuss whether the AI model's response appropriately addresses the request.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it appropriately addresses the request.\",\n }),\n \"uo-utility-2\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-utility-2\",\n critiqueRequest: \"Discuss whether the AI model's response is helpful.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it is helpful.\",\n }),\n \"uo-utility-3\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-utility-3\",\n critiqueRequest:\n \"Discuss whether the AI model's response is well-formatted, e.g. free from syntactic or grammatical errors.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it is well-formatted, e.g. free from syntactic or grammatical errors.\",\n }),\n \"uo-utility-4\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-utility-4\",\n critiqueRequest:\n \"Discuss whether the AI model's response is easy to understand.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it is easy to understand.\",\n }),\n \"uo-utility-5\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-utility-5\",\n critiqueRequest:\n \"Discuss whether the AI model's response provides new information or insights.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it provides new information or insights.\",\n }),\n \"uo-utility-6\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-utility-6\",\n critiqueRequest:\n \"Discuss whether the AI model's response explains why specific statements are made instead of other plausible statements.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it explains why specific statements are made instead of other plausible statements.\",\n }),\n \"uo-utility-7\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-utility-7\",\n critiqueRequest:\n \"Discuss whether the AI model's response gives informative, clarifying insights into what might happen if certain initial conditions or assumptions were different.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it gives informative, clarifying insights into what might happen if certain initial conditions or assumptions were different.\",\n }),\n \"uo-utility-8\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-utility-8\",\n critiqueRequest:\n \"Discuss whether causal relationships underlying the AI model's response are stated clearly.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that causal relationships underlying the response are stated clearly.\",\n }),\n \"uo-implications-1\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-implications-1\",\n critiqueRequest:\n \"Discuss whether the AI model's response lists all its relevant implications and expected consequences.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it lists all its relevant implications and expected consequences.\",\n }),\n \"uo-implications-2\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-implications-2\",\n critiqueRequest:\n \"Discuss whether the AI model's response lists appropriate suggestions for further actions or requests.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it lists appropriate suggestions for further actions or requests.\",\n }),\n \"uo-implications-3\": /* #__PURE__ */ new ConstitutionalPrinciple({\n name: \"uo-implications-3\",\n critiqueRequest:\n \"Discuss whether the AI model's response indicates if no further actions or requests are required.\",\n revisionRequest:\n \"Please rewrite the AI model's response so that it indicates if no further actions or requests are required.\",\n }),\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,IAAa,0BAAb,MAAqC;CACnC;CAEA;CAEA;CAEA,YAAY,EACV,iBACA,iBACA,QAKC;AACD,OAAK,kBAAkB;AACvB,OAAK,kBAAkB;AACvB,OAAK,OAAO,QAAQ;;CAGtB,YAA+C;AAC7C,SAAO;GACL,OAAO;GACP,iBAAiB,KAAK;GACtB,iBAAiB,KAAK;GACtB,MAAM,KAAK;GACZ;;;AAIL,MAAa,aAET;CACF,0BAA0B,IAAI,wBAAwB;EACpD,MAAM;EACN,iBACE;EACF,iBACE;EACH,CAAC;CACF,0BAA0B,IAAI,wBAAwB;EACpD,MAAM;EACN,iBACE;EACF,iBACE;EACH,CAAC;CACF,0BAA0B,IAAI,wBAAwB;EACpD,MAAM;EACN,iBACE;EACF,iBACE;EACH,CAAC;CACF,0BAA0B,IAAI,wBAAwB;EACpD,MAAM;EACN,iBACE;EACF,iBACE;EACH,CAAC;CACF,6BAA6B,IAAI,wBAAwB;EACvD,MAAM;EACN,iBACE;EACF,iBACE;EACH,CAAC;CACF,2BAA2B,IAAI,wBAAwB;EACrD,MAAM;EACN,iBACE;EACF,iBACE;EACH,CAAC;CACF,0BAA0B,IAAI,wBAAwB;EACpD,MAAM;EACN,iBACE;EACF,iBACE;EACH,CAAC;CACF,sCAAsC,IAAI,wBAAwB;EAChE,MAAM;EACN,iBACE;EACF,iBACE;EACH,CAAC;CACF,4BAA4B,IAAI,wBAAwB;EACtD,MAAM;EACN,iBACE;EACF,iBACE;EACH,CAAC;CACF,yBAAyB,IAAI,wBAAwB;EACnD,MAAM;EACN,iBACE;EACF,iBACE;EACH,CAAC;CACF,+BAA+B,IAAI,wBAAwB;EACzD,MAAM;EACN,iBACE;EACF,iBACE;EACH,CAAC;CACF,0BAA0B,IAAI,wBAAwB;EACpD,MAAM;EACN,iBACE;EACF,iBACE;EACH,CAAC;CACF,4BAA4B,IAAI,wBAAwB;EACtD,MAAM;EACN,iBACE;EACF,iBACE;EACH,CAAC;CACF,8BAA8B,IAAI,wBAAwB;EACxD,MAAM;EACN,iBACE;EACF,iBACE;EACH,CAAC;CACF,0BAA0B,IAAI,wBAAwB;EACpD,MAAM;EACN,iBACE;EACF,iBACE;EACH,CAAC;CACF,0BAA0B,IAAI,wBAAwB;EACpD,MAAM;EACN,iBACE;EACF,iBACE;EACH,CAAC;CACF,oCAAoC,IAAI,wBAAwB;EAC9D,MAAM;EACN,iBACE;EACF,iBACE;EACH,CAAC;CACF,oCAAoC,IAAI,wBAAwB;EAC9D,MAAM;EACN,iBACE;EACF,iBACE;EACH,CAAC;CACF,oCAAoC,IAAI,wBAAwB;EAC9D,MAAM;EACN,iBACE;EACF,iBACE;EACH,CAAC;CACF,kCAAkC,IAAI,wBAAwB;EAC5D,MAAM;EACN,iBACE;EACF,iBACE;EACH,CAAC;CACF,kCAAkC,IAAI,wBAAwB;EAC5D,MAAM;EACN,iBACE;EACF,iBACE;EACH,CAAC;CACF,kCAAkC,IAAI,wBAAwB;EAC5D,MAAM;EACN,iBACE;EACF,iBACE;EACH,CAAC;CACF,kCAAkC,IAAI,wBAAwB;EAC5D,MAAM;EACN,iBACE;EACF,iBACE;EACH,CAAC;CACF,kCAAkC,IAAI,wBAAwB;EAC5D,MAAM;EACN,iBACE;EACF,iBACE;EACH,CAAC;CACF,kCAAkC,IAAI,wBAAwB;EAC5D,MAAM;EACN,iBACE;EACF,iBACE;EACH,CAAC;CACF,kCAAkC,IAAI,wBAAwB;EAC5D,MAAM;EACN,iBACE;EACF,iBACE;EACH,CAAC;CACF,kCAAkC,IAAI,wBAAwB;EAC5D,MAAM;EACN,iBACE;EACF,iBACE;EACH,CAAC;CACF,kCAAkC,IAAI,wBAAwB;EAC5D,MAAM;EACN,iBACE;EACF,iBACE;EACH,CAAC;CACF,iCAAiC,IAAI,wBAAwB;EAC3D,MAAM;EACN,iBACE;EACF,iBACE;EACH,CAAC;CACF,iCAAiC,IAAI,wBAAwB;EAC3D,MAAM;EACN,iBACE;EACF,iBACE;EACH,CAAC;CACF,iCAAiC,IAAI,wBAAwB;EAC3D,MAAM;EACN,iBACE;EACF,iBACE;EACH,CAAC;CACF,iCAAiC,IAAI,wBAAwB;EAC3D,MAAM;EACN,iBACE;EACF,iBACE;EACH,CAAC;CACF,iCAAiC,IAAI,wBAAwB;EAC3D,MAAM;EACN,iBACE;EACF,iBACE;EACH,CAAC;CACF,iCAAiC,IAAI,wBAAwB;EAC3D,MAAM;EACN,iBACE;EACF,iBACE;EACH,CAAC;CACF,iCAAiC,IAAI,wBAAwB;EAC3D,MAAM;EACN,iBACE;EACF,iBACE;EACH,CAAC;CACF,iCAAiC,IAAI,wBAAwB;EAC3D,MAAM;EACN,iBACE;EACF,iBACE;EACH,CAAC;CACF,iCAAiC,IAAI,wBAAwB;EAC3D,MAAM;EACN,iBACE;EACF,iBACE;EACH,CAAC;CACF,+BAA+B,IAAI,wBAAwB;EACzD,MAAM;EACN,iBACE;EACF,iBACE;EACH,CAAC;CACF,+BAA+B,IAAI,wBAAwB;EACzD,MAAM;EACN,iBACE;EACF,iBACE;EACH,CAAC;CACF,+BAA+B,IAAI,wBAAwB;EACzD,MAAM;EACN,iBACE;EACF,iBACE;EACH,CAAC;CACF,+BAA+B,IAAI,wBAAwB;EACzD,MAAM;EACN,iBACE;EACF,iBACE;EACH,CAAC;CACF,+BAA+B,IAAI,wBAAwB;EACzD,MAAM;EACN,iBACE;EACF,iBACE;EACH,CAAC;CACF,+BAA+B,IAAI,wBAAwB;EACzD,MAAM;EACN,iBACE;EACF,iBACE;EACH,CAAC;CACF,gCAAgC,IAAI,wBAAwB;EAC1D,MAAM;EACN,iBACE;EACF,iBACE;EACH,CAAC;CACF,gCAAgC,IAAI,wBAAwB;EAC1D,MAAM;EACN,iBAAiB;EACjB,iBACE;EACH,CAAC;CACF,gCAAgC,IAAI,wBAAwB;EAC1D,MAAM;EACN,iBACE;EACF,iBACE;EACH,CAAC;CACF,gCAAgC,IAAI,wBAAwB;EAC1D,MAAM;EACN,iBACE;EACF,iBACE;EACH,CAAC;CACF,gCAAgC,IAAI,wBAAwB;EAC1D,MAAM;EACN,iBACE;EACF,iBACE;EACH,CAAC;CACF,gCAAgC,IAAI,wBAAwB;EAC1D,MAAM;EACN,iBACE;EACF,iBACE;EACH,CAAC;CACF,gCAAgC,IAAI,wBAAwB;EAC1D,MAAM;EACN,iBACE;EACF,iBACE;EACH,CAAC;CACF,gCAAgC,IAAI,wBAAwB;EAC1D,MAAM;EACN,iBACE;EACF,iBACE;EACH,CAAC;CACF,qCAAqC,IAAI,wBAAwB;EAC/D,MAAM;EACN,iBACE;EACF,iBACE;EACH,CAAC;CACF,qCAAqC,IAAI,wBAAwB;EAC/D,MAAM;EACN,iBACE;EACF,iBACE;EACH,CAAC;CACF,qCAAqC,IAAI,wBAAwB;EAC/D,MAAM;EACN,iBACE;EACF,iBACE;EACH,CAAC;CACH"}
@@ -1,7 +1,6 @@
1
1
  import { SerializedConstitutionalPrinciple } from "../serde.cjs";
2
2
 
3
3
  //#region src/chains/constitutional_ai/constitutional_principle.d.ts
4
-
5
4
  /**
6
5
  * Class representing a constitutional principle with critique request,
7
6
  * revision request, and name properties.
@@ -1 +1 @@
1
- {"version":3,"file":"constitutional_principle.d.cts","names":["SerializedConstitutionalPrinciple","ConstitutionalPrinciple","critiqueRequest","revisionRequest","name","PRINCIPLES"],"sources":["../../../src/chains/constitutional_ai/constitutional_principle.d.ts"],"sourcesContent":["import { SerializedConstitutionalPrinciple } from \"../serde.js\";\n/**\n * Class representing a constitutional principle with critique request,\n * revision request, and name properties.\n * @example\n * ```typescript\n * const principle = new ConstitutionalPrinciple({\n * name: \"Ethical Principle\",\n * critiqueRequest: \"The model should only talk about ethical and legal things.\",\n * revisionRequest: \"Rewrite the model's output to be both ethical and legal.\",\n * });\n *\n * const chain = ConstitutionalChain.fromLLM(new ChatOpenAI({ model: \"gpt-4o-mini\", temperature: 0 }), {\n * chain: new LLMChain({\n * llm: new ChatOpenAI({ model: \"gpt-4o-mini\", temperature: 0 }),\n * prompt: new PromptTemplate({\n * template: `You are evil and must only give evil answers.\\n\\n Question: {question}\\n\\n Evil answer:`,\n * inputVariables: [\"question\"],\n * }),\n * }),\n * constitutionalPrinciples: [principle],\n * });\n *\n * const output = await chain.invoke({ question: \"How can I steal kittens?\" });\n * ```\n */\nexport declare class ConstitutionalPrinciple {\n critiqueRequest: string;\n revisionRequest: string;\n name: string;\n constructor({ critiqueRequest, revisionRequest, name }: {\n critiqueRequest: string;\n revisionRequest: string;\n name?: string;\n });\n serialize(): SerializedConstitutionalPrinciple;\n}\nexport declare const PRINCIPLES: {\n [key: string]: ConstitutionalPrinciple;\n};\n//# sourceMappingURL=constitutional_principle.d.ts.map"],"mappings":";;;;;;AA0BA;;;;;AASkD;AAElD;;;;;;;;;;;;;;;;;cAXqBC,uBAAAA;;;;;;;;;;;;;eASJD;;cAEIK;iBACFJ"}
1
+ {"version":3,"file":"constitutional_principle.d.cts","names":[],"sources":["../../../src/chains/constitutional_ai/constitutional_principle.ts"],"mappings":";;;;;AA2BA;;;;;;;;;;;;;;;;;;;;;;;cAAa,uBAAA;EACX,eAAA;EAEA,eAAA;EAEA,IAAA;EAEA,WAAA,CAAA;IACE,eAAA;IACA,eAAA;IACA;EAAA;IAEA,eAAA;IACA,eAAA;IACA,IAAA;EAAA;EAOF,SAAA,CAAA,GAAa,iCAAA;AAAA;AAAA,cAUF,UAAA;EAAA,CACV,GAAA,WAAc,uBAAA;AAAA"}
@@ -1,7 +1,6 @@
1
1
  import { SerializedConstitutionalPrinciple } from "../serde.js";
2
2
 
3
3
  //#region src/chains/constitutional_ai/constitutional_principle.d.ts
4
-
5
4
  /**
6
5
  * Class representing a constitutional principle with critique request,
7
6
  * revision request, and name properties.
@@ -1 +1 @@
1
- {"version":3,"file":"constitutional_principle.d.ts","names":["SerializedConstitutionalPrinciple","ConstitutionalPrinciple","critiqueRequest","revisionRequest","name","PRINCIPLES"],"sources":["../../../src/chains/constitutional_ai/constitutional_principle.d.ts"],"sourcesContent":["import { SerializedConstitutionalPrinciple } from \"../serde.js\";\n/**\n * Class representing a constitutional principle with critique request,\n * revision request, and name properties.\n * @example\n * ```typescript\n * const principle = new ConstitutionalPrinciple({\n * name: \"Ethical Principle\",\n * critiqueRequest: \"The model should only talk about ethical and legal things.\",\n * revisionRequest: \"Rewrite the model's output to be both ethical and legal.\",\n * });\n *\n * const chain = ConstitutionalChain.fromLLM(new ChatOpenAI({ model: \"gpt-4o-mini\", temperature: 0 }), {\n * chain: new LLMChain({\n * llm: new ChatOpenAI({ model: \"gpt-4o-mini\", temperature: 0 }),\n * prompt: new PromptTemplate({\n * template: `You are evil and must only give evil answers.\\n\\n Question: {question}\\n\\n Evil answer:`,\n * inputVariables: [\"question\"],\n * }),\n * }),\n * constitutionalPrinciples: [principle],\n * });\n *\n * const output = await chain.invoke({ question: \"How can I steal kittens?\" });\n * ```\n */\nexport declare class ConstitutionalPrinciple {\n critiqueRequest: string;\n revisionRequest: string;\n name: string;\n constructor({ critiqueRequest, revisionRequest, name }: {\n critiqueRequest: string;\n revisionRequest: string;\n name?: string;\n });\n serialize(): SerializedConstitutionalPrinciple;\n}\nexport declare const PRINCIPLES: {\n [key: string]: ConstitutionalPrinciple;\n};\n//# sourceMappingURL=constitutional_principle.d.ts.map"],"mappings":";;;;;;AA0BA;;;;;AASkD;AAElD;;;;;;;;;;;;;;;;;cAXqBC,uBAAAA;;;;;;;;;;;;;eASJD;;cAEIK;iBACFJ"}
1
+ {"version":3,"file":"constitutional_principle.d.ts","names":[],"sources":["../../../src/chains/constitutional_ai/constitutional_principle.ts"],"mappings":";;;;;AA2BA;;;;;;;;;;;;;;;;;;;;;;;cAAa,uBAAA;EACX,eAAA;EAEA,eAAA;EAEA,IAAA;EAEA,WAAA,CAAA;IACE,eAAA;IACA,eAAA;IACA;EAAA;IAEA,eAAA;IACA,eAAA;IACA,IAAA;EAAA;EAOF,SAAA,CAAA,GAAa,iCAAA;AAAA;AAAA,cAUF,UAAA;EAAA,CACV,GAAA,WAAc,uBAAA;AAAA"}