@ai-sdk/xai 4.0.55 → 4.0.56

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,13 @@
1
1
  # @ai-sdk/xai
2
2
 
3
+ ## 4.0.56
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [912fb01]
8
+ - @ai-sdk/provider@4.0.12
9
+ - @ai-sdk/provider-utils@5.0.38
10
+
3
11
  ## 4.0.55
4
12
 
5
13
  ### Patch Changes
package/dist/index.js CHANGED
@@ -4358,7 +4358,7 @@ var xaiTools = {
4358
4358
  };
4359
4359
 
4360
4360
  // src/version.ts
4361
- var VERSION = true ? "4.0.55" : "0.0.0-test";
4361
+ var VERSION = true ? "4.0.56" : "0.0.0-test";
4362
4362
 
4363
4363
  // src/files/xai-files.ts
4364
4364
  import {
package/docs/01-xai.mdx CHANGED
@@ -625,65 +625,16 @@ The following provider options are available:
625
625
  tools with client-side function tools in the same request.
626
626
  </Note>
627
627
 
628
- ## Text Batches
628
+ ## Batch
629
629
 
630
630
  <Note type="warning">
631
- Text batch support is experimental and the API may change in patch releases.
631
+ Batch support is experimental and the API may change in patch releases.
632
632
  </Note>
633
633
 
634
- The xAI provider supports asynchronous text generation through the
635
- [Batch API](https://docs.x.ai/developers/advanced-api-usage/batch-api). Use the
636
- experimental text batch APIs to start a batch, poll its status, and stream its
637
- results:
638
-
639
- ```ts
640
- import { xai } from '@ai-sdk/xai';
641
- import {
642
- experimental_getBatchResults as getBatchResults,
643
- experimental_getBatchStatus as getBatchStatus,
644
- experimental_startBatch as startBatch,
645
- } from 'ai';
646
- import { setTimeout } from 'node:timers/promises';
647
-
648
- const model = 'grok-4.3';
649
-
650
- const batch = await startBatch({
651
- provider: xai,
652
- requests: [
653
- {
654
- id: 'capital-france',
655
- type: 'text',
656
- model,
657
- prompt: 'What is the capital of France?',
658
- },
659
- {
660
- id: 'capital-germany',
661
- type: 'text',
662
- model: 'grok-4.20-non-reasoning',
663
- prompt: 'What is the capital of Germany?',
664
- },
665
- ],
666
- });
667
-
668
- let status = batch.status;
669
- while (status === 'pending') {
670
- await setTimeout(60_000);
671
- ({ status } = await getBatchStatus({ provider: xai, batch }));
672
- }
673
-
674
- for await (const item of getBatchResults({ provider: xai, batch })) {
675
- if (item.status === 'succeeded') {
676
- console.log(item.id, item.text);
677
- } else {
678
- console.error(item.id, item.error);
679
- }
680
- }
681
- ```
682
-
683
- `startBatch` returns a serializable batch reference. Persist this reference
684
- to check the batch status or retrieve its results from another process. Results
685
- can arrive in a different order from the input requests, so match each result by
686
- its `id`.
634
+ The xAI provider supports asynchronous text generation through the [Batch
635
+ API](https://docs.x.ai/developers/advanced-api-usage/batch-api). Pass the xAI
636
+ provider to the AI SDK's [Batch](/docs/ai-sdk-core/batch) API
637
+ for the complete workflow, including polling, persistence, and result handling.
687
638
 
688
639
  Each request specifies its `type` and `model`. xAI supports using different
689
640
  text models within the same batch.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/xai",
3
- "version": "4.0.55",
3
+ "version": "4.0.56",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "sideEffects": false,
@@ -29,8 +29,8 @@
29
29
  }
30
30
  },
31
31
  "dependencies": {
32
- "@ai-sdk/provider": "4.0.11",
33
- "@ai-sdk/provider-utils": "5.0.37"
32
+ "@ai-sdk/provider": "4.0.12",
33
+ "@ai-sdk/provider-utils": "5.0.38"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@ai-sdk/test-server": "2.0.1",