@ai-sdk/xai 4.0.59 → 5.0.0
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 +6 -0
- package/dist/index.d.ts +5 -61
- package/dist/index.js +908 -1790
- package/dist/index.js.map +1 -1
- package/docs/01-xai.mdx +2 -12
- package/package.json +1 -1
- package/src/index.ts +0 -5
- package/src/xai-batch.ts +86 -12
- package/src/xai-error.ts +2 -2
- package/src/xai-provider.ts +0 -18
- package/src/convert-to-xai-chat-messages.ts +0 -181
- package/src/convert-xai-chat-usage.ts +0 -29
- package/src/xai-chat-language-model-options.ts +0 -141
- package/src/xai-chat-language-model.ts +0 -778
- package/src/xai-chat-prompt.ts +0 -48
- package/src/xai-prepare-tools.ts +0 -98
package/CHANGELOG.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -3,58 +3,6 @@ import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
|
3
3
|
import { InferSchema, FetchFunction, WebSocketConstructor } from '@ai-sdk/provider-utils';
|
|
4
4
|
import { ProviderV4, LanguageModelV4, Experimental_BatchV4, 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
|
-
type XaiChatModelId = 'grok-4.20-non-reasoning' | 'grok-4.20-reasoning' | 'grok-4.3' | 'grok-4.5' | 'grok-4.6' | 'grok-latest' | (string & {});
|
|
7
|
-
declare const xaiLanguageModelChatOptions: z.ZodObject<{
|
|
8
|
-
reasoningEffort: z.ZodOptional<z.ZodEnum<{
|
|
9
|
-
none: "none";
|
|
10
|
-
low: "low";
|
|
11
|
-
medium: "medium";
|
|
12
|
-
high: "high";
|
|
13
|
-
xhigh: "xhigh";
|
|
14
|
-
}>>;
|
|
15
|
-
logprobs: z.ZodOptional<z.ZodBoolean>;
|
|
16
|
-
topLogprobs: z.ZodOptional<z.ZodNumber>;
|
|
17
|
-
serviceTier: z.ZodOptional<z.ZodEnum<{
|
|
18
|
-
default: "default";
|
|
19
|
-
priority: "priority";
|
|
20
|
-
}>>;
|
|
21
|
-
parallel_function_calling: z.ZodOptional<z.ZodBoolean>;
|
|
22
|
-
searchParameters: z.ZodOptional<z.ZodObject<{
|
|
23
|
-
mode: z.ZodEnum<{
|
|
24
|
-
off: "off";
|
|
25
|
-
auto: "auto";
|
|
26
|
-
on: "on";
|
|
27
|
-
}>;
|
|
28
|
-
returnCitations: z.ZodOptional<z.ZodBoolean>;
|
|
29
|
-
fromDate: z.ZodOptional<z.ZodString>;
|
|
30
|
-
toDate: z.ZodOptional<z.ZodString>;
|
|
31
|
-
maxSearchResults: z.ZodOptional<z.ZodNumber>;
|
|
32
|
-
sources: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
33
|
-
type: z.ZodLiteral<"web">;
|
|
34
|
-
country: z.ZodOptional<z.ZodString>;
|
|
35
|
-
excludedWebsites: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
36
|
-
allowedWebsites: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
37
|
-
safeSearch: z.ZodOptional<z.ZodBoolean>;
|
|
38
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
39
|
-
type: z.ZodLiteral<"x">;
|
|
40
|
-
excludedXHandles: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
41
|
-
includedXHandles: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
42
|
-
postFavoriteCount: z.ZodOptional<z.ZodNumber>;
|
|
43
|
-
postViewCount: z.ZodOptional<z.ZodNumber>;
|
|
44
|
-
xHandles: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
45
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
46
|
-
type: z.ZodLiteral<"news">;
|
|
47
|
-
country: z.ZodOptional<z.ZodString>;
|
|
48
|
-
excludedWebsites: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
49
|
-
safeSearch: z.ZodOptional<z.ZodBoolean>;
|
|
50
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
51
|
-
type: z.ZodLiteral<"rss">;
|
|
52
|
-
links: z.ZodArray<z.ZodString>;
|
|
53
|
-
}, z.core.$strip>]>>>;
|
|
54
|
-
}, z.core.$strip>>;
|
|
55
|
-
}, z.core.$strip>;
|
|
56
|
-
type XaiLanguageModelChatOptions = z.infer<typeof xaiLanguageModelChatOptions>;
|
|
57
|
-
|
|
58
6
|
declare const xaiErrorDataSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
59
7
|
error: z.ZodObject<{
|
|
60
8
|
message: z.ZodString;
|
|
@@ -85,10 +33,10 @@ type XaiResponsesModelId = 'grok-4.20-non-reasoning' | 'grok-4.20-reasoning' | '
|
|
|
85
33
|
*/
|
|
86
34
|
declare const xaiLanguageModelResponsesOptions: z.ZodObject<{
|
|
87
35
|
reasoningEffort: z.ZodOptional<z.ZodEnum<{
|
|
88
|
-
none: "none";
|
|
89
36
|
low: "low";
|
|
90
|
-
medium: "medium";
|
|
91
37
|
high: "high";
|
|
38
|
+
none: "none";
|
|
39
|
+
medium: "medium";
|
|
92
40
|
xhigh: "xhigh";
|
|
93
41
|
}>>;
|
|
94
42
|
reasoningSummary: z.ZodOptional<z.ZodEnum<{
|
|
@@ -120,8 +68,8 @@ declare const xaiImageModelOptions: z.ZodObject<{
|
|
|
120
68
|
}>>;
|
|
121
69
|
quality: z.ZodOptional<z.ZodEnum<{
|
|
122
70
|
low: "low";
|
|
123
|
-
medium: "medium";
|
|
124
71
|
high: "high";
|
|
72
|
+
medium: "medium";
|
|
125
73
|
}>>;
|
|
126
74
|
user: z.ZodOptional<z.ZodString>;
|
|
127
75
|
}, z.core.$strip>;
|
|
@@ -218,7 +166,7 @@ type XaiVideoModelOptions = XaiVideoGenerationOptions | XaiVideoEditModeOptions
|
|
|
218
166
|
declare const xaiSpeechModelOptionsSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
219
167
|
sampleRate?: 8000 | 16000 | 22050 | 24000 | 44100 | 48000 | null | undefined;
|
|
220
168
|
bitRate?: 32000 | 64000 | 96000 | 128000 | 192000 | null | undefined;
|
|
221
|
-
optimizeStreamingLatency?: 0 |
|
|
169
|
+
optimizeStreamingLatency?: 0 | 2 | 1 | null | undefined;
|
|
222
170
|
textNormalization?: boolean | null | undefined;
|
|
223
171
|
withTimestamps?: boolean | null | undefined;
|
|
224
172
|
replace?: Record<string, string> | null | undefined;
|
|
@@ -540,10 +488,6 @@ interface XaiProvider extends ProviderV4 {
|
|
|
540
488
|
* Creates an Xai language model for text generation.
|
|
541
489
|
*/
|
|
542
490
|
languageModel(modelId: XaiResponsesModelId): LanguageModelV4;
|
|
543
|
-
/**
|
|
544
|
-
* Creates an Xai chat model for text generation.
|
|
545
|
-
*/
|
|
546
|
-
chat: (modelId: XaiChatModelId) => LanguageModelV4;
|
|
547
491
|
/**
|
|
548
492
|
* Creates an Xai responses model for text generation.
|
|
549
493
|
*/
|
|
@@ -655,4 +599,4 @@ declare class XaiRealtimeModel implements Experimental_RealtimeModelV4 {
|
|
|
655
599
|
|
|
656
600
|
declare const VERSION: string;
|
|
657
601
|
|
|
658
|
-
export { XaiRealtimeModel as Experimental_XaiRealtimeModel, type XaiRealtimeModelConfig as Experimental_XaiRealtimeModelConfig, VERSION, type XaiErrorData, type XaiFilePartProviderOptions, type XaiFilesOptions, type XaiImageModelOptions, type XaiImageModelOptions as XaiImageProviderOptions, type
|
|
602
|
+
export { XaiRealtimeModel as Experimental_XaiRealtimeModel, type XaiRealtimeModelConfig as Experimental_XaiRealtimeModelConfig, VERSION, type XaiErrorData, type XaiFilePartProviderOptions, type XaiFilesOptions, type XaiImageModelOptions, type XaiImageModelOptions as XaiImageProviderOptions, type XaiLanguageModelResponsesOptions, type XaiProvider, type XaiProviderSettings, type XaiLanguageModelResponsesOptions as XaiResponsesProviderOptions, type XaiSpeechModelOptions, type XaiTranscriptionModelOptions, type XaiVideoModelId, type XaiVideoModelOptions, type XaiVideoModelOptions as XaiVideoProviderOptions, codeExecution, createXai, imageGeneration, mcpServer, viewImage, viewXVideo, webSearch, xSearch, xai, xaiTools };
|