@ai-sdk/provider 4.0.0-beta.1 → 4.0.0-beta.11
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 +74 -13
- package/dist/index.d.ts +681 -366
- package/dist/index.js +53 -75
- package/dist/index.js.map +1 -1
- package/package.json +5 -7
- package/src/errors/get-error-message.ts +1 -1
- package/src/errors/index.ts +1 -0
- package/src/errors/no-such-provider-reference-error.ts +35 -0
- package/src/files/index.ts +1 -0
- package/src/files/v4/files-v4-upload-file-call-options.ts +28 -0
- package/src/files/v4/files-v4-upload-file-result.ts +35 -0
- package/src/files/v4/files-v4.ts +25 -0
- package/src/files/v4/index.ts +3 -0
- package/src/image-model/v4/image-model-v4-result.ts +73 -0
- package/src/image-model/v4/image-model-v4.ts +2 -69
- package/src/image-model/v4/index.ts +4 -3
- package/src/index.ts +2 -0
- package/src/language-model/v4/index.ts +2 -0
- package/src/language-model/v4/language-model-v4-call-options.ts +13 -0
- package/src/language-model/v4/language-model-v4-content.ts +4 -0
- package/src/language-model/v4/language-model-v4-custom-content.ts +21 -0
- package/src/language-model/v4/language-model-v4-prompt.ts +61 -19
- package/src/language-model/v4/language-model-v4-reasoning-file.ts +32 -0
- package/src/language-model/v4/language-model-v4-stream-part.ts +4 -0
- package/src/provider/v4/provider-v4.ts +16 -0
- package/src/reranking-model/v4/index.ts +1 -0
- package/src/reranking-model/v4/reranking-model-v4-result.ts +68 -0
- package/src/reranking-model/v4/reranking-model-v4.ts +4 -64
- package/src/shared/v4/index.ts +1 -0
- package/src/shared/v4/shared-v4-provider-reference.ts +15 -0
- package/src/shared/v4/shared-v4-warning.ts +16 -0
- package/src/skills/index.ts +1 -0
- package/src/skills/v4/index.ts +6 -0
- package/src/skills/v4/skills-v4-upload-skill-call-options.ts +30 -0
- package/src/skills/v4/skills-v4-upload-skill-result.ts +40 -0
- package/src/skills/v4/skills-v4.ts +28 -0
- package/src/speech-model/v4/index.ts +1 -0
- package/src/speech-model/v4/speech-model-v4-result.ts +64 -0
- package/src/speech-model/v4/speech-model-v4.ts +4 -60
- package/src/transcription-model/v4/index.ts +1 -0
- package/src/transcription-model/v4/transcription-model-v4-result.ts +92 -0
- package/src/transcription-model/v4/transcription-model-v4.ts +4 -88
- package/src/video-model/v4/index.ts +4 -3
- package/src/video-model/v4/video-model-v4-result.ts +92 -0
- package/src/video-model/v4/video-model-v4.ts +2 -88
- package/dist/index.d.mts +0 -6304
- package/dist/index.mjs +0 -404
- package/dist/index.mjs.map +0 -1
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { SharedV4ProviderMetadata } from '../../shared/v4/shared-v4-provider-metadata';
|
|
2
|
+
import { SharedV4ProviderReference } from '../../shared/v4/shared-v4-provider-reference';
|
|
3
|
+
import { SharedV4Warning } from '../../shared/v4/shared-v4-warning';
|
|
4
|
+
|
|
5
|
+
export interface SkillsV4UploadSkillResult {
|
|
6
|
+
/**
|
|
7
|
+
* A provider reference mapping provider names to provider-specific skill identifiers.
|
|
8
|
+
*/
|
|
9
|
+
providerReference: SharedV4ProviderReference;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Optional human-readable title for the uploaded skill.
|
|
13
|
+
*/
|
|
14
|
+
displayTitle?: string;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Optional name of the uploaded skill.
|
|
18
|
+
*/
|
|
19
|
+
name?: string;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Optional description of what the uploaded skill does.
|
|
23
|
+
*/
|
|
24
|
+
description?: string;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Optional latest version identifier of the uploaded skill.
|
|
28
|
+
*/
|
|
29
|
+
latestVersion?: string;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Additional provider-specific metadata.
|
|
33
|
+
*/
|
|
34
|
+
providerMetadata?: SharedV4ProviderMetadata;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Warnings for the call, e.g. unsupported settings.
|
|
38
|
+
*/
|
|
39
|
+
warnings: SharedV4Warning[];
|
|
40
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { SkillsV4UploadSkillCallOptions } from './skills-v4-upload-skill-call-options';
|
|
2
|
+
import { SkillsV4UploadSkillResult } from './skills-v4-upload-skill-result';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Skills specification version 4.
|
|
6
|
+
*/
|
|
7
|
+
export interface SkillsV4 {
|
|
8
|
+
/**
|
|
9
|
+
* The skills implementation must specify which skills interface
|
|
10
|
+
* version it implements. This will allow us to evolve the skills
|
|
11
|
+
* interface and retain backwards compatibility. The different
|
|
12
|
+
* implementation versions can be handled as a discriminated union
|
|
13
|
+
* on our side.
|
|
14
|
+
*/
|
|
15
|
+
readonly specificationVersion: 'v4';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Name of the provider for logging purposes.
|
|
19
|
+
*/
|
|
20
|
+
readonly provider: string;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Uploads a new skill from the given files.
|
|
24
|
+
*/
|
|
25
|
+
uploadSkill(
|
|
26
|
+
params: SkillsV4UploadSkillCallOptions,
|
|
27
|
+
): PromiseLike<SkillsV4UploadSkillResult>;
|
|
28
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { JSONObject } from '../../json-value';
|
|
2
|
+
import { SharedV2Headers } from '../../shared';
|
|
3
|
+
import { SharedV4Warning } from '../../shared/v4/shared-v4-warning';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The result of a speech model doGenerate call.
|
|
7
|
+
*/
|
|
8
|
+
export type SpeechModelV4Result = {
|
|
9
|
+
/**
|
|
10
|
+
* Generated audio as an ArrayBuffer.
|
|
11
|
+
* The audio should be returned without any unnecessary conversion.
|
|
12
|
+
* If the API returns base64 encoded strings, the audio should be returned
|
|
13
|
+
* as base64 encoded strings. If the API returns binary data, the audio
|
|
14
|
+
* should be returned as binary data.
|
|
15
|
+
*/
|
|
16
|
+
audio: string | Uint8Array;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Warnings for the call, e.g. unsupported settings.
|
|
20
|
+
*/
|
|
21
|
+
warnings: Array<SharedV4Warning>;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Optional request information for telemetry and debugging purposes.
|
|
25
|
+
*/
|
|
26
|
+
request?: {
|
|
27
|
+
/**
|
|
28
|
+
* Response body (available only for providers that use HTTP requests).
|
|
29
|
+
*/
|
|
30
|
+
body?: unknown;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Response information for telemetry and debugging purposes.
|
|
35
|
+
*/
|
|
36
|
+
response: {
|
|
37
|
+
/**
|
|
38
|
+
* Timestamp for the start of the generated response.
|
|
39
|
+
*/
|
|
40
|
+
timestamp: Date;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* The ID of the response model that was used to generate the response.
|
|
44
|
+
*/
|
|
45
|
+
modelId: string;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Response headers.
|
|
49
|
+
*/
|
|
50
|
+
headers?: SharedV2Headers;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Response body.
|
|
54
|
+
*/
|
|
55
|
+
body?: unknown;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Additional provider-specific metadata. They are passed through
|
|
60
|
+
* from the provider to the AI SDK and enable provider-specific
|
|
61
|
+
* results that can be fully encapsulated in the provider.
|
|
62
|
+
*/
|
|
63
|
+
providerMetadata?: Record<string, JSONObject>;
|
|
64
|
+
};
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { JSONObject } from '../../json-value';
|
|
2
|
-
import { SharedV2Headers } from '../../shared';
|
|
3
|
-
import { SharedV4Warning } from '../../shared/v4/shared-v4-warning';
|
|
4
1
|
import { SpeechModelV4CallOptions } from './speech-model-v4-call-options';
|
|
2
|
+
import { SpeechModelV4Result } from './speech-model-v4-result';
|
|
5
3
|
|
|
6
4
|
/**
|
|
7
5
|
* Speech model specification version 3.
|
|
@@ -29,61 +27,7 @@ export type SpeechModelV4 = {
|
|
|
29
27
|
/**
|
|
30
28
|
* Generates speech audio from text.
|
|
31
29
|
*/
|
|
32
|
-
doGenerate(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
* The audio should be returned without any unnecessary conversion.
|
|
36
|
-
* If the API returns base64 encoded strings, the audio should be returned
|
|
37
|
-
* as base64 encoded strings. If the API returns binary data, the audio
|
|
38
|
-
* should be returned as binary data.
|
|
39
|
-
*/
|
|
40
|
-
audio: string | Uint8Array;
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Warnings for the call, e.g. unsupported settings.
|
|
44
|
-
*/
|
|
45
|
-
warnings: Array<SharedV4Warning>;
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Optional request information for telemetry and debugging purposes.
|
|
49
|
-
*/
|
|
50
|
-
request?: {
|
|
51
|
-
/**
|
|
52
|
-
* Response body (available only for providers that use HTTP requests).
|
|
53
|
-
*/
|
|
54
|
-
body?: unknown;
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Response information for telemetry and debugging purposes.
|
|
59
|
-
*/
|
|
60
|
-
response: {
|
|
61
|
-
/**
|
|
62
|
-
* Timestamp for the start of the generated response.
|
|
63
|
-
*/
|
|
64
|
-
timestamp: Date;
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* The ID of the response model that was used to generate the response.
|
|
68
|
-
*/
|
|
69
|
-
modelId: string;
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Response headers.
|
|
73
|
-
*/
|
|
74
|
-
headers?: SharedV2Headers;
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Response body.
|
|
78
|
-
*/
|
|
79
|
-
body?: unknown;
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Additional provider-specific metadata. They are passed through
|
|
84
|
-
* from the provider to the AI SDK and enable provider-specific
|
|
85
|
-
* results that can be fully encapsulated in the provider.
|
|
86
|
-
*/
|
|
87
|
-
providerMetadata?: Record<string, JSONObject>;
|
|
88
|
-
}>;
|
|
30
|
+
doGenerate(
|
|
31
|
+
options: SpeechModelV4CallOptions,
|
|
32
|
+
): PromiseLike<SpeechModelV4Result>;
|
|
89
33
|
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { JSONObject } from '../../json-value';
|
|
2
|
+
import { SharedV4Headers } from '../../shared';
|
|
3
|
+
import { SharedV4Warning } from '../../shared/v4/shared-v4-warning';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The result of a transcription model doGenerate call.
|
|
7
|
+
*/
|
|
8
|
+
export type TranscriptionModelV4Result = {
|
|
9
|
+
/**
|
|
10
|
+
* The complete transcribed text from the audio.
|
|
11
|
+
*/
|
|
12
|
+
text: string;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Array of transcript segments with timing information.
|
|
16
|
+
* Each segment represents a portion of the transcribed text with start and end times.
|
|
17
|
+
*/
|
|
18
|
+
segments: Array<{
|
|
19
|
+
/**
|
|
20
|
+
* The text content of this segment.
|
|
21
|
+
*/
|
|
22
|
+
text: string;
|
|
23
|
+
/**
|
|
24
|
+
* The start time of this segment in seconds.
|
|
25
|
+
*/
|
|
26
|
+
startSecond: number;
|
|
27
|
+
/**
|
|
28
|
+
* The end time of this segment in seconds.
|
|
29
|
+
*/
|
|
30
|
+
endSecond: number;
|
|
31
|
+
}>;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The detected language of the audio content, as an ISO-639-1 code (e.g., 'en' for English).
|
|
35
|
+
* May be undefined if the language couldn't be detected.
|
|
36
|
+
*/
|
|
37
|
+
language: string | undefined;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* The total duration of the audio file in seconds.
|
|
41
|
+
* May be undefined if the duration couldn't be determined.
|
|
42
|
+
*/
|
|
43
|
+
durationInSeconds: number | undefined;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Warnings for the call, e.g. unsupported settings.
|
|
47
|
+
*/
|
|
48
|
+
warnings: Array<SharedV4Warning>;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Optional request information for telemetry and debugging purposes.
|
|
52
|
+
*/
|
|
53
|
+
request?: {
|
|
54
|
+
/**
|
|
55
|
+
* Raw request HTTP body that was sent to the provider API as a string (JSON should be stringified).
|
|
56
|
+
* Non-HTTP(s) providers should not set this.
|
|
57
|
+
*/
|
|
58
|
+
body?: string;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Response information for telemetry and debugging purposes.
|
|
63
|
+
*/
|
|
64
|
+
response: {
|
|
65
|
+
/**
|
|
66
|
+
* Timestamp for the start of the generated response.
|
|
67
|
+
*/
|
|
68
|
+
timestamp: Date;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* The ID of the response model that was used to generate the response.
|
|
72
|
+
*/
|
|
73
|
+
modelId: string;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Response headers.
|
|
77
|
+
*/
|
|
78
|
+
headers?: SharedV4Headers;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Response body.
|
|
82
|
+
*/
|
|
83
|
+
body?: unknown;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Additional provider-specific metadata. They are passed through
|
|
88
|
+
* from the provider to the AI SDK and enable provider-specific
|
|
89
|
+
* results that can be fully encapsulated in the provider.
|
|
90
|
+
*/
|
|
91
|
+
providerMetadata?: Record<string, JSONObject>;
|
|
92
|
+
};
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { JSONObject } from '../../json-value';
|
|
2
|
-
import { SharedV4Headers } from '../../shared';
|
|
3
|
-
import { SharedV4Warning } from '../../shared/v4/shared-v4-warning';
|
|
4
1
|
import { TranscriptionModelV4CallOptions } from './transcription-model-v4-call-options';
|
|
2
|
+
import { TranscriptionModelV4Result } from './transcription-model-v4-result';
|
|
5
3
|
|
|
6
4
|
/**
|
|
7
5
|
* Transcription model specification version 3.
|
|
@@ -29,89 +27,7 @@ export type TranscriptionModelV4 = {
|
|
|
29
27
|
/**
|
|
30
28
|
* Generates a transcript.
|
|
31
29
|
*/
|
|
32
|
-
doGenerate(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
*/
|
|
36
|
-
text: string;
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Array of transcript segments with timing information.
|
|
40
|
-
* Each segment represents a portion of the transcribed text with start and end times.
|
|
41
|
-
*/
|
|
42
|
-
segments: Array<{
|
|
43
|
-
/**
|
|
44
|
-
* The text content of this segment.
|
|
45
|
-
*/
|
|
46
|
-
text: string;
|
|
47
|
-
/**
|
|
48
|
-
* The start time of this segment in seconds.
|
|
49
|
-
*/
|
|
50
|
-
startSecond: number;
|
|
51
|
-
/**
|
|
52
|
-
* The end time of this segment in seconds.
|
|
53
|
-
*/
|
|
54
|
-
endSecond: number;
|
|
55
|
-
}>;
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* The detected language of the audio content, as an ISO-639-1 code (e.g., 'en' for English).
|
|
59
|
-
* May be undefined if the language couldn't be detected.
|
|
60
|
-
*/
|
|
61
|
-
language: string | undefined;
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* The total duration of the audio file in seconds.
|
|
65
|
-
* May be undefined if the duration couldn't be determined.
|
|
66
|
-
*/
|
|
67
|
-
durationInSeconds: number | undefined;
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Warnings for the call, e.g. unsupported settings.
|
|
71
|
-
*/
|
|
72
|
-
warnings: Array<SharedV4Warning>;
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Optional request information for telemetry and debugging purposes.
|
|
76
|
-
*/
|
|
77
|
-
request?: {
|
|
78
|
-
/**
|
|
79
|
-
* Raw request HTTP body that was sent to the provider API as a string (JSON should be stringified).
|
|
80
|
-
* Non-HTTP(s) providers should not set this.
|
|
81
|
-
*/
|
|
82
|
-
body?: string;
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Response information for telemetry and debugging purposes.
|
|
87
|
-
*/
|
|
88
|
-
response: {
|
|
89
|
-
/**
|
|
90
|
-
* Timestamp for the start of the generated response.
|
|
91
|
-
*/
|
|
92
|
-
timestamp: Date;
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* The ID of the response model that was used to generate the response.
|
|
96
|
-
*/
|
|
97
|
-
modelId: string;
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Response headers.
|
|
101
|
-
*/
|
|
102
|
-
headers?: SharedV4Headers;
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Response body.
|
|
106
|
-
*/
|
|
107
|
-
body?: unknown;
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Additional provider-specific metadata. They are passed through
|
|
112
|
-
* from the provider to the AI SDK and enable provider-specific
|
|
113
|
-
* results that can be fully encapsulated in the provider.
|
|
114
|
-
*/
|
|
115
|
-
providerMetadata?: Record<string, JSONObject>;
|
|
116
|
-
}>;
|
|
30
|
+
doGenerate(
|
|
31
|
+
options: TranscriptionModelV4CallOptions,
|
|
32
|
+
): PromiseLike<TranscriptionModelV4Result>;
|
|
117
33
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
export type { VideoModelV4 as Experimental_VideoModelV4 } from './video-model-v4';
|
|
2
|
+
export type { VideoModelV4CallOptions as Experimental_VideoModelV4CallOptions } from './video-model-v4-call-options';
|
|
1
3
|
export type {
|
|
2
|
-
|
|
4
|
+
VideoModelV4Result as Experimental_VideoModelV4Result,
|
|
3
5
|
VideoModelV4VideoData as Experimental_VideoModelV4VideoData,
|
|
4
|
-
} from './video-model-v4';
|
|
5
|
-
export type { VideoModelV4CallOptions as Experimental_VideoModelV4CallOptions } from './video-model-v4-call-options';
|
|
6
|
+
} from './video-model-v4-result';
|
|
6
7
|
export type { VideoModelV4File as Experimental_VideoModelV4File } from './video-model-v4-file';
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { SharedV4ProviderMetadata } from '../../shared/v4/shared-v4-provider-metadata';
|
|
2
|
+
import type { SharedV4Warning } from '../../shared/v4/shared-v4-warning';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Generated video data. Can be a URL, base64-encoded string, or binary data.
|
|
6
|
+
*/
|
|
7
|
+
export type VideoModelV4VideoData =
|
|
8
|
+
| {
|
|
9
|
+
/**
|
|
10
|
+
* Video available as a URL (most common for video providers).
|
|
11
|
+
*/
|
|
12
|
+
type: 'url';
|
|
13
|
+
url: string;
|
|
14
|
+
mediaType: string;
|
|
15
|
+
}
|
|
16
|
+
| {
|
|
17
|
+
/**
|
|
18
|
+
* Video as base64-encoded string.
|
|
19
|
+
*/
|
|
20
|
+
type: 'base64';
|
|
21
|
+
data: string;
|
|
22
|
+
mediaType: string;
|
|
23
|
+
}
|
|
24
|
+
| {
|
|
25
|
+
/**
|
|
26
|
+
* Video as binary data.
|
|
27
|
+
*/
|
|
28
|
+
type: 'binary';
|
|
29
|
+
data: Uint8Array;
|
|
30
|
+
mediaType: string;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The result of a video model doGenerate call.
|
|
35
|
+
*/
|
|
36
|
+
export type VideoModelV4Result = {
|
|
37
|
+
/**
|
|
38
|
+
* Generated videos as URLs, base64 strings, or binary data.
|
|
39
|
+
*
|
|
40
|
+
* Most providers return URLs to video files (MP4, WebM) due to large file sizes.
|
|
41
|
+
* Use the discriminated union to indicate the type of video data being returned.
|
|
42
|
+
*/
|
|
43
|
+
videos: Array<VideoModelV4VideoData>;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Warnings for the call, e.g. unsupported features.
|
|
47
|
+
*/
|
|
48
|
+
warnings: Array<SharedV4Warning>;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Additional provider-specific metadata. They are passed through
|
|
52
|
+
* from the provider to the AI SDK and enable provider-specific
|
|
53
|
+
* results that can be fully encapsulated in the provider.
|
|
54
|
+
*
|
|
55
|
+
* The outer record is keyed by the provider name, and the inner
|
|
56
|
+
* record is provider-specific metadata.
|
|
57
|
+
*
|
|
58
|
+
* ```ts
|
|
59
|
+
* {
|
|
60
|
+
* "fal": {
|
|
61
|
+
* "videos": [{
|
|
62
|
+
* "duration": 5.0,
|
|
63
|
+
* "fps": 24,
|
|
64
|
+
* "width": 1280,
|
|
65
|
+
* "height": 720
|
|
66
|
+
* }]
|
|
67
|
+
* }
|
|
68
|
+
* }
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
providerMetadata?: SharedV4ProviderMetadata;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Response information for telemetry and debugging purposes.
|
|
75
|
+
*/
|
|
76
|
+
response: {
|
|
77
|
+
/**
|
|
78
|
+
* Timestamp for the start of the generated response.
|
|
79
|
+
*/
|
|
80
|
+
timestamp: Date;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* The ID of the response model that was used to generate the response.
|
|
84
|
+
*/
|
|
85
|
+
modelId: string;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Response headers.
|
|
89
|
+
*/
|
|
90
|
+
headers: Record<string, string> | undefined;
|
|
91
|
+
};
|
|
92
|
+
};
|
|
@@ -1,40 +1,10 @@
|
|
|
1
1
|
import type { VideoModelV4CallOptions } from './video-model-v4-call-options';
|
|
2
|
-
import type {
|
|
3
|
-
import type { SharedV4Warning } from '../../shared/v4/shared-v4-warning';
|
|
2
|
+
import type { VideoModelV4Result } from './video-model-v4-result';
|
|
4
3
|
|
|
5
4
|
type GetMaxVideosPerCallFunction = (options: {
|
|
6
5
|
modelId: string;
|
|
7
6
|
}) => PromiseLike<number | undefined> | number | undefined;
|
|
8
7
|
|
|
9
|
-
/**
|
|
10
|
-
* Generated video data. Can be a URL, base64-encoded string, or binary data.
|
|
11
|
-
*/
|
|
12
|
-
export type VideoModelV4VideoData =
|
|
13
|
-
| {
|
|
14
|
-
/**
|
|
15
|
-
* Video available as a URL (most common for video providers).
|
|
16
|
-
*/
|
|
17
|
-
type: 'url';
|
|
18
|
-
url: string;
|
|
19
|
-
mediaType: string;
|
|
20
|
-
}
|
|
21
|
-
| {
|
|
22
|
-
/**
|
|
23
|
-
* Video as base64-encoded string.
|
|
24
|
-
*/
|
|
25
|
-
type: 'base64';
|
|
26
|
-
data: string;
|
|
27
|
-
mediaType: string;
|
|
28
|
-
}
|
|
29
|
-
| {
|
|
30
|
-
/**
|
|
31
|
-
* Video as binary data.
|
|
32
|
-
*/
|
|
33
|
-
type: 'binary';
|
|
34
|
-
data: Uint8Array;
|
|
35
|
-
mediaType: string;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
8
|
/**
|
|
39
9
|
* Video generation model specification version 3.
|
|
40
10
|
*/
|
|
@@ -72,61 +42,5 @@ export type VideoModelV4 = {
|
|
|
72
42
|
/**
|
|
73
43
|
* Generates an array of videos.
|
|
74
44
|
*/
|
|
75
|
-
doGenerate(options: VideoModelV4CallOptions): PromiseLike<
|
|
76
|
-
/**
|
|
77
|
-
* Generated videos as URLs, base64 strings, or binary data.
|
|
78
|
-
*
|
|
79
|
-
* Most providers return URLs to video files (MP4, WebM) due to large file sizes.
|
|
80
|
-
* Use the discriminated union to indicate the type of video data being returned.
|
|
81
|
-
*/
|
|
82
|
-
videos: Array<VideoModelV4VideoData>;
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Warnings for the call, e.g. unsupported features.
|
|
86
|
-
*/
|
|
87
|
-
warnings: Array<SharedV4Warning>;
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Additional provider-specific metadata. They are passed through
|
|
91
|
-
* from the provider to the AI SDK and enable provider-specific
|
|
92
|
-
* results that can be fully encapsulated in the provider.
|
|
93
|
-
*
|
|
94
|
-
* The outer record is keyed by the provider name, and the inner
|
|
95
|
-
* record is provider-specific metadata.
|
|
96
|
-
*
|
|
97
|
-
* ```ts
|
|
98
|
-
* {
|
|
99
|
-
* "fal": {
|
|
100
|
-
* "videos": [{
|
|
101
|
-
* "duration": 5.0,
|
|
102
|
-
* "fps": 24,
|
|
103
|
-
* "width": 1280,
|
|
104
|
-
* "height": 720
|
|
105
|
-
* }]
|
|
106
|
-
* }
|
|
107
|
-
* }
|
|
108
|
-
* ```
|
|
109
|
-
*/
|
|
110
|
-
providerMetadata?: SharedV4ProviderMetadata;
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Response information for telemetry and debugging purposes.
|
|
114
|
-
*/
|
|
115
|
-
response: {
|
|
116
|
-
/**
|
|
117
|
-
* Timestamp for the start of the generated response.
|
|
118
|
-
*/
|
|
119
|
-
timestamp: Date;
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* The ID of the response model that was used to generate the response.
|
|
123
|
-
*/
|
|
124
|
-
modelId: string;
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Response headers.
|
|
128
|
-
*/
|
|
129
|
-
headers: Record<string, string> | undefined;
|
|
130
|
-
};
|
|
131
|
-
}>;
|
|
45
|
+
doGenerate(options: VideoModelV4CallOptions): PromiseLike<VideoModelV4Result>;
|
|
132
46
|
};
|