@ai-sdk/xai 3.0.103 → 3.0.104

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/xai",
3
- "version": "3.0.103",
3
+ "version": "3.0.104",
4
4
  "license": "Apache-2.0",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/index.js",
@@ -29,9 +29,9 @@
29
29
  }
30
30
  },
31
31
  "dependencies": {
32
- "@ai-sdk/openai-compatible": "2.0.57",
32
+ "@ai-sdk/openai-compatible": "2.0.58",
33
33
  "@ai-sdk/provider": "3.0.13",
34
- "@ai-sdk/provider-utils": "4.0.36"
34
+ "@ai-sdk/provider-utils": "4.0.37"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/node": "20.17.24",
@@ -113,7 +113,7 @@ export function convertToXaiChatMessages(prompt: LanguageModelV3Prompt): {
113
113
  contentValue = output.value;
114
114
  break;
115
115
  case 'execution-denied':
116
- contentValue = output.reason ?? 'Tool execution denied.';
116
+ contentValue = output.reason ?? 'Tool call execution denied.';
117
117
  break;
118
118
  case 'content':
119
119
  case 'json':
@@ -225,6 +225,9 @@ const outputItemSchema = z.discriminatedUnion('type', [
225
225
  type: z.literal('reasoning'),
226
226
  id: z.string(),
227
227
  summary: z.array(reasoningSummaryPartSchema),
228
+ content: z
229
+ .array(z.object({ type: z.string(), text: z.string() }))
230
+ .nullish(),
228
231
  status: z.string(),
229
232
  encrypted_content: z.string().nullish(),
230
233
  }),
@@ -367,11 +367,14 @@ export class XaiResponsesLanguageModel implements LanguageModelV3 {
367
367
  }
368
368
 
369
369
  case 'reasoning': {
370
- const summaryTexts = part.summary
371
- .map(s => s.text)
372
- .filter(text => text && text.length > 0);
373
-
374
- const reasoningText = summaryTexts.join('');
370
+ const texts =
371
+ part.summary.length > 0
372
+ ? part.summary.map(s => s.text)
373
+ : (part.content ?? []).map(c => c.text);
374
+
375
+ const reasoningText = texts
376
+ .filter(text => text && text.length > 0)
377
+ .join('');
375
378
 
376
379
  // condition changed here since encrypted content can now come with empty reasoning text
377
380
  if (reasoningText || part.encrypted_content) {