@ai-sdk/xai 3.0.47 → 3.0.49

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.47",
3
+ "version": "3.0.49",
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.27",
33
- "@ai-sdk/provider": "3.0.7",
34
- "@ai-sdk/provider-utils": "4.0.13"
32
+ "@ai-sdk/openai-compatible": "2.0.28",
33
+ "@ai-sdk/provider": "3.0.8",
34
+ "@ai-sdk/provider-utils": "4.0.14"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/node": "20.17.24",
@@ -341,6 +341,20 @@ export const xaiResponsesChunkSchema = z.union([
341
341
  summary_index: z.number(),
342
342
  text: z.string(),
343
343
  }),
344
+ z.object({
345
+ type: z.literal('response.reasoning_text.delta'),
346
+ item_id: z.string(),
347
+ output_index: z.number(),
348
+ content_index: z.number(),
349
+ delta: z.string(),
350
+ }),
351
+ z.object({
352
+ type: z.literal('response.reasoning_text.done'),
353
+ item_id: z.string(),
354
+ output_index: z.number(),
355
+ content_index: z.number(),
356
+ text: z.string(),
357
+ }),
344
358
  z.object({
345
359
  type: z.literal('response.web_search_call.in_progress'),
346
360
  item_id: z.string(),
@@ -529,6 +529,40 @@ export class XaiResponsesLanguageModel implements LanguageModelV3 {
529
529
  return;
530
530
  }
531
531
 
532
+ if (event.type === 'response.reasoning_text.delta') {
533
+ const blockId = `reasoning-${event.item_id}`;
534
+
535
+ if (activeReasoning[event.item_id] == null) {
536
+ activeReasoning[event.item_id] = {};
537
+ controller.enqueue({
538
+ type: 'reasoning-start',
539
+ id: blockId,
540
+ providerMetadata: {
541
+ xai: {
542
+ itemId: event.item_id,
543
+ },
544
+ },
545
+ });
546
+ }
547
+
548
+ controller.enqueue({
549
+ type: 'reasoning-delta',
550
+ id: blockId,
551
+ delta: event.delta,
552
+ providerMetadata: {
553
+ xai: {
554
+ itemId: event.item_id,
555
+ },
556
+ },
557
+ });
558
+
559
+ return;
560
+ }
561
+
562
+ if (event.type === 'response.reasoning_text.done') {
563
+ return;
564
+ }
565
+
532
566
  if (event.type === 'response.output_text.delta') {
533
567
  const blockId = `text-${event.item_id}`;
534
568