@ai-sdk/xai 4.0.44 → 4.0.48

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,37 @@
1
1
  # @ai-sdk/xai
2
2
 
3
+ ## 4.0.48
4
+
5
+ ### Patch Changes
6
+
7
+ - 6843788: fix(xai): preserve web_search action (query, sources, open_page) in responses tool results
8
+
9
+ ## 4.0.47
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies [3e125ba]
14
+ - @ai-sdk/provider-utils@5.0.32
15
+
16
+ ## 4.0.46
17
+
18
+ ### Patch Changes
19
+
20
+ - 41e7760: Preserve complete xAI Responses usage objects in raw usage metadata.
21
+
22
+ ## 4.0.45
23
+
24
+ ### Patch Changes
25
+
26
+ - 7de3612: Encode provider-returned identifiers before using them in credentialed follow-up request paths.
27
+ - 35841f5: feat: normalize mid-stream provider error events across supported providers into public StreamProviderError instances and preserve provider-owned type, code, status, retry, and raw payload metadata
28
+ - 3f8fa93: feat(xai): batch API support
29
+ - dfa7305: Preserve complete xAI Chat Completions usage objects in generated and streamed results.
30
+ - Updated dependencies [a9782e1]
31
+ - Updated dependencies [35841f5]
32
+ - Updated dependencies [d2f3353]
33
+ - @ai-sdk/provider-utils@5.0.31
34
+
3
35
  ## 4.0.44
4
36
 
5
37
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod/v4';
2
2
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
3
3
  import { InferSchema, FetchFunction, WebSocketConstructor } from '@ai-sdk/provider-utils';
4
- import { ProviderV4, LanguageModelV4, ImageModelV4, Experimental_VideoModelV4, Experimental_RealtimeFactoryV4, SpeechModelV4, TranscriptionModelV4, FilesV4, Experimental_RealtimeModelV4, Experimental_RealtimeModelV4ClientSecretOptions, Experimental_RealtimeModelV4ClientSecretResult, Experimental_RealtimeModelV4ServerEvent, Experimental_RealtimeModelV4ClientEvent, Experimental_RealtimeModelV4SessionConfig } from '@ai-sdk/provider';
4
+ import { ProviderV4, Experimental_BatchLanguageModelV4, LanguageModelV4, ImageModelV4, Experimental_VideoModelV4, Experimental_RealtimeFactoryV4, SpeechModelV4, TranscriptionModelV4, FilesV4, Experimental_RealtimeModelV4, Experimental_RealtimeModelV4ClientSecretOptions, Experimental_RealtimeModelV4ClientSecretResult, Experimental_RealtimeModelV4ServerEvent, Experimental_RealtimeModelV4ClientEvent, Experimental_RealtimeModelV4SessionConfig } from '@ai-sdk/provider';
5
5
 
6
6
  type XaiChatModelId = 'grok-4.20-non-reasoning' | 'grok-4.20-reasoning' | 'grok-4.3' | 'grok-4.5' | 'grok-4.6' | 'grok-latest' | (string & {});
7
7
  declare const xaiLanguageModelChatOptions: z.ZodObject<{
@@ -331,11 +331,21 @@ declare const viewXVideo: (args?: Parameters<typeof viewXVideoToolFactory>[0]) =
331
331
  }, {}>;
332
332
 
333
333
  declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderExecutedToolFactory<{}, {
334
- query: string;
335
- sources: Array<{
336
- title: string;
334
+ action?: {
335
+ type: "search";
336
+ query?: string;
337
+ queries?: string[];
338
+ } | {
339
+ type: "openPage";
340
+ url?: string | null;
341
+ } | {
342
+ type: "findInPage";
343
+ url?: string | null;
344
+ pattern?: string | null;
345
+ };
346
+ sources?: Array<{
347
+ type: "url";
337
348
  url: string;
338
- snippet: string;
339
349
  }>;
340
350
  }, {
341
351
  allowedDomains?: string[];
@@ -344,11 +354,21 @@ declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderExecutedToolF
344
354
  enableImageUnderstanding?: boolean;
345
355
  }, {}>;
346
356
  declare const webSearch: (args?: Parameters<typeof webSearchToolFactory>[0]) => _ai_sdk_provider_utils.ProviderExecutedTool<{}, {
347
- query: string;
348
- sources: Array<{
349
- title: string;
357
+ action?: {
358
+ type: "search";
359
+ query?: string;
360
+ queries?: string[];
361
+ } | {
362
+ type: "openPage";
363
+ url?: string | null;
364
+ } | {
365
+ type: "findInPage";
366
+ url?: string | null;
367
+ pattern?: string | null;
368
+ };
369
+ sources?: Array<{
370
+ type: "url";
350
371
  url: string;
351
- snippet: string;
352
372
  }>;
353
373
  }, {}>;
354
374
 
@@ -448,11 +468,21 @@ declare const xaiTools: {
448
468
  duration?: number | undefined;
449
469
  }, {}>;
450
470
  webSearch: (args?: Parameters<_ai_sdk_provider_utils.ProviderExecutedToolFactory<{}, {
451
- query: string;
452
- sources: Array<{
453
- title: string;
471
+ action?: {
472
+ type: "search";
473
+ query?: string;
474
+ queries?: string[];
475
+ } | {
476
+ type: "openPage";
477
+ url?: string | null;
478
+ } | {
479
+ type: "findInPage";
480
+ url?: string | null;
481
+ pattern?: string | null;
482
+ };
483
+ sources?: Array<{
484
+ type: "url";
454
485
  url: string;
455
- snippet: string;
456
486
  }>;
457
487
  }, {
458
488
  allowedDomains?: string[];
@@ -460,11 +490,21 @@ declare const xaiTools: {
460
490
  enableImageSearch?: boolean;
461
491
  enableImageUnderstanding?: boolean;
462
492
  }, {}>>[0]) => _ai_sdk_provider_utils.ProviderExecutedTool<{}, {
463
- query: string;
464
- sources: Array<{
465
- title: string;
493
+ action?: {
494
+ type: "search";
495
+ query?: string;
496
+ queries?: string[];
497
+ } | {
498
+ type: "openPage";
499
+ url?: string | null;
500
+ } | {
501
+ type: "findInPage";
502
+ url?: string | null;
503
+ pattern?: string | null;
504
+ };
505
+ sources?: Array<{
506
+ type: "url";
466
507
  url: string;
467
- snippet: string;
468
508
  }>;
469
509
  }, {}>;
470
510
  xSearch: (args?: Parameters<_ai_sdk_provider_utils.ProviderExecutedToolFactory<{}, {
@@ -494,11 +534,11 @@ declare const xaiTools: {
494
534
  };
495
535
 
496
536
  interface XaiProvider extends ProviderV4 {
497
- (modelId: XaiResponsesModelId): LanguageModelV4;
537
+ (modelId: XaiResponsesModelId): Experimental_BatchLanguageModelV4;
498
538
  /**
499
539
  * Creates an Xai language model for text generation.
500
540
  */
501
- languageModel(modelId: XaiResponsesModelId): LanguageModelV4;
541
+ languageModel(modelId: XaiResponsesModelId): Experimental_BatchLanguageModelV4;
502
542
  /**
503
543
  * Creates an Xai chat model for text generation.
504
544
  */
@@ -506,7 +546,7 @@ interface XaiProvider extends ProviderV4 {
506
546
  /**
507
547
  * Creates an Xai responses model for text generation.
508
548
  */
509
- responses: (modelId: XaiResponsesModelId) => LanguageModelV4;
549
+ responses: (modelId: XaiResponsesModelId) => Experimental_BatchLanguageModelV4;
510
550
  /**
511
551
  * Creates an Xai image model for image generation.
512
552
  */