@ai-sdk/xai 3.0.15 → 3.0.16

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @ai-sdk/xai
2
2
 
3
+ ## 3.0.16
4
+
5
+ ### Patch Changes
6
+
7
+ - f446e23: fix(provider/xai): make streaming providerMetadata structure consistent with non-streaming
8
+
3
9
  ## 3.0.15
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1890,7 +1890,7 @@ var XaiResponsesLanguageModel = class {
1890
1890
  controller.enqueue({ type: "stream-start", warnings });
1891
1891
  },
1892
1892
  transform(chunk, controller) {
1893
- var _a2, _b, _c, _d, _e, _f, _g, _h, _i;
1893
+ var _a2, _b, _c, _d, _e, _f, _g, _h;
1894
1894
  if (options.includeRawChunks) {
1895
1895
  controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
1896
1896
  }
@@ -2005,8 +2005,10 @@ var XaiResponsesLanguageModel = class {
2005
2005
  id: `reasoning-${part.id}`,
2006
2006
  providerMetadata: {
2007
2007
  xai: {
2008
- itemId: part.id,
2009
- reasoningEncryptedContent: (_c = part.encrypted_content) != null ? _c : null
2008
+ ...part.encrypted_content && {
2009
+ reasoningEncryptedContent: part.encrypted_content
2010
+ },
2011
+ ...part.id && { itemId: part.id }
2010
2012
  }
2011
2013
  }
2012
2014
  });
@@ -2026,15 +2028,15 @@ var XaiResponsesLanguageModel = class {
2026
2028
  "x_semantic_search",
2027
2029
  "x_thread_fetch"
2028
2030
  ];
2029
- let toolName = (_d = part.name) != null ? _d : "";
2030
- if (webSearchSubTools.includes((_e = part.name) != null ? _e : "") || part.type === "web_search_call") {
2031
+ let toolName = (_c = part.name) != null ? _c : "";
2032
+ if (webSearchSubTools.includes((_d = part.name) != null ? _d : "") || part.type === "web_search_call") {
2031
2033
  toolName = webSearchToolName != null ? webSearchToolName : "web_search";
2032
- } else if (xSearchSubTools.includes((_f = part.name) != null ? _f : "") || part.type === "x_search_call") {
2034
+ } else if (xSearchSubTools.includes((_e = part.name) != null ? _e : "") || part.type === "x_search_call") {
2033
2035
  toolName = xSearchToolName != null ? xSearchToolName : "x_search";
2034
2036
  } else if (part.name === "code_execution" || part.type === "code_interpreter_call" || part.type === "code_execution_call") {
2035
2037
  toolName = codeExecutionToolName != null ? codeExecutionToolName : "code_execution";
2036
2038
  }
2037
- const toolInput = part.type === "custom_tool_call" ? (_g = part.input) != null ? _g : "" : (_h = part.arguments) != null ? _h : "";
2039
+ const toolInput = part.type === "custom_tool_call" ? (_f = part.input) != null ? _f : "" : (_g = part.arguments) != null ? _g : "";
2038
2040
  const shouldEmit = part.type === "custom_tool_call" ? event.type === "response.output_item.done" : !seenToolCalls.has(part.id);
2039
2041
  if (shouldEmit && !seenToolCalls.has(part.id)) {
2040
2042
  seenToolCalls.add(part.id);
@@ -2087,7 +2089,7 @@ var XaiResponsesLanguageModel = class {
2087
2089
  sourceType: "url",
2088
2090
  id: self.config.generateId(),
2089
2091
  url: annotation.url,
2090
- title: (_i = annotation.title) != null ? _i : annotation.url
2092
+ title: (_h = annotation.title) != null ? _h : annotation.url
2091
2093
  });
2092
2094
  }
2093
2095
  }
@@ -2192,7 +2194,7 @@ var xaiTools = {
2192
2194
  };
2193
2195
 
2194
2196
  // src/version.ts
2195
- var VERSION = true ? "3.0.15" : "0.0.0-test";
2197
+ var VERSION = true ? "3.0.16" : "0.0.0-test";
2196
2198
 
2197
2199
  // src/xai-provider.ts
2198
2200
  var xaiErrorStructure = {