@ai-sdk/xai 3.0.51 → 3.0.53
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 +14 -0
- package/dist/index.d.mts +13 -6
- package/dist/index.d.ts +13 -6
- package/dist/index.js +578 -437
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +544 -396
- package/dist/index.mjs.map +1 -1
- package/docs/01-xai.mdx +89 -21
- package/package.json +3 -3
- package/src/index.ts +15 -2
- package/src/responses/xai-responses-language-model.ts +2 -2
- package/src/responses/xai-responses-options.ts +3 -3
- package/src/xai-chat-language-model.ts +5 -2
- package/src/xai-chat-options.ts +4 -2
- package/src/xai-image-model.ts +190 -0
- package/src/xai-image-options.ts +9 -0
- package/src/xai-image-settings.ts +4 -1
- package/src/xai-provider.ts +3 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @ai-sdk/xai
|
|
2
2
|
|
|
3
|
+
## 3.0.53
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 99fbed8: feat: normalize provider specific model options type names and ensure they are exported
|
|
8
|
+
- Updated dependencies [99fbed8]
|
|
9
|
+
- @ai-sdk/openai-compatible@2.0.29
|
|
10
|
+
|
|
11
|
+
## 3.0.52
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- c781168: feat(provider/xai): add dedicated XaiImageModel with JSON-based image editing
|
|
16
|
+
|
|
3
17
|
## 3.0.51
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -4,7 +4,7 @@ import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
|
4
4
|
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
5
5
|
|
|
6
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 & {});
|
|
7
|
-
declare const
|
|
7
|
+
declare const xaiLanguageModelChatOptions: z.ZodObject<{
|
|
8
8
|
reasoningEffort: z.ZodOptional<z.ZodEnum<{
|
|
9
9
|
low: "low";
|
|
10
10
|
high: "high";
|
|
@@ -44,7 +44,7 @@ declare const xaiProviderOptions: z.ZodObject<{
|
|
|
44
44
|
}, z.core.$strip>]>>>;
|
|
45
45
|
}, z.core.$strip>>;
|
|
46
46
|
}, z.core.$strip>;
|
|
47
|
-
type
|
|
47
|
+
type XaiLanguageModelChatOptions = z.infer<typeof xaiLanguageModelChatOptions>;
|
|
48
48
|
|
|
49
49
|
declare const xaiErrorDataSchema: z.ZodObject<{
|
|
50
50
|
error: z.ZodObject<{
|
|
@@ -60,7 +60,7 @@ type XaiResponsesModelId = 'grok-4-1-fast-reasoning' | 'grok-4-1-fast-non-reason
|
|
|
60
60
|
/**
|
|
61
61
|
* @see https://docs.x.ai/docs/api-reference#create-new-response
|
|
62
62
|
*/
|
|
63
|
-
declare const
|
|
63
|
+
declare const xaiLanguageModelResponsesOptions: z.ZodObject<{
|
|
64
64
|
reasoningEffort: z.ZodOptional<z.ZodEnum<{
|
|
65
65
|
low: "low";
|
|
66
66
|
high: "high";
|
|
@@ -72,9 +72,16 @@ declare const xaiResponsesProviderOptions: z.ZodObject<{
|
|
|
72
72
|
"file_search_call.results": "file_search_call.results";
|
|
73
73
|
}>>>>;
|
|
74
74
|
}, z.core.$strip>;
|
|
75
|
-
type
|
|
75
|
+
type XaiLanguageModelResponsesOptions = z.infer<typeof xaiLanguageModelResponsesOptions>;
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
declare const xaiImageModelOptions: z.ZodObject<{
|
|
78
|
+
aspect_ratio: z.ZodOptional<z.ZodString>;
|
|
79
|
+
output_format: z.ZodOptional<z.ZodString>;
|
|
80
|
+
sync_mode: z.ZodOptional<z.ZodBoolean>;
|
|
81
|
+
}, z.core.$strip>;
|
|
82
|
+
type XaiImageModelOptions = z.infer<typeof xaiImageModelOptions>;
|
|
83
|
+
|
|
84
|
+
type XaiImageModelId = 'grok-2-image' | 'grok-imagine-image' | (string & {});
|
|
78
85
|
|
|
79
86
|
declare const codeExecutionToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<Record<string, never>, {
|
|
80
87
|
output: string;
|
|
@@ -333,4 +340,4 @@ declare const xai: XaiProvider;
|
|
|
333
340
|
|
|
334
341
|
declare const VERSION: string;
|
|
335
342
|
|
|
336
|
-
export { VERSION, type XaiErrorData, type XaiProvider, type XaiProviderOptions, type XaiProviderSettings, type XaiResponsesProviderOptions, codeExecution, createXai, mcpServer, viewImage, viewXVideo, webSearch, xSearch, xai, xaiTools };
|
|
343
|
+
export { VERSION, type XaiErrorData, type XaiImageModelOptions, type XaiImageModelOptions as XaiImageProviderOptions, type XaiLanguageModelChatOptions, type XaiLanguageModelResponsesOptions, type XaiProvider, type XaiLanguageModelChatOptions as XaiProviderOptions, type XaiProviderSettings, type XaiLanguageModelResponsesOptions as XaiResponsesProviderOptions, codeExecution, createXai, mcpServer, viewImage, viewXVideo, webSearch, xSearch, xai, xaiTools };
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
|
4
4
|
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
5
5
|
|
|
6
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 & {});
|
|
7
|
-
declare const
|
|
7
|
+
declare const xaiLanguageModelChatOptions: z.ZodObject<{
|
|
8
8
|
reasoningEffort: z.ZodOptional<z.ZodEnum<{
|
|
9
9
|
low: "low";
|
|
10
10
|
high: "high";
|
|
@@ -44,7 +44,7 @@ declare const xaiProviderOptions: z.ZodObject<{
|
|
|
44
44
|
}, z.core.$strip>]>>>;
|
|
45
45
|
}, z.core.$strip>>;
|
|
46
46
|
}, z.core.$strip>;
|
|
47
|
-
type
|
|
47
|
+
type XaiLanguageModelChatOptions = z.infer<typeof xaiLanguageModelChatOptions>;
|
|
48
48
|
|
|
49
49
|
declare const xaiErrorDataSchema: z.ZodObject<{
|
|
50
50
|
error: z.ZodObject<{
|
|
@@ -60,7 +60,7 @@ type XaiResponsesModelId = 'grok-4-1-fast-reasoning' | 'grok-4-1-fast-non-reason
|
|
|
60
60
|
/**
|
|
61
61
|
* @see https://docs.x.ai/docs/api-reference#create-new-response
|
|
62
62
|
*/
|
|
63
|
-
declare const
|
|
63
|
+
declare const xaiLanguageModelResponsesOptions: z.ZodObject<{
|
|
64
64
|
reasoningEffort: z.ZodOptional<z.ZodEnum<{
|
|
65
65
|
low: "low";
|
|
66
66
|
high: "high";
|
|
@@ -72,9 +72,16 @@ declare const xaiResponsesProviderOptions: z.ZodObject<{
|
|
|
72
72
|
"file_search_call.results": "file_search_call.results";
|
|
73
73
|
}>>>>;
|
|
74
74
|
}, z.core.$strip>;
|
|
75
|
-
type
|
|
75
|
+
type XaiLanguageModelResponsesOptions = z.infer<typeof xaiLanguageModelResponsesOptions>;
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
declare const xaiImageModelOptions: z.ZodObject<{
|
|
78
|
+
aspect_ratio: z.ZodOptional<z.ZodString>;
|
|
79
|
+
output_format: z.ZodOptional<z.ZodString>;
|
|
80
|
+
sync_mode: z.ZodOptional<z.ZodBoolean>;
|
|
81
|
+
}, z.core.$strip>;
|
|
82
|
+
type XaiImageModelOptions = z.infer<typeof xaiImageModelOptions>;
|
|
83
|
+
|
|
84
|
+
type XaiImageModelId = 'grok-2-image' | 'grok-imagine-image' | (string & {});
|
|
78
85
|
|
|
79
86
|
declare const codeExecutionToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<Record<string, never>, {
|
|
80
87
|
output: string;
|
|
@@ -333,4 +340,4 @@ declare const xai: XaiProvider;
|
|
|
333
340
|
|
|
334
341
|
declare const VERSION: string;
|
|
335
342
|
|
|
336
|
-
export { VERSION, type XaiErrorData, type XaiProvider, type XaiProviderOptions, type XaiProviderSettings, type XaiResponsesProviderOptions, codeExecution, createXai, mcpServer, viewImage, viewXVideo, webSearch, xSearch, xai, xaiTools };
|
|
343
|
+
export { VERSION, type XaiErrorData, type XaiImageModelOptions, type XaiImageModelOptions as XaiImageProviderOptions, type XaiLanguageModelChatOptions, type XaiLanguageModelResponsesOptions, type XaiProvider, type XaiLanguageModelChatOptions as XaiProviderOptions, type XaiProviderSettings, type XaiLanguageModelResponsesOptions as XaiResponsesProviderOptions, codeExecution, createXai, mcpServer, viewImage, viewXVideo, webSearch, xSearch, xai, xaiTools };
|