@ai-sdk/xai 2.0.44 → 2.0.46

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.
package/dist/index.mjs CHANGED
@@ -1015,11 +1015,29 @@ var xaiResponsesChunkSchema = z4.union([
1015
1015
  item_id: z4.string(),
1016
1016
  output_index: z4.number()
1017
1017
  }),
1018
+ z4.object({
1019
+ type: z4.literal("response.code_interpreter_call.interpreting"),
1020
+ item_id: z4.string(),
1021
+ output_index: z4.number()
1022
+ }),
1018
1023
  z4.object({
1019
1024
  type: z4.literal("response.code_interpreter_call.completed"),
1020
1025
  item_id: z4.string(),
1021
1026
  output_index: z4.number()
1022
1027
  }),
1028
+ // Code interpreter code streaming events
1029
+ z4.object({
1030
+ type: z4.literal("response.code_interpreter_call_code.delta"),
1031
+ item_id: z4.string(),
1032
+ output_index: z4.number(),
1033
+ delta: z4.string()
1034
+ }),
1035
+ z4.object({
1036
+ type: z4.literal("response.code_interpreter_call_code.done"),
1037
+ item_id: z4.string(),
1038
+ output_index: z4.number(),
1039
+ code: z4.string()
1040
+ }),
1023
1041
  z4.object({
1024
1042
  type: z4.literal("response.done"),
1025
1043
  response: xaiResponsesResponseSchema
@@ -1377,11 +1395,9 @@ async function prepareResponsesTools({
1377
1395
  } else {
1378
1396
  xaiTools2.push({
1379
1397
  type: "function",
1380
- function: {
1381
- name: tool.name,
1382
- description: tool.description,
1383
- parameters: tool.inputSchema
1384
- }
1398
+ name: tool.name,
1399
+ description: tool.description,
1400
+ parameters: tool.inputSchema
1385
1401
  });
1386
1402
  }
1387
1403
  }
@@ -1599,11 +1615,11 @@ var XaiResponsesLanguageModel = class {
1599
1615
  for (const part of response.output) {
1600
1616
  if (part.type === "web_search_call" || part.type === "x_search_call" || part.type === "code_interpreter_call" || part.type === "code_execution_call" || part.type === "view_image_call" || part.type === "view_x_video_call" || part.type === "custom_tool_call") {
1601
1617
  let toolName = (_b = part.name) != null ? _b : "";
1602
- if (webSearchSubTools.includes((_c = part.name) != null ? _c : "")) {
1618
+ if (webSearchSubTools.includes((_c = part.name) != null ? _c : "") || part.type === "web_search_call") {
1603
1619
  toolName = webSearchToolName != null ? webSearchToolName : "web_search";
1604
- } else if (xSearchSubTools.includes((_d = part.name) != null ? _d : "")) {
1620
+ } else if (xSearchSubTools.includes((_d = part.name) != null ? _d : "") || part.type === "x_search_call") {
1605
1621
  toolName = xSearchToolName != null ? xSearchToolName : "x_search";
1606
- } else if (part.name === "code_execution") {
1622
+ } else if (part.name === "code_execution" || part.type === "code_interpreter_call" || part.type === "code_execution_call") {
1607
1623
  toolName = codeExecutionToolName != null ? codeExecutionToolName : "code_execution";
1608
1624
  }
1609
1625
  const toolInput = part.type === "custom_tool_call" ? (_e = part.input) != null ? _e : "" : (_f = part.arguments) != null ? _f : "";
@@ -1833,11 +1849,11 @@ var XaiResponsesLanguageModel = class {
1833
1849
  "x_thread_fetch"
1834
1850
  ];
1835
1851
  let toolName = (_e = part.name) != null ? _e : "";
1836
- if (webSearchSubTools.includes((_f = part.name) != null ? _f : "")) {
1852
+ if (webSearchSubTools.includes((_f = part.name) != null ? _f : "") || part.type === "web_search_call") {
1837
1853
  toolName = webSearchToolName != null ? webSearchToolName : "web_search";
1838
- } else if (xSearchSubTools.includes((_g = part.name) != null ? _g : "")) {
1854
+ } else if (xSearchSubTools.includes((_g = part.name) != null ? _g : "") || part.type === "x_search_call") {
1839
1855
  toolName = xSearchToolName != null ? xSearchToolName : "x_search";
1840
- } else if (part.name === "code_execution") {
1856
+ } else if (part.name === "code_execution" || part.type === "code_interpreter_call" || part.type === "code_execution_call") {
1841
1857
  toolName = codeExecutionToolName != null ? codeExecutionToolName : "code_execution";
1842
1858
  }
1843
1859
  const toolInput = part.type === "custom_tool_call" ? (_h = part.input) != null ? _h : "" : (_i = part.arguments) != null ? _i : "";
@@ -1998,7 +2014,7 @@ var xaiTools = {
1998
2014
  };
1999
2015
 
2000
2016
  // src/version.ts
2001
- var VERSION = true ? "2.0.44" : "0.0.0-test";
2017
+ var VERSION = true ? "2.0.46" : "0.0.0-test";
2002
2018
 
2003
2019
  // src/xai-provider.ts
2004
2020
  var xaiErrorStructure = {