@langchain/core 1.0.0-alpha.2 → 1.0.0-alpha.4

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 (595) hide show
  1. package/README.md +3 -19
  2. package/dist/agents.d.ts.map +1 -1
  3. package/dist/caches/base.cjs +5 -18
  4. package/dist/caches/base.cjs.map +1 -1
  5. package/dist/caches/base.d.cts +4 -20
  6. package/dist/caches/base.d.cts.map +1 -1
  7. package/dist/caches/base.d.ts +4 -20
  8. package/dist/caches/base.d.ts.map +1 -1
  9. package/dist/caches/base.js +5 -18
  10. package/dist/caches/base.js.map +1 -1
  11. package/dist/callbacks/base.d.cts +3 -2
  12. package/dist/callbacks/base.d.cts.map +1 -1
  13. package/dist/callbacks/base.d.ts +3 -2
  14. package/dist/callbacks/base.d.ts.map +1 -1
  15. package/dist/callbacks/manager.d.cts +1 -1
  16. package/dist/callbacks/manager.d.ts +1 -1
  17. package/dist/document_loaders/langsmith.cjs +1 -1
  18. package/dist/document_loaders/langsmith.cjs.map +1 -1
  19. package/dist/document_loaders/langsmith.js +1 -1
  20. package/dist/document_loaders/langsmith.js.map +1 -1
  21. package/dist/embeddings.cjs.map +1 -1
  22. package/dist/embeddings.d.cts +6 -6
  23. package/dist/embeddings.d.cts.map +1 -1
  24. package/dist/embeddings.d.ts +6 -6
  25. package/dist/embeddings.d.ts.map +1 -1
  26. package/dist/embeddings.js.map +1 -1
  27. package/dist/errors/index.cjs.map +1 -1
  28. package/dist/errors/index.js.map +1 -1
  29. package/dist/indexing/base.cjs +2 -2
  30. package/dist/indexing/base.cjs.map +1 -1
  31. package/dist/indexing/base.d.cts +0 -3
  32. package/dist/indexing/base.d.cts.map +1 -1
  33. package/dist/indexing/base.d.ts +0 -3
  34. package/dist/indexing/base.d.ts.map +1 -1
  35. package/dist/indexing/base.js +2 -2
  36. package/dist/indexing/base.js.map +1 -1
  37. package/dist/language_models/base.cjs +1 -1
  38. package/dist/language_models/base.cjs.map +1 -1
  39. package/dist/language_models/base.d.cts +4 -4
  40. package/dist/language_models/base.d.cts.map +1 -1
  41. package/dist/language_models/base.d.ts +4 -4
  42. package/dist/language_models/base.d.ts.map +1 -1
  43. package/dist/language_models/base.js +1 -1
  44. package/dist/language_models/base.js.map +1 -1
  45. package/dist/language_models/chat_models.cjs +1 -0
  46. package/dist/language_models/chat_models.cjs.map +1 -1
  47. package/dist/language_models/chat_models.d.cts +2 -1
  48. package/dist/language_models/chat_models.d.cts.map +1 -1
  49. package/dist/language_models/chat_models.d.ts +2 -1
  50. package/dist/language_models/chat_models.d.ts.map +1 -1
  51. package/dist/language_models/chat_models.js +2 -1
  52. package/dist/language_models/chat_models.js.map +1 -1
  53. package/dist/language_models/llms.cjs.map +1 -1
  54. package/dist/language_models/llms.js.map +1 -1
  55. package/dist/load/import_map.cjs +1 -5
  56. package/dist/load/import_map.cjs.map +1 -1
  57. package/dist/load/import_map.js +3 -7
  58. package/dist/load/import_map.js.map +1 -1
  59. package/dist/load/index.cjs.map +1 -1
  60. package/dist/load/index.js.map +1 -1
  61. package/dist/load/serializable.cjs.map +1 -1
  62. package/dist/load/serializable.d.cts +1 -3
  63. package/dist/load/serializable.d.cts.map +1 -1
  64. package/dist/load/serializable.d.ts +1 -3
  65. package/dist/load/serializable.d.ts.map +1 -1
  66. package/dist/load/serializable.js.map +1 -1
  67. package/dist/messages/ai.cjs +34 -62
  68. package/dist/messages/ai.cjs.map +1 -1
  69. package/dist/messages/ai.d.cts +26 -119
  70. package/dist/messages/ai.d.cts.map +1 -1
  71. package/dist/messages/ai.d.ts +26 -119
  72. package/dist/messages/ai.d.ts.map +1 -1
  73. package/dist/messages/ai.js +34 -62
  74. package/dist/messages/ai.js.map +1 -1
  75. package/dist/messages/base.cjs +53 -33
  76. package/dist/messages/base.cjs.map +1 -1
  77. package/dist/messages/base.d.cts +38 -41
  78. package/dist/messages/base.d.cts.map +1 -1
  79. package/dist/messages/base.d.ts +38 -41
  80. package/dist/messages/base.d.ts.map +1 -1
  81. package/dist/messages/base.js +53 -33
  82. package/dist/messages/base.js.map +1 -1
  83. package/dist/messages/block_translators/utils.cjs +1 -1
  84. package/dist/messages/block_translators/utils.cjs.map +1 -1
  85. package/dist/messages/block_translators/utils.js +1 -1
  86. package/dist/messages/block_translators/utils.js.map +1 -1
  87. package/dist/messages/chat.cjs +18 -12
  88. package/dist/messages/chat.cjs.map +1 -1
  89. package/dist/messages/chat.d.cts +21 -13
  90. package/dist/messages/chat.d.cts.map +1 -1
  91. package/dist/messages/chat.d.ts +21 -13
  92. package/dist/messages/chat.d.ts.map +1 -1
  93. package/dist/messages/chat.js +18 -12
  94. package/dist/messages/chat.js.map +1 -1
  95. package/dist/messages/content/index.cjs.map +1 -1
  96. package/dist/messages/content/index.d.cts +1 -1
  97. package/dist/messages/content/index.d.cts.map +1 -1
  98. package/dist/messages/content/index.d.ts +1 -1
  99. package/dist/messages/content/index.d.ts.map +1 -1
  100. package/dist/messages/content/index.js.map +1 -1
  101. package/dist/messages/function.cjs +8 -13
  102. package/dist/messages/function.cjs.map +1 -1
  103. package/dist/messages/function.d.cts +11 -11
  104. package/dist/messages/function.d.cts.map +1 -1
  105. package/dist/messages/function.d.ts +11 -11
  106. package/dist/messages/function.d.ts.map +1 -1
  107. package/dist/messages/function.js +8 -13
  108. package/dist/messages/function.js.map +1 -1
  109. package/dist/messages/human.cjs +20 -11
  110. package/dist/messages/human.cjs.map +1 -1
  111. package/dist/messages/human.d.cts +20 -15
  112. package/dist/messages/human.d.cts.map +1 -1
  113. package/dist/messages/human.d.ts +20 -15
  114. package/dist/messages/human.d.ts.map +1 -1
  115. package/dist/messages/human.js +20 -11
  116. package/dist/messages/human.js.map +1 -1
  117. package/dist/messages/index.cjs +11 -1
  118. package/dist/messages/index.cjs.map +1 -1
  119. package/dist/messages/index.d.cts +9 -7
  120. package/dist/messages/index.d.ts +9 -7
  121. package/dist/messages/index.js +8 -2
  122. package/dist/messages/index.js.map +1 -1
  123. package/dist/messages/message.cjs +15 -0
  124. package/dist/messages/message.cjs.map +1 -0
  125. package/dist/messages/message.d.cts +598 -0
  126. package/dist/messages/message.d.cts.map +1 -0
  127. package/dist/messages/message.d.ts +598 -0
  128. package/dist/messages/message.d.ts.map +1 -0
  129. package/dist/messages/message.js +14 -0
  130. package/dist/messages/message.js.map +1 -0
  131. package/dist/messages/metadata.cjs +41 -0
  132. package/dist/messages/metadata.cjs.map +1 -0
  133. package/dist/messages/metadata.d.cts +98 -0
  134. package/dist/messages/metadata.d.cts.map +1 -0
  135. package/dist/messages/metadata.d.ts +98 -0
  136. package/dist/messages/metadata.d.ts.map +1 -0
  137. package/dist/messages/metadata.js +40 -0
  138. package/dist/messages/metadata.js.map +1 -0
  139. package/dist/messages/modifier.cjs +5 -4
  140. package/dist/messages/modifier.cjs.map +1 -1
  141. package/dist/messages/modifier.d.cts +7 -5
  142. package/dist/messages/modifier.d.cts.map +1 -1
  143. package/dist/messages/modifier.d.ts +7 -5
  144. package/dist/messages/modifier.d.ts.map +1 -1
  145. package/dist/messages/modifier.js +5 -4
  146. package/dist/messages/modifier.js.map +1 -1
  147. package/dist/messages/system.cjs +20 -11
  148. package/dist/messages/system.cjs.map +1 -1
  149. package/dist/messages/system.d.cts +20 -15
  150. package/dist/messages/system.d.cts.map +1 -1
  151. package/dist/messages/system.d.ts +20 -15
  152. package/dist/messages/system.d.ts.map +1 -1
  153. package/dist/messages/system.js +20 -11
  154. package/dist/messages/system.js.map +1 -1
  155. package/dist/messages/tool.cjs +21 -19
  156. package/dist/messages/tool.cjs.map +1 -1
  157. package/dist/messages/tool.d.cts +72 -46
  158. package/dist/messages/tool.d.cts.map +1 -1
  159. package/dist/messages/tool.d.ts +72 -46
  160. package/dist/messages/tool.d.ts.map +1 -1
  161. package/dist/messages/tool.js +21 -19
  162. package/dist/messages/tool.js.map +1 -1
  163. package/dist/messages/transformers.cjs +2 -2
  164. package/dist/messages/transformers.cjs.map +1 -1
  165. package/dist/messages/transformers.d.cts +2 -1
  166. package/dist/messages/transformers.d.cts.map +1 -1
  167. package/dist/messages/transformers.d.ts +2 -1
  168. package/dist/messages/transformers.d.ts.map +1 -1
  169. package/dist/messages/transformers.js +2 -2
  170. package/dist/messages/transformers.js.map +1 -1
  171. package/dist/messages/utils.cjs +13 -1
  172. package/dist/messages/utils.cjs.map +1 -1
  173. package/dist/messages/utils.d.cts +83 -3
  174. package/dist/messages/utils.d.cts.map +1 -1
  175. package/dist/messages/utils.d.ts +83 -3
  176. package/dist/messages/utils.d.ts.map +1 -1
  177. package/dist/messages/utils.js +13 -2
  178. package/dist/messages/utils.js.map +1 -1
  179. package/dist/output_parsers/list.cjs +1 -1
  180. package/dist/output_parsers/list.cjs.map +1 -1
  181. package/dist/output_parsers/list.js +1 -1
  182. package/dist/output_parsers/list.js.map +1 -1
  183. package/dist/output_parsers/openai_functions/json_output_functions_parsers.d.cts +1 -1
  184. package/dist/output_parsers/openai_functions/json_output_functions_parsers.d.ts +1 -1
  185. package/dist/output_parsers/openai_tools/json_output_tools_parsers.cjs +1 -1
  186. package/dist/output_parsers/openai_tools/json_output_tools_parsers.cjs.map +1 -1
  187. package/dist/output_parsers/openai_tools/json_output_tools_parsers.d.cts +1 -1
  188. package/dist/output_parsers/openai_tools/json_output_tools_parsers.d.ts +1 -1
  189. package/dist/output_parsers/openai_tools/json_output_tools_parsers.js +1 -1
  190. package/dist/output_parsers/openai_tools/json_output_tools_parsers.js.map +1 -1
  191. package/dist/output_parsers/structured.cjs +2 -1
  192. package/dist/output_parsers/structured.cjs.map +1 -1
  193. package/dist/output_parsers/structured.js +2 -1
  194. package/dist/output_parsers/structured.js.map +1 -1
  195. package/dist/prompt_values.d.cts +4 -3
  196. package/dist/prompt_values.d.cts.map +1 -1
  197. package/dist/prompt_values.d.ts +4 -3
  198. package/dist/prompt_values.d.ts.map +1 -1
  199. package/dist/prompts/chat.cjs +3 -1
  200. package/dist/prompts/chat.cjs.map +1 -1
  201. package/dist/prompts/chat.d.cts +7 -15
  202. package/dist/prompts/chat.d.cts.map +1 -1
  203. package/dist/prompts/chat.d.ts +7 -15
  204. package/dist/prompts/chat.d.ts.map +1 -1
  205. package/dist/prompts/chat.js +3 -1
  206. package/dist/prompts/chat.js.map +1 -1
  207. package/dist/prompts/few_shot.d.cts +1 -1
  208. package/dist/prompts/few_shot.d.ts +1 -1
  209. package/dist/prompts/image.cjs.map +1 -1
  210. package/dist/prompts/image.d.cts +1 -3
  211. package/dist/prompts/image.d.cts.map +1 -1
  212. package/dist/prompts/image.d.ts +1 -3
  213. package/dist/prompts/image.d.ts.map +1 -1
  214. package/dist/prompts/image.js.map +1 -1
  215. package/dist/prompts/pipeline.cjs.map +1 -1
  216. package/dist/prompts/pipeline.js.map +1 -1
  217. package/dist/prompts/prompt.cjs.map +1 -1
  218. package/dist/prompts/prompt.d.cts +5 -17
  219. package/dist/prompts/prompt.d.cts.map +1 -1
  220. package/dist/prompts/prompt.d.ts +5 -17
  221. package/dist/prompts/prompt.d.ts.map +1 -1
  222. package/dist/prompts/prompt.js.map +1 -1
  223. package/dist/prompts/structured.cjs.map +1 -1
  224. package/dist/prompts/structured.js.map +1 -1
  225. package/dist/prompts/template.cjs +4 -2
  226. package/dist/prompts/template.cjs.map +1 -1
  227. package/dist/prompts/template.d.cts +1 -1
  228. package/dist/prompts/template.d.ts +1 -1
  229. package/dist/prompts/template.js +4 -2
  230. package/dist/prompts/template.js.map +1 -1
  231. package/dist/runnables/base.cjs +6 -6
  232. package/dist/runnables/base.cjs.map +1 -1
  233. package/dist/runnables/base.d.cts +1 -4
  234. package/dist/runnables/base.d.cts.map +1 -1
  235. package/dist/runnables/base.d.ts +1 -4
  236. package/dist/runnables/base.d.ts.map +1 -1
  237. package/dist/runnables/base.js +6 -6
  238. package/dist/runnables/base.js.map +1 -1
  239. package/dist/runnables/branch.cjs +2 -2
  240. package/dist/runnables/branch.cjs.map +1 -1
  241. package/dist/runnables/branch.js +2 -2
  242. package/dist/runnables/branch.js.map +1 -1
  243. package/dist/runnables/config.cjs.map +1 -1
  244. package/dist/runnables/config.js.map +1 -1
  245. package/dist/runnables/graph.cjs +1 -1
  246. package/dist/runnables/graph.cjs.map +1 -1
  247. package/dist/runnables/graph.js +1 -1
  248. package/dist/runnables/graph.js.map +1 -1
  249. package/dist/runnables/graph_mermaid.cjs +26 -3
  250. package/dist/runnables/graph_mermaid.cjs.map +1 -1
  251. package/dist/runnables/graph_mermaid.js +26 -3
  252. package/dist/runnables/graph_mermaid.js.map +1 -1
  253. package/dist/runnables/remote.cjs.map +1 -1
  254. package/dist/runnables/remote.js.map +1 -1
  255. package/dist/runnables/types.d.cts +0 -1
  256. package/dist/runnables/types.d.cts.map +1 -1
  257. package/dist/runnables/types.d.ts +0 -1
  258. package/dist/runnables/types.d.ts.map +1 -1
  259. package/dist/singletons/async_local_storage/context.cjs.map +1 -1
  260. package/dist/singletons/async_local_storage/context.d.cts +0 -1
  261. package/dist/singletons/async_local_storage/context.d.cts.map +1 -1
  262. package/dist/singletons/async_local_storage/context.d.ts +0 -1
  263. package/dist/singletons/async_local_storage/context.d.ts.map +1 -1
  264. package/dist/singletons/async_local_storage/context.js.map +1 -1
  265. package/dist/singletons/callbacks.cjs.map +1 -1
  266. package/dist/singletons/callbacks.js.map +1 -1
  267. package/dist/tools/index.cjs.map +1 -1
  268. package/dist/tools/index.d.cts +3 -3
  269. package/dist/tools/index.d.cts.map +1 -1
  270. package/dist/tools/index.d.ts +3 -3
  271. package/dist/tools/index.d.ts.map +1 -1
  272. package/dist/tools/index.js.map +1 -1
  273. package/dist/tools/types.d.cts +6 -6
  274. package/dist/tools/types.d.cts.map +1 -1
  275. package/dist/tools/types.d.ts +6 -6
  276. package/dist/tools/types.d.ts.map +1 -1
  277. package/dist/tracers/base.cjs.map +1 -1
  278. package/dist/tracers/base.d.cts +1 -1
  279. package/dist/tracers/base.d.ts +1 -1
  280. package/dist/tracers/base.js.map +1 -1
  281. package/dist/tracers/console.cjs +1 -1
  282. package/dist/tracers/console.cjs.map +1 -1
  283. package/dist/tracers/console.js +1 -1
  284. package/dist/tracers/console.js.map +1 -1
  285. package/dist/tracers/event_stream.cjs +1 -1
  286. package/dist/tracers/event_stream.cjs.map +1 -1
  287. package/dist/tracers/event_stream.d.cts +0 -1
  288. package/dist/tracers/event_stream.d.cts.map +1 -1
  289. package/dist/tracers/event_stream.d.ts +0 -1
  290. package/dist/tracers/event_stream.d.ts.map +1 -1
  291. package/dist/tracers/event_stream.js +1 -1
  292. package/dist/tracers/event_stream.js.map +1 -1
  293. package/dist/tracers/log_stream.cjs.map +1 -1
  294. package/dist/tracers/log_stream.js.map +1 -1
  295. package/dist/tracers/tracer_langchain.cjs.map +1 -1
  296. package/dist/tracers/tracer_langchain.js.map +1 -1
  297. package/dist/tracers/tracer_langchain_v1.d.cts +1 -1
  298. package/dist/tracers/tracer_langchain_v1.d.ts +1 -1
  299. package/dist/utils/chunk_array.cjs.map +1 -1
  300. package/dist/utils/chunk_array.js.map +1 -1
  301. package/dist/utils/env.cjs +1 -1
  302. package/dist/utils/env.cjs.map +1 -1
  303. package/dist/utils/env.js +1 -1
  304. package/dist/utils/env.js.map +1 -1
  305. package/dist/utils/event_source_parse.cjs.map +1 -1
  306. package/dist/utils/event_source_parse.d.cts.map +1 -1
  307. package/dist/utils/event_source_parse.d.ts.map +1 -1
  308. package/dist/utils/event_source_parse.js.map +1 -1
  309. package/dist/utils/hash.cjs +3 -8
  310. package/dist/utils/hash.cjs.map +1 -1
  311. package/dist/utils/hash.d.cts +1 -2
  312. package/dist/utils/hash.d.cts.map +1 -1
  313. package/dist/utils/hash.d.ts +1 -2
  314. package/dist/utils/hash.d.ts.map +1 -1
  315. package/dist/utils/hash.js +2 -6
  316. package/dist/utils/hash.js.map +1 -1
  317. package/dist/utils/js-sha256/hash.cjs +0 -9
  318. package/dist/utils/js-sha256/hash.cjs.map +1 -1
  319. package/dist/utils/js-sha256/hash.js +1 -5
  320. package/dist/utils/js-sha256/hash.js.map +1 -1
  321. package/dist/utils/json.cjs +2 -2
  322. package/dist/utils/json.cjs.map +1 -1
  323. package/dist/utils/json.js +2 -2
  324. package/dist/utils/json.js.map +1 -1
  325. package/dist/utils/json_schema.cjs +3 -2
  326. package/dist/utils/json_schema.cjs.map +1 -1
  327. package/dist/utils/json_schema.d.cts +8 -4
  328. package/dist/utils/json_schema.d.cts.map +1 -1
  329. package/dist/utils/json_schema.d.ts +8 -4
  330. package/dist/utils/json_schema.d.ts.map +1 -1
  331. package/dist/utils/json_schema.js +2 -1
  332. package/dist/utils/json_schema.js.map +1 -1
  333. package/dist/utils/stream.cjs.map +1 -1
  334. package/dist/utils/stream.js.map +1 -1
  335. package/dist/utils/testing/index.cjs.map +1 -1
  336. package/dist/utils/testing/index.d.cts +8 -12
  337. package/dist/utils/testing/index.d.cts.map +1 -1
  338. package/dist/utils/testing/index.d.ts +8 -12
  339. package/dist/utils/testing/index.d.ts.map +1 -1
  340. package/dist/utils/testing/index.js.map +1 -1
  341. package/dist/utils/zod-to-json-schema/Options.cjs +40 -0
  342. package/dist/utils/zod-to-json-schema/Options.cjs.map +1 -0
  343. package/dist/utils/zod-to-json-schema/Options.js +37 -0
  344. package/dist/utils/zod-to-json-schema/Options.js.map +1 -0
  345. package/dist/utils/zod-to-json-schema/Refs.cjs +30 -0
  346. package/dist/utils/zod-to-json-schema/Refs.cjs.map +1 -0
  347. package/dist/utils/zod-to-json-schema/Refs.js +30 -0
  348. package/dist/utils/zod-to-json-schema/Refs.js.map +1 -0
  349. package/dist/utils/zod-to-json-schema/errorMessages.cjs +18 -0
  350. package/dist/utils/zod-to-json-schema/errorMessages.cjs.map +1 -0
  351. package/dist/utils/zod-to-json-schema/errorMessages.d.cts +11 -0
  352. package/dist/utils/zod-to-json-schema/errorMessages.d.cts.map +1 -0
  353. package/dist/utils/zod-to-json-schema/errorMessages.d.ts +11 -0
  354. package/dist/utils/zod-to-json-schema/errorMessages.d.ts.map +1 -0
  355. package/dist/utils/zod-to-json-schema/errorMessages.js +16 -0
  356. package/dist/utils/zod-to-json-schema/errorMessages.js.map +1 -0
  357. package/dist/utils/zod-to-json-schema/getRelativePath.cjs +11 -0
  358. package/dist/utils/zod-to-json-schema/getRelativePath.cjs.map +1 -0
  359. package/dist/utils/zod-to-json-schema/getRelativePath.js +10 -0
  360. package/dist/utils/zod-to-json-schema/getRelativePath.js.map +1 -0
  361. package/dist/utils/zod-to-json-schema/index.cjs +37 -0
  362. package/dist/utils/zod-to-json-schema/index.js +37 -0
  363. package/dist/utils/zod-to-json-schema/parseDef.cjs +57 -0
  364. package/dist/utils/zod-to-json-schema/parseDef.cjs.map +1 -0
  365. package/dist/utils/zod-to-json-schema/parseDef.js +57 -0
  366. package/dist/utils/zod-to-json-schema/parseDef.js.map +1 -0
  367. package/dist/utils/zod-to-json-schema/parseTypes.d.cts +38 -0
  368. package/dist/utils/zod-to-json-schema/parseTypes.d.cts.map +1 -0
  369. package/dist/utils/zod-to-json-schema/parseTypes.d.ts +38 -0
  370. package/dist/utils/zod-to-json-schema/parseTypes.d.ts.map +1 -0
  371. package/dist/utils/zod-to-json-schema/parsers/any.cjs +17 -0
  372. package/dist/utils/zod-to-json-schema/parsers/any.cjs.map +1 -0
  373. package/dist/utils/zod-to-json-schema/parsers/any.d.cts +7 -0
  374. package/dist/utils/zod-to-json-schema/parsers/any.d.cts.map +1 -0
  375. package/dist/utils/zod-to-json-schema/parsers/any.d.ts +7 -0
  376. package/dist/utils/zod-to-json-schema/parsers/any.d.ts.map +1 -0
  377. package/dist/utils/zod-to-json-schema/parsers/any.js +17 -0
  378. package/dist/utils/zod-to-json-schema/parsers/any.js.map +1 -0
  379. package/dist/utils/zod-to-json-schema/parsers/array.cjs +24 -0
  380. package/dist/utils/zod-to-json-schema/parsers/array.cjs.map +1 -0
  381. package/dist/utils/zod-to-json-schema/parsers/array.d.cts +14 -0
  382. package/dist/utils/zod-to-json-schema/parsers/array.d.cts.map +1 -0
  383. package/dist/utils/zod-to-json-schema/parsers/array.d.ts +15 -0
  384. package/dist/utils/zod-to-json-schema/parsers/array.d.ts.map +1 -0
  385. package/dist/utils/zod-to-json-schema/parsers/array.js +23 -0
  386. package/dist/utils/zod-to-json-schema/parsers/array.js.map +1 -0
  387. package/dist/utils/zod-to-json-schema/parsers/bigint.cjs +36 -0
  388. package/dist/utils/zod-to-json-schema/parsers/bigint.cjs.map +1 -0
  389. package/dist/utils/zod-to-json-schema/parsers/bigint.d.cts +16 -0
  390. package/dist/utils/zod-to-json-schema/parsers/bigint.d.cts.map +1 -0
  391. package/dist/utils/zod-to-json-schema/parsers/bigint.d.ts +17 -0
  392. package/dist/utils/zod-to-json-schema/parsers/bigint.d.ts.map +1 -0
  393. package/dist/utils/zod-to-json-schema/parsers/bigint.js +36 -0
  394. package/dist/utils/zod-to-json-schema/parsers/bigint.js.map +1 -0
  395. package/dist/utils/zod-to-json-schema/parsers/boolean.cjs +9 -0
  396. package/dist/utils/zod-to-json-schema/parsers/boolean.cjs.map +1 -0
  397. package/dist/utils/zod-to-json-schema/parsers/boolean.d.cts +7 -0
  398. package/dist/utils/zod-to-json-schema/parsers/boolean.d.cts.map +1 -0
  399. package/dist/utils/zod-to-json-schema/parsers/boolean.d.ts +7 -0
  400. package/dist/utils/zod-to-json-schema/parsers/boolean.d.ts.map +1 -0
  401. package/dist/utils/zod-to-json-schema/parsers/boolean.js +8 -0
  402. package/dist/utils/zod-to-json-schema/parsers/boolean.js.map +1 -0
  403. package/dist/utils/zod-to-json-schema/parsers/branded.cjs +10 -0
  404. package/dist/utils/zod-to-json-schema/parsers/branded.cjs.map +1 -0
  405. package/dist/utils/zod-to-json-schema/parsers/branded.js +10 -0
  406. package/dist/utils/zod-to-json-schema/parsers/branded.js.map +1 -0
  407. package/dist/utils/zod-to-json-schema/parsers/catch.cjs +10 -0
  408. package/dist/utils/zod-to-json-schema/parsers/catch.cjs.map +1 -0
  409. package/dist/utils/zod-to-json-schema/parsers/catch.js +10 -0
  410. package/dist/utils/zod-to-json-schema/parsers/catch.js.map +1 -0
  411. package/dist/utils/zod-to-json-schema/parsers/date.cjs +39 -0
  412. package/dist/utils/zod-to-json-schema/parsers/date.cjs.map +1 -0
  413. package/dist/utils/zod-to-json-schema/parsers/date.d.cts +17 -0
  414. package/dist/utils/zod-to-json-schema/parsers/date.d.cts.map +1 -0
  415. package/dist/utils/zod-to-json-schema/parsers/date.d.ts +17 -0
  416. package/dist/utils/zod-to-json-schema/parsers/date.d.ts.map +1 -0
  417. package/dist/utils/zod-to-json-schema/parsers/date.js +39 -0
  418. package/dist/utils/zod-to-json-schema/parsers/date.js.map +1 -0
  419. package/dist/utils/zod-to-json-schema/parsers/default.cjs +13 -0
  420. package/dist/utils/zod-to-json-schema/parsers/default.cjs.map +1 -0
  421. package/dist/utils/zod-to-json-schema/parsers/default.js +13 -0
  422. package/dist/utils/zod-to-json-schema/parsers/default.js.map +1 -0
  423. package/dist/utils/zod-to-json-schema/parsers/effects.cjs +11 -0
  424. package/dist/utils/zod-to-json-schema/parsers/effects.cjs.map +1 -0
  425. package/dist/utils/zod-to-json-schema/parsers/effects.js +11 -0
  426. package/dist/utils/zod-to-json-schema/parsers/effects.js.map +1 -0
  427. package/dist/utils/zod-to-json-schema/parsers/enum.cjs +12 -0
  428. package/dist/utils/zod-to-json-schema/parsers/enum.cjs.map +1 -0
  429. package/dist/utils/zod-to-json-schema/parsers/enum.d.cts +8 -0
  430. package/dist/utils/zod-to-json-schema/parsers/enum.d.cts.map +1 -0
  431. package/dist/utils/zod-to-json-schema/parsers/enum.d.ts +10 -0
  432. package/dist/utils/zod-to-json-schema/parsers/enum.d.ts.map +1 -0
  433. package/dist/utils/zod-to-json-schema/parsers/enum.js +11 -0
  434. package/dist/utils/zod-to-json-schema/parsers/enum.js.map +1 -0
  435. package/dist/utils/zod-to-json-schema/parsers/intersection.cjs +47 -0
  436. package/dist/utils/zod-to-json-schema/parsers/intersection.cjs.map +1 -0
  437. package/dist/utils/zod-to-json-schema/parsers/intersection.d.cts +10 -0
  438. package/dist/utils/zod-to-json-schema/parsers/intersection.d.cts.map +1 -0
  439. package/dist/utils/zod-to-json-schema/parsers/intersection.d.ts +11 -0
  440. package/dist/utils/zod-to-json-schema/parsers/intersection.d.ts.map +1 -0
  441. package/dist/utils/zod-to-json-schema/parsers/intersection.js +47 -0
  442. package/dist/utils/zod-to-json-schema/parsers/intersection.js.map +1 -0
  443. package/dist/utils/zod-to-json-schema/parsers/literal.cjs +18 -0
  444. package/dist/utils/zod-to-json-schema/parsers/literal.cjs.map +1 -0
  445. package/dist/utils/zod-to-json-schema/parsers/literal.d.cts +11 -0
  446. package/dist/utils/zod-to-json-schema/parsers/literal.d.cts.map +1 -0
  447. package/dist/utils/zod-to-json-schema/parsers/literal.d.ts +12 -0
  448. package/dist/utils/zod-to-json-schema/parsers/literal.d.ts.map +1 -0
  449. package/dist/utils/zod-to-json-schema/parsers/literal.js +17 -0
  450. package/dist/utils/zod-to-json-schema/parsers/literal.js.map +1 -0
  451. package/dist/utils/zod-to-json-schema/parsers/map.cjs +40 -0
  452. package/dist/utils/zod-to-json-schema/parsers/map.cjs.map +1 -0
  453. package/dist/utils/zod-to-json-schema/parsers/map.d.cts +17 -0
  454. package/dist/utils/zod-to-json-schema/parsers/map.d.cts.map +1 -0
  455. package/dist/utils/zod-to-json-schema/parsers/map.d.ts +17 -0
  456. package/dist/utils/zod-to-json-schema/parsers/map.d.ts.map +1 -0
  457. package/dist/utils/zod-to-json-schema/parsers/map.js +40 -0
  458. package/dist/utils/zod-to-json-schema/parsers/map.js.map +1 -0
  459. package/dist/utils/zod-to-json-schema/parsers/nativeEnum.cjs +18 -0
  460. package/dist/utils/zod-to-json-schema/parsers/nativeEnum.cjs.map +1 -0
  461. package/dist/utils/zod-to-json-schema/parsers/nativeEnum.d.cts +8 -0
  462. package/dist/utils/zod-to-json-schema/parsers/nativeEnum.d.cts.map +1 -0
  463. package/dist/utils/zod-to-json-schema/parsers/nativeEnum.d.ts +10 -0
  464. package/dist/utils/zod-to-json-schema/parsers/nativeEnum.d.ts.map +1 -0
  465. package/dist/utils/zod-to-json-schema/parsers/nativeEnum.js +17 -0
  466. package/dist/utils/zod-to-json-schema/parsers/nativeEnum.js.map +1 -0
  467. package/dist/utils/zod-to-json-schema/parsers/never.cjs +13 -0
  468. package/dist/utils/zod-to-json-schema/parsers/never.cjs.map +1 -0
  469. package/dist/utils/zod-to-json-schema/parsers/never.d.cts +9 -0
  470. package/dist/utils/zod-to-json-schema/parsers/never.d.cts.map +1 -0
  471. package/dist/utils/zod-to-json-schema/parsers/never.d.ts +9 -0
  472. package/dist/utils/zod-to-json-schema/parsers/never.d.ts.map +1 -0
  473. package/dist/utils/zod-to-json-schema/parsers/never.js +13 -0
  474. package/dist/utils/zod-to-json-schema/parsers/never.js.map +1 -0
  475. package/dist/utils/zod-to-json-schema/parsers/null.cjs +12 -0
  476. package/dist/utils/zod-to-json-schema/parsers/null.cjs.map +1 -0
  477. package/dist/utils/zod-to-json-schema/parsers/null.d.cts +7 -0
  478. package/dist/utils/zod-to-json-schema/parsers/null.d.cts.map +1 -0
  479. package/dist/utils/zod-to-json-schema/parsers/null.d.ts +7 -0
  480. package/dist/utils/zod-to-json-schema/parsers/null.d.ts.map +1 -0
  481. package/dist/utils/zod-to-json-schema/parsers/null.js +11 -0
  482. package/dist/utils/zod-to-json-schema/parsers/null.js.map +1 -0
  483. package/dist/utils/zod-to-json-schema/parsers/nullable.cjs +46 -0
  484. package/dist/utils/zod-to-json-schema/parsers/nullable.cjs.map +1 -0
  485. package/dist/utils/zod-to-json-schema/parsers/nullable.d.cts +12 -0
  486. package/dist/utils/zod-to-json-schema/parsers/nullable.d.cts.map +1 -0
  487. package/dist/utils/zod-to-json-schema/parsers/nullable.d.ts +13 -0
  488. package/dist/utils/zod-to-json-schema/parsers/nullable.d.ts.map +1 -0
  489. package/dist/utils/zod-to-json-schema/parsers/nullable.js +46 -0
  490. package/dist/utils/zod-to-json-schema/parsers/nullable.js.map +1 -0
  491. package/dist/utils/zod-to-json-schema/parsers/number.cjs +37 -0
  492. package/dist/utils/zod-to-json-schema/parsers/number.cjs.map +1 -0
  493. package/dist/utils/zod-to-json-schema/parsers/number.d.cts +15 -0
  494. package/dist/utils/zod-to-json-schema/parsers/number.d.cts.map +1 -0
  495. package/dist/utils/zod-to-json-schema/parsers/number.d.ts +16 -0
  496. package/dist/utils/zod-to-json-schema/parsers/number.d.ts.map +1 -0
  497. package/dist/utils/zod-to-json-schema/parsers/number.js +37 -0
  498. package/dist/utils/zod-to-json-schema/parsers/number.js.map +1 -0
  499. package/dist/utils/zod-to-json-schema/parsers/object.cjs +64 -0
  500. package/dist/utils/zod-to-json-schema/parsers/object.cjs.map +1 -0
  501. package/dist/utils/zod-to-json-schema/parsers/object.d.cts +12 -0
  502. package/dist/utils/zod-to-json-schema/parsers/object.d.cts.map +1 -0
  503. package/dist/utils/zod-to-json-schema/parsers/object.d.ts +13 -0
  504. package/dist/utils/zod-to-json-schema/parsers/object.d.ts.map +1 -0
  505. package/dist/utils/zod-to-json-schema/parsers/object.js +64 -0
  506. package/dist/utils/zod-to-json-schema/parsers/object.js.map +1 -0
  507. package/dist/utils/zod-to-json-schema/parsers/optional.cjs +20 -0
  508. package/dist/utils/zod-to-json-schema/parsers/optional.cjs.map +1 -0
  509. package/dist/utils/zod-to-json-schema/parsers/optional.js +20 -0
  510. package/dist/utils/zod-to-json-schema/parsers/optional.js.map +1 -0
  511. package/dist/utils/zod-to-json-schema/parsers/pipeline.cjs +28 -0
  512. package/dist/utils/zod-to-json-schema/parsers/pipeline.cjs.map +1 -0
  513. package/dist/utils/zod-to-json-schema/parsers/pipeline.js +28 -0
  514. package/dist/utils/zod-to-json-schema/parsers/pipeline.js.map +1 -0
  515. package/dist/utils/zod-to-json-schema/parsers/promise.cjs +10 -0
  516. package/dist/utils/zod-to-json-schema/parsers/promise.cjs.map +1 -0
  517. package/dist/utils/zod-to-json-schema/parsers/promise.js +10 -0
  518. package/dist/utils/zod-to-json-schema/parsers/promise.js.map +1 -0
  519. package/dist/utils/zod-to-json-schema/parsers/readonly.cjs +10 -0
  520. package/dist/utils/zod-to-json-schema/parsers/readonly.cjs.map +1 -0
  521. package/dist/utils/zod-to-json-schema/parsers/readonly.js +10 -0
  522. package/dist/utils/zod-to-json-schema/parsers/readonly.js.map +1 -0
  523. package/dist/utils/zod-to-json-schema/parsers/record.cjs +57 -0
  524. package/dist/utils/zod-to-json-schema/parsers/record.cjs.map +1 -0
  525. package/dist/utils/zod-to-json-schema/parsers/record.d.cts +14 -0
  526. package/dist/utils/zod-to-json-schema/parsers/record.d.cts.map +1 -0
  527. package/dist/utils/zod-to-json-schema/parsers/record.d.ts +15 -0
  528. package/dist/utils/zod-to-json-schema/parsers/record.d.ts.map +1 -0
  529. package/dist/utils/zod-to-json-schema/parsers/record.js +56 -0
  530. package/dist/utils/zod-to-json-schema/parsers/record.js.map +1 -0
  531. package/dist/utils/zod-to-json-schema/parsers/set.cjs +22 -0
  532. package/dist/utils/zod-to-json-schema/parsers/set.cjs.map +1 -0
  533. package/dist/utils/zod-to-json-schema/parsers/set.d.cts +15 -0
  534. package/dist/utils/zod-to-json-schema/parsers/set.d.cts.map +1 -0
  535. package/dist/utils/zod-to-json-schema/parsers/set.d.ts +16 -0
  536. package/dist/utils/zod-to-json-schema/parsers/set.d.ts.map +1 -0
  537. package/dist/utils/zod-to-json-schema/parsers/set.js +22 -0
  538. package/dist/utils/zod-to-json-schema/parsers/set.js.map +1 -0
  539. package/dist/utils/zod-to-json-schema/parsers/string.cjs +255 -0
  540. package/dist/utils/zod-to-json-schema/parsers/string.cjs.map +1 -0
  541. package/dist/utils/zod-to-json-schema/parsers/string.d.cts +28 -0
  542. package/dist/utils/zod-to-json-schema/parsers/string.d.cts.map +1 -0
  543. package/dist/utils/zod-to-json-schema/parsers/string.d.ts +29 -0
  544. package/dist/utils/zod-to-json-schema/parsers/string.d.ts.map +1 -0
  545. package/dist/utils/zod-to-json-schema/parsers/string.js +254 -0
  546. package/dist/utils/zod-to-json-schema/parsers/string.js.map +1 -0
  547. package/dist/utils/zod-to-json-schema/parsers/tuple.cjs +38 -0
  548. package/dist/utils/zod-to-json-schema/parsers/tuple.cjs.map +1 -0
  549. package/dist/utils/zod-to-json-schema/parsers/tuple.d.cts +15 -0
  550. package/dist/utils/zod-to-json-schema/parsers/tuple.d.cts.map +1 -0
  551. package/dist/utils/zod-to-json-schema/parsers/tuple.d.ts +16 -0
  552. package/dist/utils/zod-to-json-schema/parsers/tuple.d.ts.map +1 -0
  553. package/dist/utils/zod-to-json-schema/parsers/tuple.js +38 -0
  554. package/dist/utils/zod-to-json-schema/parsers/tuple.js.map +1 -0
  555. package/dist/utils/zod-to-json-schema/parsers/undefined.cjs +10 -0
  556. package/dist/utils/zod-to-json-schema/parsers/undefined.cjs.map +1 -0
  557. package/dist/utils/zod-to-json-schema/parsers/undefined.d.cts +9 -0
  558. package/dist/utils/zod-to-json-schema/parsers/undefined.d.cts.map +1 -0
  559. package/dist/utils/zod-to-json-schema/parsers/undefined.d.ts +9 -0
  560. package/dist/utils/zod-to-json-schema/parsers/undefined.d.ts.map +1 -0
  561. package/dist/utils/zod-to-json-schema/parsers/undefined.js +10 -0
  562. package/dist/utils/zod-to-json-schema/parsers/undefined.js.map +1 -0
  563. package/dist/utils/zod-to-json-schema/parsers/union.cjs +67 -0
  564. package/dist/utils/zod-to-json-schema/parsers/union.cjs.map +1 -0
  565. package/dist/utils/zod-to-json-schema/parsers/union.d.cts +24 -0
  566. package/dist/utils/zod-to-json-schema/parsers/union.d.cts.map +1 -0
  567. package/dist/utils/zod-to-json-schema/parsers/union.d.ts +25 -0
  568. package/dist/utils/zod-to-json-schema/parsers/union.d.ts.map +1 -0
  569. package/dist/utils/zod-to-json-schema/parsers/union.js +66 -0
  570. package/dist/utils/zod-to-json-schema/parsers/union.js.map +1 -0
  571. package/dist/utils/zod-to-json-schema/parsers/unknown.cjs +10 -0
  572. package/dist/utils/zod-to-json-schema/parsers/unknown.cjs.map +1 -0
  573. package/dist/utils/zod-to-json-schema/parsers/unknown.d.cts +7 -0
  574. package/dist/utils/zod-to-json-schema/parsers/unknown.d.cts.map +1 -0
  575. package/dist/utils/zod-to-json-schema/parsers/unknown.d.ts +7 -0
  576. package/dist/utils/zod-to-json-schema/parsers/unknown.d.ts.map +1 -0
  577. package/dist/utils/zod-to-json-schema/parsers/unknown.js +10 -0
  578. package/dist/utils/zod-to-json-schema/parsers/unknown.js.map +1 -0
  579. package/dist/utils/zod-to-json-schema/selectParser.cjs +81 -0
  580. package/dist/utils/zod-to-json-schema/selectParser.cjs.map +1 -0
  581. package/dist/utils/zod-to-json-schema/selectParser.js +80 -0
  582. package/dist/utils/zod-to-json-schema/selectParser.js.map +1 -0
  583. package/dist/utils/zod-to-json-schema/zodToJsonSchema.cjs +70 -0
  584. package/dist/utils/zod-to-json-schema/zodToJsonSchema.cjs.map +1 -0
  585. package/dist/utils/zod-to-json-schema/zodToJsonSchema.js +70 -0
  586. package/dist/utils/zod-to-json-schema/zodToJsonSchema.js.map +1 -0
  587. package/package.json +7 -36
  588. package/dist/utils/js-sha1/hash.cjs +0 -291
  589. package/dist/utils/js-sha1/hash.cjs.map +0 -1
  590. package/dist/utils/js-sha1/hash.d.cts +0 -9
  591. package/dist/utils/js-sha1/hash.d.cts.map +0 -1
  592. package/dist/utils/js-sha1/hash.d.ts +0 -9
  593. package/dist/utils/js-sha1/hash.d.ts.map +0 -1
  594. package/dist/utils/js-sha1/hash.js +0 -284
  595. package/dist/utils/js-sha1/hash.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"chat.cjs","names":["BaseMessage","fields: string | ChatMessageFieldsWithRole","role?: string","message: BaseMessage","BaseMessageChunk","chunk: ChatMessageChunk","mergeContent","_mergeDicts","x: BaseMessage","x: BaseMessageChunk"],"sources":["../../src/messages/chat.ts"],"sourcesContent":["import {\n BaseMessage,\n BaseMessageChunk,\n type BaseMessageFields,\n mergeContent,\n _mergeDicts,\n type MessageType,\n} from \"./base.js\";\n\nexport interface ChatMessageFieldsWithRole extends BaseMessageFields {\n role: string;\n}\n\n/**\n * Represents a chat message in a conversation.\n */\nexport class ChatMessage\n extends BaseMessage\n implements ChatMessageFieldsWithRole\n{\n static lc_name() {\n return \"ChatMessage\";\n }\n\n role: string;\n\n static _chatMessageClass(): typeof ChatMessage {\n return ChatMessage;\n }\n\n constructor(content: string, role: string);\n\n constructor(fields: ChatMessageFieldsWithRole);\n\n constructor(fields: string | ChatMessageFieldsWithRole, role?: string) {\n if (typeof fields === \"string\") {\n // eslint-disable-next-line no-param-reassign, @typescript-eslint/no-non-null-assertion\n fields = { content: fields, role: role! };\n }\n super(fields);\n this.role = fields.role;\n }\n\n _getType(): MessageType {\n return \"generic\";\n }\n\n static isInstance(message: BaseMessage): message is ChatMessage {\n return message._getType() === \"generic\";\n }\n\n override get _printableFields(): Record<string, unknown> {\n return {\n ...super._printableFields,\n role: this.role,\n };\n }\n}\n\n/**\n * Represents a chunk of a chat message, which can be concatenated with\n * other chat message chunks.\n */\nexport class ChatMessageChunk extends BaseMessageChunk {\n static lc_name() {\n return \"ChatMessageChunk\";\n }\n\n role: string;\n\n constructor(content: string, role: string);\n\n constructor(fields: ChatMessageFieldsWithRole);\n\n constructor(fields: string | ChatMessageFieldsWithRole, role?: string) {\n if (typeof fields === \"string\") {\n // eslint-disable-next-line no-param-reassign, @typescript-eslint/no-non-null-assertion\n fields = { content: fields, role: role! };\n }\n super(fields);\n this.role = fields.role;\n }\n\n _getType(): MessageType {\n return \"generic\";\n }\n\n concat(chunk: ChatMessageChunk) {\n return new ChatMessageChunk({\n content: mergeContent(this.content, chunk.content),\n additional_kwargs: _mergeDicts(\n this.additional_kwargs,\n chunk.additional_kwargs\n ),\n response_metadata: _mergeDicts(\n this.response_metadata,\n chunk.response_metadata\n ),\n role: this.role,\n id: this.id ?? chunk.id,\n });\n }\n\n override get _printableFields(): Record<string, unknown> {\n return {\n ...super._printableFields,\n role: this.role,\n };\n }\n}\n\nexport function isChatMessage(x: BaseMessage): x is ChatMessage {\n return x._getType() === \"generic\";\n}\n\nexport function isChatMessageChunk(x: BaseMessageChunk): x is ChatMessageChunk {\n return x._getType() === \"generic\";\n}\n"],"mappings":";;;;;;AAgBA,IAAa,cAAb,MAAa,oBACHA,yBAEV;CACE,OAAO,UAAU;AACf,SAAO;CACR;CAED;CAEA,OAAO,oBAAwC;AAC7C,SAAO;CACR;CAMD,YAAYC,QAA4CC,MAAe;AACrE,MAAI,OAAO,WAAW,UAEpB,SAAS;GAAE,SAAS;GAAc;EAAO;EAE3C,MAAM,OAAO;EACb,KAAK,OAAO,OAAO;CACpB;CAED,WAAwB;AACtB,SAAO;CACR;CAED,OAAO,WAAWC,SAA8C;AAC9D,SAAO,QAAQ,UAAU,KAAK;CAC/B;CAED,IAAa,mBAA4C;AACvD,SAAO;GACL,GAAG,MAAM;GACT,MAAM,KAAK;EACZ;CACF;AACF;;;;;AAMD,IAAa,mBAAb,MAAa,yBAAyBC,8BAAiB;CACrD,OAAO,UAAU;AACf,SAAO;CACR;CAED;CAMA,YAAYH,QAA4CC,MAAe;AACrE,MAAI,OAAO,WAAW,UAEpB,SAAS;GAAE,SAAS;GAAc;EAAO;EAE3C,MAAM,OAAO;EACb,KAAK,OAAO,OAAO;CACpB;CAED,WAAwB;AACtB,SAAO;CACR;CAED,OAAOG,OAAyB;AAC9B,SAAO,IAAI,iBAAiB;GAC1B,SAASC,0BAAa,KAAK,SAAS,MAAM,QAAQ;GAClD,mBAAmBC,yBACjB,KAAK,mBACL,MAAM,kBACP;GACD,mBAAmBA,yBACjB,KAAK,mBACL,MAAM,kBACP;GACD,MAAM,KAAK;GACX,IAAI,KAAK,MAAM,MAAM;EACtB;CACF;CAED,IAAa,mBAA4C;AACvD,SAAO;GACL,GAAG,MAAM;GACT,MAAM,KAAK;EACZ;CACF;AACF;AAED,SAAgB,cAAcC,GAAkC;AAC9D,QAAO,EAAE,UAAU,KAAK;AACzB;AAED,SAAgB,mBAAmBC,GAA4C;AAC7E,QAAO,EAAE,UAAU,KAAK;AACzB"}
1
+ {"version":3,"file":"chat.cjs","names":["BaseMessage","fields:\n | $InferMessageContent<TStructure, \"generic\">\n | ChatMessageFields<TStructure>","role?: string","obj: unknown","BaseMessageChunk","chunk: ChatMessageChunk<TStructure>","mergeContent","_mergeDicts","x: BaseMessage","x: BaseMessageChunk"],"sources":["../../src/messages/chat.ts"],"sourcesContent":["import {\n BaseMessage,\n BaseMessageChunk,\n type BaseMessageFields,\n mergeContent,\n _mergeDicts,\n} from \"./base.js\";\nimport { $InferMessageContent, MessageStructure } from \"./message.js\";\nimport { Constructor } from \"./utils.js\";\n\nexport interface ChatMessageFields<\n TStructure extends MessageStructure = MessageStructure\n> extends BaseMessageFields<TStructure, \"generic\"> {\n role: string;\n}\n\n/**\n * Represents a chat message in a conversation.\n */\nexport class ChatMessage<TStructure extends MessageStructure = MessageStructure>\n extends BaseMessage<TStructure, \"generic\">\n implements ChatMessageFields<TStructure>\n{\n static lc_name() {\n return \"ChatMessage\";\n }\n\n readonly type = \"generic\" as const;\n\n role: string;\n\n static _chatMessageClass(): typeof ChatMessage {\n return ChatMessage;\n }\n\n constructor(\n content: $InferMessageContent<TStructure, \"generic\">,\n role: string\n );\n\n constructor(fields: ChatMessageFields<TStructure>);\n\n constructor(\n fields:\n | $InferMessageContent<TStructure, \"generic\">\n | ChatMessageFields<TStructure>,\n role?: string\n ) {\n if (typeof fields === \"string\" || Array.isArray(fields)) {\n // eslint-disable-next-line no-param-reassign, @typescript-eslint/no-non-null-assertion\n fields = { content: fields, role: role! };\n }\n super(fields);\n this.role = fields.role;\n }\n\n static isInstance(obj: unknown): obj is ChatMessage {\n return super.isInstance(obj) && obj.type === \"generic\";\n }\n\n override get _printableFields(): Record<string, unknown> {\n return {\n ...super._printableFields,\n role: this.role,\n };\n }\n}\n\n/**\n * Represents a chunk of a chat message, which can be concatenated with\n * other chat message chunks.\n */\nexport class ChatMessageChunk<\n TStructure extends MessageStructure = MessageStructure\n> extends BaseMessageChunk<TStructure, \"generic\"> {\n static lc_name() {\n return \"ChatMessageChunk\";\n }\n\n readonly type = \"generic\" as const;\n\n role: string;\n\n constructor(\n content: $InferMessageContent<TStructure, \"generic\">,\n role: string\n );\n\n constructor(fields: ChatMessageFields<TStructure>);\n\n constructor(\n fields:\n | $InferMessageContent<TStructure, \"generic\">\n | ChatMessageFields<TStructure>,\n role?: string\n ) {\n if (typeof fields === \"string\" || Array.isArray(fields)) {\n // eslint-disable-next-line no-param-reassign, @typescript-eslint/no-non-null-assertion\n fields = { content: fields, role: role! };\n }\n super(fields);\n this.role = fields.role;\n }\n\n concat(chunk: ChatMessageChunk<TStructure>) {\n const Cls = this.constructor as Constructor<this>;\n return new Cls({\n content: mergeContent(this.content, chunk.content),\n additional_kwargs: _mergeDicts(\n this.additional_kwargs,\n chunk.additional_kwargs\n ),\n response_metadata: _mergeDicts(\n this.response_metadata,\n chunk.response_metadata\n ),\n role: this.role,\n id: this.id ?? chunk.id,\n });\n }\n\n static isInstance(obj: unknown): obj is ChatMessageChunk {\n return super.isInstance(obj) && obj.type === \"generic\";\n }\n\n override get _printableFields(): Record<string, unknown> {\n return {\n ...super._printableFields,\n role: this.role,\n };\n }\n}\n\n/**\n * @deprecated Use {@link ChatMessage.isInstance} instead\n */\nexport function isChatMessage(x: BaseMessage): x is ChatMessage {\n return x._getType() === \"generic\";\n}\n\n/**\n * @deprecated Use {@link ChatMessageChunk.isInstance} instead\n */\nexport function isChatMessageChunk(x: BaseMessageChunk): x is ChatMessageChunk {\n return x._getType() === \"generic\";\n}\n"],"mappings":";;;;;;AAmBA,IAAa,cAAb,MAAa,oBACHA,yBAEV;CACE,OAAO,UAAU;AACf,SAAO;CACR;CAED,AAAS,OAAO;CAEhB;CAEA,OAAO,oBAAwC;AAC7C,SAAO;CACR;CASD,YACEC,QAGAC,MACA;AACA,MAAI,OAAO,WAAW,YAAY,MAAM,QAAQ,OAAO,EAErD,SAAS;GAAE,SAAS;GAAc;EAAO;EAE3C,MAAM,OAAO;EACb,KAAK,OAAO,OAAO;CACpB;CAED,OAAO,WAAWC,KAAkC;AAClD,SAAO,MAAM,WAAW,IAAI,IAAI,IAAI,SAAS;CAC9C;CAED,IAAa,mBAA4C;AACvD,SAAO;GACL,GAAG,MAAM;GACT,MAAM,KAAK;EACZ;CACF;AACF;;;;;AAMD,IAAa,mBAAb,cAEUC,8BAAwC;CAChD,OAAO,UAAU;AACf,SAAO;CACR;CAED,AAAS,OAAO;CAEhB;CASA,YACEH,QAGAC,MACA;AACA,MAAI,OAAO,WAAW,YAAY,MAAM,QAAQ,OAAO,EAErD,SAAS;GAAE,SAAS;GAAc;EAAO;EAE3C,MAAM,OAAO;EACb,KAAK,OAAO,OAAO;CACpB;CAED,OAAOG,OAAqC;EAC1C,MAAM,MAAM,KAAK;AACjB,SAAO,IAAI,IAAI;GACb,SAASC,0BAAa,KAAK,SAAS,MAAM,QAAQ;GAClD,mBAAmBC,yBACjB,KAAK,mBACL,MAAM,kBACP;GACD,mBAAmBA,yBACjB,KAAK,mBACL,MAAM,kBACP;GACD,MAAM,KAAK;GACX,IAAI,KAAK,MAAM,MAAM;EACtB;CACF;CAED,OAAO,WAAWJ,KAAuC;AACvD,SAAO,MAAM,WAAW,IAAI,IAAI,IAAI,SAAS;CAC9C;CAED,IAAa,mBAA4C;AACvD,SAAO;GACL,GAAG,MAAM;GACT,MAAM,KAAK;EACZ;CACF;AACF;;;;AAKD,SAAgB,cAAcK,GAAkC;AAC9D,QAAO,EAAE,UAAU,KAAK;AACzB;;;;AAKD,SAAgB,mBAAmBC,GAA4C;AAC7E,QAAO,EAAE,UAAU,KAAK;AACzB"}
@@ -1,37 +1,45 @@
1
- import { BaseMessage, BaseMessageChunk, BaseMessageFields, MessageType } from "./base.cjs";
1
+ import { BaseMessage, BaseMessageChunk, BaseMessageFields } from "./base.cjs";
2
+ import { $InferMessageContent, MessageStructure } from "./message.cjs";
2
3
 
3
4
  //#region src/messages/chat.d.ts
4
- interface ChatMessageFieldsWithRole extends BaseMessageFields {
5
+ interface ChatMessageFields<TStructure extends MessageStructure = MessageStructure> extends BaseMessageFields<TStructure, "generic"> {
5
6
  role: string;
6
7
  }
7
8
  /**
8
9
  * Represents a chat message in a conversation.
9
10
  */
10
- declare class ChatMessage extends BaseMessage implements ChatMessageFieldsWithRole {
11
+ declare class ChatMessage<TStructure extends MessageStructure = MessageStructure> extends BaseMessage<TStructure, "generic"> implements ChatMessageFields<TStructure> {
11
12
  static lc_name(): string;
13
+ readonly type: "generic";
12
14
  role: string;
13
15
  static _chatMessageClass(): typeof ChatMessage;
14
- constructor(content: string, role: string);
15
- constructor(fields: ChatMessageFieldsWithRole);
16
- _getType(): MessageType;
17
- static isInstance(message: BaseMessage): message is ChatMessage;
16
+ constructor(content: $InferMessageContent<TStructure, "generic">, role: string);
17
+ constructor(fields: ChatMessageFields<TStructure>);
18
+ static isInstance(obj: unknown): obj is ChatMessage;
18
19
  get _printableFields(): Record<string, unknown>;
19
20
  }
20
21
  /**
21
22
  * Represents a chunk of a chat message, which can be concatenated with
22
23
  * other chat message chunks.
23
24
  */
24
- declare class ChatMessageChunk extends BaseMessageChunk {
25
+ declare class ChatMessageChunk<TStructure extends MessageStructure = MessageStructure> extends BaseMessageChunk<TStructure, "generic"> {
25
26
  static lc_name(): string;
27
+ readonly type: "generic";
26
28
  role: string;
27
- constructor(content: string, role: string);
28
- constructor(fields: ChatMessageFieldsWithRole);
29
- _getType(): MessageType;
30
- concat(chunk: ChatMessageChunk): ChatMessageChunk;
29
+ constructor(content: $InferMessageContent<TStructure, "generic">, role: string);
30
+ constructor(fields: ChatMessageFields<TStructure>);
31
+ concat(chunk: ChatMessageChunk<TStructure>): this;
32
+ static isInstance(obj: unknown): obj is ChatMessageChunk;
31
33
  get _printableFields(): Record<string, unknown>;
32
34
  }
35
+ /**
36
+ * @deprecated Use {@link ChatMessage.isInstance} instead
37
+ */
33
38
  declare function isChatMessage(x: BaseMessage): x is ChatMessage;
39
+ /**
40
+ * @deprecated Use {@link ChatMessageChunk.isInstance} instead
41
+ */
34
42
  declare function isChatMessageChunk(x: BaseMessageChunk): x is ChatMessageChunk;
35
43
  //#endregion
36
- export { ChatMessage, ChatMessageChunk, ChatMessageFieldsWithRole, isChatMessage, isChatMessageChunk };
44
+ export { ChatMessage, ChatMessageChunk, ChatMessageFields, isChatMessage, isChatMessageChunk };
37
45
  //# sourceMappingURL=chat.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"chat.d.cts","names":["BaseMessage","BaseMessageChunk","BaseMessageFields","MessageType","ChatMessageFieldsWithRole","ChatMessage","Record","ChatMessageChunk","isChatMessage","isChatMessageChunk"],"sources":["../../src/messages/chat.d.ts"],"sourcesContent":["import { BaseMessage, BaseMessageChunk, type BaseMessageFields, type MessageType } from \"./base.js\";\nexport interface ChatMessageFieldsWithRole extends BaseMessageFields {\n role: string;\n}\n/**\n * Represents a chat message in a conversation.\n */\nexport declare class ChatMessage extends BaseMessage implements ChatMessageFieldsWithRole {\n static lc_name(): string;\n role: string;\n static _chatMessageClass(): typeof ChatMessage;\n constructor(content: string, role: string);\n constructor(fields: ChatMessageFieldsWithRole);\n _getType(): MessageType;\n static isInstance(message: BaseMessage): message is ChatMessage;\n get _printableFields(): Record<string, unknown>;\n}\n/**\n * Represents a chunk of a chat message, which can be concatenated with\n * other chat message chunks.\n */\nexport declare class ChatMessageChunk extends BaseMessageChunk {\n static lc_name(): string;\n role: string;\n constructor(content: string, role: string);\n constructor(fields: ChatMessageFieldsWithRole);\n _getType(): MessageType;\n concat(chunk: ChatMessageChunk): ChatMessageChunk;\n get _printableFields(): Record<string, unknown>;\n}\nexport declare function isChatMessage(x: BaseMessage): x is ChatMessage;\nexport declare function isChatMessageChunk(x: BaseMessageChunk): x is ChatMessageChunk;\n"],"mappings":";;;UACiBI,yBAAAA,SAAkCF;;AAAnD;AAMA;;;AAKwBE,cALHC,WAAAA,SAAoBL,WAAAA,YAAuBI,yBAKxCA,CAAAA;EAAyB,OACjCD,OAAAA,CAAAA,CAAAA,EAAAA,MAAAA;EAAW,IACIH,EAAAA,MAAAA;EAAW,OAAcK,iBAAAA,CAAAA,CAAAA,EAAAA,OAJjBA,WAIiBA;EAAW,WACvCC,CAAAA,OAAAA,EAAAA,MAAAA,EAAAA,IAAAA,EAAAA,MAAAA;EAAM,WARON,CAAAA,MAAAA,EAKjBI,yBALiBJ;EAAW,QAAYI,CAAAA,CAAAA,EAMhDD,WANgDC;EAAyB,OAAA,UAAA,CAAA,OAAA,EAO1DJ,WAP0D,CAAA,EAAA,OAAA,IAOjCK,WAPiC;EAcpEE,IAAAA,gBAAgB,CAAA,CAAA,EANTD,MAMS,CAAA,MAAA,EAAA,OAAA,CAAA;;;;;;AAOTA,cAPPC,gBAAAA,SAAyBN,gBAAAA,CAOlBK;EAAM,OAPYL,OAAAA,CAAAA,CAAAA,EAAAA,MAAAA;EAAgB,IAAA,EAAA,MAAA;EAStCO,WAAAA,CAAAA,OAAa,EAAA,MAAA,EAAA,IAAA,EAAA,MAAA;EAAA,WAAA,CAAA,MAAA,EALbJ,yBAKa;EAAA,QAAIJ,CAAAA,CAAAA,EAJzBG,WAIyBH;EAAW,MAAQK,CAAAA,KAAAA,EAH1CE,gBAG0CF,CAAAA,EAHvBE,gBAGuBF;EAAW,IAAA,gBAAA,CAAA,CAAA,EAF3CC,MAE2C,CAAA,MAAA,EAAA,OAAA,CAAA;AACvE;AAA0C,iBADlBE,aAAAA,CACkB,CAAA,EADDR,WACC,CAAA,EAAA,CAAA,IADkBK,WAClB;AAAIJ,iBAAtBQ,kBAAAA,CAAsBR,CAAAA,EAAAA,gBAAAA,CAAAA,EAAAA,CAAAA,IAAwBM,gBAAxBN"}
1
+ {"version":3,"file":"chat.d.cts","names":["BaseMessage","BaseMessageChunk","BaseMessageFields","$InferMessageContent","MessageStructure","ChatMessageFields","TStructure","ChatMessage","Record","ChatMessageChunk","isChatMessage","isChatMessageChunk"],"sources":["../../src/messages/chat.d.ts"],"sourcesContent":["import { BaseMessage, BaseMessageChunk, type BaseMessageFields } from \"./base.js\";\nimport { $InferMessageContent, MessageStructure } from \"./message.js\";\nexport interface ChatMessageFields<TStructure extends MessageStructure = MessageStructure> extends BaseMessageFields<TStructure, \"generic\"> {\n role: string;\n}\n/**\n * Represents a chat message in a conversation.\n */\nexport declare class ChatMessage<TStructure extends MessageStructure = MessageStructure> extends BaseMessage<TStructure, \"generic\"> implements ChatMessageFields<TStructure> {\n static lc_name(): string;\n readonly type: \"generic\";\n role: string;\n static _chatMessageClass(): typeof ChatMessage;\n constructor(content: $InferMessageContent<TStructure, \"generic\">, role: string);\n constructor(fields: ChatMessageFields<TStructure>);\n static isInstance(obj: unknown): obj is ChatMessage;\n get _printableFields(): Record<string, unknown>;\n}\n/**\n * Represents a chunk of a chat message, which can be concatenated with\n * other chat message chunks.\n */\nexport declare class ChatMessageChunk<TStructure extends MessageStructure = MessageStructure> extends BaseMessageChunk<TStructure, \"generic\"> {\n static lc_name(): string;\n readonly type: \"generic\";\n role: string;\n constructor(content: $InferMessageContent<TStructure, \"generic\">, role: string);\n constructor(fields: ChatMessageFields<TStructure>);\n concat(chunk: ChatMessageChunk<TStructure>): this;\n static isInstance(obj: unknown): obj is ChatMessageChunk;\n get _printableFields(): Record<string, unknown>;\n}\n/**\n * @deprecated Use {@link ChatMessage.isInstance} instead\n */\nexport declare function isChatMessage(x: BaseMessage): x is ChatMessage;\n/**\n * @deprecated Use {@link ChatMessageChunk.isInstance} instead\n */\nexport declare function isChatMessageChunk(x: BaseMessageChunk): x is ChatMessageChunk;\n"],"mappings":";;;;UAEiBK,qCAAqCD,mBAAmBA,0BAA0BF,kBAAkBI;;AAArH;;;;AAAqHA,cAMhGC,WANgGD,CAAAA,mBAMjEF,gBANiEE,GAM9CF,gBAN8CE,CAAAA,SAMpBN,WANoBM,CAMRA,UANQA,EAAAA,SAAAA,CAAAA,YAM0BD,iBAN1BC,CAM4CA,UAN5CA,CAAAA,CAAAA;EAAU,OAA5BJ,OAAAA,CAAAA,CAAAA,EAAAA,MAAAA;EAAiB,SAAA,IAAA,EAAA,SAAA;EAM/FK,IAAAA,EAAAA,MAAAA;EAAW,OAAA,iBAAA,CAAA,CAAA,EAAA,OAIOA,WAJP;EAAA,WAAoBH,CAAAA,OAAAA,EAK3BD,oBAL2BC,CAKNE,UALMF,EAAAA,SAAAA,CAAAA,EAAAA,IAAAA,EAAAA,MAAAA;EAAgB,WAAGA,CAAAA,MAAAA,EAM/CC,iBAN+CD,CAM7BE,UAN6BF,CAAAA;EAAgB,OAAsBE,UAAAA,CAAAA,GAAAA,EAAAA,OAAAA,CAAAA,EAAAA,GAAAA,IAOjEC,WAPiED;EAAU,IAA0CA,gBAAAA,CAAAA,CAAAA,EAQrIE,MARqIF,CAAAA,MAAAA,EAAAA,OAAAA,CAAAA;;;;;;AAOrHC,cAOvBE,gBAPuBF,CAAAA,mBAOaH,gBAPbG,GAOgCH,gBAPhCG,CAAAA,SAO0DN,gBAP1DM,CAO2ED,UAP3EC,EAAAA,SAAAA,CAAAA,CAAAA;EAAW,OAC3BC,OAAAA,CAAAA,CAAAA,EAAAA,MAAAA;EAAM,SAR+DR,IAAAA,EAAAA,SAAAA;EAAW,IAAmCK,EAAAA,MAAAA;EAAiB,WAAA,CAAA,OAAA,EAkBvIF,oBAlBuI,CAkBlHG,UAlBkH,EAAA,SAAA,CAAA,EAAA,IAAA,EAAA,MAAA;EAc3IG,WAAAA,CAAAA,MAAAA,EAKGJ,iBALa,CAKKC,UALL,CAAA;EAAA,MAAA,CAAA,KAAA,EAMnBG,gBANmB,CAMFH,UANE,CAAA,CAAA,EAAA,IAAA;EAAA,OAAoBF,UAAAA,CAAAA,GAAAA,EAAAA,OAAAA,CAAAA,EAAAA,GAAAA,IAObK,gBAPaL;EAAgB,IAAGA,gBAAAA,CAAAA,CAAAA,EAQhDI,MARgDJ,CAAAA,MAAAA,EAAAA,OAAAA,CAAAA;;;;;AAKpDC,iBAQAK,aAAAA,CARAL,CAAAA,EAQiBL,WARjBK,CAAAA,EAAAA,CAAAA,IAQoCE,WARpCF;;;;AAGIG,iBASJG,kBAAAA,CATIH,CAAAA,EASkBP,gBATlBO,CAAAA,EAAAA,CAAAA,IAS0CC,gBAT1CD"}
@@ -1,37 +1,45 @@
1
- import { BaseMessage, BaseMessageChunk, BaseMessageFields, MessageType } from "./base.js";
1
+ import { BaseMessage, BaseMessageChunk, BaseMessageFields } from "./base.js";
2
+ import { $InferMessageContent, MessageStructure } from "./message.js";
2
3
 
3
4
  //#region src/messages/chat.d.ts
4
- interface ChatMessageFieldsWithRole extends BaseMessageFields {
5
+ interface ChatMessageFields<TStructure extends MessageStructure = MessageStructure> extends BaseMessageFields<TStructure, "generic"> {
5
6
  role: string;
6
7
  }
7
8
  /**
8
9
  * Represents a chat message in a conversation.
9
10
  */
10
- declare class ChatMessage extends BaseMessage implements ChatMessageFieldsWithRole {
11
+ declare class ChatMessage<TStructure extends MessageStructure = MessageStructure> extends BaseMessage<TStructure, "generic"> implements ChatMessageFields<TStructure> {
11
12
  static lc_name(): string;
13
+ readonly type: "generic";
12
14
  role: string;
13
15
  static _chatMessageClass(): typeof ChatMessage;
14
- constructor(content: string, role: string);
15
- constructor(fields: ChatMessageFieldsWithRole);
16
- _getType(): MessageType;
17
- static isInstance(message: BaseMessage): message is ChatMessage;
16
+ constructor(content: $InferMessageContent<TStructure, "generic">, role: string);
17
+ constructor(fields: ChatMessageFields<TStructure>);
18
+ static isInstance(obj: unknown): obj is ChatMessage;
18
19
  get _printableFields(): Record<string, unknown>;
19
20
  }
20
21
  /**
21
22
  * Represents a chunk of a chat message, which can be concatenated with
22
23
  * other chat message chunks.
23
24
  */
24
- declare class ChatMessageChunk extends BaseMessageChunk {
25
+ declare class ChatMessageChunk<TStructure extends MessageStructure = MessageStructure> extends BaseMessageChunk<TStructure, "generic"> {
25
26
  static lc_name(): string;
27
+ readonly type: "generic";
26
28
  role: string;
27
- constructor(content: string, role: string);
28
- constructor(fields: ChatMessageFieldsWithRole);
29
- _getType(): MessageType;
30
- concat(chunk: ChatMessageChunk): ChatMessageChunk;
29
+ constructor(content: $InferMessageContent<TStructure, "generic">, role: string);
30
+ constructor(fields: ChatMessageFields<TStructure>);
31
+ concat(chunk: ChatMessageChunk<TStructure>): this;
32
+ static isInstance(obj: unknown): obj is ChatMessageChunk;
31
33
  get _printableFields(): Record<string, unknown>;
32
34
  }
35
+ /**
36
+ * @deprecated Use {@link ChatMessage.isInstance} instead
37
+ */
33
38
  declare function isChatMessage(x: BaseMessage): x is ChatMessage;
39
+ /**
40
+ * @deprecated Use {@link ChatMessageChunk.isInstance} instead
41
+ */
34
42
  declare function isChatMessageChunk(x: BaseMessageChunk): x is ChatMessageChunk;
35
43
  //#endregion
36
- export { ChatMessage, ChatMessageChunk, ChatMessageFieldsWithRole, isChatMessage, isChatMessageChunk };
44
+ export { ChatMessage, ChatMessageChunk, ChatMessageFields, isChatMessage, isChatMessageChunk };
37
45
  //# sourceMappingURL=chat.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"chat.d.ts","names":["BaseMessage","BaseMessageChunk","BaseMessageFields","MessageType","ChatMessageFieldsWithRole","ChatMessage","Record","ChatMessageChunk","isChatMessage","isChatMessageChunk"],"sources":["../../src/messages/chat.d.ts"],"sourcesContent":["import { BaseMessage, BaseMessageChunk, type BaseMessageFields, type MessageType } from \"./base.js\";\nexport interface ChatMessageFieldsWithRole extends BaseMessageFields {\n role: string;\n}\n/**\n * Represents a chat message in a conversation.\n */\nexport declare class ChatMessage extends BaseMessage implements ChatMessageFieldsWithRole {\n static lc_name(): string;\n role: string;\n static _chatMessageClass(): typeof ChatMessage;\n constructor(content: string, role: string);\n constructor(fields: ChatMessageFieldsWithRole);\n _getType(): MessageType;\n static isInstance(message: BaseMessage): message is ChatMessage;\n get _printableFields(): Record<string, unknown>;\n}\n/**\n * Represents a chunk of a chat message, which can be concatenated with\n * other chat message chunks.\n */\nexport declare class ChatMessageChunk extends BaseMessageChunk {\n static lc_name(): string;\n role: string;\n constructor(content: string, role: string);\n constructor(fields: ChatMessageFieldsWithRole);\n _getType(): MessageType;\n concat(chunk: ChatMessageChunk): ChatMessageChunk;\n get _printableFields(): Record<string, unknown>;\n}\nexport declare function isChatMessage(x: BaseMessage): x is ChatMessage;\nexport declare function isChatMessageChunk(x: BaseMessageChunk): x is ChatMessageChunk;\n"],"mappings":";;;UACiBI,yBAAAA,SAAkCF;;AAAnD;AAMA;;;AAKwBE,cALHC,WAAAA,SAAoBL,WAAAA,YAAuBI,yBAKxCA,CAAAA;EAAyB,OACjCD,OAAAA,CAAAA,CAAAA,EAAAA,MAAAA;EAAW,IACIH,EAAAA,MAAAA;EAAW,OAAcK,iBAAAA,CAAAA,CAAAA,EAAAA,OAJjBA,WAIiBA;EAAW,WACvCC,CAAAA,OAAAA,EAAAA,MAAAA,EAAAA,IAAAA,EAAAA,MAAAA;EAAM,WARON,CAAAA,MAAAA,EAKjBI,yBALiBJ;EAAW,QAAYI,CAAAA,CAAAA,EAMhDD,WANgDC;EAAyB,OAAA,UAAA,CAAA,OAAA,EAO1DJ,WAP0D,CAAA,EAAA,OAAA,IAOjCK,WAPiC;EAcpEE,IAAAA,gBAAgB,CAAA,CAAA,EANTD,MAMS,CAAA,MAAA,EAAA,OAAA,CAAA;;;;;;AAOTA,cAPPC,gBAAAA,SAAyBN,gBAAAA,CAOlBK;EAAM,OAPYL,OAAAA,CAAAA,CAAAA,EAAAA,MAAAA;EAAgB,IAAA,EAAA,MAAA;EAStCO,WAAAA,CAAAA,OAAa,EAAA,MAAA,EAAA,IAAA,EAAA,MAAA;EAAA,WAAA,CAAA,MAAA,EALbJ,yBAKa;EAAA,QAAIJ,CAAAA,CAAAA,EAJzBG,WAIyBH;EAAW,MAAQK,CAAAA,KAAAA,EAH1CE,gBAG0CF,CAAAA,EAHvBE,gBAGuBF;EAAW,IAAA,gBAAA,CAAA,CAAA,EAF3CC,MAE2C,CAAA,MAAA,EAAA,OAAA,CAAA;AACvE;AAA0C,iBADlBE,aAAAA,CACkB,CAAA,EADDR,WACC,CAAA,EAAA,CAAA,IADkBK,WAClB;AAAIJ,iBAAtBQ,kBAAAA,CAAsBR,CAAAA,EAAAA,gBAAAA,CAAAA,EAAAA,CAAAA,IAAwBM,gBAAxBN"}
1
+ {"version":3,"file":"chat.d.ts","names":["BaseMessage","BaseMessageChunk","BaseMessageFields","$InferMessageContent","MessageStructure","ChatMessageFields","TStructure","ChatMessage","Record","ChatMessageChunk","isChatMessage","isChatMessageChunk"],"sources":["../../src/messages/chat.d.ts"],"sourcesContent":["import { BaseMessage, BaseMessageChunk, type BaseMessageFields } from \"./base.js\";\nimport { $InferMessageContent, MessageStructure } from \"./message.js\";\nexport interface ChatMessageFields<TStructure extends MessageStructure = MessageStructure> extends BaseMessageFields<TStructure, \"generic\"> {\n role: string;\n}\n/**\n * Represents a chat message in a conversation.\n */\nexport declare class ChatMessage<TStructure extends MessageStructure = MessageStructure> extends BaseMessage<TStructure, \"generic\"> implements ChatMessageFields<TStructure> {\n static lc_name(): string;\n readonly type: \"generic\";\n role: string;\n static _chatMessageClass(): typeof ChatMessage;\n constructor(content: $InferMessageContent<TStructure, \"generic\">, role: string);\n constructor(fields: ChatMessageFields<TStructure>);\n static isInstance(obj: unknown): obj is ChatMessage;\n get _printableFields(): Record<string, unknown>;\n}\n/**\n * Represents a chunk of a chat message, which can be concatenated with\n * other chat message chunks.\n */\nexport declare class ChatMessageChunk<TStructure extends MessageStructure = MessageStructure> extends BaseMessageChunk<TStructure, \"generic\"> {\n static lc_name(): string;\n readonly type: \"generic\";\n role: string;\n constructor(content: $InferMessageContent<TStructure, \"generic\">, role: string);\n constructor(fields: ChatMessageFields<TStructure>);\n concat(chunk: ChatMessageChunk<TStructure>): this;\n static isInstance(obj: unknown): obj is ChatMessageChunk;\n get _printableFields(): Record<string, unknown>;\n}\n/**\n * @deprecated Use {@link ChatMessage.isInstance} instead\n */\nexport declare function isChatMessage(x: BaseMessage): x is ChatMessage;\n/**\n * @deprecated Use {@link ChatMessageChunk.isInstance} instead\n */\nexport declare function isChatMessageChunk(x: BaseMessageChunk): x is ChatMessageChunk;\n"],"mappings":";;;;UAEiBK,qCAAqCD,mBAAmBA,0BAA0BF,kBAAkBI;;AAArH;;;;AAAqHA,cAMhGC,WANgGD,CAAAA,mBAMjEF,gBANiEE,GAM9CF,gBAN8CE,CAAAA,SAMpBN,WANoBM,CAMRA,UANQA,EAAAA,SAAAA,CAAAA,YAM0BD,iBAN1BC,CAM4CA,UAN5CA,CAAAA,CAAAA;EAAU,OAA5BJ,OAAAA,CAAAA,CAAAA,EAAAA,MAAAA;EAAiB,SAAA,IAAA,EAAA,SAAA;EAM/FK,IAAAA,EAAAA,MAAAA;EAAW,OAAA,iBAAA,CAAA,CAAA,EAAA,OAIOA,WAJP;EAAA,WAAoBH,CAAAA,OAAAA,EAK3BD,oBAL2BC,CAKNE,UALMF,EAAAA,SAAAA,CAAAA,EAAAA,IAAAA,EAAAA,MAAAA;EAAgB,WAAGA,CAAAA,MAAAA,EAM/CC,iBAN+CD,CAM7BE,UAN6BF,CAAAA;EAAgB,OAAsBE,UAAAA,CAAAA,GAAAA,EAAAA,OAAAA,CAAAA,EAAAA,GAAAA,IAOjEC,WAPiED;EAAU,IAA0CA,gBAAAA,CAAAA,CAAAA,EAQrIE,MARqIF,CAAAA,MAAAA,EAAAA,OAAAA,CAAAA;;;;;;AAOrHC,cAOvBE,gBAPuBF,CAAAA,mBAOaH,gBAPbG,GAOgCH,gBAPhCG,CAAAA,SAO0DN,gBAP1DM,CAO2ED,UAP3EC,EAAAA,SAAAA,CAAAA,CAAAA;EAAW,OAC3BC,OAAAA,CAAAA,CAAAA,EAAAA,MAAAA;EAAM,SAR+DR,IAAAA,EAAAA,SAAAA;EAAW,IAAmCK,EAAAA,MAAAA;EAAiB,WAAA,CAAA,OAAA,EAkBvIF,oBAlBuI,CAkBlHG,UAlBkH,EAAA,SAAA,CAAA,EAAA,IAAA,EAAA,MAAA;EAc3IG,WAAAA,CAAAA,MAAAA,EAKGJ,iBALa,CAKKC,UALL,CAAA;EAAA,MAAA,CAAA,KAAA,EAMnBG,gBANmB,CAMFH,UANE,CAAA,CAAA,EAAA,IAAA;EAAA,OAAoBF,UAAAA,CAAAA,GAAAA,EAAAA,OAAAA,CAAAA,EAAAA,GAAAA,IAObK,gBAPaL;EAAgB,IAAGA,gBAAAA,CAAAA,CAAAA,EAQhDI,MARgDJ,CAAAA,MAAAA,EAAAA,OAAAA,CAAAA;;;;;AAKpDC,iBAQAK,aAAAA,CARAL,CAAAA,EAQiBL,WARjBK,CAAAA,EAAAA,CAAAA,IAQoCE,WARpCF;;;;AAGIG,iBASJG,kBAAAA,CATIH,CAAAA,EASkBP,gBATlBO,CAAAA,EAAAA,CAAAA,IAS0CC,gBAT1CD"}
@@ -8,23 +8,21 @@ var ChatMessage = class ChatMessage extends BaseMessage {
8
8
  static lc_name() {
9
9
  return "ChatMessage";
10
10
  }
11
+ type = "generic";
11
12
  role;
12
13
  static _chatMessageClass() {
13
14
  return ChatMessage;
14
15
  }
15
16
  constructor(fields, role) {
16
- if (typeof fields === "string") fields = {
17
+ if (typeof fields === "string" || Array.isArray(fields)) fields = {
17
18
  content: fields,
18
19
  role
19
20
  };
20
21
  super(fields);
21
22
  this.role = fields.role;
22
23
  }
23
- _getType() {
24
- return "generic";
25
- }
26
- static isInstance(message) {
27
- return message._getType() === "generic";
24
+ static isInstance(obj) {
25
+ return super.isInstance(obj) && obj.type === "generic";
28
26
  }
29
27
  get _printableFields() {
30
28
  return {
@@ -37,24 +35,23 @@ var ChatMessage = class ChatMessage extends BaseMessage {
37
35
  * Represents a chunk of a chat message, which can be concatenated with
38
36
  * other chat message chunks.
39
37
  */
40
- var ChatMessageChunk = class ChatMessageChunk extends BaseMessageChunk {
38
+ var ChatMessageChunk = class extends BaseMessageChunk {
41
39
  static lc_name() {
42
40
  return "ChatMessageChunk";
43
41
  }
42
+ type = "generic";
44
43
  role;
45
44
  constructor(fields, role) {
46
- if (typeof fields === "string") fields = {
45
+ if (typeof fields === "string" || Array.isArray(fields)) fields = {
47
46
  content: fields,
48
47
  role
49
48
  };
50
49
  super(fields);
51
50
  this.role = fields.role;
52
51
  }
53
- _getType() {
54
- return "generic";
55
- }
56
52
  concat(chunk) {
57
- return new ChatMessageChunk({
53
+ const Cls = this.constructor;
54
+ return new Cls({
58
55
  content: mergeContent(this.content, chunk.content),
59
56
  additional_kwargs: _mergeDicts(this.additional_kwargs, chunk.additional_kwargs),
60
57
  response_metadata: _mergeDicts(this.response_metadata, chunk.response_metadata),
@@ -62,6 +59,9 @@ var ChatMessageChunk = class ChatMessageChunk extends BaseMessageChunk {
62
59
  id: this.id ?? chunk.id
63
60
  });
64
61
  }
62
+ static isInstance(obj) {
63
+ return super.isInstance(obj) && obj.type === "generic";
64
+ }
65
65
  get _printableFields() {
66
66
  return {
67
67
  ...super._printableFields,
@@ -69,9 +69,15 @@ var ChatMessageChunk = class ChatMessageChunk extends BaseMessageChunk {
69
69
  };
70
70
  }
71
71
  };
72
+ /**
73
+ * @deprecated Use {@link ChatMessage.isInstance} instead
74
+ */
72
75
  function isChatMessage(x) {
73
76
  return x._getType() === "generic";
74
77
  }
78
+ /**
79
+ * @deprecated Use {@link ChatMessageChunk.isInstance} instead
80
+ */
75
81
  function isChatMessageChunk(x) {
76
82
  return x._getType() === "generic";
77
83
  }
@@ -1 +1 @@
1
- {"version":3,"file":"chat.js","names":["fields: string | ChatMessageFieldsWithRole","role?: string","message: BaseMessage","chunk: ChatMessageChunk","x: BaseMessage","x: BaseMessageChunk"],"sources":["../../src/messages/chat.ts"],"sourcesContent":["import {\n BaseMessage,\n BaseMessageChunk,\n type BaseMessageFields,\n mergeContent,\n _mergeDicts,\n type MessageType,\n} from \"./base.js\";\n\nexport interface ChatMessageFieldsWithRole extends BaseMessageFields {\n role: string;\n}\n\n/**\n * Represents a chat message in a conversation.\n */\nexport class ChatMessage\n extends BaseMessage\n implements ChatMessageFieldsWithRole\n{\n static lc_name() {\n return \"ChatMessage\";\n }\n\n role: string;\n\n static _chatMessageClass(): typeof ChatMessage {\n return ChatMessage;\n }\n\n constructor(content: string, role: string);\n\n constructor(fields: ChatMessageFieldsWithRole);\n\n constructor(fields: string | ChatMessageFieldsWithRole, role?: string) {\n if (typeof fields === \"string\") {\n // eslint-disable-next-line no-param-reassign, @typescript-eslint/no-non-null-assertion\n fields = { content: fields, role: role! };\n }\n super(fields);\n this.role = fields.role;\n }\n\n _getType(): MessageType {\n return \"generic\";\n }\n\n static isInstance(message: BaseMessage): message is ChatMessage {\n return message._getType() === \"generic\";\n }\n\n override get _printableFields(): Record<string, unknown> {\n return {\n ...super._printableFields,\n role: this.role,\n };\n }\n}\n\n/**\n * Represents a chunk of a chat message, which can be concatenated with\n * other chat message chunks.\n */\nexport class ChatMessageChunk extends BaseMessageChunk {\n static lc_name() {\n return \"ChatMessageChunk\";\n }\n\n role: string;\n\n constructor(content: string, role: string);\n\n constructor(fields: ChatMessageFieldsWithRole);\n\n constructor(fields: string | ChatMessageFieldsWithRole, role?: string) {\n if (typeof fields === \"string\") {\n // eslint-disable-next-line no-param-reassign, @typescript-eslint/no-non-null-assertion\n fields = { content: fields, role: role! };\n }\n super(fields);\n this.role = fields.role;\n }\n\n _getType(): MessageType {\n return \"generic\";\n }\n\n concat(chunk: ChatMessageChunk) {\n return new ChatMessageChunk({\n content: mergeContent(this.content, chunk.content),\n additional_kwargs: _mergeDicts(\n this.additional_kwargs,\n chunk.additional_kwargs\n ),\n response_metadata: _mergeDicts(\n this.response_metadata,\n chunk.response_metadata\n ),\n role: this.role,\n id: this.id ?? chunk.id,\n });\n }\n\n override get _printableFields(): Record<string, unknown> {\n return {\n ...super._printableFields,\n role: this.role,\n };\n }\n}\n\nexport function isChatMessage(x: BaseMessage): x is ChatMessage {\n return x._getType() === \"generic\";\n}\n\nexport function isChatMessageChunk(x: BaseMessageChunk): x is ChatMessageChunk {\n return x._getType() === \"generic\";\n}\n"],"mappings":";;;;;;AAgBA,IAAa,cAAb,MAAa,oBACH,YAEV;CACE,OAAO,UAAU;AACf,SAAO;CACR;CAED;CAEA,OAAO,oBAAwC;AAC7C,SAAO;CACR;CAMD,YAAYA,QAA4CC,MAAe;AACrE,MAAI,OAAO,WAAW,UAEpB,SAAS;GAAE,SAAS;GAAc;EAAO;EAE3C,MAAM,OAAO;EACb,KAAK,OAAO,OAAO;CACpB;CAED,WAAwB;AACtB,SAAO;CACR;CAED,OAAO,WAAWC,SAA8C;AAC9D,SAAO,QAAQ,UAAU,KAAK;CAC/B;CAED,IAAa,mBAA4C;AACvD,SAAO;GACL,GAAG,MAAM;GACT,MAAM,KAAK;EACZ;CACF;AACF;;;;;AAMD,IAAa,mBAAb,MAAa,yBAAyB,iBAAiB;CACrD,OAAO,UAAU;AACf,SAAO;CACR;CAED;CAMA,YAAYF,QAA4CC,MAAe;AACrE,MAAI,OAAO,WAAW,UAEpB,SAAS;GAAE,SAAS;GAAc;EAAO;EAE3C,MAAM,OAAO;EACb,KAAK,OAAO,OAAO;CACpB;CAED,WAAwB;AACtB,SAAO;CACR;CAED,OAAOE,OAAyB;AAC9B,SAAO,IAAI,iBAAiB;GAC1B,SAAS,aAAa,KAAK,SAAS,MAAM,QAAQ;GAClD,mBAAmB,YACjB,KAAK,mBACL,MAAM,kBACP;GACD,mBAAmB,YACjB,KAAK,mBACL,MAAM,kBACP;GACD,MAAM,KAAK;GACX,IAAI,KAAK,MAAM,MAAM;EACtB;CACF;CAED,IAAa,mBAA4C;AACvD,SAAO;GACL,GAAG,MAAM;GACT,MAAM,KAAK;EACZ;CACF;AACF;AAED,SAAgB,cAAcC,GAAkC;AAC9D,QAAO,EAAE,UAAU,KAAK;AACzB;AAED,SAAgB,mBAAmBC,GAA4C;AAC7E,QAAO,EAAE,UAAU,KAAK;AACzB"}
1
+ {"version":3,"file":"chat.js","names":["fields:\n | $InferMessageContent<TStructure, \"generic\">\n | ChatMessageFields<TStructure>","role?: string","obj: unknown","chunk: ChatMessageChunk<TStructure>","x: BaseMessage","x: BaseMessageChunk"],"sources":["../../src/messages/chat.ts"],"sourcesContent":["import {\n BaseMessage,\n BaseMessageChunk,\n type BaseMessageFields,\n mergeContent,\n _mergeDicts,\n} from \"./base.js\";\nimport { $InferMessageContent, MessageStructure } from \"./message.js\";\nimport { Constructor } from \"./utils.js\";\n\nexport interface ChatMessageFields<\n TStructure extends MessageStructure = MessageStructure\n> extends BaseMessageFields<TStructure, \"generic\"> {\n role: string;\n}\n\n/**\n * Represents a chat message in a conversation.\n */\nexport class ChatMessage<TStructure extends MessageStructure = MessageStructure>\n extends BaseMessage<TStructure, \"generic\">\n implements ChatMessageFields<TStructure>\n{\n static lc_name() {\n return \"ChatMessage\";\n }\n\n readonly type = \"generic\" as const;\n\n role: string;\n\n static _chatMessageClass(): typeof ChatMessage {\n return ChatMessage;\n }\n\n constructor(\n content: $InferMessageContent<TStructure, \"generic\">,\n role: string\n );\n\n constructor(fields: ChatMessageFields<TStructure>);\n\n constructor(\n fields:\n | $InferMessageContent<TStructure, \"generic\">\n | ChatMessageFields<TStructure>,\n role?: string\n ) {\n if (typeof fields === \"string\" || Array.isArray(fields)) {\n // eslint-disable-next-line no-param-reassign, @typescript-eslint/no-non-null-assertion\n fields = { content: fields, role: role! };\n }\n super(fields);\n this.role = fields.role;\n }\n\n static isInstance(obj: unknown): obj is ChatMessage {\n return super.isInstance(obj) && obj.type === \"generic\";\n }\n\n override get _printableFields(): Record<string, unknown> {\n return {\n ...super._printableFields,\n role: this.role,\n };\n }\n}\n\n/**\n * Represents a chunk of a chat message, which can be concatenated with\n * other chat message chunks.\n */\nexport class ChatMessageChunk<\n TStructure extends MessageStructure = MessageStructure\n> extends BaseMessageChunk<TStructure, \"generic\"> {\n static lc_name() {\n return \"ChatMessageChunk\";\n }\n\n readonly type = \"generic\" as const;\n\n role: string;\n\n constructor(\n content: $InferMessageContent<TStructure, \"generic\">,\n role: string\n );\n\n constructor(fields: ChatMessageFields<TStructure>);\n\n constructor(\n fields:\n | $InferMessageContent<TStructure, \"generic\">\n | ChatMessageFields<TStructure>,\n role?: string\n ) {\n if (typeof fields === \"string\" || Array.isArray(fields)) {\n // eslint-disable-next-line no-param-reassign, @typescript-eslint/no-non-null-assertion\n fields = { content: fields, role: role! };\n }\n super(fields);\n this.role = fields.role;\n }\n\n concat(chunk: ChatMessageChunk<TStructure>) {\n const Cls = this.constructor as Constructor<this>;\n return new Cls({\n content: mergeContent(this.content, chunk.content),\n additional_kwargs: _mergeDicts(\n this.additional_kwargs,\n chunk.additional_kwargs\n ),\n response_metadata: _mergeDicts(\n this.response_metadata,\n chunk.response_metadata\n ),\n role: this.role,\n id: this.id ?? chunk.id,\n });\n }\n\n static isInstance(obj: unknown): obj is ChatMessageChunk {\n return super.isInstance(obj) && obj.type === \"generic\";\n }\n\n override get _printableFields(): Record<string, unknown> {\n return {\n ...super._printableFields,\n role: this.role,\n };\n }\n}\n\n/**\n * @deprecated Use {@link ChatMessage.isInstance} instead\n */\nexport function isChatMessage(x: BaseMessage): x is ChatMessage {\n return x._getType() === \"generic\";\n}\n\n/**\n * @deprecated Use {@link ChatMessageChunk.isInstance} instead\n */\nexport function isChatMessageChunk(x: BaseMessageChunk): x is ChatMessageChunk {\n return x._getType() === \"generic\";\n}\n"],"mappings":";;;;;;AAmBA,IAAa,cAAb,MAAa,oBACH,YAEV;CACE,OAAO,UAAU;AACf,SAAO;CACR;CAED,AAAS,OAAO;CAEhB;CAEA,OAAO,oBAAwC;AAC7C,SAAO;CACR;CASD,YACEA,QAGAC,MACA;AACA,MAAI,OAAO,WAAW,YAAY,MAAM,QAAQ,OAAO,EAErD,SAAS;GAAE,SAAS;GAAc;EAAO;EAE3C,MAAM,OAAO;EACb,KAAK,OAAO,OAAO;CACpB;CAED,OAAO,WAAWC,KAAkC;AAClD,SAAO,MAAM,WAAW,IAAI,IAAI,IAAI,SAAS;CAC9C;CAED,IAAa,mBAA4C;AACvD,SAAO;GACL,GAAG,MAAM;GACT,MAAM,KAAK;EACZ;CACF;AACF;;;;;AAMD,IAAa,mBAAb,cAEU,iBAAwC;CAChD,OAAO,UAAU;AACf,SAAO;CACR;CAED,AAAS,OAAO;CAEhB;CASA,YACEF,QAGAC,MACA;AACA,MAAI,OAAO,WAAW,YAAY,MAAM,QAAQ,OAAO,EAErD,SAAS;GAAE,SAAS;GAAc;EAAO;EAE3C,MAAM,OAAO;EACb,KAAK,OAAO,OAAO;CACpB;CAED,OAAOE,OAAqC;EAC1C,MAAM,MAAM,KAAK;AACjB,SAAO,IAAI,IAAI;GACb,SAAS,aAAa,KAAK,SAAS,MAAM,QAAQ;GAClD,mBAAmB,YACjB,KAAK,mBACL,MAAM,kBACP;GACD,mBAAmB,YACjB,KAAK,mBACL,MAAM,kBACP;GACD,MAAM,KAAK;GACX,IAAI,KAAK,MAAM,MAAM;EACtB;CACF;CAED,OAAO,WAAWD,KAAuC;AACvD,SAAO,MAAM,WAAW,IAAI,IAAI,IAAI,SAAS;CAC9C;CAED,IAAa,mBAA4C;AACvD,SAAO;GACL,GAAG,MAAM;GACT,MAAM,KAAK;EACZ;CACF;AACF;;;;AAKD,SAAgB,cAAcE,GAAkC;AAC9D,QAAO,EAAE,UAAU,KAAK;AACzB;;;;AAKD,SAAgB,mBAAmBC,GAA4C;AAC7E,QAAO,EAAE,UAAU,KAAK;AACzB"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["KNOWN_BLOCK_TYPES","KNOWN_TOOL_BLOCK_TYPES","KNOWN_MULTIMODAL_BLOCK_TYPES"],"sources":["../../../src/messages/content/index.ts"],"sourcesContent":["import type { BaseContentBlock } from \"./base.js\";\nimport {\n KNOWN_BLOCK_TYPES as KNOWN_TOOL_BLOCK_TYPES,\n type Tools,\n} from \"./tools.js\";\nimport {\n KNOWN_BLOCK_TYPES as KNOWN_MULTIMODAL_BLOCK_TYPES,\n type Multimodal,\n} from \"./multimodal.js\";\nimport { type Data } from \"./data.js\";\n\nexport type ContentBlock = BaseContentBlock;\n\nexport const KNOWN_BLOCK_TYPES = [\n \"text\",\n \"reasoning\",\n ...KNOWN_TOOL_BLOCK_TYPES,\n ...KNOWN_MULTIMODAL_BLOCK_TYPES,\n];\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport declare namespace ContentBlock {\n /**\n * Annotation for citing data from a document.\n */\n export interface Citation {\n /**\n * Type of the content block\n */\n readonly type: \"citation\";\n /**\n * Source type for the citation.\n */\n source?: string;\n /**\n * URL of the document source\n */\n url?: string;\n /**\n * Source document title.\n *\n * For example, the page title for a web page or the title of a paper.\n */\n title?: string;\n /**\n * Start index of the **response text** for which the annotation applies.\n *\n * @see {Text}\n */\n startIndex?: number;\n /**\n * End index of the **response text** for which the annotation applies.\n *\n * @see {Text}\n */\n endIndex?: number;\n /**\n * Excerpt of source text being cited.\n */\n citedText?: string;\n }\n\n /**\n * Text output from a LLM.\n *\n * This typically represents the main text content of a message, such as the response\n * from a language model or the text of a user message.\n */\n export interface Text extends ContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"text\";\n /**\n * Block text.\n */\n text: string;\n /**\n * Index of block in aggregate response. Used during streaming.\n */\n index?: number;\n /**\n * Citations and other annotations.\n */\n annotations?: Array<Citation | BaseContentBlock>;\n }\n\n /**\n * Reasoning output from a LLM.\n */\n export interface Reasoning extends ContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"reasoning\";\n /**\n * Reasoning text.\n *\n * Either the thought summary or the raw reasoning text itself.\n * This is often parsed from `<think>` tags in the model's response.\n */\n reasoning: string;\n /**\n * Index of block in aggregate response. Used during streaming.\n */\n index?: number;\n }\n\n export { Tools };\n export { Multimodal };\n export { Data };\n\n export type Standard =\n | Text\n | Reasoning\n | Tools.Standard\n | Multimodal.Standard;\n}\n"],"mappings":";;;;AAaA,MAAaA,sBAAoB;CAC/B;CACA;CACA,GAAGC;CACH,GAAGC;AACJ"}
1
+ {"version":3,"file":"index.cjs","names":["KNOWN_BLOCK_TYPES","KNOWN_TOOL_BLOCK_TYPES","KNOWN_MULTIMODAL_BLOCK_TYPES"],"sources":["../../../src/messages/content/index.ts"],"sourcesContent":["import type { BaseContentBlock } from \"./base.js\";\nimport {\n KNOWN_BLOCK_TYPES as KNOWN_TOOL_BLOCK_TYPES,\n type Tools,\n} from \"./tools.js\";\nimport {\n KNOWN_BLOCK_TYPES as KNOWN_MULTIMODAL_BLOCK_TYPES,\n type Multimodal,\n} from \"./multimodal.js\";\nimport { type Data } from \"./data.js\";\n\nexport interface ContentBlock extends BaseContentBlock {}\n\nexport const KNOWN_BLOCK_TYPES = [\n \"text\",\n \"reasoning\",\n ...KNOWN_TOOL_BLOCK_TYPES,\n ...KNOWN_MULTIMODAL_BLOCK_TYPES,\n];\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport declare namespace ContentBlock {\n /**\n * Annotation for citing data from a document.\n */\n export interface Citation {\n /**\n * Type of the content block\n */\n readonly type: \"citation\";\n /**\n * Source type for the citation.\n */\n source?: string;\n /**\n * URL of the document source\n */\n url?: string;\n /**\n * Source document title.\n *\n * For example, the page title for a web page or the title of a paper.\n */\n title?: string;\n /**\n * Start index of the **response text** for which the annotation applies.\n *\n * @see {Text}\n */\n startIndex?: number;\n /**\n * End index of the **response text** for which the annotation applies.\n *\n * @see {Text}\n */\n endIndex?: number;\n /**\n * Excerpt of source text being cited.\n */\n citedText?: string;\n }\n\n /**\n * Text output from a LLM.\n *\n * This typically represents the main text content of a message, such as the response\n * from a language model or the text of a user message.\n */\n export interface Text extends ContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"text\";\n /**\n * Block text.\n */\n text: string;\n /**\n * Index of block in aggregate response. Used during streaming.\n */\n index?: number;\n /**\n * Citations and other annotations.\n */\n annotations?: Array<Citation | BaseContentBlock>;\n }\n\n /**\n * Reasoning output from a LLM.\n */\n export interface Reasoning extends ContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"reasoning\";\n /**\n * Reasoning text.\n *\n * Either the thought summary or the raw reasoning text itself.\n * This is often parsed from `<think>` tags in the model's response.\n */\n reasoning: string;\n /**\n * Index of block in aggregate response. Used during streaming.\n */\n index?: number;\n }\n\n export { Tools };\n export { Multimodal };\n export { Data };\n\n export type Standard =\n | Text\n | Reasoning\n | Tools.Standard\n | Multimodal.Standard;\n}\n"],"mappings":";;;;AAaA,MAAaA,sBAAoB;CAC/B;CACA;CACA,GAAGC;CACH,GAAGC;AACJ"}
@@ -4,7 +4,7 @@ import { Multimodal } from "./multimodal.cjs";
4
4
  import { Data } from "./data.cjs";
5
5
 
6
6
  //#region src/messages/content/index.d.ts
7
- type ContentBlock = BaseContentBlock;
7
+ interface ContentBlock extends BaseContentBlock {}
8
8
  declare const KNOWN_BLOCK_TYPES: string[];
9
9
  // eslint-disable-next-line @typescript-eslint/no-namespace
10
10
  declare namespace ContentBlock {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":["BaseContentBlock","Tools","Multimodal","Data","ContentBlock","KNOWN_BLOCK_TYPES","Citation","Array","Text","Reasoning","Standard"],"sources":["../../../src/messages/content/index.d.ts"],"sourcesContent":["import type { BaseContentBlock } from \"./base.js\";\nimport { type Tools } from \"./tools.js\";\nimport { type Multimodal } from \"./multimodal.js\";\nimport { type Data } from \"./data.js\";\nexport type ContentBlock = BaseContentBlock;\nexport declare const KNOWN_BLOCK_TYPES: string[];\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport declare namespace ContentBlock {\n /**\n * Annotation for citing data from a document.\n */\n export interface Citation {\n /**\n * Type of the content block\n */\n readonly type: \"citation\";\n /**\n * Source type for the citation.\n */\n source?: string;\n /**\n * URL of the document source\n */\n url?: string;\n /**\n * Source document title.\n *\n * For example, the page title for a web page or the title of a paper.\n */\n title?: string;\n /**\n * Start index of the **response text** for which the annotation applies.\n *\n * @see {Text}\n */\n startIndex?: number;\n /**\n * End index of the **response text** for which the annotation applies.\n *\n * @see {Text}\n */\n endIndex?: number;\n /**\n * Excerpt of source text being cited.\n */\n citedText?: string;\n }\n /**\n * Text output from a LLM.\n *\n * This typically represents the main text content of a message, such as the response\n * from a language model or the text of a user message.\n */\n export interface Text extends ContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"text\";\n /**\n * Block text.\n */\n text: string;\n /**\n * Index of block in aggregate response. Used during streaming.\n */\n index?: number;\n /**\n * Citations and other annotations.\n */\n annotations?: Array<Citation | BaseContentBlock>;\n }\n /**\n * Reasoning output from a LLM.\n */\n export interface Reasoning extends ContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"reasoning\";\n /**\n * Reasoning text.\n *\n * Either the thought summary or the raw reasoning text itself.\n * This is often parsed from `<think>` tags in the model's response.\n */\n reasoning: string;\n /**\n * Index of block in aggregate response. Used during streaming.\n */\n index?: number;\n }\n export { Tools };\n export { Multimodal };\n export { Data };\n export type Standard = Text | Reasoning | Tools.Standard | Multimodal.Standard;\n}\n"],"mappings":";;;;;;KAIYI,YAAAA,GAAeJ;cACNK;AADrB;AACqBA,kBAEID,YAAAA,CAFuB;EAEvBA;;;EA8DW,OAAGJ,UAAAA,QAAAA,CAAAA;IAAjBO;;;IAsBTN,SAAAA,IAAAA,EAAAA,UAAAA;IACAC;;;IAEqBO,MAAAA,CAAAA,EAAAA,MAAAA;IAAYR;;AAAoC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAzChDG;;;;;;;;;;;;;;;;kBAgBZG,MAAMD,WAAWN;;;;;qCAKAI;;;;;;;;;;;;;;;;;WAiB1BH;WACAC;WACAC;yBACcK,OAAOC,YAAYR,KAAAA,CAAMS,WAAWR,UAAAA,CAAWQ"}
1
+ {"version":3,"file":"index.d.cts","names":["BaseContentBlock","Tools","Multimodal","Data","ContentBlock","KNOWN_BLOCK_TYPES","Citation","Array","Text","Reasoning","Standard"],"sources":["../../../src/messages/content/index.d.ts"],"sourcesContent":["import type { BaseContentBlock } from \"./base.js\";\nimport { type Tools } from \"./tools.js\";\nimport { type Multimodal } from \"./multimodal.js\";\nimport { type Data } from \"./data.js\";\nexport interface ContentBlock extends BaseContentBlock {\n}\nexport declare const KNOWN_BLOCK_TYPES: string[];\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport declare namespace ContentBlock {\n /**\n * Annotation for citing data from a document.\n */\n export interface Citation {\n /**\n * Type of the content block\n */\n readonly type: \"citation\";\n /**\n * Source type for the citation.\n */\n source?: string;\n /**\n * URL of the document source\n */\n url?: string;\n /**\n * Source document title.\n *\n * For example, the page title for a web page or the title of a paper.\n */\n title?: string;\n /**\n * Start index of the **response text** for which the annotation applies.\n *\n * @see {Text}\n */\n startIndex?: number;\n /**\n * End index of the **response text** for which the annotation applies.\n *\n * @see {Text}\n */\n endIndex?: number;\n /**\n * Excerpt of source text being cited.\n */\n citedText?: string;\n }\n /**\n * Text output from a LLM.\n *\n * This typically represents the main text content of a message, such as the response\n * from a language model or the text of a user message.\n */\n export interface Text extends ContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"text\";\n /**\n * Block text.\n */\n text: string;\n /**\n * Index of block in aggregate response. Used during streaming.\n */\n index?: number;\n /**\n * Citations and other annotations.\n */\n annotations?: Array<Citation | BaseContentBlock>;\n }\n /**\n * Reasoning output from a LLM.\n */\n export interface Reasoning extends ContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"reasoning\";\n /**\n * Reasoning text.\n *\n * Either the thought summary or the raw reasoning text itself.\n * This is often parsed from `<think>` tags in the model's response.\n */\n reasoning: string;\n /**\n * Index of block in aggregate response. Used during streaming.\n */\n index?: number;\n }\n export { Tools };\n export { Multimodal };\n export { Data };\n export type Standard = Text | Reasoning | Tools.Standard | Multimodal.Standard;\n}\n"],"mappings":";;;;;;UAIiBI,YAAAA,SAAqBJ;AAArBI,cAEIC,iBAFiBL,EAAAA,MAAAA,EAAgB;AAEtD;AAEyBI,kBAAAA,YAAAA,CAAY;EAAA;;;EA8DkB,OAAjCG,UAAAA,QAAAA,CAAAA;IAhBYH;;;IAuCrBF,SAAAA,IAAAA,EAAAA,UAAAA;IACAC;;;IACiCF,MAAMS,CAAAA,EAAAA,MAAAA;IAAWR;AAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAzChDE;;;;;;;;;;;;;;;;kBAgBZG,MAAMD,WAAWN;;;;;qCAKAI;;;;;;;;;;;;;;;;;WAiB1BH;WACAC;WACAC;yBACcK,OAAOC,YAAYR,KAAAA,CAAMS,WAAWR,UAAAA,CAAWQ"}
@@ -4,7 +4,7 @@ import { Multimodal } from "./multimodal.js";
4
4
  import { Data } from "./data.js";
5
5
 
6
6
  //#region src/messages/content/index.d.ts
7
- type ContentBlock = BaseContentBlock;
7
+ interface ContentBlock extends BaseContentBlock {}
8
8
  declare const KNOWN_BLOCK_TYPES: string[];
9
9
  // eslint-disable-next-line @typescript-eslint/no-namespace
10
10
  declare namespace ContentBlock {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":["BaseContentBlock","Tools","Multimodal","Data","ContentBlock","KNOWN_BLOCK_TYPES","Citation","Array","Text","Reasoning","Standard"],"sources":["../../../src/messages/content/index.d.ts"],"sourcesContent":["import type { BaseContentBlock } from \"./base.js\";\nimport { type Tools } from \"./tools.js\";\nimport { type Multimodal } from \"./multimodal.js\";\nimport { type Data } from \"./data.js\";\nexport type ContentBlock = BaseContentBlock;\nexport declare const KNOWN_BLOCK_TYPES: string[];\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport declare namespace ContentBlock {\n /**\n * Annotation for citing data from a document.\n */\n export interface Citation {\n /**\n * Type of the content block\n */\n readonly type: \"citation\";\n /**\n * Source type for the citation.\n */\n source?: string;\n /**\n * URL of the document source\n */\n url?: string;\n /**\n * Source document title.\n *\n * For example, the page title for a web page or the title of a paper.\n */\n title?: string;\n /**\n * Start index of the **response text** for which the annotation applies.\n *\n * @see {Text}\n */\n startIndex?: number;\n /**\n * End index of the **response text** for which the annotation applies.\n *\n * @see {Text}\n */\n endIndex?: number;\n /**\n * Excerpt of source text being cited.\n */\n citedText?: string;\n }\n /**\n * Text output from a LLM.\n *\n * This typically represents the main text content of a message, such as the response\n * from a language model or the text of a user message.\n */\n export interface Text extends ContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"text\";\n /**\n * Block text.\n */\n text: string;\n /**\n * Index of block in aggregate response. Used during streaming.\n */\n index?: number;\n /**\n * Citations and other annotations.\n */\n annotations?: Array<Citation | BaseContentBlock>;\n }\n /**\n * Reasoning output from a LLM.\n */\n export interface Reasoning extends ContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"reasoning\";\n /**\n * Reasoning text.\n *\n * Either the thought summary or the raw reasoning text itself.\n * This is often parsed from `<think>` tags in the model's response.\n */\n reasoning: string;\n /**\n * Index of block in aggregate response. Used during streaming.\n */\n index?: number;\n }\n export { Tools };\n export { Multimodal };\n export { Data };\n export type Standard = Text | Reasoning | Tools.Standard | Multimodal.Standard;\n}\n"],"mappings":";;;;;;KAIYI,YAAAA,GAAeJ;cACNK;AADrB;AACqBA,kBAEID,YAAAA,CAFuB;EAEvBA;;;EA8DW,OAAGJ,UAAAA,QAAAA,CAAAA;IAAjBO;;;IAsBTN,SAAAA,IAAAA,EAAAA,UAAAA;IACAC;;;IAEqBO,MAAAA,CAAAA,EAAAA,MAAAA;IAAYR;;AAAoC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAzChDG;;;;;;;;;;;;;;;;kBAgBZG,MAAMD,WAAWN;;;;;qCAKAI;;;;;;;;;;;;;;;;;WAiB1BH;WACAC;WACAC;yBACcK,OAAOC,YAAYR,KAAAA,CAAMS,WAAWR,UAAAA,CAAWQ"}
1
+ {"version":3,"file":"index.d.ts","names":["BaseContentBlock","Tools","Multimodal","Data","ContentBlock","KNOWN_BLOCK_TYPES","Citation","Array","Text","Reasoning","Standard"],"sources":["../../../src/messages/content/index.d.ts"],"sourcesContent":["import type { BaseContentBlock } from \"./base.js\";\nimport { type Tools } from \"./tools.js\";\nimport { type Multimodal } from \"./multimodal.js\";\nimport { type Data } from \"./data.js\";\nexport interface ContentBlock extends BaseContentBlock {\n}\nexport declare const KNOWN_BLOCK_TYPES: string[];\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport declare namespace ContentBlock {\n /**\n * Annotation for citing data from a document.\n */\n export interface Citation {\n /**\n * Type of the content block\n */\n readonly type: \"citation\";\n /**\n * Source type for the citation.\n */\n source?: string;\n /**\n * URL of the document source\n */\n url?: string;\n /**\n * Source document title.\n *\n * For example, the page title for a web page or the title of a paper.\n */\n title?: string;\n /**\n * Start index of the **response text** for which the annotation applies.\n *\n * @see {Text}\n */\n startIndex?: number;\n /**\n * End index of the **response text** for which the annotation applies.\n *\n * @see {Text}\n */\n endIndex?: number;\n /**\n * Excerpt of source text being cited.\n */\n citedText?: string;\n }\n /**\n * Text output from a LLM.\n *\n * This typically represents the main text content of a message, such as the response\n * from a language model or the text of a user message.\n */\n export interface Text extends ContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"text\";\n /**\n * Block text.\n */\n text: string;\n /**\n * Index of block in aggregate response. Used during streaming.\n */\n index?: number;\n /**\n * Citations and other annotations.\n */\n annotations?: Array<Citation | BaseContentBlock>;\n }\n /**\n * Reasoning output from a LLM.\n */\n export interface Reasoning extends ContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"reasoning\";\n /**\n * Reasoning text.\n *\n * Either the thought summary or the raw reasoning text itself.\n * This is often parsed from `<think>` tags in the model's response.\n */\n reasoning: string;\n /**\n * Index of block in aggregate response. Used during streaming.\n */\n index?: number;\n }\n export { Tools };\n export { Multimodal };\n export { Data };\n export type Standard = Text | Reasoning | Tools.Standard | Multimodal.Standard;\n}\n"],"mappings":";;;;;;UAIiBI,YAAAA,SAAqBJ;AAArBI,cAEIC,iBAFiBL,EAAAA,MAAAA,EAAgB;AAEtD;AAEyBI,kBAAAA,YAAAA,CAAY;EAAA;;;EA8DkB,OAAjCG,UAAAA,QAAAA,CAAAA;IAhBYH;;;IAuCrBF,SAAAA,IAAAA,EAAAA,UAAAA;IACAC;;;IACiCF,MAAMS,CAAAA,EAAAA,MAAAA;IAAWR;AAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAzChDE;;;;;;;;;;;;;;;;kBAgBZG,MAAMD,WAAWN;;;;;qCAKAI;;;;;;;;;;;;;;;;;WAiB1BH;WACAC;WACAC;yBACcK,OAAOC,YAAYR,KAAAA,CAAMS,WAAWR,UAAAA,CAAWQ"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["KNOWN_BLOCK_TYPES","KNOWN_TOOL_BLOCK_TYPES","KNOWN_MULTIMODAL_BLOCK_TYPES"],"sources":["../../../src/messages/content/index.ts"],"sourcesContent":["import type { BaseContentBlock } from \"./base.js\";\nimport {\n KNOWN_BLOCK_TYPES as KNOWN_TOOL_BLOCK_TYPES,\n type Tools,\n} from \"./tools.js\";\nimport {\n KNOWN_BLOCK_TYPES as KNOWN_MULTIMODAL_BLOCK_TYPES,\n type Multimodal,\n} from \"./multimodal.js\";\nimport { type Data } from \"./data.js\";\n\nexport type ContentBlock = BaseContentBlock;\n\nexport const KNOWN_BLOCK_TYPES = [\n \"text\",\n \"reasoning\",\n ...KNOWN_TOOL_BLOCK_TYPES,\n ...KNOWN_MULTIMODAL_BLOCK_TYPES,\n];\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport declare namespace ContentBlock {\n /**\n * Annotation for citing data from a document.\n */\n export interface Citation {\n /**\n * Type of the content block\n */\n readonly type: \"citation\";\n /**\n * Source type for the citation.\n */\n source?: string;\n /**\n * URL of the document source\n */\n url?: string;\n /**\n * Source document title.\n *\n * For example, the page title for a web page or the title of a paper.\n */\n title?: string;\n /**\n * Start index of the **response text** for which the annotation applies.\n *\n * @see {Text}\n */\n startIndex?: number;\n /**\n * End index of the **response text** for which the annotation applies.\n *\n * @see {Text}\n */\n endIndex?: number;\n /**\n * Excerpt of source text being cited.\n */\n citedText?: string;\n }\n\n /**\n * Text output from a LLM.\n *\n * This typically represents the main text content of a message, such as the response\n * from a language model or the text of a user message.\n */\n export interface Text extends ContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"text\";\n /**\n * Block text.\n */\n text: string;\n /**\n * Index of block in aggregate response. Used during streaming.\n */\n index?: number;\n /**\n * Citations and other annotations.\n */\n annotations?: Array<Citation | BaseContentBlock>;\n }\n\n /**\n * Reasoning output from a LLM.\n */\n export interface Reasoning extends ContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"reasoning\";\n /**\n * Reasoning text.\n *\n * Either the thought summary or the raw reasoning text itself.\n * This is often parsed from `<think>` tags in the model's response.\n */\n reasoning: string;\n /**\n * Index of block in aggregate response. Used during streaming.\n */\n index?: number;\n }\n\n export { Tools };\n export { Multimodal };\n export { Data };\n\n export type Standard =\n | Text\n | Reasoning\n | Tools.Standard\n | Multimodal.Standard;\n}\n"],"mappings":";;;;AAaA,MAAaA,sBAAoB;CAC/B;CACA;CACA,GAAGC;CACH,GAAGC;AACJ"}
1
+ {"version":3,"file":"index.js","names":["KNOWN_BLOCK_TYPES","KNOWN_TOOL_BLOCK_TYPES","KNOWN_MULTIMODAL_BLOCK_TYPES"],"sources":["../../../src/messages/content/index.ts"],"sourcesContent":["import type { BaseContentBlock } from \"./base.js\";\nimport {\n KNOWN_BLOCK_TYPES as KNOWN_TOOL_BLOCK_TYPES,\n type Tools,\n} from \"./tools.js\";\nimport {\n KNOWN_BLOCK_TYPES as KNOWN_MULTIMODAL_BLOCK_TYPES,\n type Multimodal,\n} from \"./multimodal.js\";\nimport { type Data } from \"./data.js\";\n\nexport interface ContentBlock extends BaseContentBlock {}\n\nexport const KNOWN_BLOCK_TYPES = [\n \"text\",\n \"reasoning\",\n ...KNOWN_TOOL_BLOCK_TYPES,\n ...KNOWN_MULTIMODAL_BLOCK_TYPES,\n];\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport declare namespace ContentBlock {\n /**\n * Annotation for citing data from a document.\n */\n export interface Citation {\n /**\n * Type of the content block\n */\n readonly type: \"citation\";\n /**\n * Source type for the citation.\n */\n source?: string;\n /**\n * URL of the document source\n */\n url?: string;\n /**\n * Source document title.\n *\n * For example, the page title for a web page or the title of a paper.\n */\n title?: string;\n /**\n * Start index of the **response text** for which the annotation applies.\n *\n * @see {Text}\n */\n startIndex?: number;\n /**\n * End index of the **response text** for which the annotation applies.\n *\n * @see {Text}\n */\n endIndex?: number;\n /**\n * Excerpt of source text being cited.\n */\n citedText?: string;\n }\n\n /**\n * Text output from a LLM.\n *\n * This typically represents the main text content of a message, such as the response\n * from a language model or the text of a user message.\n */\n export interface Text extends ContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"text\";\n /**\n * Block text.\n */\n text: string;\n /**\n * Index of block in aggregate response. Used during streaming.\n */\n index?: number;\n /**\n * Citations and other annotations.\n */\n annotations?: Array<Citation | BaseContentBlock>;\n }\n\n /**\n * Reasoning output from a LLM.\n */\n export interface Reasoning extends ContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"reasoning\";\n /**\n * Reasoning text.\n *\n * Either the thought summary or the raw reasoning text itself.\n * This is often parsed from `<think>` tags in the model's response.\n */\n reasoning: string;\n /**\n * Index of block in aggregate response. Used during streaming.\n */\n index?: number;\n }\n\n export { Tools };\n export { Multimodal };\n export { Data };\n\n export type Standard =\n | Text\n | Reasoning\n | Tools.Standard\n | Multimodal.Standard;\n}\n"],"mappings":";;;;AAaA,MAAaA,sBAAoB;CAC/B;CACA;CACA,GAAGC;CACH,GAAGC;AACJ"}
@@ -8,30 +8,25 @@ var FunctionMessage = class extends require_base.BaseMessage {
8
8
  static lc_name() {
9
9
  return "FunctionMessage";
10
10
  }
11
- constructor(fields, name) {
12
- if (typeof fields === "string") fields = {
13
- content: fields,
14
- name
15
- };
11
+ type = "function";
12
+ name;
13
+ constructor(fields) {
16
14
  super(fields);
17
- }
18
- _getType() {
19
- return "function";
15
+ this.name = fields.name;
20
16
  }
21
17
  };
22
18
  /**
23
19
  * Represents a chunk of a function message, which can be concatenated
24
20
  * with other function message chunks.
25
21
  */
26
- var FunctionMessageChunk = class FunctionMessageChunk extends require_base.BaseMessageChunk {
22
+ var FunctionMessageChunk = class extends require_base.BaseMessageChunk {
27
23
  static lc_name() {
28
24
  return "FunctionMessageChunk";
29
25
  }
30
- _getType() {
31
- return "function";
32
- }
26
+ type = "function";
33
27
  concat(chunk) {
34
- return new FunctionMessageChunk({
28
+ const Cls = this.constructor;
29
+ return new Cls({
35
30
  content: require_base.mergeContent(this.content, chunk.content),
36
31
  additional_kwargs: require_base._mergeDicts(this.additional_kwargs, chunk.additional_kwargs),
37
32
  response_metadata: require_base._mergeDicts(this.response_metadata, chunk.response_metadata),
@@ -1 +1 @@
1
- {"version":3,"file":"function.cjs","names":["BaseMessage","fields: string | FunctionMessageFieldsWithName","name?: string","BaseMessageChunk","chunk: FunctionMessageChunk","mergeContent","_mergeDicts","x: BaseMessage","x: BaseMessageChunk"],"sources":["../../src/messages/function.ts"],"sourcesContent":["import {\n BaseMessage,\n BaseMessageChunk,\n type BaseMessageFields,\n mergeContent,\n _mergeDicts,\n type MessageType,\n} from \"./base.js\";\n\nexport interface FunctionMessageFieldsWithName extends BaseMessageFields {\n name: string;\n}\n\n/**\n * Represents a function message in a conversation.\n */\nexport class FunctionMessage extends BaseMessage {\n static lc_name() {\n return \"FunctionMessage\";\n }\n\n constructor(fields: FunctionMessageFieldsWithName);\n\n constructor(\n fields: string | BaseMessageFields,\n /** @deprecated */\n name: string\n );\n\n constructor(\n fields: string | FunctionMessageFieldsWithName,\n /** @deprecated */\n name?: string\n ) {\n if (typeof fields === \"string\") {\n // eslint-disable-next-line no-param-reassign, @typescript-eslint/no-non-null-assertion\n fields = { content: fields, name: name! };\n }\n super(fields);\n }\n\n _getType(): MessageType {\n return \"function\";\n }\n}\n\n/**\n * Represents a chunk of a function message, which can be concatenated\n * with other function message chunks.\n */\nexport class FunctionMessageChunk extends BaseMessageChunk {\n static lc_name() {\n return \"FunctionMessageChunk\";\n }\n\n _getType(): MessageType {\n return \"function\";\n }\n\n concat(chunk: FunctionMessageChunk) {\n return new FunctionMessageChunk({\n content: mergeContent(this.content, chunk.content),\n additional_kwargs: _mergeDicts(\n this.additional_kwargs,\n chunk.additional_kwargs\n ),\n response_metadata: _mergeDicts(\n this.response_metadata,\n chunk.response_metadata\n ),\n name: this.name ?? \"\",\n id: this.id ?? chunk.id,\n });\n }\n}\n\nexport function isFunctionMessage(x: BaseMessage): x is FunctionMessage {\n return x._getType() === \"function\";\n}\n\nexport function isFunctionMessageChunk(\n x: BaseMessageChunk\n): x is FunctionMessageChunk {\n return x._getType() === \"function\";\n}\n"],"mappings":";;;;;;AAgBA,IAAa,kBAAb,cAAqCA,yBAAY;CAC/C,OAAO,UAAU;AACf,SAAO;CACR;CAUD,YACEC,QAEAC,MACA;AACA,MAAI,OAAO,WAAW,UAEpB,SAAS;GAAE,SAAS;GAAc;EAAO;EAE3C,MAAM,OAAO;CACd;CAED,WAAwB;AACtB,SAAO;CACR;AACF;;;;;AAMD,IAAa,uBAAb,MAAa,6BAA6BC,8BAAiB;CACzD,OAAO,UAAU;AACf,SAAO;CACR;CAED,WAAwB;AACtB,SAAO;CACR;CAED,OAAOC,OAA6B;AAClC,SAAO,IAAI,qBAAqB;GAC9B,SAASC,0BAAa,KAAK,SAAS,MAAM,QAAQ;GAClD,mBAAmBC,yBACjB,KAAK,mBACL,MAAM,kBACP;GACD,mBAAmBA,yBACjB,KAAK,mBACL,MAAM,kBACP;GACD,MAAM,KAAK,QAAQ;GACnB,IAAI,KAAK,MAAM,MAAM;EACtB;CACF;AACF;AAED,SAAgB,kBAAkBC,GAAsC;AACtE,QAAO,EAAE,UAAU,KAAK;AACzB;AAED,SAAgB,uBACdC,GAC2B;AAC3B,QAAO,EAAE,UAAU,KAAK;AACzB"}
1
+ {"version":3,"file":"function.cjs","names":["BaseMessage","fields: FunctionMessageFields<TStructure>","BaseMessageChunk","chunk: FunctionMessageChunk<TStructure>","mergeContent","_mergeDicts","x: BaseMessage","x: BaseMessageChunk"],"sources":["../../src/messages/function.ts"],"sourcesContent":["import {\n BaseMessage,\n BaseMessageChunk,\n type BaseMessageFields,\n mergeContent,\n _mergeDicts,\n} from \"./base.js\";\nimport { MessageStructure } from \"./message.js\";\nimport { Constructor } from \"./utils.js\";\n\nexport interface FunctionMessageFields<\n TStructure extends MessageStructure = MessageStructure\n> extends BaseMessageFields<TStructure, \"function\"> {\n name: string;\n}\n\n/**\n * Represents a function message in a conversation.\n */\nexport class FunctionMessage<\n TStructure extends MessageStructure = MessageStructure\n >\n extends BaseMessage<TStructure, \"function\">\n implements FunctionMessageFields<TStructure>\n{\n static lc_name() {\n return \"FunctionMessage\";\n }\n\n readonly type = \"function\" as const;\n\n name: string;\n\n constructor(fields: FunctionMessageFields<TStructure>) {\n super(fields);\n this.name = fields.name;\n }\n}\n\n/**\n * Represents a chunk of a function message, which can be concatenated\n * with other function message chunks.\n */\nexport class FunctionMessageChunk<\n TStructure extends MessageStructure = MessageStructure\n> extends BaseMessageChunk<TStructure, \"function\"> {\n static lc_name() {\n return \"FunctionMessageChunk\";\n }\n\n readonly type = \"function\" as const;\n\n concat(chunk: FunctionMessageChunk<TStructure>) {\n const Cls = this.constructor as Constructor<this>;\n return new Cls({\n content: mergeContent(this.content, chunk.content),\n additional_kwargs: _mergeDicts(\n this.additional_kwargs,\n chunk.additional_kwargs\n ),\n response_metadata: _mergeDicts(\n this.response_metadata,\n chunk.response_metadata\n ),\n name: this.name ?? \"\",\n id: this.id ?? chunk.id,\n });\n }\n}\n\nexport function isFunctionMessage(x: BaseMessage): x is FunctionMessage {\n return x._getType() === \"function\";\n}\n\nexport function isFunctionMessageChunk(\n x: BaseMessageChunk\n): x is FunctionMessageChunk {\n return x._getType() === \"function\";\n}\n"],"mappings":";;;;;;AAmBA,IAAa,kBAAb,cAGUA,yBAEV;CACE,OAAO,UAAU;AACf,SAAO;CACR;CAED,AAAS,OAAO;CAEhB;CAEA,YAAYC,QAA2C;EACrD,MAAM,OAAO;EACb,KAAK,OAAO,OAAO;CACpB;AACF;;;;;AAMD,IAAa,uBAAb,cAEUC,8BAAyC;CACjD,OAAO,UAAU;AACf,SAAO;CACR;CAED,AAAS,OAAO;CAEhB,OAAOC,OAAyC;EAC9C,MAAM,MAAM,KAAK;AACjB,SAAO,IAAI,IAAI;GACb,SAASC,0BAAa,KAAK,SAAS,MAAM,QAAQ;GAClD,mBAAmBC,yBACjB,KAAK,mBACL,MAAM,kBACP;GACD,mBAAmBA,yBACjB,KAAK,mBACL,MAAM,kBACP;GACD,MAAM,KAAK,QAAQ;GACnB,IAAI,KAAK,MAAM,MAAM;EACtB;CACF;AACF;AAED,SAAgB,kBAAkBC,GAAsC;AACtE,QAAO,EAAE,UAAU,KAAK;AACzB;AAED,SAAgB,uBACdC,GAC2B;AAC3B,QAAO,EAAE,UAAU,KAAK;AACzB"}
@@ -1,30 +1,30 @@
1
- import { BaseMessage, BaseMessageChunk, BaseMessageFields, MessageType } from "./base.cjs";
1
+ import { BaseMessage, BaseMessageChunk, BaseMessageFields } from "./base.cjs";
2
+ import { MessageStructure } from "./message.cjs";
2
3
 
3
4
  //#region src/messages/function.d.ts
4
- interface FunctionMessageFieldsWithName extends BaseMessageFields {
5
+ interface FunctionMessageFields<TStructure extends MessageStructure = MessageStructure> extends BaseMessageFields<TStructure, "function"> {
5
6
  name: string;
6
7
  }
7
8
  /**
8
9
  * Represents a function message in a conversation.
9
10
  */
10
- declare class FunctionMessage extends BaseMessage {
11
+ declare class FunctionMessage<TStructure extends MessageStructure = MessageStructure> extends BaseMessage<TStructure, "function"> implements FunctionMessageFields<TStructure> {
11
12
  static lc_name(): string;
12
- constructor(fields: FunctionMessageFieldsWithName);
13
- constructor(fields: string | BaseMessageFields, /** @deprecated */
14
- name: string);
15
- _getType(): MessageType;
13
+ readonly type: "function";
14
+ name: string;
15
+ constructor(fields: FunctionMessageFields<TStructure>);
16
16
  }
17
17
  /**
18
18
  * Represents a chunk of a function message, which can be concatenated
19
19
  * with other function message chunks.
20
20
  */
21
- declare class FunctionMessageChunk extends BaseMessageChunk {
21
+ declare class FunctionMessageChunk<TStructure extends MessageStructure = MessageStructure> extends BaseMessageChunk<TStructure, "function"> {
22
22
  static lc_name(): string;
23
- _getType(): MessageType;
24
- concat(chunk: FunctionMessageChunk): FunctionMessageChunk;
23
+ readonly type: "function";
24
+ concat(chunk: FunctionMessageChunk<TStructure>): this;
25
25
  }
26
26
  declare function isFunctionMessage(x: BaseMessage): x is FunctionMessage;
27
27
  declare function isFunctionMessageChunk(x: BaseMessageChunk): x is FunctionMessageChunk;
28
28
  //#endregion
29
- export { FunctionMessage, FunctionMessageChunk, FunctionMessageFieldsWithName, isFunctionMessage, isFunctionMessageChunk };
29
+ export { FunctionMessage, FunctionMessageChunk, FunctionMessageFields, isFunctionMessage, isFunctionMessageChunk };
30
30
  //# sourceMappingURL=function.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"function.d.cts","names":["BaseMessage","BaseMessageChunk","BaseMessageFields","MessageType","FunctionMessageFieldsWithName","FunctionMessage","FunctionMessageChunk","isFunctionMessage","isFunctionMessageChunk"],"sources":["../../src/messages/function.d.ts"],"sourcesContent":["import { BaseMessage, BaseMessageChunk, type BaseMessageFields, type MessageType } from \"./base.js\";\nexport interface FunctionMessageFieldsWithName extends BaseMessageFields {\n name: string;\n}\n/**\n * Represents a function message in a conversation.\n */\nexport declare class FunctionMessage extends BaseMessage {\n static lc_name(): string;\n constructor(fields: FunctionMessageFieldsWithName);\n constructor(fields: string | BaseMessageFields, \n /** @deprecated */\n name: string);\n _getType(): MessageType;\n}\n/**\n * Represents a chunk of a function message, which can be concatenated\n * with other function message chunks.\n */\nexport declare class FunctionMessageChunk extends BaseMessageChunk {\n static lc_name(): string;\n _getType(): MessageType;\n concat(chunk: FunctionMessageChunk): FunctionMessageChunk;\n}\nexport declare function isFunctionMessage(x: BaseMessage): x is FunctionMessage;\nexport declare function isFunctionMessageChunk(x: BaseMessageChunk): x is FunctionMessageChunk;\n"],"mappings":";;;UACiBI,6BAAAA,SAAsCF;;AAAvD;AAMA;;;AAGiCA,cAHZG,eAAAA,SAAwBL,WAAAA,CAGZE;EAAiB,OAGlCC,OAAAA,CAAAA,CAAAA,EAAAA,MAAAA;EAAW,WANkBH,CAAAA,MAAAA,EAErBI,6BAFqBJ;EAAW,WAAA,CAAA,MAAA,EAAA,MAAA,GAGvBE,iBAHuB,EAYnCI;EAAoB,IAAA,EAAA,MAAA;EAAA,QAEzBH,CAAAA,CAAAA,EARAA,WAQAA;;;;AAFkD;AAKlE;AAAyC,cALpBG,oBAAAA,SAA6BL,gBAAAA,CAKT;EAAA,OAAID,OAAAA,CAAAA,CAAAA,EAAAA,MAAAA;EAAW,QAAQK,CAAAA,CAAAA,EAHhDF,WAGgDE;EAAe,MAAA,CAAA,KAAA,EAF7DC,oBAE6D,CAAA,EAFtCA,oBAEsC;AAC/E;AAA8C,iBADtBC,iBAAAA,CACsB,CAAA,EADDP,WACC,CAAA,EAAA,CAAA,IADkBK,eAClB;AAAIJ,iBAA1BO,sBAAAA,CAA0BP,CAAAA,EAAAA,gBAAAA,CAAAA,EAAAA,CAAAA,IAAwBK,oBAAxBL"}
1
+ {"version":3,"file":"function.d.cts","names":["BaseMessage","BaseMessageChunk","BaseMessageFields","MessageStructure","FunctionMessageFields","TStructure","FunctionMessage","FunctionMessageChunk","isFunctionMessage","isFunctionMessageChunk"],"sources":["../../src/messages/function.d.ts"],"sourcesContent":["import { BaseMessage, BaseMessageChunk, type BaseMessageFields } from \"./base.js\";\nimport { MessageStructure } from \"./message.js\";\nexport interface FunctionMessageFields<TStructure extends MessageStructure = MessageStructure> extends BaseMessageFields<TStructure, \"function\"> {\n name: string;\n}\n/**\n * Represents a function message in a conversation.\n */\nexport declare class FunctionMessage<TStructure extends MessageStructure = MessageStructure> extends BaseMessage<TStructure, \"function\"> implements FunctionMessageFields<TStructure> {\n static lc_name(): string;\n readonly type: \"function\";\n name: string;\n constructor(fields: FunctionMessageFields<TStructure>);\n}\n/**\n * Represents a chunk of a function message, which can be concatenated\n * with other function message chunks.\n */\nexport declare class FunctionMessageChunk<TStructure extends MessageStructure = MessageStructure> extends BaseMessageChunk<TStructure, \"function\"> {\n static lc_name(): string;\n readonly type: \"function\";\n concat(chunk: FunctionMessageChunk<TStructure>): this;\n}\nexport declare function isFunctionMessage(x: BaseMessage): x is FunctionMessage;\nexport declare function isFunctionMessageChunk(x: BaseMessageChunk): x is FunctionMessageChunk;\n"],"mappings":";;;;UAEiBI,yCAAyCD,mBAAmBA,0BAA0BD,kBAAkBG;;AAAzH;;;;AAAyHA,cAMpGC,eANoGD,CAAAA,mBAMjEF,gBANiEE,GAM9CF,gBAN8CE,CAAAA,SAMpBL,WANoBK,CAMRA,UANQA,EAAAA,UAAAA,CAAAA,YAM2BD,qBAN3BC,CAMiDA,UANjDA,CAAAA,CAAAA;EAAU,OAA5BH,OAAAA,CAAAA,CAAAA,EAAAA,MAAAA;EAAiB,SAAA,IAAA,EAAA,UAAA;EAMnGI,IAAAA,EAAAA,MAAAA;EAAe,WAAA,CAAA,MAAA,EAIZF,qBAJY,CAIUC,UAJV,CAAA;;;;;;AAIZD,cAMHG,oBANGH,CAAAA,mBAMqCD,gBANrCC,GAMwDD,gBANxDC,CAAAA,SAMkFH,gBANlFG,CAMmGC,UANnGD,EAAAA,UAAAA,CAAAA,CAAAA;EAAqB,OAJwDJ,OAAAA,CAAAA,CAAAA,EAAAA,MAAAA;EAAW,SAAoCI,IAAAA,EAAAA,UAAAA;EAAqB,MAAA,CAAA,KAAA,EAavJG,oBAbuJ,CAalIF,UAbkI,CAAA,CAAA,EAAA,IAAA;AAUzK;AAAyC,iBAKjBG,iBAAAA,CALiB,CAAA,EAKIR,WALJ,CAAA,EAAA,CAAA,IAKuBM,eALvB;AAAoBH,iBAMrCM,sBAAAA,CANqCN,CAAAA,EAMXF,gBANWE,CAAAA,EAAAA,CAAAA,IAMaI,oBANbJ"}
@@ -1,30 +1,30 @@
1
- import { BaseMessage, BaseMessageChunk, BaseMessageFields, MessageType } from "./base.js";
1
+ import { BaseMessage, BaseMessageChunk, BaseMessageFields } from "./base.js";
2
+ import { MessageStructure } from "./message.js";
2
3
 
3
4
  //#region src/messages/function.d.ts
4
- interface FunctionMessageFieldsWithName extends BaseMessageFields {
5
+ interface FunctionMessageFields<TStructure extends MessageStructure = MessageStructure> extends BaseMessageFields<TStructure, "function"> {
5
6
  name: string;
6
7
  }
7
8
  /**
8
9
  * Represents a function message in a conversation.
9
10
  */
10
- declare class FunctionMessage extends BaseMessage {
11
+ declare class FunctionMessage<TStructure extends MessageStructure = MessageStructure> extends BaseMessage<TStructure, "function"> implements FunctionMessageFields<TStructure> {
11
12
  static lc_name(): string;
12
- constructor(fields: FunctionMessageFieldsWithName);
13
- constructor(fields: string | BaseMessageFields, /** @deprecated */
14
- name: string);
15
- _getType(): MessageType;
13
+ readonly type: "function";
14
+ name: string;
15
+ constructor(fields: FunctionMessageFields<TStructure>);
16
16
  }
17
17
  /**
18
18
  * Represents a chunk of a function message, which can be concatenated
19
19
  * with other function message chunks.
20
20
  */
21
- declare class FunctionMessageChunk extends BaseMessageChunk {
21
+ declare class FunctionMessageChunk<TStructure extends MessageStructure = MessageStructure> extends BaseMessageChunk<TStructure, "function"> {
22
22
  static lc_name(): string;
23
- _getType(): MessageType;
24
- concat(chunk: FunctionMessageChunk): FunctionMessageChunk;
23
+ readonly type: "function";
24
+ concat(chunk: FunctionMessageChunk<TStructure>): this;
25
25
  }
26
26
  declare function isFunctionMessage(x: BaseMessage): x is FunctionMessage;
27
27
  declare function isFunctionMessageChunk(x: BaseMessageChunk): x is FunctionMessageChunk;
28
28
  //#endregion
29
- export { FunctionMessage, FunctionMessageChunk, FunctionMessageFieldsWithName, isFunctionMessage, isFunctionMessageChunk };
29
+ export { FunctionMessage, FunctionMessageChunk, FunctionMessageFields, isFunctionMessage, isFunctionMessageChunk };
30
30
  //# sourceMappingURL=function.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"function.d.ts","names":["BaseMessage","BaseMessageChunk","BaseMessageFields","MessageType","FunctionMessageFieldsWithName","FunctionMessage","FunctionMessageChunk","isFunctionMessage","isFunctionMessageChunk"],"sources":["../../src/messages/function.d.ts"],"sourcesContent":["import { BaseMessage, BaseMessageChunk, type BaseMessageFields, type MessageType } from \"./base.js\";\nexport interface FunctionMessageFieldsWithName extends BaseMessageFields {\n name: string;\n}\n/**\n * Represents a function message in a conversation.\n */\nexport declare class FunctionMessage extends BaseMessage {\n static lc_name(): string;\n constructor(fields: FunctionMessageFieldsWithName);\n constructor(fields: string | BaseMessageFields, \n /** @deprecated */\n name: string);\n _getType(): MessageType;\n}\n/**\n * Represents a chunk of a function message, which can be concatenated\n * with other function message chunks.\n */\nexport declare class FunctionMessageChunk extends BaseMessageChunk {\n static lc_name(): string;\n _getType(): MessageType;\n concat(chunk: FunctionMessageChunk): FunctionMessageChunk;\n}\nexport declare function isFunctionMessage(x: BaseMessage): x is FunctionMessage;\nexport declare function isFunctionMessageChunk(x: BaseMessageChunk): x is FunctionMessageChunk;\n"],"mappings":";;;UACiBI,6BAAAA,SAAsCF;;AAAvD;AAMA;;;AAGiCA,cAHZG,eAAAA,SAAwBL,WAAAA,CAGZE;EAAiB,OAGlCC,OAAAA,CAAAA,CAAAA,EAAAA,MAAAA;EAAW,WANkBH,CAAAA,MAAAA,EAErBI,6BAFqBJ;EAAW,WAAA,CAAA,MAAA,EAAA,MAAA,GAGvBE,iBAHuB,EAYnCI;EAAoB,IAAA,EAAA,MAAA;EAAA,QAEzBH,CAAAA,CAAAA,EARAA,WAQAA;;;;AAFkD;AAKlE;AAAyC,cALpBG,oBAAAA,SAA6BL,gBAAAA,CAKT;EAAA,OAAID,OAAAA,CAAAA,CAAAA,EAAAA,MAAAA;EAAW,QAAQK,CAAAA,CAAAA,EAHhDF,WAGgDE;EAAe,MAAA,CAAA,KAAA,EAF7DC,oBAE6D,CAAA,EAFtCA,oBAEsC;AAC/E;AAA8C,iBADtBC,iBAAAA,CACsB,CAAA,EADDP,WACC,CAAA,EAAA,CAAA,IADkBK,eAClB;AAAIJ,iBAA1BO,sBAAAA,CAA0BP,CAAAA,EAAAA,gBAAAA,CAAAA,EAAAA,CAAAA,IAAwBK,oBAAxBL"}
1
+ {"version":3,"file":"function.d.ts","names":["BaseMessage","BaseMessageChunk","BaseMessageFields","MessageStructure","FunctionMessageFields","TStructure","FunctionMessage","FunctionMessageChunk","isFunctionMessage","isFunctionMessageChunk"],"sources":["../../src/messages/function.d.ts"],"sourcesContent":["import { BaseMessage, BaseMessageChunk, type BaseMessageFields } from \"./base.js\";\nimport { MessageStructure } from \"./message.js\";\nexport interface FunctionMessageFields<TStructure extends MessageStructure = MessageStructure> extends BaseMessageFields<TStructure, \"function\"> {\n name: string;\n}\n/**\n * Represents a function message in a conversation.\n */\nexport declare class FunctionMessage<TStructure extends MessageStructure = MessageStructure> extends BaseMessage<TStructure, \"function\"> implements FunctionMessageFields<TStructure> {\n static lc_name(): string;\n readonly type: \"function\";\n name: string;\n constructor(fields: FunctionMessageFields<TStructure>);\n}\n/**\n * Represents a chunk of a function message, which can be concatenated\n * with other function message chunks.\n */\nexport declare class FunctionMessageChunk<TStructure extends MessageStructure = MessageStructure> extends BaseMessageChunk<TStructure, \"function\"> {\n static lc_name(): string;\n readonly type: \"function\";\n concat(chunk: FunctionMessageChunk<TStructure>): this;\n}\nexport declare function isFunctionMessage(x: BaseMessage): x is FunctionMessage;\nexport declare function isFunctionMessageChunk(x: BaseMessageChunk): x is FunctionMessageChunk;\n"],"mappings":";;;;UAEiBI,yCAAyCD,mBAAmBA,0BAA0BD,kBAAkBG;;AAAzH;;;;AAAyHA,cAMpGC,eANoGD,CAAAA,mBAMjEF,gBANiEE,GAM9CF,gBAN8CE,CAAAA,SAMpBL,WANoBK,CAMRA,UANQA,EAAAA,UAAAA,CAAAA,YAM2BD,qBAN3BC,CAMiDA,UANjDA,CAAAA,CAAAA;EAAU,OAA5BH,OAAAA,CAAAA,CAAAA,EAAAA,MAAAA;EAAiB,SAAA,IAAA,EAAA,UAAA;EAMnGI,IAAAA,EAAAA,MAAAA;EAAe,WAAA,CAAA,MAAA,EAIZF,qBAJY,CAIUC,UAJV,CAAA;;;;;;AAIZD,cAMHG,oBANGH,CAAAA,mBAMqCD,gBANrCC,GAMwDD,gBANxDC,CAAAA,SAMkFH,gBANlFG,CAMmGC,UANnGD,EAAAA,UAAAA,CAAAA,CAAAA;EAAqB,OAJwDJ,OAAAA,CAAAA,CAAAA,EAAAA,MAAAA;EAAW,SAAoCI,IAAAA,EAAAA,UAAAA;EAAqB,MAAA,CAAA,KAAA,EAavJG,oBAbuJ,CAalIF,UAbkI,CAAA,CAAA,EAAA,IAAA;AAUzK;AAAyC,iBAKjBG,iBAAAA,CALiB,CAAA,EAKIR,WALJ,CAAA,EAAA,CAAA,IAKuBM,eALvB;AAAoBH,iBAMrCM,sBAAAA,CANqCN,CAAAA,EAMXF,gBANWE,CAAAA,EAAAA,CAAAA,IAMaI,oBANbJ"}