@ai-sdk/xai 3.0.60 → 3.0.62

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,17 @@
1
1
  # @ai-sdk/xai
2
2
 
3
+ ## 3.0.62
4
+
5
+ ### Patch Changes
6
+
7
+ - 64a8fae: chore: remove obsolete model IDs for Anthropic, Google, OpenAI, xAI
8
+
9
+ ## 3.0.61
10
+
11
+ ### Patch Changes
12
+
13
+ - 2e00e03: add support for `logprobs` and `topLogprobs` in xai chat and responses provider options
14
+
3
15
  ## 3.0.60
4
16
 
5
17
  ### Patch Changes
package/README.md CHANGED
@@ -34,7 +34,7 @@ import { xai } from '@ai-sdk/xai';
34
34
  import { generateText } from 'ai';
35
35
 
36
36
  const { text } = await generateText({
37
- model: xai('grok-3-beta'),
37
+ model: xai('grok-3'),
38
38
  prompt: 'Write a vegetarian lasagna recipe for 4 people.',
39
39
  });
40
40
  ```
package/dist/index.d.mts CHANGED
@@ -3,12 +3,14 @@ import { ProviderV3, LanguageModelV3, ImageModelV3, Experimental_VideoModelV3 }
3
3
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
4
4
  import { FetchFunction } from '@ai-sdk/provider-utils';
5
5
 
6
- type XaiChatModelId = 'grok-4-1-fast-reasoning' | 'grok-4-1-fast-non-reasoning' | 'grok-4-fast-non-reasoning' | 'grok-4-fast-reasoning' | 'grok-code-fast-1' | 'grok-4' | 'grok-4-0709' | 'grok-4-latest' | 'grok-3' | 'grok-3-latest' | 'grok-3-fast' | 'grok-3-fast-latest' | 'grok-3-mini' | 'grok-3-mini-latest' | 'grok-3-mini-fast' | 'grok-3-mini-fast-latest' | 'grok-2-vision-1212' | 'grok-2-vision' | 'grok-2-vision-latest' | 'grok-2-image-1212' | 'grok-2-image' | 'grok-2-image-latest' | 'grok-2-1212' | 'grok-2' | 'grok-2-latest' | 'grok-vision-beta' | 'grok-beta' | (string & {});
6
+ type XaiChatModelId = 'grok-4-1-fast-reasoning' | 'grok-4-1-fast-non-reasoning' | 'grok-4-fast-non-reasoning' | 'grok-4-fast-reasoning' | 'grok-code-fast-1' | 'grok-4' | 'grok-4-0709' | 'grok-4-latest' | 'grok-3' | 'grok-3-latest' | 'grok-3-mini' | 'grok-3-mini-latest' | 'grok-2-vision-1212' | 'grok-2-vision' | 'grok-2-vision-latest' | 'grok-2-image-1212' | 'grok-2-image' | 'grok-2-image-latest' | (string & {});
7
7
  declare const xaiLanguageModelChatOptions: z.ZodObject<{
8
8
  reasoningEffort: z.ZodOptional<z.ZodEnum<{
9
9
  low: "low";
10
10
  high: "high";
11
11
  }>>;
12
+ logprobs: z.ZodOptional<z.ZodBoolean>;
13
+ topLogprobs: z.ZodOptional<z.ZodNumber>;
12
14
  parallel_function_calling: z.ZodOptional<z.ZodBoolean>;
13
15
  searchParameters: z.ZodOptional<z.ZodObject<{
14
16
  mode: z.ZodEnum<{
@@ -56,7 +58,7 @@ declare const xaiErrorDataSchema: z.ZodObject<{
56
58
  }, z.core.$strip>;
57
59
  type XaiErrorData = z.infer<typeof xaiErrorDataSchema>;
58
60
 
59
- type XaiResponsesModelId = 'grok-4-1-fast-reasoning' | 'grok-4-1-fast-non-reasoning' | 'grok-4' | 'grok-4-fast' | 'grok-4-fast-non-reasoning' | (string & {});
61
+ type XaiResponsesModelId = 'grok-4-1-fast-reasoning' | 'grok-4-1-fast-non-reasoning' | 'grok-4' | 'grok-4-fast-non-reasoning' | 'grok-4-fast-reasoning' | (string & {});
60
62
  /**
61
63
  * @see https://docs.x.ai/docs/api-reference#create-new-response
62
64
  */
@@ -66,6 +68,8 @@ declare const xaiLanguageModelResponsesOptions: z.ZodObject<{
66
68
  high: "high";
67
69
  medium: "medium";
68
70
  }>>;
71
+ logprobs: z.ZodOptional<z.ZodBoolean>;
72
+ topLogprobs: z.ZodOptional<z.ZodNumber>;
69
73
  store: z.ZodOptional<z.ZodBoolean>;
70
74
  previousResponseId: z.ZodOptional<z.ZodString>;
71
75
  include: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodEnum<{
package/dist/index.d.ts CHANGED
@@ -3,12 +3,14 @@ import { ProviderV3, LanguageModelV3, ImageModelV3, Experimental_VideoModelV3 }
3
3
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
4
4
  import { FetchFunction } from '@ai-sdk/provider-utils';
5
5
 
6
- type XaiChatModelId = 'grok-4-1-fast-reasoning' | 'grok-4-1-fast-non-reasoning' | 'grok-4-fast-non-reasoning' | 'grok-4-fast-reasoning' | 'grok-code-fast-1' | 'grok-4' | 'grok-4-0709' | 'grok-4-latest' | 'grok-3' | 'grok-3-latest' | 'grok-3-fast' | 'grok-3-fast-latest' | 'grok-3-mini' | 'grok-3-mini-latest' | 'grok-3-mini-fast' | 'grok-3-mini-fast-latest' | 'grok-2-vision-1212' | 'grok-2-vision' | 'grok-2-vision-latest' | 'grok-2-image-1212' | 'grok-2-image' | 'grok-2-image-latest' | 'grok-2-1212' | 'grok-2' | 'grok-2-latest' | 'grok-vision-beta' | 'grok-beta' | (string & {});
6
+ type XaiChatModelId = 'grok-4-1-fast-reasoning' | 'grok-4-1-fast-non-reasoning' | 'grok-4-fast-non-reasoning' | 'grok-4-fast-reasoning' | 'grok-code-fast-1' | 'grok-4' | 'grok-4-0709' | 'grok-4-latest' | 'grok-3' | 'grok-3-latest' | 'grok-3-mini' | 'grok-3-mini-latest' | 'grok-2-vision-1212' | 'grok-2-vision' | 'grok-2-vision-latest' | 'grok-2-image-1212' | 'grok-2-image' | 'grok-2-image-latest' | (string & {});
7
7
  declare const xaiLanguageModelChatOptions: z.ZodObject<{
8
8
  reasoningEffort: z.ZodOptional<z.ZodEnum<{
9
9
  low: "low";
10
10
  high: "high";
11
11
  }>>;
12
+ logprobs: z.ZodOptional<z.ZodBoolean>;
13
+ topLogprobs: z.ZodOptional<z.ZodNumber>;
12
14
  parallel_function_calling: z.ZodOptional<z.ZodBoolean>;
13
15
  searchParameters: z.ZodOptional<z.ZodObject<{
14
16
  mode: z.ZodEnum<{
@@ -56,7 +58,7 @@ declare const xaiErrorDataSchema: z.ZodObject<{
56
58
  }, z.core.$strip>;
57
59
  type XaiErrorData = z.infer<typeof xaiErrorDataSchema>;
58
60
 
59
- type XaiResponsesModelId = 'grok-4-1-fast-reasoning' | 'grok-4-1-fast-non-reasoning' | 'grok-4' | 'grok-4-fast' | 'grok-4-fast-non-reasoning' | (string & {});
61
+ type XaiResponsesModelId = 'grok-4-1-fast-reasoning' | 'grok-4-1-fast-non-reasoning' | 'grok-4' | 'grok-4-fast-non-reasoning' | 'grok-4-fast-reasoning' | (string & {});
60
62
  /**
61
63
  * @see https://docs.x.ai/docs/api-reference#create-new-response
62
64
  */
@@ -66,6 +68,8 @@ declare const xaiLanguageModelResponsesOptions: z.ZodObject<{
66
68
  high: "high";
67
69
  medium: "medium";
68
70
  }>>;
71
+ logprobs: z.ZodOptional<z.ZodBoolean>;
72
+ topLogprobs: z.ZodOptional<z.ZodNumber>;
69
73
  store: z.ZodOptional<z.ZodBoolean>;
70
74
  previousResponseId: z.ZodOptional<z.ZodString>;
71
75
  include: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodEnum<{
package/dist/index.js CHANGED
@@ -247,6 +247,8 @@ var searchSourceSchema = import_v4.z.discriminatedUnion("type", [
247
247
  ]);
248
248
  var xaiLanguageModelChatOptions = import_v4.z.object({
249
249
  reasoningEffort: import_v4.z.enum(["low", "high"]).optional(),
250
+ logprobs: import_v4.z.boolean().optional(),
251
+ topLogprobs: import_v4.z.number().int().min(0).max(8).optional(),
250
252
  /**
251
253
  * Whether to enable parallel function calling during tool use.
252
254
  * When true, the model can call multiple functions in parallel.
@@ -426,6 +428,8 @@ var XaiChatLanguageModel = class {
426
428
  // model id
427
429
  model: this.modelId,
428
430
  // standard generation settings
431
+ logprobs: options.logprobs === true || options.topLogprobs != null ? true : void 0,
432
+ top_logprobs: options.topLogprobs,
429
433
  max_completion_tokens: maxOutputTokens,
430
434
  temperature,
431
435
  top_p: topP,
@@ -1637,6 +1641,8 @@ var xaiLanguageModelResponsesOptions = import_v47.z.object({
1637
1641
  * Possible values are `low` (uses fewer reasoning tokens), `medium` and `high` (uses more reasoning tokens).
1638
1642
  */
1639
1643
  reasoningEffort: import_v47.z.enum(["low", "medium", "high"]).optional(),
1644
+ logprobs: import_v47.z.boolean().optional(),
1645
+ topLogprobs: import_v47.z.number().int().min(0).max(8).optional(),
1640
1646
  /**
1641
1647
  * Whether to store the input message(s) and model response for later retrieval.
1642
1648
  * @default true
@@ -2015,6 +2021,8 @@ var XaiResponsesLanguageModel = class {
2015
2021
  const baseArgs = {
2016
2022
  model: this.modelId,
2017
2023
  input,
2024
+ logprobs: options.logprobs === true || options.topLogprobs != null ? true : void 0,
2025
+ top_logprobs: options.topLogprobs,
2018
2026
  max_output_tokens: maxOutputTokens,
2019
2027
  temperature,
2020
2028
  top_p: topP,
@@ -2696,7 +2704,7 @@ var xaiTools = {
2696
2704
  };
2697
2705
 
2698
2706
  // src/version.ts
2699
- var VERSION = true ? "3.0.60" : "0.0.0-test";
2707
+ var VERSION = true ? "3.0.62" : "0.0.0-test";
2700
2708
 
2701
2709
  // src/xai-video-model.ts
2702
2710
  var import_provider6 = require("@ai-sdk/provider");