@ai-sdk/xai 4.0.27 → 4.0.28
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 +8 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/src/xai-video-model.ts +8 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/xai",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.28",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -29,17 +29,17 @@
|
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@ai-sdk/openai-compatible": "3.0.
|
|
32
|
+
"@ai-sdk/openai-compatible": "3.0.23",
|
|
33
33
|
"@ai-sdk/provider": "4.0.5",
|
|
34
|
-
"@ai-sdk/provider-utils": "5.0.
|
|
34
|
+
"@ai-sdk/provider-utils": "5.0.21"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/node": "22.19.19",
|
|
38
38
|
"tsup": "^8.5.1",
|
|
39
39
|
"typescript": "5.8.3",
|
|
40
40
|
"zod": "3.25.76",
|
|
41
|
-
"@ai-
|
|
42
|
-
"@
|
|
41
|
+
"@vercel/ai-tsconfig": "0.0.0",
|
|
42
|
+
"@ai-sdk/test-server": "2.0.1"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"zod": "^3.25.76 || ^4.1.8"
|
package/src/xai-video-model.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AISDKError,
|
|
3
3
|
APICallError,
|
|
4
|
-
type Experimental_VideoModelV4,
|
|
4
|
+
type Experimental_VideoModelV4 as VideoModelV4,
|
|
5
5
|
type Experimental_VideoModelV4CallOptions as VideoModelV4CallOptions,
|
|
6
|
-
type Experimental_VideoModelV4File,
|
|
6
|
+
type Experimental_VideoModelV4File as VideoModelV4File,
|
|
7
7
|
type Experimental_VideoModelV4OperationStartResult as VideoModelV4OperationStartResult,
|
|
8
8
|
type Experimental_VideoModelV4OperationStatusResult as VideoModelV4OperationStatusResult,
|
|
9
9
|
type SharedV4Warning,
|
|
@@ -29,8 +29,6 @@ import {
|
|
|
29
29
|
} from './xai-video-model-options';
|
|
30
30
|
import type { XaiVideoModelId } from './xai-video-settings';
|
|
31
31
|
|
|
32
|
-
type VideoModelV4 = Experimental_VideoModelV4;
|
|
33
|
-
|
|
34
32
|
interface XaiVideoModelConfig {
|
|
35
33
|
provider: string;
|
|
36
34
|
baseURL: string | undefined;
|
|
@@ -51,28 +49,28 @@ type XaiVideoCallOptions = VideoModelV4CallOptions;
|
|
|
51
49
|
|
|
52
50
|
function getFirstFrameImage(
|
|
53
51
|
options: XaiVideoCallOptions,
|
|
54
|
-
):
|
|
52
|
+
): VideoModelV4File | undefined {
|
|
55
53
|
return options.frameImages?.find(frame => frame.frameType === 'first_frame')
|
|
56
54
|
?.image;
|
|
57
55
|
}
|
|
58
56
|
|
|
59
57
|
function getLastFrameImage(
|
|
60
58
|
options: XaiVideoCallOptions,
|
|
61
|
-
):
|
|
59
|
+
): VideoModelV4File | undefined {
|
|
62
60
|
return options.frameImages?.find(frame => frame.frameType === 'last_frame')
|
|
63
61
|
?.image;
|
|
64
62
|
}
|
|
65
63
|
|
|
66
64
|
function resolveStartImage(
|
|
67
65
|
options: XaiVideoCallOptions,
|
|
68
|
-
):
|
|
66
|
+
): VideoModelV4File | undefined {
|
|
69
67
|
return getFirstFrameImage(options) ?? options.image;
|
|
70
68
|
}
|
|
71
69
|
|
|
72
|
-
const isVideoFile = (file:
|
|
70
|
+
const isVideoFile = (file: VideoModelV4File): boolean =>
|
|
73
71
|
file.mediaType != null && getTopLevelMediaType(file.mediaType) === 'video';
|
|
74
72
|
|
|
75
|
-
function fileToXaiImageUrl(file:
|
|
73
|
+
function fileToXaiImageUrl(file: VideoModelV4File): string {
|
|
76
74
|
if (file.type === 'url') {
|
|
77
75
|
return file.url;
|
|
78
76
|
}
|
|
@@ -153,7 +151,7 @@ function resolveVideoMode(
|
|
|
153
151
|
return undefined;
|
|
154
152
|
}
|
|
155
153
|
|
|
156
|
-
export class XaiVideoModel implements
|
|
154
|
+
export class XaiVideoModel implements VideoModelV4 {
|
|
157
155
|
readonly specificationVersion = 'v4';
|
|
158
156
|
readonly maxVideosPerCall = 1;
|
|
159
157
|
|