@ai-sdk/xai 2.0.0-canary.9 → 2.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 +588 -0
- package/README.md +2 -2
- package/dist/index.d.mts +52 -24
- package/dist/index.d.ts +52 -24
- package/dist/index.js +717 -35
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +725 -33
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -7
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,56 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
import { ProviderV2, LanguageModelV2, ImageModelV2 } from '@ai-sdk/provider';
|
|
2
3
|
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
3
|
-
import { z } from 'zod';
|
|
4
4
|
|
|
5
|
-
type XaiChatModelId = '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 & {});
|
|
5
|
+
type XaiChatModelId = '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
|
+
declare const xaiProviderOptions: z.ZodObject<{
|
|
7
|
+
reasoningEffort: z.ZodOptional<z.ZodEnum<{
|
|
8
|
+
low: "low";
|
|
9
|
+
high: "high";
|
|
10
|
+
}>>;
|
|
11
|
+
searchParameters: z.ZodOptional<z.ZodObject<{
|
|
12
|
+
mode: z.ZodEnum<{
|
|
13
|
+
off: "off";
|
|
14
|
+
auto: "auto";
|
|
15
|
+
on: "on";
|
|
16
|
+
}>;
|
|
17
|
+
returnCitations: z.ZodOptional<z.ZodBoolean>;
|
|
18
|
+
fromDate: z.ZodOptional<z.ZodString>;
|
|
19
|
+
toDate: z.ZodOptional<z.ZodString>;
|
|
20
|
+
maxSearchResults: z.ZodOptional<z.ZodNumber>;
|
|
21
|
+
sources: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
22
|
+
type: z.ZodLiteral<"web">;
|
|
23
|
+
country: z.ZodOptional<z.ZodString>;
|
|
24
|
+
excludedWebsites: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
25
|
+
allowedWebsites: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
26
|
+
safeSearch: z.ZodOptional<z.ZodBoolean>;
|
|
27
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
28
|
+
type: z.ZodLiteral<"x">;
|
|
29
|
+
xHandles: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
30
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
31
|
+
type: z.ZodLiteral<"news">;
|
|
32
|
+
country: z.ZodOptional<z.ZodString>;
|
|
33
|
+
excludedWebsites: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
34
|
+
safeSearch: z.ZodOptional<z.ZodBoolean>;
|
|
35
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
36
|
+
type: z.ZodLiteral<"rss">;
|
|
37
|
+
links: z.ZodArray<z.ZodString>;
|
|
38
|
+
}, z.core.$strip>]>>>;
|
|
39
|
+
}, z.core.$strip>>;
|
|
40
|
+
}, z.core.$strip>;
|
|
41
|
+
type XaiProviderOptions = z.infer<typeof xaiProviderOptions>;
|
|
42
|
+
|
|
43
|
+
declare const xaiErrorDataSchema: z.ZodObject<{
|
|
44
|
+
error: z.ZodObject<{
|
|
45
|
+
message: z.ZodString;
|
|
46
|
+
type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
47
|
+
param: z.ZodOptional<z.ZodNullable<z.ZodAny>>;
|
|
48
|
+
code: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
|
|
49
|
+
}, z.core.$strip>;
|
|
50
|
+
}, z.core.$strip>;
|
|
51
|
+
type XaiErrorData = z.infer<typeof xaiErrorDataSchema>;
|
|
6
52
|
|
|
7
53
|
type XaiImageModelId = 'grok-2-image' | (string & {});
|
|
8
|
-
interface XaiImageSettings {
|
|
9
|
-
/**
|
|
10
|
-
Override the maximum number of images per call. Default is 10.
|
|
11
|
-
*/
|
|
12
|
-
maxImagesPerCall?: number;
|
|
13
|
-
}
|
|
14
54
|
|
|
15
55
|
interface XaiProvider extends ProviderV2 {
|
|
16
56
|
/**
|
|
@@ -28,11 +68,11 @@ interface XaiProvider extends ProviderV2 {
|
|
|
28
68
|
/**
|
|
29
69
|
Creates an Xai image model for image generation.
|
|
30
70
|
*/
|
|
31
|
-
image(modelId: XaiImageModelId
|
|
71
|
+
image(modelId: XaiImageModelId): ImageModelV2;
|
|
32
72
|
/**
|
|
33
73
|
Creates an Xai image model for image generation.
|
|
34
74
|
*/
|
|
35
|
-
imageModel(modelId: XaiImageModelId
|
|
75
|
+
imageModel(modelId: XaiImageModelId): ImageModelV2;
|
|
36
76
|
}
|
|
37
77
|
interface XaiProviderSettings {
|
|
38
78
|
/**
|
|
@@ -56,16 +96,4 @@ interface XaiProviderSettings {
|
|
|
56
96
|
declare function createXai(options?: XaiProviderSettings): XaiProvider;
|
|
57
97
|
declare const xai: XaiProvider;
|
|
58
98
|
|
|
59
|
-
|
|
60
|
-
code: z.ZodString;
|
|
61
|
-
error: z.ZodString;
|
|
62
|
-
}, "strip", z.ZodTypeAny, {
|
|
63
|
-
code: string;
|
|
64
|
-
error: string;
|
|
65
|
-
}, {
|
|
66
|
-
code: string;
|
|
67
|
-
error: string;
|
|
68
|
-
}>;
|
|
69
|
-
type XaiErrorData = z.infer<typeof xaiErrorSchema>;
|
|
70
|
-
|
|
71
|
-
export { type XaiErrorData, type XaiProvider, type XaiProviderSettings, createXai, xai };
|
|
99
|
+
export { type XaiErrorData, type XaiProvider, type XaiProviderOptions, type XaiProviderSettings, createXai, xai };
|