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

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 (173) hide show
  1. package/dist/agents.d.ts.map +1 -1
  2. package/dist/caches/base.d.cts.map +1 -1
  3. package/dist/caches/base.d.ts.map +1 -1
  4. package/dist/callbacks/base.d.cts.map +1 -1
  5. package/dist/language_models/chat_models.d.cts.map +1 -1
  6. package/dist/language_models/chat_models.d.ts.map +1 -1
  7. package/dist/load/import_map.cjs +1 -1
  8. package/dist/load/import_map.js +1 -1
  9. package/dist/messages/ai.cjs +19 -14
  10. package/dist/messages/ai.cjs.map +1 -1
  11. package/dist/messages/ai.js +19 -14
  12. package/dist/messages/ai.js.map +1 -1
  13. package/dist/messages/base.cjs +9 -2
  14. package/dist/messages/base.cjs.map +1 -1
  15. package/dist/messages/base.d.cts +2 -2
  16. package/dist/messages/base.d.cts.map +1 -1
  17. package/dist/messages/base.d.ts +2 -2
  18. package/dist/messages/base.d.ts.map +1 -1
  19. package/dist/messages/base.js +9 -2
  20. package/dist/messages/base.js.map +1 -1
  21. package/dist/messages/block_translators/bedrock_converse.cjs +213 -0
  22. package/dist/messages/block_translators/bedrock_converse.cjs.map +1 -0
  23. package/dist/messages/block_translators/bedrock_converse.js +213 -0
  24. package/dist/messages/block_translators/bedrock_converse.js.map +1 -0
  25. package/dist/messages/block_translators/google_genai.cjs +73 -0
  26. package/dist/messages/block_translators/google_genai.cjs.map +1 -0
  27. package/dist/messages/block_translators/google_genai.js +73 -0
  28. package/dist/messages/block_translators/google_genai.js.map +1 -0
  29. package/dist/messages/block_translators/google_vertexai.cjs +74 -0
  30. package/dist/messages/block_translators/google_vertexai.cjs.map +1 -0
  31. package/dist/messages/block_translators/google_vertexai.js +74 -0
  32. package/dist/messages/block_translators/google_vertexai.js.map +1 -0
  33. package/dist/messages/block_translators/index.cjs +10 -1
  34. package/dist/messages/block_translators/index.cjs.map +1 -1
  35. package/dist/messages/block_translators/index.js +10 -1
  36. package/dist/messages/block_translators/index.js.map +1 -1
  37. package/dist/messages/block_translators/utils.cjs +4 -0
  38. package/dist/messages/block_translators/utils.cjs.map +1 -1
  39. package/dist/messages/block_translators/utils.js +4 -1
  40. package/dist/messages/block_translators/utils.js.map +1 -1
  41. package/dist/messages/content/index.cjs.map +1 -1
  42. package/dist/messages/content/index.d.cts +20 -1
  43. package/dist/messages/content/index.d.cts.map +1 -1
  44. package/dist/messages/content/index.d.ts +20 -1
  45. package/dist/messages/content/index.d.ts.map +1 -1
  46. package/dist/messages/content/index.js.map +1 -1
  47. package/dist/messages/content/tools.cjs +3 -0
  48. package/dist/messages/content/tools.cjs.map +1 -1
  49. package/dist/messages/content/tools.d.cts +67 -6
  50. package/dist/messages/content/tools.d.cts.map +1 -1
  51. package/dist/messages/content/tools.d.ts +67 -6
  52. package/dist/messages/content/tools.d.ts.map +1 -1
  53. package/dist/messages/content/tools.js +3 -0
  54. package/dist/messages/content/tools.js.map +1 -1
  55. package/dist/messages/index.cjs +4 -0
  56. package/dist/messages/index.cjs.map +1 -1
  57. package/dist/messages/index.d.cts +2 -2
  58. package/dist/messages/index.d.ts +2 -2
  59. package/dist/messages/index.js +4 -2
  60. package/dist/messages/index.js.map +1 -1
  61. package/dist/messages/message.cjs.map +1 -1
  62. package/dist/messages/message.d.cts +6 -6
  63. package/dist/messages/message.d.cts.map +1 -1
  64. package/dist/messages/message.d.ts +6 -6
  65. package/dist/messages/message.d.ts.map +1 -1
  66. package/dist/messages/message.js.map +1 -1
  67. package/dist/messages/tool.cjs.map +1 -1
  68. package/dist/messages/tool.d.cts +3 -1
  69. package/dist/messages/tool.d.cts.map +1 -1
  70. package/dist/messages/tool.d.ts +3 -1
  71. package/dist/messages/tool.d.ts.map +1 -1
  72. package/dist/messages/tool.js.map +1 -1
  73. package/dist/utils/testing/chat_models.cjs +245 -0
  74. package/dist/utils/testing/chat_models.cjs.map +1 -0
  75. package/dist/utils/testing/chat_models.d.cts +134 -0
  76. package/dist/utils/testing/chat_models.d.cts.map +1 -0
  77. package/dist/utils/testing/chat_models.d.ts +134 -0
  78. package/dist/utils/testing/chat_models.d.ts.map +1 -0
  79. package/dist/utils/testing/chat_models.js +243 -0
  80. package/dist/utils/testing/chat_models.js.map +1 -0
  81. package/dist/utils/testing/embeddings.cjs +90 -0
  82. package/dist/utils/testing/embeddings.cjs.map +1 -0
  83. package/dist/utils/testing/embeddings.d.cts +58 -0
  84. package/dist/utils/testing/embeddings.d.cts.map +1 -0
  85. package/dist/utils/testing/embeddings.d.ts +58 -0
  86. package/dist/utils/testing/embeddings.d.ts.map +1 -0
  87. package/dist/utils/testing/embeddings.js +89 -0
  88. package/dist/utils/testing/embeddings.js.map +1 -0
  89. package/dist/utils/testing/index.cjs +42 -655
  90. package/dist/utils/testing/index.cjs.map +1 -1
  91. package/dist/utils/testing/index.d.cts +11 -379
  92. package/dist/utils/testing/index.d.ts +11 -379
  93. package/dist/utils/testing/index.js +10 -623
  94. package/dist/utils/testing/index.js.map +1 -1
  95. package/dist/utils/testing/llms.cjs +59 -0
  96. package/dist/utils/testing/llms.cjs.map +1 -0
  97. package/dist/utils/testing/llms.d.cts +31 -0
  98. package/dist/utils/testing/llms.d.cts.map +1 -0
  99. package/dist/utils/testing/llms.d.ts +31 -0
  100. package/dist/utils/testing/llms.d.ts.map +1 -0
  101. package/dist/utils/testing/llms.js +58 -0
  102. package/dist/utils/testing/llms.js.map +1 -0
  103. package/dist/utils/testing/message_history.cjs +67 -0
  104. package/dist/utils/testing/message_history.cjs.map +1 -0
  105. package/dist/utils/testing/message_history.d.cts +31 -0
  106. package/dist/utils/testing/message_history.d.cts.map +1 -0
  107. package/dist/utils/testing/message_history.d.ts +31 -0
  108. package/dist/utils/testing/message_history.d.ts.map +1 -0
  109. package/dist/utils/testing/message_history.js +65 -0
  110. package/dist/utils/testing/message_history.js.map +1 -0
  111. package/dist/utils/testing/output_parsers.cjs +20 -0
  112. package/dist/utils/testing/output_parsers.cjs.map +1 -0
  113. package/dist/utils/testing/output_parsers.d.cts +16 -0
  114. package/dist/utils/testing/output_parsers.d.cts.map +1 -0
  115. package/dist/utils/testing/output_parsers.d.ts +16 -0
  116. package/dist/utils/testing/output_parsers.d.ts.map +1 -0
  117. package/dist/utils/testing/output_parsers.js +20 -0
  118. package/dist/utils/testing/output_parsers.js.map +1 -0
  119. package/dist/utils/testing/retrievers.cjs +19 -0
  120. package/dist/utils/testing/retrievers.cjs.map +1 -0
  121. package/dist/utils/testing/retrievers.d.cts +17 -0
  122. package/dist/utils/testing/retrievers.d.cts.map +1 -0
  123. package/dist/utils/testing/retrievers.d.ts +17 -0
  124. package/dist/utils/testing/retrievers.d.ts.map +1 -0
  125. package/dist/utils/testing/retrievers.js +19 -0
  126. package/dist/utils/testing/retrievers.js.map +1 -0
  127. package/dist/utils/testing/runnables.cjs +19 -0
  128. package/dist/utils/testing/runnables.cjs.map +1 -0
  129. package/dist/utils/testing/runnables.d.cts +15 -0
  130. package/dist/utils/testing/runnables.d.cts.map +1 -0
  131. package/dist/utils/testing/runnables.d.ts +15 -0
  132. package/dist/utils/testing/runnables.d.ts.map +1 -0
  133. package/dist/utils/testing/runnables.js +19 -0
  134. package/dist/utils/testing/runnables.js.map +1 -0
  135. package/dist/utils/testing/tools.cjs +21 -0
  136. package/dist/utils/testing/tools.cjs.map +1 -0
  137. package/dist/utils/testing/tools.d.cts +21 -0
  138. package/dist/utils/testing/tools.d.cts.map +1 -0
  139. package/dist/utils/testing/tools.d.ts +21 -0
  140. package/dist/utils/testing/tools.d.ts.map +1 -0
  141. package/dist/utils/testing/tools.js +21 -0
  142. package/dist/utils/testing/tools.js.map +1 -0
  143. package/dist/utils/testing/tracers.cjs +25 -0
  144. package/dist/utils/testing/tracers.cjs.map +1 -0
  145. package/dist/utils/testing/tracers.d.cts +15 -0
  146. package/dist/utils/testing/tracers.d.cts.map +1 -0
  147. package/dist/utils/testing/tracers.d.ts +15 -0
  148. package/dist/utils/testing/tracers.d.ts.map +1 -0
  149. package/dist/utils/testing/tracers.js +25 -0
  150. package/dist/utils/testing/tracers.js.map +1 -0
  151. package/dist/utils/testing/vectorstores.cjs +129 -0
  152. package/dist/utils/testing/vectorstores.cjs.map +1 -0
  153. package/dist/utils/testing/vectorstores.d.cts +101 -0
  154. package/dist/utils/testing/vectorstores.d.cts.map +1 -0
  155. package/dist/utils/testing/vectorstores.d.ts +101 -0
  156. package/dist/utils/testing/vectorstores.d.ts.map +1 -0
  157. package/dist/utils/testing/vectorstores.js +129 -0
  158. package/dist/utils/testing/vectorstores.js.map +1 -0
  159. package/dist/utils/types/index.cjs +2 -0
  160. package/dist/utils/types/index.d.cts +2 -2
  161. package/dist/utils/types/index.d.ts +2 -2
  162. package/dist/utils/types/index.js +3 -2
  163. package/dist/utils/types/zod.cjs +39 -3
  164. package/dist/utils/types/zod.cjs.map +1 -1
  165. package/dist/utils/types/zod.d.cts +18 -1
  166. package/dist/utils/types/zod.d.cts.map +1 -1
  167. package/dist/utils/types/zod.d.ts +18 -1
  168. package/dist/utils/types/zod.d.ts.map +1 -1
  169. package/dist/utils/types/zod.js +39 -4
  170. package/dist/utils/types/zod.js.map +1 -1
  171. package/package.json +1 -1
  172. package/dist/utils/testing/index.d.cts.map +0 -1
  173. package/dist/utils/testing/index.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"tools.cjs","names":[],"sources":["../../../src/messages/content/tools.ts"],"sourcesContent":["import { BaseContentBlock } from \"./base.js\";\n\nexport type Tools = never;\n\nexport const KNOWN_BLOCK_TYPES = [\n \"tool_call\",\n \"tool_call_chunk\",\n \"invalid_tool_call\",\n \"web_search_call\",\n \"web_search_result\",\n \"code_interpreter\",\n \"code_interpreter_result\",\n];\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport declare namespace Tools {\n /**\n * Represents a request to call a tool.\n *\n * @example\n * ```ts\n * const toolCall: ToolCall = {\n * type: \"tool_call\",\n * name: \"foo\",\n * args: { a: 1 },\n * callId: \"123\"\n * };\n * ```\n * This represents a request to call the tool named \"foo\" with arguments {\"a\": 1}\n * and an identifier of \"123\".\n */\n export interface ToolCall<TName extends string = string, TArgs = unknown>\n extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"tool_call\";\n /**\n * The name of the tool being called\n */\n name: TName;\n /**\n * The arguments to the tool call\n */\n args: TArgs;\n }\n\n /** Content block to represent partial data of a tool call */\n export interface ToolCallChunk<TName extends string = string>\n extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"tool_call_chunk\";\n /**\n * The name of the tool being called\n */\n name?: TName;\n /**\n * The arguments to the tool call\n */\n args?: string;\n /**\n * The index of the tool call chunk\n */\n index?: number;\n }\n\n /** Content block to represent an invalid tool call */\n export interface InvalidToolCall<TName extends string = string>\n extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"invalid_tool_call\";\n /**\n * The name of the tool being called\n */\n name?: TName;\n /**\n * The arguments to the tool call\n */\n args?: string;\n /**\n * An error message associated with the tool call\n */\n error?: string;\n /**\n * Index of block in aggregate response\n */\n index?: string | number;\n }\n\n /** Content block for a built-in web search tool call. */\n export interface WebSearchCall extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"web_search_call\";\n /**\n * The search query used in the web search tool call\n */\n query?: string;\n }\n\n /** Content block for the result of a built-in search tool call */\n export interface WebSearchResult extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"web_search_result\";\n /**\n * List of URLs returned by the web search tool call\n */\n urls?: string[];\n }\n\n /** Content block for a built-in code interpreter tool call. */\n export interface CodeInterpreterCall extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"code_interpreter_call\";\n /**\n * The language of the code executed by the code interpreter tool call\n */\n language?: string;\n /**\n * The code to be executed by the code interpreter\n */\n code?: string;\n }\n\n /** Content block for the output of a singular code interpreter tool call */\n export interface CodeInterpreterOutput {\n readonly type: \"code_interpreter_output\";\n /**\n * The return code of the code interpreter tool call\n * Example: 0 for success, non-zero for failure\n */\n returnCode?: number;\n /**\n * Standard error output of the executed code\n */\n stderr?: string;\n /**\n * Standard output of the executed code\n */\n stdout?: string;\n /**\n * File IDs of the files created by the code interpreter tool call\n */\n fileIds?: string[];\n }\n\n /** Content block for the result of a code interpreter tool call */\n export interface CodeInterpreterResult extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"code_interpreter_result\";\n /**\n * The result of the code interpreter tool call\n */\n output: CodeInterpreterOutput[];\n }\n\n export type Standard =\n | ToolCall\n | ToolCallChunk\n | InvalidToolCall\n | WebSearchCall\n | WebSearchResult\n | CodeInterpreterCall\n | CodeInterpreterResult;\n}\n"],"mappings":";;AAIA,MAAa,oBAAoB;CAC/B;CACA;CACA;CACA;CACA;CACA;CACA;AACD"}
1
+ {"version":3,"file":"tools.cjs","names":[],"sources":["../../../src/messages/content/tools.ts"],"sourcesContent":["import { BaseContentBlock } from \"./base.js\";\n\nexport type Tools = never;\n\nexport const KNOWN_BLOCK_TYPES = [\n \"tool_call\",\n \"tool_call_chunk\",\n \"invalid_tool_call\",\n \"server_tool_call\",\n \"server_tool_call_chunk\",\n \"server_tool_call_result\",\n \"web_search_call\",\n \"web_search_result\",\n \"code_interpreter\",\n \"code_interpreter_result\",\n];\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport declare namespace Tools {\n /**\n * Represents a request to call a tool.\n *\n * @example\n * ```ts\n * const toolCall: ToolCall = {\n * type: \"tool_call\",\n * name: \"foo\",\n * args: { a: 1 },\n * callId: \"123\"\n * };\n * ```\n * This represents a request to call the tool named \"foo\" with arguments {\"a\": 1}\n * and an identifier of \"123\".\n */\n export interface ToolCall<TName extends string = string, TArgs = unknown>\n extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"tool_call\";\n /**\n * The name of the tool being called\n */\n name: TName;\n /**\n * The arguments to the tool call\n */\n args: TArgs;\n }\n\n /** Content block to represent partial data of a tool call */\n export interface ToolCallChunk<TName extends string = string>\n extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"tool_call_chunk\";\n /**\n * The name of the tool being called\n */\n name?: TName;\n /**\n * The arguments to the tool call\n */\n args?: string;\n /**\n * The index of the tool call chunk\n */\n index?: number;\n }\n\n /** Content block to represent an invalid tool call */\n export interface InvalidToolCall<TName extends string = string>\n extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"invalid_tool_call\";\n /**\n * The name of the tool being called\n */\n name?: TName;\n /**\n * The arguments to the tool call\n */\n args?: string;\n /**\n * An error message associated with the tool call\n */\n error?: string;\n /**\n * Index of block in aggregate response\n */\n index?: string | number;\n }\n\n export interface ServerToolCall<\n TName extends string = string,\n TArgs = unknown\n > extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"server_tool_call\";\n /**\n * The name of the tool being called\n */\n name: TName;\n /**\n * The arguments to the tool call\n */\n args: TArgs;\n }\n\n export interface ServerToolCallChunk<TName extends string = string>\n extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"server_tool_call_chunk\";\n /**\n * The name of the tool being called\n */\n name?: TName;\n /**\n * The arguments to the tool call\n */\n args?: string;\n }\n\n export interface ServerToolCallResult<TOutput = Record<string, unknown>>\n extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"server_tool_call_result\";\n /**\n * The unique identifier of the tool call that this result corresponds to\n */\n toolCallId: string;\n /**\n * The status of the server tool call\n */\n status: \"success\" | \"error\";\n /**\n * The output of the server tool call\n */\n output: TOutput;\n }\n\n /**\n * Content block for a built-in web search tool call.\n * @deprecated Use ServerToolCall instead\n */\n export interface WebSearchCall extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"web_search_call\";\n /**\n * The search query used in the web search tool call\n */\n query?: string;\n }\n\n /**\n * Content block for the result of a built-in search tool call\n * @deprecated Use ServerToolCallResult instead\n */\n export interface WebSearchResult extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"web_search_result\";\n /**\n * List of URLs returned by the web search tool call\n */\n urls?: string[];\n }\n\n /**\n * Content block for a built-in code interpreter tool call.\n * @deprecated Use ServerToolCall instead\n */\n export interface CodeInterpreterCall extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"code_interpreter_call\";\n /**\n * The language of the code executed by the code interpreter tool call\n */\n language?: string;\n /**\n * The code to be executed by the code interpreter\n */\n code?: string;\n }\n\n /**\n * Content block for the output of a singular code interpreter tool call\n * @deprecated Use ServerToolCallResult instead\n */\n export interface CodeInterpreterOutput {\n readonly type: \"code_interpreter_output\";\n /**\n * The return code of the code interpreter tool call\n * Example: 0 for success, non-zero for failure\n */\n returnCode?: number;\n /**\n * Standard error output of the executed code\n */\n stderr?: string;\n /**\n * Standard output of the executed code\n */\n stdout?: string;\n /**\n * File IDs of the files created by the code interpreter tool call\n */\n fileIds?: string[];\n }\n\n /**\n * Content block for the result of a code interpreter tool call\n * @deprecated Use ServerToolCallResult instead\n */\n export interface CodeInterpreterResult extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"code_interpreter_result\";\n /**\n * The result of the code interpreter tool call\n */\n output: CodeInterpreterOutput[];\n }\n\n export type Standard =\n | ToolCall\n | ToolCallChunk\n | InvalidToolCall\n | ServerToolCall\n | ServerToolCallChunk\n | ServerToolCallResult\n | WebSearchCall\n | WebSearchResult\n | CodeInterpreterCall\n | CodeInterpreterResult;\n}\n"],"mappings":";;AAIA,MAAa,oBAAoB;CAC/B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD"}
@@ -75,7 +75,56 @@ declare namespace Tools {
75
75
  */
76
76
  index?: string | number;
77
77
  }
78
- /** Content block for a built-in web search tool call. */
78
+ interface ServerToolCall<TName extends string = string, TArgs = unknown> extends BaseContentBlock {
79
+ /**
80
+ * Type of the content block
81
+ */
82
+ readonly type: "server_tool_call";
83
+ /**
84
+ * The name of the tool being called
85
+ */
86
+ name: TName;
87
+ /**
88
+ * The arguments to the tool call
89
+ */
90
+ args: TArgs;
91
+ }
92
+ interface ServerToolCallChunk<TName extends string = string> extends BaseContentBlock {
93
+ /**
94
+ * Type of the content block
95
+ */
96
+ readonly type: "server_tool_call_chunk";
97
+ /**
98
+ * The name of the tool being called
99
+ */
100
+ name?: TName;
101
+ /**
102
+ * The arguments to the tool call
103
+ */
104
+ args?: string;
105
+ }
106
+ interface ServerToolCallResult<TOutput = Record<string, unknown>> extends BaseContentBlock {
107
+ /**
108
+ * Type of the content block
109
+ */
110
+ readonly type: "server_tool_call_result";
111
+ /**
112
+ * The unique identifier of the tool call that this result corresponds to
113
+ */
114
+ toolCallId: string;
115
+ /**
116
+ * The status of the server tool call
117
+ */
118
+ status: "success" | "error";
119
+ /**
120
+ * The output of the server tool call
121
+ */
122
+ output: TOutput;
123
+ }
124
+ /**
125
+ * Content block for a built-in web search tool call.
126
+ * @deprecated Use ServerToolCall instead
127
+ */
79
128
  interface WebSearchCall extends BaseContentBlock {
80
129
  /**
81
130
  * Type of the content block
@@ -86,7 +135,10 @@ declare namespace Tools {
86
135
  */
87
136
  query?: string;
88
137
  }
89
- /** Content block for the result of a built-in search tool call */
138
+ /**
139
+ * Content block for the result of a built-in search tool call
140
+ * @deprecated Use ServerToolCallResult instead
141
+ */
90
142
  interface WebSearchResult extends BaseContentBlock {
91
143
  /**
92
144
  * Type of the content block
@@ -97,7 +149,10 @@ declare namespace Tools {
97
149
  */
98
150
  urls?: string[];
99
151
  }
100
- /** Content block for a built-in code interpreter tool call. */
152
+ /**
153
+ * Content block for a built-in code interpreter tool call.
154
+ * @deprecated Use ServerToolCall instead
155
+ */
101
156
  interface CodeInterpreterCall extends BaseContentBlock {
102
157
  /**
103
158
  * Type of the content block
@@ -112,7 +167,10 @@ declare namespace Tools {
112
167
  */
113
168
  code?: string;
114
169
  }
115
- /** Content block for the output of a singular code interpreter tool call */
170
+ /**
171
+ * Content block for the output of a singular code interpreter tool call
172
+ * @deprecated Use ServerToolCallResult instead
173
+ */
116
174
  interface CodeInterpreterOutput {
117
175
  readonly type: "code_interpreter_output";
118
176
  /**
@@ -133,7 +191,10 @@ declare namespace Tools {
133
191
  */
134
192
  fileIds?: string[];
135
193
  }
136
- /** Content block for the result of a code interpreter tool call */
194
+ /**
195
+ * Content block for the result of a code interpreter tool call
196
+ * @deprecated Use ServerToolCallResult instead
197
+ */
137
198
  interface CodeInterpreterResult extends BaseContentBlock {
138
199
  /**
139
200
  * Type of the content block
@@ -144,7 +205,7 @@ declare namespace Tools {
144
205
  */
145
206
  output: CodeInterpreterOutput[];
146
207
  }
147
- type Standard = ToolCall | ToolCallChunk | InvalidToolCall | WebSearchCall | WebSearchResult | CodeInterpreterCall | CodeInterpreterResult;
208
+ type Standard = ToolCall | ToolCallChunk | InvalidToolCall | ServerToolCall | ServerToolCallChunk | ServerToolCallResult | WebSearchCall | WebSearchResult | CodeInterpreterCall | CodeInterpreterResult;
148
209
  }
149
210
  //#endregion
150
211
  export { Tools };
@@ -1 +1 @@
1
- {"version":3,"file":"tools.d.cts","names":["BaseContentBlock","Tools","KNOWN_BLOCK_TYPES","TName","TArgs","CodeInterpreterOutput","ToolCall","ToolCallChunk","InvalidToolCall","WebSearchCall","WebSearchResult","CodeInterpreterCall","CodeInterpreterResult"],"sources":["../../../src/messages/content/tools.d.ts"],"sourcesContent":["import { BaseContentBlock } from \"./base.js\";\nexport type Tools = never;\nexport declare const KNOWN_BLOCK_TYPES: string[];\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport declare namespace Tools {\n /**\n * Represents a request to call a tool.\n *\n * @example\n * ```ts\n * const toolCall: ToolCall = {\n * type: \"tool_call\",\n * name: \"foo\",\n * args: { a: 1 },\n * callId: \"123\"\n * };\n * ```\n * This represents a request to call the tool named \"foo\" with arguments {\"a\": 1}\n * and an identifier of \"123\".\n */\n interface ToolCall<TName extends string = string, TArgs = unknown> extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"tool_call\";\n /**\n * The name of the tool being called\n */\n name: TName;\n /**\n * The arguments to the tool call\n */\n args: TArgs;\n }\n /** Content block to represent partial data of a tool call */\n interface ToolCallChunk<TName extends string = string> extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"tool_call_chunk\";\n /**\n * The name of the tool being called\n */\n name?: TName;\n /**\n * The arguments to the tool call\n */\n args?: string;\n /**\n * The index of the tool call chunk\n */\n index?: number;\n }\n /** Content block to represent an invalid tool call */\n interface InvalidToolCall<TName extends string = string> extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"invalid_tool_call\";\n /**\n * The name of the tool being called\n */\n name?: TName;\n /**\n * The arguments to the tool call\n */\n args?: string;\n /**\n * An error message associated with the tool call\n */\n error?: string;\n /**\n * Index of block in aggregate response\n */\n index?: string | number;\n }\n /** Content block for a built-in web search tool call. */\n interface WebSearchCall extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"web_search_call\";\n /**\n * The search query used in the web search tool call\n */\n query?: string;\n }\n /** Content block for the result of a built-in search tool call */\n interface WebSearchResult extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"web_search_result\";\n /**\n * List of URLs returned by the web search tool call\n */\n urls?: string[];\n }\n /** Content block for a built-in code interpreter tool call. */\n interface CodeInterpreterCall extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"code_interpreter_call\";\n /**\n * The language of the code executed by the code interpreter tool call\n */\n language?: string;\n /**\n * The code to be executed by the code interpreter\n */\n code?: string;\n }\n /** Content block for the output of a singular code interpreter tool call */\n interface CodeInterpreterOutput {\n readonly type: \"code_interpreter_output\";\n /**\n * The return code of the code interpreter tool call\n * Example: 0 for success, non-zero for failure\n */\n returnCode?: number;\n /**\n * Standard error output of the executed code\n */\n stderr?: string;\n /**\n * Standard output of the executed code\n */\n stdout?: string;\n /**\n * File IDs of the files created by the code interpreter tool call\n */\n fileIds?: string[];\n }\n /** Content block for the result of a code interpreter tool call */\n interface CodeInterpreterResult extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"code_interpreter_result\";\n /**\n * The result of the code interpreter tool call\n */\n output: CodeInterpreterOutput[];\n }\n type Standard = ToolCall | ToolCallChunk | InvalidToolCall | WebSearchCall | WebSearchResult | CodeInterpreterCall | CodeInterpreterResult;\n}\n"],"mappings":";;;KACYC,KAAAA;AAAZ;AAGyBA,kBAAAA,KAAAA,CAAK;EAAA;;;;;;;;;;;;;;;EA6Ic,UAAGO,QAAAA,CAAAA,cAAAA,MAAAA,GAAAA,MAAAA,EAAAA,QAAAA,OAAAA,CAAAA,SA7HgCR,gBA6HhCQ,CAAAA;IAAkBC;;;IAAwDG,SAAAA,IAAAA,EAAAA,WAAAA;IAAqB;;;UArHhIT;;;;UAIAC;;;iEAGqDJ;;;;;;;;WAQpDG;;;;;;;;;;;mEAWsDH;;;;;;;;WAQtDG;;;;;;;;;;;;;;;kCAeqBH;;;;;;;;;;;oCAWEA;;;;;;;;;;;wCAWIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0CAoCEA;;;;;;;;YAQ5BK;;kBAEIC,WAAWC,gBAAgBC,kBAAkBC,gBAAgBC,kBAAkBC,sBAAsBC"}
1
+ {"version":3,"file":"tools.d.cts","names":["BaseContentBlock","Tools","KNOWN_BLOCK_TYPES","TName","TArgs","Record","TOutput","CodeInterpreterOutput","ToolCall","ToolCallChunk","InvalidToolCall","ServerToolCall","ServerToolCallChunk","ServerToolCallResult","WebSearchCall","WebSearchResult","CodeInterpreterCall","CodeInterpreterResult"],"sources":["../../../src/messages/content/tools.d.ts"],"sourcesContent":["import { BaseContentBlock } from \"./base.js\";\nexport type Tools = never;\nexport declare const KNOWN_BLOCK_TYPES: string[];\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport declare namespace Tools {\n /**\n * Represents a request to call a tool.\n *\n * @example\n * ```ts\n * const toolCall: ToolCall = {\n * type: \"tool_call\",\n * name: \"foo\",\n * args: { a: 1 },\n * callId: \"123\"\n * };\n * ```\n * This represents a request to call the tool named \"foo\" with arguments {\"a\": 1}\n * and an identifier of \"123\".\n */\n interface ToolCall<TName extends string = string, TArgs = unknown> extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"tool_call\";\n /**\n * The name of the tool being called\n */\n name: TName;\n /**\n * The arguments to the tool call\n */\n args: TArgs;\n }\n /** Content block to represent partial data of a tool call */\n interface ToolCallChunk<TName extends string = string> extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"tool_call_chunk\";\n /**\n * The name of the tool being called\n */\n name?: TName;\n /**\n * The arguments to the tool call\n */\n args?: string;\n /**\n * The index of the tool call chunk\n */\n index?: number;\n }\n /** Content block to represent an invalid tool call */\n interface InvalidToolCall<TName extends string = string> extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"invalid_tool_call\";\n /**\n * The name of the tool being called\n */\n name?: TName;\n /**\n * The arguments to the tool call\n */\n args?: string;\n /**\n * An error message associated with the tool call\n */\n error?: string;\n /**\n * Index of block in aggregate response\n */\n index?: string | number;\n }\n interface ServerToolCall<TName extends string = string, TArgs = unknown> extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"server_tool_call\";\n /**\n * The name of the tool being called\n */\n name: TName;\n /**\n * The arguments to the tool call\n */\n args: TArgs;\n }\n interface ServerToolCallChunk<TName extends string = string> extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"server_tool_call_chunk\";\n /**\n * The name of the tool being called\n */\n name?: TName;\n /**\n * The arguments to the tool call\n */\n args?: string;\n }\n interface ServerToolCallResult<TOutput = Record<string, unknown>> extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"server_tool_call_result\";\n /**\n * The unique identifier of the tool call that this result corresponds to\n */\n toolCallId: string;\n /**\n * The status of the server tool call\n */\n status: \"success\" | \"error\";\n /**\n * The output of the server tool call\n */\n output: TOutput;\n }\n /**\n * Content block for a built-in web search tool call.\n * @deprecated Use ServerToolCall instead\n */\n interface WebSearchCall extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"web_search_call\";\n /**\n * The search query used in the web search tool call\n */\n query?: string;\n }\n /**\n * Content block for the result of a built-in search tool call\n * @deprecated Use ServerToolCallResult instead\n */\n interface WebSearchResult extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"web_search_result\";\n /**\n * List of URLs returned by the web search tool call\n */\n urls?: string[];\n }\n /**\n * Content block for a built-in code interpreter tool call.\n * @deprecated Use ServerToolCall instead\n */\n interface CodeInterpreterCall extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"code_interpreter_call\";\n /**\n * The language of the code executed by the code interpreter tool call\n */\n language?: string;\n /**\n * The code to be executed by the code interpreter\n */\n code?: string;\n }\n /**\n * Content block for the output of a singular code interpreter tool call\n * @deprecated Use ServerToolCallResult instead\n */\n interface CodeInterpreterOutput {\n readonly type: \"code_interpreter_output\";\n /**\n * The return code of the code interpreter tool call\n * Example: 0 for success, non-zero for failure\n */\n returnCode?: number;\n /**\n * Standard error output of the executed code\n */\n stderr?: string;\n /**\n * Standard output of the executed code\n */\n stdout?: string;\n /**\n * File IDs of the files created by the code interpreter tool call\n */\n fileIds?: string[];\n }\n /**\n * Content block for the result of a code interpreter tool call\n * @deprecated Use ServerToolCallResult instead\n */\n interface CodeInterpreterResult extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"code_interpreter_result\";\n /**\n * The result of the code interpreter tool call\n */\n output: CodeInterpreterOutput[];\n }\n type Standard = ToolCall | ToolCallChunk | InvalidToolCall | ServerToolCall | ServerToolCallChunk | ServerToolCallResult | WebSearchCall | WebSearchResult | CodeInterpreterCall | CodeInterpreterResult;\n}\n"],"mappings":";;;KACYC,KAAAA;AAAZ;AAGyBA,kBAAAA,KAAAA,CAAK;EAAA;;;;;;;;;;;;;;;EAoHP,UAhBuDD,QAAAA,CAAAA,cAAAA,MAAAA,GAAAA,MAAAA,EAAAA,QAAAA,OAAAA,CAAAA,SApFCA,gBAoFDA,CAAAA;IAsB1CA;;;IA8EpBO,SAAAA,IAAAA,EAAAA,WAAAA;IAR4BP;;;IAUGU,IAAAA,EAlLjCP,KAkLiCO;IAAkBC;;;IAA8DG,IAAAA,EA9KjHV,KA8KiHU;EAAa;EAAkB;EAAsB,UAAGG,aAAAA,CAAAA,cAAAA,MAAAA,GAAAA,MAAAA,CAAAA,SA3KpHjB,gBA2KoHiB,CAAAA;IAAqB;;;;;;;WAnK7Ld;;;;;;;;;;;mEAWsDH;;;;;;;;WAQtDG;;;;;;;;;;;;;;mFAcsEH;;;;;;;;UAQvEG;;;;UAIAC;;uEAE2DJ;;;;;;;;WAQ1DG;;;;;;2CAM8BE,iCAAiCL;;;;;;;;;;;;;;;;YAgB9DM;;;;;;kCAMoBN;;;;;;;;;;;;;;oCAcEA;;;;;;;;;;;;;;wCAcIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0CA0CEA;;;;;;;;YAQ5BO;;kBAEIC,WAAWC,gBAAgBC,kBAAkBC,iBAAiBC,sBAAsBC,uBAAuBC,gBAAgBC,kBAAkBC,sBAAsBC"}
@@ -75,7 +75,56 @@ declare namespace Tools {
75
75
  */
76
76
  index?: string | number;
77
77
  }
78
- /** Content block for a built-in web search tool call. */
78
+ interface ServerToolCall<TName extends string = string, TArgs = unknown> extends BaseContentBlock {
79
+ /**
80
+ * Type of the content block
81
+ */
82
+ readonly type: "server_tool_call";
83
+ /**
84
+ * The name of the tool being called
85
+ */
86
+ name: TName;
87
+ /**
88
+ * The arguments to the tool call
89
+ */
90
+ args: TArgs;
91
+ }
92
+ interface ServerToolCallChunk<TName extends string = string> extends BaseContentBlock {
93
+ /**
94
+ * Type of the content block
95
+ */
96
+ readonly type: "server_tool_call_chunk";
97
+ /**
98
+ * The name of the tool being called
99
+ */
100
+ name?: TName;
101
+ /**
102
+ * The arguments to the tool call
103
+ */
104
+ args?: string;
105
+ }
106
+ interface ServerToolCallResult<TOutput = Record<string, unknown>> extends BaseContentBlock {
107
+ /**
108
+ * Type of the content block
109
+ */
110
+ readonly type: "server_tool_call_result";
111
+ /**
112
+ * The unique identifier of the tool call that this result corresponds to
113
+ */
114
+ toolCallId: string;
115
+ /**
116
+ * The status of the server tool call
117
+ */
118
+ status: "success" | "error";
119
+ /**
120
+ * The output of the server tool call
121
+ */
122
+ output: TOutput;
123
+ }
124
+ /**
125
+ * Content block for a built-in web search tool call.
126
+ * @deprecated Use ServerToolCall instead
127
+ */
79
128
  interface WebSearchCall extends BaseContentBlock {
80
129
  /**
81
130
  * Type of the content block
@@ -86,7 +135,10 @@ declare namespace Tools {
86
135
  */
87
136
  query?: string;
88
137
  }
89
- /** Content block for the result of a built-in search tool call */
138
+ /**
139
+ * Content block for the result of a built-in search tool call
140
+ * @deprecated Use ServerToolCallResult instead
141
+ */
90
142
  interface WebSearchResult extends BaseContentBlock {
91
143
  /**
92
144
  * Type of the content block
@@ -97,7 +149,10 @@ declare namespace Tools {
97
149
  */
98
150
  urls?: string[];
99
151
  }
100
- /** Content block for a built-in code interpreter tool call. */
152
+ /**
153
+ * Content block for a built-in code interpreter tool call.
154
+ * @deprecated Use ServerToolCall instead
155
+ */
101
156
  interface CodeInterpreterCall extends BaseContentBlock {
102
157
  /**
103
158
  * Type of the content block
@@ -112,7 +167,10 @@ declare namespace Tools {
112
167
  */
113
168
  code?: string;
114
169
  }
115
- /** Content block for the output of a singular code interpreter tool call */
170
+ /**
171
+ * Content block for the output of a singular code interpreter tool call
172
+ * @deprecated Use ServerToolCallResult instead
173
+ */
116
174
  interface CodeInterpreterOutput {
117
175
  readonly type: "code_interpreter_output";
118
176
  /**
@@ -133,7 +191,10 @@ declare namespace Tools {
133
191
  */
134
192
  fileIds?: string[];
135
193
  }
136
- /** Content block for the result of a code interpreter tool call */
194
+ /**
195
+ * Content block for the result of a code interpreter tool call
196
+ * @deprecated Use ServerToolCallResult instead
197
+ */
137
198
  interface CodeInterpreterResult extends BaseContentBlock {
138
199
  /**
139
200
  * Type of the content block
@@ -144,7 +205,7 @@ declare namespace Tools {
144
205
  */
145
206
  output: CodeInterpreterOutput[];
146
207
  }
147
- type Standard = ToolCall | ToolCallChunk | InvalidToolCall | WebSearchCall | WebSearchResult | CodeInterpreterCall | CodeInterpreterResult;
208
+ type Standard = ToolCall | ToolCallChunk | InvalidToolCall | ServerToolCall | ServerToolCallChunk | ServerToolCallResult | WebSearchCall | WebSearchResult | CodeInterpreterCall | CodeInterpreterResult;
148
209
  }
149
210
  //#endregion
150
211
  export { Tools };
@@ -1 +1 @@
1
- {"version":3,"file":"tools.d.ts","names":["BaseContentBlock","Tools","KNOWN_BLOCK_TYPES","TName","TArgs","CodeInterpreterOutput","ToolCall","ToolCallChunk","InvalidToolCall","WebSearchCall","WebSearchResult","CodeInterpreterCall","CodeInterpreterResult"],"sources":["../../../src/messages/content/tools.d.ts"],"sourcesContent":["import { BaseContentBlock } from \"./base.js\";\nexport type Tools = never;\nexport declare const KNOWN_BLOCK_TYPES: string[];\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport declare namespace Tools {\n /**\n * Represents a request to call a tool.\n *\n * @example\n * ```ts\n * const toolCall: ToolCall = {\n * type: \"tool_call\",\n * name: \"foo\",\n * args: { a: 1 },\n * callId: \"123\"\n * };\n * ```\n * This represents a request to call the tool named \"foo\" with arguments {\"a\": 1}\n * and an identifier of \"123\".\n */\n interface ToolCall<TName extends string = string, TArgs = unknown> extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"tool_call\";\n /**\n * The name of the tool being called\n */\n name: TName;\n /**\n * The arguments to the tool call\n */\n args: TArgs;\n }\n /** Content block to represent partial data of a tool call */\n interface ToolCallChunk<TName extends string = string> extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"tool_call_chunk\";\n /**\n * The name of the tool being called\n */\n name?: TName;\n /**\n * The arguments to the tool call\n */\n args?: string;\n /**\n * The index of the tool call chunk\n */\n index?: number;\n }\n /** Content block to represent an invalid tool call */\n interface InvalidToolCall<TName extends string = string> extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"invalid_tool_call\";\n /**\n * The name of the tool being called\n */\n name?: TName;\n /**\n * The arguments to the tool call\n */\n args?: string;\n /**\n * An error message associated with the tool call\n */\n error?: string;\n /**\n * Index of block in aggregate response\n */\n index?: string | number;\n }\n /** Content block for a built-in web search tool call. */\n interface WebSearchCall extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"web_search_call\";\n /**\n * The search query used in the web search tool call\n */\n query?: string;\n }\n /** Content block for the result of a built-in search tool call */\n interface WebSearchResult extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"web_search_result\";\n /**\n * List of URLs returned by the web search tool call\n */\n urls?: string[];\n }\n /** Content block for a built-in code interpreter tool call. */\n interface CodeInterpreterCall extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"code_interpreter_call\";\n /**\n * The language of the code executed by the code interpreter tool call\n */\n language?: string;\n /**\n * The code to be executed by the code interpreter\n */\n code?: string;\n }\n /** Content block for the output of a singular code interpreter tool call */\n interface CodeInterpreterOutput {\n readonly type: \"code_interpreter_output\";\n /**\n * The return code of the code interpreter tool call\n * Example: 0 for success, non-zero for failure\n */\n returnCode?: number;\n /**\n * Standard error output of the executed code\n */\n stderr?: string;\n /**\n * Standard output of the executed code\n */\n stdout?: string;\n /**\n * File IDs of the files created by the code interpreter tool call\n */\n fileIds?: string[];\n }\n /** Content block for the result of a code interpreter tool call */\n interface CodeInterpreterResult extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"code_interpreter_result\";\n /**\n * The result of the code interpreter tool call\n */\n output: CodeInterpreterOutput[];\n }\n type Standard = ToolCall | ToolCallChunk | InvalidToolCall | WebSearchCall | WebSearchResult | CodeInterpreterCall | CodeInterpreterResult;\n}\n"],"mappings":";;;KACYC,KAAAA;AAAZ;AAGyBA,kBAAAA,KAAAA,CAAK;EAAA;;;;;;;;;;;;;;;EA6Ic,UAAGO,QAAAA,CAAAA,cAAAA,MAAAA,GAAAA,MAAAA,EAAAA,QAAAA,OAAAA,CAAAA,SA7HgCR,gBA6HhCQ,CAAAA;IAAkBC;;;IAAwDG,SAAAA,IAAAA,EAAAA,WAAAA;IAAqB;;;UArHhIT;;;;UAIAC;;;iEAGqDJ;;;;;;;;WAQpDG;;;;;;;;;;;mEAWsDH;;;;;;;;WAQtDG;;;;;;;;;;;;;;;kCAeqBH;;;;;;;;;;;oCAWEA;;;;;;;;;;;wCAWIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0CAoCEA;;;;;;;;YAQ5BK;;kBAEIC,WAAWC,gBAAgBC,kBAAkBC,gBAAgBC,kBAAkBC,sBAAsBC"}
1
+ {"version":3,"file":"tools.d.ts","names":["BaseContentBlock","Tools","KNOWN_BLOCK_TYPES","TName","TArgs","Record","TOutput","CodeInterpreterOutput","ToolCall","ToolCallChunk","InvalidToolCall","ServerToolCall","ServerToolCallChunk","ServerToolCallResult","WebSearchCall","WebSearchResult","CodeInterpreterCall","CodeInterpreterResult"],"sources":["../../../src/messages/content/tools.d.ts"],"sourcesContent":["import { BaseContentBlock } from \"./base.js\";\nexport type Tools = never;\nexport declare const KNOWN_BLOCK_TYPES: string[];\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport declare namespace Tools {\n /**\n * Represents a request to call a tool.\n *\n * @example\n * ```ts\n * const toolCall: ToolCall = {\n * type: \"tool_call\",\n * name: \"foo\",\n * args: { a: 1 },\n * callId: \"123\"\n * };\n * ```\n * This represents a request to call the tool named \"foo\" with arguments {\"a\": 1}\n * and an identifier of \"123\".\n */\n interface ToolCall<TName extends string = string, TArgs = unknown> extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"tool_call\";\n /**\n * The name of the tool being called\n */\n name: TName;\n /**\n * The arguments to the tool call\n */\n args: TArgs;\n }\n /** Content block to represent partial data of a tool call */\n interface ToolCallChunk<TName extends string = string> extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"tool_call_chunk\";\n /**\n * The name of the tool being called\n */\n name?: TName;\n /**\n * The arguments to the tool call\n */\n args?: string;\n /**\n * The index of the tool call chunk\n */\n index?: number;\n }\n /** Content block to represent an invalid tool call */\n interface InvalidToolCall<TName extends string = string> extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"invalid_tool_call\";\n /**\n * The name of the tool being called\n */\n name?: TName;\n /**\n * The arguments to the tool call\n */\n args?: string;\n /**\n * An error message associated with the tool call\n */\n error?: string;\n /**\n * Index of block in aggregate response\n */\n index?: string | number;\n }\n interface ServerToolCall<TName extends string = string, TArgs = unknown> extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"server_tool_call\";\n /**\n * The name of the tool being called\n */\n name: TName;\n /**\n * The arguments to the tool call\n */\n args: TArgs;\n }\n interface ServerToolCallChunk<TName extends string = string> extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"server_tool_call_chunk\";\n /**\n * The name of the tool being called\n */\n name?: TName;\n /**\n * The arguments to the tool call\n */\n args?: string;\n }\n interface ServerToolCallResult<TOutput = Record<string, unknown>> extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"server_tool_call_result\";\n /**\n * The unique identifier of the tool call that this result corresponds to\n */\n toolCallId: string;\n /**\n * The status of the server tool call\n */\n status: \"success\" | \"error\";\n /**\n * The output of the server tool call\n */\n output: TOutput;\n }\n /**\n * Content block for a built-in web search tool call.\n * @deprecated Use ServerToolCall instead\n */\n interface WebSearchCall extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"web_search_call\";\n /**\n * The search query used in the web search tool call\n */\n query?: string;\n }\n /**\n * Content block for the result of a built-in search tool call\n * @deprecated Use ServerToolCallResult instead\n */\n interface WebSearchResult extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"web_search_result\";\n /**\n * List of URLs returned by the web search tool call\n */\n urls?: string[];\n }\n /**\n * Content block for a built-in code interpreter tool call.\n * @deprecated Use ServerToolCall instead\n */\n interface CodeInterpreterCall extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"code_interpreter_call\";\n /**\n * The language of the code executed by the code interpreter tool call\n */\n language?: string;\n /**\n * The code to be executed by the code interpreter\n */\n code?: string;\n }\n /**\n * Content block for the output of a singular code interpreter tool call\n * @deprecated Use ServerToolCallResult instead\n */\n interface CodeInterpreterOutput {\n readonly type: \"code_interpreter_output\";\n /**\n * The return code of the code interpreter tool call\n * Example: 0 for success, non-zero for failure\n */\n returnCode?: number;\n /**\n * Standard error output of the executed code\n */\n stderr?: string;\n /**\n * Standard output of the executed code\n */\n stdout?: string;\n /**\n * File IDs of the files created by the code interpreter tool call\n */\n fileIds?: string[];\n }\n /**\n * Content block for the result of a code interpreter tool call\n * @deprecated Use ServerToolCallResult instead\n */\n interface CodeInterpreterResult extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"code_interpreter_result\";\n /**\n * The result of the code interpreter tool call\n */\n output: CodeInterpreterOutput[];\n }\n type Standard = ToolCall | ToolCallChunk | InvalidToolCall | ServerToolCall | ServerToolCallChunk | ServerToolCallResult | WebSearchCall | WebSearchResult | CodeInterpreterCall | CodeInterpreterResult;\n}\n"],"mappings":";;;KACYC,KAAAA;AAAZ;AAGyBA,kBAAAA,KAAAA,CAAK;EAAA;;;;;;;;;;;;;;;EAoHP,UAhBuDD,QAAAA,CAAAA,cAAAA,MAAAA,GAAAA,MAAAA,EAAAA,QAAAA,OAAAA,CAAAA,SApFCA,gBAoFDA,CAAAA;IAsB1CA;;;IA8EpBO,SAAAA,IAAAA,EAAAA,WAAAA;IAR4BP;;;IAUGU,IAAAA,EAlLjCP,KAkLiCO;IAAkBC;;;IAA8DG,IAAAA,EA9KjHV,KA8KiHU;EAAa;EAAkB;EAAsB,UAAGG,aAAAA,CAAAA,cAAAA,MAAAA,GAAAA,MAAAA,CAAAA,SA3KpHjB,gBA2KoHiB,CAAAA;IAAqB;;;;;;;WAnK7Ld;;;;;;;;;;;mEAWsDH;;;;;;;;WAQtDG;;;;;;;;;;;;;;mFAcsEH;;;;;;;;UAQvEG;;;;UAIAC;;uEAE2DJ;;;;;;;;WAQ1DG;;;;;;2CAM8BE,iCAAiCL;;;;;;;;;;;;;;;;YAgB9DM;;;;;;kCAMoBN;;;;;;;;;;;;;;oCAcEA;;;;;;;;;;;;;;wCAcIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0CA0CEA;;;;;;;;YAQ5BO;;kBAEIC,WAAWC,gBAAgBC,kBAAkBC,iBAAiBC,sBAAsBC,uBAAuBC,gBAAgBC,kBAAkBC,sBAAsBC"}
@@ -3,6 +3,9 @@ const KNOWN_BLOCK_TYPES = [
3
3
  "tool_call",
4
4
  "tool_call_chunk",
5
5
  "invalid_tool_call",
6
+ "server_tool_call",
7
+ "server_tool_call_chunk",
8
+ "server_tool_call_result",
6
9
  "web_search_call",
7
10
  "web_search_result",
8
11
  "code_interpreter",
@@ -1 +1 @@
1
- {"version":3,"file":"tools.js","names":[],"sources":["../../../src/messages/content/tools.ts"],"sourcesContent":["import { BaseContentBlock } from \"./base.js\";\n\nexport type Tools = never;\n\nexport const KNOWN_BLOCK_TYPES = [\n \"tool_call\",\n \"tool_call_chunk\",\n \"invalid_tool_call\",\n \"web_search_call\",\n \"web_search_result\",\n \"code_interpreter\",\n \"code_interpreter_result\",\n];\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport declare namespace Tools {\n /**\n * Represents a request to call a tool.\n *\n * @example\n * ```ts\n * const toolCall: ToolCall = {\n * type: \"tool_call\",\n * name: \"foo\",\n * args: { a: 1 },\n * callId: \"123\"\n * };\n * ```\n * This represents a request to call the tool named \"foo\" with arguments {\"a\": 1}\n * and an identifier of \"123\".\n */\n export interface ToolCall<TName extends string = string, TArgs = unknown>\n extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"tool_call\";\n /**\n * The name of the tool being called\n */\n name: TName;\n /**\n * The arguments to the tool call\n */\n args: TArgs;\n }\n\n /** Content block to represent partial data of a tool call */\n export interface ToolCallChunk<TName extends string = string>\n extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"tool_call_chunk\";\n /**\n * The name of the tool being called\n */\n name?: TName;\n /**\n * The arguments to the tool call\n */\n args?: string;\n /**\n * The index of the tool call chunk\n */\n index?: number;\n }\n\n /** Content block to represent an invalid tool call */\n export interface InvalidToolCall<TName extends string = string>\n extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"invalid_tool_call\";\n /**\n * The name of the tool being called\n */\n name?: TName;\n /**\n * The arguments to the tool call\n */\n args?: string;\n /**\n * An error message associated with the tool call\n */\n error?: string;\n /**\n * Index of block in aggregate response\n */\n index?: string | number;\n }\n\n /** Content block for a built-in web search tool call. */\n export interface WebSearchCall extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"web_search_call\";\n /**\n * The search query used in the web search tool call\n */\n query?: string;\n }\n\n /** Content block for the result of a built-in search tool call */\n export interface WebSearchResult extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"web_search_result\";\n /**\n * List of URLs returned by the web search tool call\n */\n urls?: string[];\n }\n\n /** Content block for a built-in code interpreter tool call. */\n export interface CodeInterpreterCall extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"code_interpreter_call\";\n /**\n * The language of the code executed by the code interpreter tool call\n */\n language?: string;\n /**\n * The code to be executed by the code interpreter\n */\n code?: string;\n }\n\n /** Content block for the output of a singular code interpreter tool call */\n export interface CodeInterpreterOutput {\n readonly type: \"code_interpreter_output\";\n /**\n * The return code of the code interpreter tool call\n * Example: 0 for success, non-zero for failure\n */\n returnCode?: number;\n /**\n * Standard error output of the executed code\n */\n stderr?: string;\n /**\n * Standard output of the executed code\n */\n stdout?: string;\n /**\n * File IDs of the files created by the code interpreter tool call\n */\n fileIds?: string[];\n }\n\n /** Content block for the result of a code interpreter tool call */\n export interface CodeInterpreterResult extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"code_interpreter_result\";\n /**\n * The result of the code interpreter tool call\n */\n output: CodeInterpreterOutput[];\n }\n\n export type Standard =\n | ToolCall\n | ToolCallChunk\n | InvalidToolCall\n | WebSearchCall\n | WebSearchResult\n | CodeInterpreterCall\n | CodeInterpreterResult;\n}\n"],"mappings":";AAIA,MAAa,oBAAoB;CAC/B;CACA;CACA;CACA;CACA;CACA;CACA;AACD"}
1
+ {"version":3,"file":"tools.js","names":[],"sources":["../../../src/messages/content/tools.ts"],"sourcesContent":["import { BaseContentBlock } from \"./base.js\";\n\nexport type Tools = never;\n\nexport const KNOWN_BLOCK_TYPES = [\n \"tool_call\",\n \"tool_call_chunk\",\n \"invalid_tool_call\",\n \"server_tool_call\",\n \"server_tool_call_chunk\",\n \"server_tool_call_result\",\n \"web_search_call\",\n \"web_search_result\",\n \"code_interpreter\",\n \"code_interpreter_result\",\n];\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport declare namespace Tools {\n /**\n * Represents a request to call a tool.\n *\n * @example\n * ```ts\n * const toolCall: ToolCall = {\n * type: \"tool_call\",\n * name: \"foo\",\n * args: { a: 1 },\n * callId: \"123\"\n * };\n * ```\n * This represents a request to call the tool named \"foo\" with arguments {\"a\": 1}\n * and an identifier of \"123\".\n */\n export interface ToolCall<TName extends string = string, TArgs = unknown>\n extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"tool_call\";\n /**\n * The name of the tool being called\n */\n name: TName;\n /**\n * The arguments to the tool call\n */\n args: TArgs;\n }\n\n /** Content block to represent partial data of a tool call */\n export interface ToolCallChunk<TName extends string = string>\n extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"tool_call_chunk\";\n /**\n * The name of the tool being called\n */\n name?: TName;\n /**\n * The arguments to the tool call\n */\n args?: string;\n /**\n * The index of the tool call chunk\n */\n index?: number;\n }\n\n /** Content block to represent an invalid tool call */\n export interface InvalidToolCall<TName extends string = string>\n extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"invalid_tool_call\";\n /**\n * The name of the tool being called\n */\n name?: TName;\n /**\n * The arguments to the tool call\n */\n args?: string;\n /**\n * An error message associated with the tool call\n */\n error?: string;\n /**\n * Index of block in aggregate response\n */\n index?: string | number;\n }\n\n export interface ServerToolCall<\n TName extends string = string,\n TArgs = unknown\n > extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"server_tool_call\";\n /**\n * The name of the tool being called\n */\n name: TName;\n /**\n * The arguments to the tool call\n */\n args: TArgs;\n }\n\n export interface ServerToolCallChunk<TName extends string = string>\n extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"server_tool_call_chunk\";\n /**\n * The name of the tool being called\n */\n name?: TName;\n /**\n * The arguments to the tool call\n */\n args?: string;\n }\n\n export interface ServerToolCallResult<TOutput = Record<string, unknown>>\n extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"server_tool_call_result\";\n /**\n * The unique identifier of the tool call that this result corresponds to\n */\n toolCallId: string;\n /**\n * The status of the server tool call\n */\n status: \"success\" | \"error\";\n /**\n * The output of the server tool call\n */\n output: TOutput;\n }\n\n /**\n * Content block for a built-in web search tool call.\n * @deprecated Use ServerToolCall instead\n */\n export interface WebSearchCall extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"web_search_call\";\n /**\n * The search query used in the web search tool call\n */\n query?: string;\n }\n\n /**\n * Content block for the result of a built-in search tool call\n * @deprecated Use ServerToolCallResult instead\n */\n export interface WebSearchResult extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"web_search_result\";\n /**\n * List of URLs returned by the web search tool call\n */\n urls?: string[];\n }\n\n /**\n * Content block for a built-in code interpreter tool call.\n * @deprecated Use ServerToolCall instead\n */\n export interface CodeInterpreterCall extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"code_interpreter_call\";\n /**\n * The language of the code executed by the code interpreter tool call\n */\n language?: string;\n /**\n * The code to be executed by the code interpreter\n */\n code?: string;\n }\n\n /**\n * Content block for the output of a singular code interpreter tool call\n * @deprecated Use ServerToolCallResult instead\n */\n export interface CodeInterpreterOutput {\n readonly type: \"code_interpreter_output\";\n /**\n * The return code of the code interpreter tool call\n * Example: 0 for success, non-zero for failure\n */\n returnCode?: number;\n /**\n * Standard error output of the executed code\n */\n stderr?: string;\n /**\n * Standard output of the executed code\n */\n stdout?: string;\n /**\n * File IDs of the files created by the code interpreter tool call\n */\n fileIds?: string[];\n }\n\n /**\n * Content block for the result of a code interpreter tool call\n * @deprecated Use ServerToolCallResult instead\n */\n export interface CodeInterpreterResult extends BaseContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"code_interpreter_result\";\n /**\n * The result of the code interpreter tool call\n */\n output: CodeInterpreterOutput[];\n }\n\n export type Standard =\n | ToolCall\n | ToolCallChunk\n | InvalidToolCall\n | ServerToolCall\n | ServerToolCallChunk\n | ServerToolCallResult\n | WebSearchCall\n | WebSearchResult\n | CodeInterpreterCall\n | CodeInterpreterResult;\n}\n"],"mappings":";AAIA,MAAa,oBAAoB;CAC/B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD"}
@@ -43,6 +43,7 @@ require_rolldown_runtime.__export(messages_exports, {
43
43
  convertToOpenAIImageBlock: () => require_data.convertToOpenAIImageBlock,
44
44
  convertToProviderContentBlock: () => require_data.convertToProviderContentBlock,
45
45
  defaultTextSplitter: () => require_transformers.defaultTextSplitter,
46
+ defaultToolCallParser: () => require_messages_tool.defaultToolCallParser,
46
47
  filterMessages: () => require_transformers.filterMessages,
47
48
  getBufferString: () => require_utils.getBufferString,
48
49
  iife: () => require_utils.iife,
@@ -54,6 +55,7 @@ require_rolldown_runtime.__export(messages_exports, {
54
55
  isChatMessage: () => require_chat.isChatMessage,
55
56
  isChatMessageChunk: () => require_chat.isChatMessageChunk,
56
57
  isDataContentBlock: () => require_data.isDataContentBlock,
58
+ isDirectToolOutput: () => require_messages_tool.isDirectToolOutput,
57
59
  isFunctionMessage: () => require_function.isFunctionMessage,
58
60
  isFunctionMessageChunk: () => require_function.isFunctionMessageChunk,
59
61
  isHumanMessage: () => require_human.isHumanMessage,
@@ -106,6 +108,7 @@ exports.convertToChunk = require_utils.convertToChunk;
106
108
  exports.convertToOpenAIImageBlock = require_data.convertToOpenAIImageBlock;
107
109
  exports.convertToProviderContentBlock = require_data.convertToProviderContentBlock;
108
110
  exports.defaultTextSplitter = require_transformers.defaultTextSplitter;
111
+ exports.defaultToolCallParser = require_messages_tool.defaultToolCallParser;
109
112
  exports.filterMessages = require_transformers.filterMessages;
110
113
  exports.getBufferString = require_utils.getBufferString;
111
114
  exports.iife = require_utils.iife;
@@ -117,6 +120,7 @@ exports.isBaseMessageChunk = require_base.isBaseMessageChunk;
117
120
  exports.isChatMessage = require_chat.isChatMessage;
118
121
  exports.isChatMessageChunk = require_chat.isChatMessageChunk;
119
122
  exports.isDataContentBlock = require_data.isDataContentBlock;
123
+ exports.isDirectToolOutput = require_messages_tool.isDirectToolOutput;
120
124
  exports.isFunctionMessage = require_function.isFunctionMessage;
121
125
  exports.isFunctionMessageChunk = require_function.isFunctionMessageChunk;
122
126
  exports.isHumanMessage = require_human.isHumanMessage;
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":[],"sources":["../../src/messages/index.ts"],"sourcesContent":["export * from \"./ai.js\";\nexport * from \"./base.js\";\nexport * from \"./chat.js\";\nexport * from \"./function.js\";\nexport * from \"./human.js\";\nexport * from \"./system.js\";\nexport * from \"./utils.js\";\nexport * from \"./transformers.js\";\nexport * from \"./metadata.js\";\nexport * from \"./message.js\";\nexport * from \"./modifier.js\";\n// TODO: Use a star export when we deprecate the\n// existing \"ToolCall\" type in \"base.js\".\nexport {\n type ToolMessageFields,\n ToolMessage,\n ToolMessageChunk,\n type InvalidToolCall,\n isToolMessage,\n isToolMessageChunk,\n} from \"./tool.js\";\n\n// This is an old export for backwards compatibility with existing multimodal content blocks\n// TODO: remove this in v2\nexport * from \"./content/data.js\";\nexport * from \"./content/index.js\";\n"],"mappings":""}
1
+ {"version":3,"file":"index.cjs","names":[],"sources":["../../src/messages/index.ts"],"sourcesContent":["export * from \"./ai.js\";\nexport * from \"./base.js\";\nexport * from \"./chat.js\";\nexport * from \"./function.js\";\nexport * from \"./human.js\";\nexport * from \"./system.js\";\nexport * from \"./utils.js\";\nexport * from \"./transformers.js\";\nexport * from \"./metadata.js\";\nexport * from \"./message.js\";\nexport * from \"./modifier.js\";\nexport * from \"./tool.js\";\n\n// This is an old export for backwards compatibility with existing multimodal content blocks\n// TODO: remove this in v2\nexport * from \"./content/data.js\";\nexport * from \"./content/index.js\";\n"],"mappings":""}
@@ -2,7 +2,7 @@ import { Data, ImageDetail, MessageContentComplex, MessageContentImageUrl, Messa
2
2
  import { ContentBlock, KNOWN_BLOCK_TYPES } from "./content/index.cjs";
3
3
  import { InputTokenDetails, ModalitiesTokenDetails, OutputTokenDetails, ResponseMetadata, UsageMetadata, mergeResponseMetadata, mergeUsageMetadata } from "./metadata.cjs";
4
4
  import { BaseMessage, BaseMessageChunk, BaseMessageFields, BaseMessageLike, FunctionCall, MessageContent, MessageFieldWithRole, OpenAIToolCall, StoredGeneration, StoredMessage, StoredMessageData, StoredMessageV1, _isMessageFieldWithRole, _mergeDicts, _mergeLists, _mergeObj, _mergeStatus, isBaseMessage, isBaseMessageChunk, isOpenAIToolCallArray, mergeContent } from "./base.cjs";
5
- import { InvalidToolCall, ToolMessage, ToolMessageChunk, ToolMessageFields, isToolMessage, isToolMessageChunk } from "./tool.cjs";
5
+ import { DirectToolOutput, InvalidToolCall, ToolCall, ToolCallChunk, ToolMessage, ToolMessageChunk, ToolMessageFields, defaultToolCallParser, isDirectToolOutput, isToolMessage, isToolMessageChunk } from "./tool.cjs";
6
6
  import { AIMessage, AIMessageChunk, AIMessageChunkFields, AIMessageFields, isAIMessage, isAIMessageChunk } from "./ai.cjs";
7
7
  import { ChatMessage, ChatMessageChunk, ChatMessageFields, isChatMessage, isChatMessageChunk } from "./chat.cjs";
8
8
  import { FunctionMessage, FunctionMessageChunk, FunctionMessageFields, isFunctionMessage, isFunctionMessageChunk } from "./function.cjs";
@@ -12,4 +12,4 @@ import { $Expand, $MergeDiscriminatedUnion, $MergeObjects, Constructor, coerceMe
12
12
  import { $InferMessageContent, $InferMessageContentBlocks, $InferMessageProperties, $InferMessageProperty, $InferResponseMetadata, $MergeContentDefinition, $MergeMessageStructure, $MergeOutputVersion, $MessageToolCallBlock, $NormalizedMessageStructure, Message, MessageOutputVersion, MessageStructure, MessageToolDefinition, MessageToolSet, MessageType, StandardMessageStructure, isMessage } from "./message.cjs";
13
13
  import { RemoveMessage, RemoveMessageFields } from "./modifier.cjs";
14
14
  import { FilterMessagesFields, MessageChunkUnion, MessageTypeOrClass, MessageUnion, TrimMessagesFields, defaultTextSplitter, filterMessages, mergeMessageRuns, trimMessages } from "./transformers.cjs";
15
- export { $Expand, $InferMessageContent, $InferMessageContentBlocks, $InferMessageProperties, $InferMessageProperty, $InferResponseMetadata, $MergeContentDefinition, $MergeDiscriminatedUnion, $MergeMessageStructure, $MergeObjects, $MergeOutputVersion, $MessageToolCallBlock, $NormalizedMessageStructure, AIMessage, AIMessageChunk, AIMessageChunkFields, AIMessageFields, BaseMessage, BaseMessageChunk, BaseMessageFields, BaseMessageLike, ChatMessage, ChatMessageChunk, ChatMessageFields, Constructor, ContentBlock, Data, FilterMessagesFields, FunctionCall, FunctionMessage, FunctionMessageChunk, FunctionMessageFields, HumanMessage, HumanMessageChunk, HumanMessageFields, ImageDetail, InputTokenDetails, type InvalidToolCall, KNOWN_BLOCK_TYPES, Message, MessageChunkUnion, MessageContent, MessageContentComplex, MessageContentImageUrl, MessageContentText, MessageFieldWithRole, MessageOutputVersion, MessageStructure, MessageToolDefinition, MessageToolSet, MessageType, MessageTypeOrClass, MessageUnion, ModalitiesTokenDetails, OpenAIToolCall, OutputTokenDetails, ProviderFormatTypes, RemoveMessage, RemoveMessageFields, ResponseMetadata, StandardContentBlockConverter, StandardMessageStructure, StoredGeneration, StoredMessage, StoredMessageData, StoredMessageV1, SystemMessage, SystemMessageChunk, SystemMessageFields, ToolMessage, ToolMessageChunk, type ToolMessageFields, TrimMessagesFields, UsageMetadata, _isMessageFieldWithRole, _mergeDicts, _mergeLists, _mergeObj, _mergeStatus, coerceMessageLikeToMessage, convertToChunk, convertToOpenAIImageBlock, convertToProviderContentBlock, defaultTextSplitter, filterMessages, getBufferString, iife, isAIMessage, isAIMessageChunk, isBase64ContentBlock, isBaseMessage, isBaseMessageChunk, isChatMessage, isChatMessageChunk, isDataContentBlock, isFunctionMessage, isFunctionMessageChunk, isHumanMessage, isHumanMessageChunk, isIDContentBlock, isMessage, isOpenAIToolCallArray, isPlainTextContentBlock, isSystemMessage, isSystemMessageChunk, isToolMessage, isToolMessageChunk, isURLContentBlock, mapChatMessagesToStoredMessages, mapStoredMessageToChatMessage, mapStoredMessagesToChatMessages, mergeContent, mergeMessageRuns, mergeResponseMetadata, mergeUsageMetadata, parseBase64DataUrl, parseMimeType, trimMessages };
15
+ export { $Expand, $InferMessageContent, $InferMessageContentBlocks, $InferMessageProperties, $InferMessageProperty, $InferResponseMetadata, $MergeContentDefinition, $MergeDiscriminatedUnion, $MergeMessageStructure, $MergeObjects, $MergeOutputVersion, $MessageToolCallBlock, $NormalizedMessageStructure, AIMessage, AIMessageChunk, AIMessageChunkFields, AIMessageFields, BaseMessage, BaseMessageChunk, BaseMessageFields, BaseMessageLike, ChatMessage, ChatMessageChunk, ChatMessageFields, Constructor, ContentBlock, Data, DirectToolOutput, FilterMessagesFields, FunctionCall, FunctionMessage, FunctionMessageChunk, FunctionMessageFields, HumanMessage, HumanMessageChunk, HumanMessageFields, ImageDetail, InputTokenDetails, InvalidToolCall, KNOWN_BLOCK_TYPES, Message, MessageChunkUnion, MessageContent, MessageContentComplex, MessageContentImageUrl, MessageContentText, MessageFieldWithRole, MessageOutputVersion, MessageStructure, MessageToolDefinition, MessageToolSet, MessageType, MessageTypeOrClass, MessageUnion, ModalitiesTokenDetails, OpenAIToolCall, OutputTokenDetails, ProviderFormatTypes, RemoveMessage, RemoveMessageFields, ResponseMetadata, StandardContentBlockConverter, StandardMessageStructure, StoredGeneration, StoredMessage, StoredMessageData, StoredMessageV1, SystemMessage, SystemMessageChunk, SystemMessageFields, ToolCall, ToolCallChunk, ToolMessage, ToolMessageChunk, ToolMessageFields, TrimMessagesFields, UsageMetadata, _isMessageFieldWithRole, _mergeDicts, _mergeLists, _mergeObj, _mergeStatus, coerceMessageLikeToMessage, convertToChunk, convertToOpenAIImageBlock, convertToProviderContentBlock, defaultTextSplitter, defaultToolCallParser, filterMessages, getBufferString, iife, isAIMessage, isAIMessageChunk, isBase64ContentBlock, isBaseMessage, isBaseMessageChunk, isChatMessage, isChatMessageChunk, isDataContentBlock, isDirectToolOutput, isFunctionMessage, isFunctionMessageChunk, isHumanMessage, isHumanMessageChunk, isIDContentBlock, isMessage, isOpenAIToolCallArray, isPlainTextContentBlock, isSystemMessage, isSystemMessageChunk, isToolMessage, isToolMessageChunk, isURLContentBlock, mapChatMessagesToStoredMessages, mapStoredMessageToChatMessage, mapStoredMessagesToChatMessages, mergeContent, mergeMessageRuns, mergeResponseMetadata, mergeUsageMetadata, parseBase64DataUrl, parseMimeType, trimMessages };
@@ -2,7 +2,7 @@ import { Data, ImageDetail, MessageContentComplex, MessageContentImageUrl, Messa
2
2
  import { ContentBlock, KNOWN_BLOCK_TYPES } from "./content/index.js";
3
3
  import { InputTokenDetails, ModalitiesTokenDetails, OutputTokenDetails, ResponseMetadata, UsageMetadata, mergeResponseMetadata, mergeUsageMetadata } from "./metadata.js";
4
4
  import { BaseMessage, BaseMessageChunk, BaseMessageFields, BaseMessageLike, FunctionCall, MessageContent, MessageFieldWithRole, OpenAIToolCall, StoredGeneration, StoredMessage, StoredMessageData, StoredMessageV1, _isMessageFieldWithRole, _mergeDicts, _mergeLists, _mergeObj, _mergeStatus, isBaseMessage, isBaseMessageChunk, isOpenAIToolCallArray, mergeContent } from "./base.js";
5
- import { InvalidToolCall, ToolMessage, ToolMessageChunk, ToolMessageFields, isToolMessage, isToolMessageChunk } from "./tool.js";
5
+ import { DirectToolOutput, InvalidToolCall, ToolCall, ToolCallChunk, ToolMessage, ToolMessageChunk, ToolMessageFields, defaultToolCallParser, isDirectToolOutput, isToolMessage, isToolMessageChunk } from "./tool.js";
6
6
  import { AIMessage, AIMessageChunk, AIMessageChunkFields, AIMessageFields, isAIMessage, isAIMessageChunk } from "./ai.js";
7
7
  import { ChatMessage, ChatMessageChunk, ChatMessageFields, isChatMessage, isChatMessageChunk } from "./chat.js";
8
8
  import { FunctionMessage, FunctionMessageChunk, FunctionMessageFields, isFunctionMessage, isFunctionMessageChunk } from "./function.js";
@@ -12,4 +12,4 @@ import { $Expand, $MergeDiscriminatedUnion, $MergeObjects, Constructor, coerceMe
12
12
  import { $InferMessageContent, $InferMessageContentBlocks, $InferMessageProperties, $InferMessageProperty, $InferResponseMetadata, $MergeContentDefinition, $MergeMessageStructure, $MergeOutputVersion, $MessageToolCallBlock, $NormalizedMessageStructure, Message, MessageOutputVersion, MessageStructure, MessageToolDefinition, MessageToolSet, MessageType, StandardMessageStructure, isMessage } from "./message.js";
13
13
  import { RemoveMessage, RemoveMessageFields } from "./modifier.js";
14
14
  import { FilterMessagesFields, MessageChunkUnion, MessageTypeOrClass, MessageUnion, TrimMessagesFields, defaultTextSplitter, filterMessages, mergeMessageRuns, trimMessages } from "./transformers.js";
15
- export { $Expand, $InferMessageContent, $InferMessageContentBlocks, $InferMessageProperties, $InferMessageProperty, $InferResponseMetadata, $MergeContentDefinition, $MergeDiscriminatedUnion, $MergeMessageStructure, $MergeObjects, $MergeOutputVersion, $MessageToolCallBlock, $NormalizedMessageStructure, AIMessage, AIMessageChunk, AIMessageChunkFields, AIMessageFields, BaseMessage, BaseMessageChunk, BaseMessageFields, BaseMessageLike, ChatMessage, ChatMessageChunk, ChatMessageFields, Constructor, ContentBlock, Data, FilterMessagesFields, FunctionCall, FunctionMessage, FunctionMessageChunk, FunctionMessageFields, HumanMessage, HumanMessageChunk, HumanMessageFields, ImageDetail, InputTokenDetails, type InvalidToolCall, KNOWN_BLOCK_TYPES, Message, MessageChunkUnion, MessageContent, MessageContentComplex, MessageContentImageUrl, MessageContentText, MessageFieldWithRole, MessageOutputVersion, MessageStructure, MessageToolDefinition, MessageToolSet, MessageType, MessageTypeOrClass, MessageUnion, ModalitiesTokenDetails, OpenAIToolCall, OutputTokenDetails, ProviderFormatTypes, RemoveMessage, RemoveMessageFields, ResponseMetadata, StandardContentBlockConverter, StandardMessageStructure, StoredGeneration, StoredMessage, StoredMessageData, StoredMessageV1, SystemMessage, SystemMessageChunk, SystemMessageFields, ToolMessage, ToolMessageChunk, type ToolMessageFields, TrimMessagesFields, UsageMetadata, _isMessageFieldWithRole, _mergeDicts, _mergeLists, _mergeObj, _mergeStatus, coerceMessageLikeToMessage, convertToChunk, convertToOpenAIImageBlock, convertToProviderContentBlock, defaultTextSplitter, filterMessages, getBufferString, iife, isAIMessage, isAIMessageChunk, isBase64ContentBlock, isBaseMessage, isBaseMessageChunk, isChatMessage, isChatMessageChunk, isDataContentBlock, isFunctionMessage, isFunctionMessageChunk, isHumanMessage, isHumanMessageChunk, isIDContentBlock, isMessage, isOpenAIToolCallArray, isPlainTextContentBlock, isSystemMessage, isSystemMessageChunk, isToolMessage, isToolMessageChunk, isURLContentBlock, mapChatMessagesToStoredMessages, mapStoredMessageToChatMessage, mapStoredMessagesToChatMessages, mergeContent, mergeMessageRuns, mergeResponseMetadata, mergeUsageMetadata, parseBase64DataUrl, parseMimeType, trimMessages };
15
+ export { $Expand, $InferMessageContent, $InferMessageContentBlocks, $InferMessageProperties, $InferMessageProperty, $InferResponseMetadata, $MergeContentDefinition, $MergeDiscriminatedUnion, $MergeMessageStructure, $MergeObjects, $MergeOutputVersion, $MessageToolCallBlock, $NormalizedMessageStructure, AIMessage, AIMessageChunk, AIMessageChunkFields, AIMessageFields, BaseMessage, BaseMessageChunk, BaseMessageFields, BaseMessageLike, ChatMessage, ChatMessageChunk, ChatMessageFields, Constructor, ContentBlock, Data, DirectToolOutput, FilterMessagesFields, FunctionCall, FunctionMessage, FunctionMessageChunk, FunctionMessageFields, HumanMessage, HumanMessageChunk, HumanMessageFields, ImageDetail, InputTokenDetails, InvalidToolCall, KNOWN_BLOCK_TYPES, Message, MessageChunkUnion, MessageContent, MessageContentComplex, MessageContentImageUrl, MessageContentText, MessageFieldWithRole, MessageOutputVersion, MessageStructure, MessageToolDefinition, MessageToolSet, MessageType, MessageTypeOrClass, MessageUnion, ModalitiesTokenDetails, OpenAIToolCall, OutputTokenDetails, ProviderFormatTypes, RemoveMessage, RemoveMessageFields, ResponseMetadata, StandardContentBlockConverter, StandardMessageStructure, StoredGeneration, StoredMessage, StoredMessageData, StoredMessageV1, SystemMessage, SystemMessageChunk, SystemMessageFields, ToolCall, ToolCallChunk, ToolMessage, ToolMessageChunk, ToolMessageFields, TrimMessagesFields, UsageMetadata, _isMessageFieldWithRole, _mergeDicts, _mergeLists, _mergeObj, _mergeStatus, coerceMessageLikeToMessage, convertToChunk, convertToOpenAIImageBlock, convertToProviderContentBlock, defaultTextSplitter, defaultToolCallParser, filterMessages, getBufferString, iife, isAIMessage, isAIMessageChunk, isBase64ContentBlock, isBaseMessage, isBaseMessageChunk, isChatMessage, isChatMessageChunk, isDataContentBlock, isDirectToolOutput, isFunctionMessage, isFunctionMessageChunk, isHumanMessage, isHumanMessageChunk, isIDContentBlock, isMessage, isOpenAIToolCallArray, isPlainTextContentBlock, isSystemMessage, isSystemMessageChunk, isToolMessage, isToolMessageChunk, isURLContentBlock, mapChatMessagesToStoredMessages, mapStoredMessageToChatMessage, mapStoredMessagesToChatMessages, mergeContent, mergeMessageRuns, mergeResponseMetadata, mergeUsageMetadata, parseBase64DataUrl, parseMimeType, trimMessages };
@@ -3,7 +3,7 @@ import { convertToOpenAIImageBlock, convertToProviderContentBlock, isBase64Conte
3
3
  import { isMessage } from "./message.js";
4
4
  import { BaseMessage, BaseMessageChunk, _isMessageFieldWithRole, _mergeDicts, _mergeLists, _mergeObj, _mergeStatus, isBaseMessage, isBaseMessageChunk, isOpenAIToolCallArray, mergeContent } from "./base.js";
5
5
  import { mergeResponseMetadata, mergeUsageMetadata } from "./metadata.js";
6
- import { ToolMessage, ToolMessageChunk, isToolMessage, isToolMessageChunk } from "./tool.js";
6
+ import { ToolMessage, ToolMessageChunk, defaultToolCallParser, isDirectToolOutput, isToolMessage, isToolMessageChunk } from "./tool.js";
7
7
  import { AIMessage, AIMessageChunk, isAIMessage, isAIMessageChunk } from "./ai.js";
8
8
  import { ChatMessage, ChatMessageChunk, isChatMessage, isChatMessageChunk } from "./chat.js";
9
9
  import { FunctionMessage, FunctionMessageChunk, isFunctionMessage, isFunctionMessageChunk } from "./function.js";
@@ -43,6 +43,7 @@ __export(messages_exports, {
43
43
  convertToOpenAIImageBlock: () => convertToOpenAIImageBlock,
44
44
  convertToProviderContentBlock: () => convertToProviderContentBlock,
45
45
  defaultTextSplitter: () => defaultTextSplitter,
46
+ defaultToolCallParser: () => defaultToolCallParser,
46
47
  filterMessages: () => filterMessages,
47
48
  getBufferString: () => getBufferString,
48
49
  iife: () => iife,
@@ -54,6 +55,7 @@ __export(messages_exports, {
54
55
  isChatMessage: () => isChatMessage,
55
56
  isChatMessageChunk: () => isChatMessageChunk,
56
57
  isDataContentBlock: () => isDataContentBlock,
58
+ isDirectToolOutput: () => isDirectToolOutput,
57
59
  isFunctionMessage: () => isFunctionMessage,
58
60
  isFunctionMessageChunk: () => isFunctionMessageChunk,
59
61
  isHumanMessage: () => isHumanMessage,
@@ -80,5 +82,5 @@ __export(messages_exports, {
80
82
  });
81
83
 
82
84
  //#endregion
83
- export { AIMessage, AIMessageChunk, BaseMessage, BaseMessageChunk, ChatMessage, ChatMessageChunk, FunctionMessage, FunctionMessageChunk, HumanMessage, HumanMessageChunk, KNOWN_BLOCK_TYPES, RemoveMessage, SystemMessage, SystemMessageChunk, ToolMessage, ToolMessageChunk, _isMessageFieldWithRole, _mergeDicts, _mergeLists, _mergeObj, _mergeStatus, coerceMessageLikeToMessage, convertToChunk, convertToOpenAIImageBlock, convertToProviderContentBlock, defaultTextSplitter, filterMessages, getBufferString, iife, isAIMessage, isAIMessageChunk, isBase64ContentBlock, isBaseMessage, isBaseMessageChunk, isChatMessage, isChatMessageChunk, isDataContentBlock, isFunctionMessage, isFunctionMessageChunk, isHumanMessage, isHumanMessageChunk, isIDContentBlock, isMessage, isOpenAIToolCallArray, isPlainTextContentBlock, isSystemMessage, isSystemMessageChunk, isToolMessage, isToolMessageChunk, isURLContentBlock, mapChatMessagesToStoredMessages, mapStoredMessageToChatMessage, mapStoredMessagesToChatMessages, mergeContent, mergeMessageRuns, mergeResponseMetadata, mergeUsageMetadata, messages_exports, parseBase64DataUrl, parseMimeType, trimMessages };
85
+ export { AIMessage, AIMessageChunk, BaseMessage, BaseMessageChunk, ChatMessage, ChatMessageChunk, FunctionMessage, FunctionMessageChunk, HumanMessage, HumanMessageChunk, KNOWN_BLOCK_TYPES, RemoveMessage, SystemMessage, SystemMessageChunk, ToolMessage, ToolMessageChunk, _isMessageFieldWithRole, _mergeDicts, _mergeLists, _mergeObj, _mergeStatus, coerceMessageLikeToMessage, convertToChunk, convertToOpenAIImageBlock, convertToProviderContentBlock, defaultTextSplitter, defaultToolCallParser, filterMessages, getBufferString, iife, isAIMessage, isAIMessageChunk, isBase64ContentBlock, isBaseMessage, isBaseMessageChunk, isChatMessage, isChatMessageChunk, isDataContentBlock, isDirectToolOutput, isFunctionMessage, isFunctionMessageChunk, isHumanMessage, isHumanMessageChunk, isIDContentBlock, isMessage, isOpenAIToolCallArray, isPlainTextContentBlock, isSystemMessage, isSystemMessageChunk, isToolMessage, isToolMessageChunk, isURLContentBlock, mapChatMessagesToStoredMessages, mapStoredMessageToChatMessage, mapStoredMessagesToChatMessages, mergeContent, mergeMessageRuns, mergeResponseMetadata, mergeUsageMetadata, messages_exports, parseBase64DataUrl, parseMimeType, trimMessages };
84
86
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/messages/index.ts"],"sourcesContent":["export * from \"./ai.js\";\nexport * from \"./base.js\";\nexport * from \"./chat.js\";\nexport * from \"./function.js\";\nexport * from \"./human.js\";\nexport * from \"./system.js\";\nexport * from \"./utils.js\";\nexport * from \"./transformers.js\";\nexport * from \"./metadata.js\";\nexport * from \"./message.js\";\nexport * from \"./modifier.js\";\n// TODO: Use a star export when we deprecate the\n// existing \"ToolCall\" type in \"base.js\".\nexport {\n type ToolMessageFields,\n ToolMessage,\n ToolMessageChunk,\n type InvalidToolCall,\n isToolMessage,\n isToolMessageChunk,\n} from \"./tool.js\";\n\n// This is an old export for backwards compatibility with existing multimodal content blocks\n// TODO: remove this in v2\nexport * from \"./content/data.js\";\nexport * from \"./content/index.js\";\n"],"mappings":""}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/messages/index.ts"],"sourcesContent":["export * from \"./ai.js\";\nexport * from \"./base.js\";\nexport * from \"./chat.js\";\nexport * from \"./function.js\";\nexport * from \"./human.js\";\nexport * from \"./system.js\";\nexport * from \"./utils.js\";\nexport * from \"./transformers.js\";\nexport * from \"./metadata.js\";\nexport * from \"./message.js\";\nexport * from \"./modifier.js\";\nexport * from \"./tool.js\";\n\n// This is an old export for backwards compatibility with existing multimodal content blocks\n// TODO: remove this in v2\nexport * from \"./content/data.js\";\nexport * from \"./content/index.js\";\n"],"mappings":""}