@ai-sdk/provider 4.0.3 → 4.0.5
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 +19 -0
- package/dist/index.d.ts +492 -38
- package/package.json +1 -1
- package/src/embedding-model/v4/embedding-model-v4.ts +1 -1
- package/src/image-model/v4/image-model-v4.ts +1 -1
- package/src/index.ts +1 -0
- package/src/realtime-model/v4/realtime-model-v4-session-config.ts +3 -22
- package/src/reranking-model/v4/reranking-model-v4.ts +1 -1
- package/src/shared/v4/index.ts +1 -0
- package/src/shared/v4/shared-v4-audio-format.ts +14 -0
- package/src/speech-model/v4/speech-model-v4.ts +1 -1
- package/src/speech-translation-model/index.ts +1 -0
- package/src/speech-translation-model/v4/index.ts +5 -0
- package/src/speech-translation-model/v4/speech-translation-model-v4-stream-options.ts +65 -0
- package/src/speech-translation-model/v4/speech-translation-model-v4-stream-part.ts +141 -0
- package/src/speech-translation-model/v4/speech-translation-model-v4-stream-result.ts +47 -0
- package/src/speech-translation-model/v4/speech-translation-model-v4-usage.ts +32 -0
- package/src/speech-translation-model/v4/speech-translation-model-v4.ts +40 -0
- package/src/transcription-model/v4/transcription-model-v4-stream-options.ts +2 -11
- package/src/transcription-model/v4/transcription-model-v4.ts +1 -1
- package/src/video-model/v4/index.ts +3 -0
- package/src/video-model/v4/video-model-v4-operation-start-result.ts +44 -0
- package/src/video-model/v4/video-model-v4-operation-status-result.ts +89 -0
- package/src/video-model/v4/video-model-v4-operation-webhook.ts +11 -0
- package/src/video-model/v4/video-model-v4.ts +87 -2
|
@@ -6,7 +6,7 @@ type GetMaxImagesPerCallFunction = (options: {
|
|
|
6
6
|
}) => PromiseLike<number | undefined> | number | undefined;
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* Image generation model specification version
|
|
9
|
+
* Image generation model specification version 4.
|
|
10
10
|
*/
|
|
11
11
|
export type ImageModelV4 = {
|
|
12
12
|
/**
|
package/src/index.ts
CHANGED
|
@@ -13,6 +13,7 @@ export * from './reranking-model/index';
|
|
|
13
13
|
export * from './shared/index';
|
|
14
14
|
export * from './skills/index';
|
|
15
15
|
export * from './speech-model/index';
|
|
16
|
+
export * from './speech-translation-model/index';
|
|
16
17
|
export * from './transcription-model/index';
|
|
17
18
|
export * from './video-model/index';
|
|
18
19
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SharedV4AudioFormat } from '../../shared';
|
|
1
2
|
import type { RealtimeModelV4ToolDefinition } from './realtime-model-v4-tool-definition';
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -23,17 +24,7 @@ export type RealtimeModelV4SessionConfig = {
|
|
|
23
24
|
/**
|
|
24
25
|
* Audio format configuration for input audio.
|
|
25
26
|
*/
|
|
26
|
-
inputAudioFormat?:
|
|
27
|
-
/**
|
|
28
|
-
* Audio format type (e.g. "audio/pcm", "audio/pcmu", "audio/pcma").
|
|
29
|
-
*/
|
|
30
|
-
type: string;
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Sample rate in Hz. Only applicable for PCM format.
|
|
34
|
-
*/
|
|
35
|
-
rate?: number;
|
|
36
|
-
};
|
|
27
|
+
inputAudioFormat?: SharedV4AudioFormat;
|
|
37
28
|
|
|
38
29
|
/**
|
|
39
30
|
* Input audio transcription configuration.
|
|
@@ -87,17 +78,7 @@ export type RealtimeModelV4SessionConfig = {
|
|
|
87
78
|
/**
|
|
88
79
|
* Audio format configuration for output audio.
|
|
89
80
|
*/
|
|
90
|
-
outputAudioFormat?:
|
|
91
|
-
/**
|
|
92
|
-
* Audio format type (e.g. "audio/pcm", "audio/pcmu", "audio/pcma").
|
|
93
|
-
*/
|
|
94
|
-
type: string;
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Sample rate in Hz. Only applicable for PCM format.
|
|
98
|
-
*/
|
|
99
|
-
rate?: number;
|
|
100
|
-
};
|
|
81
|
+
outputAudioFormat?: SharedV4AudioFormat;
|
|
101
82
|
|
|
102
83
|
/**
|
|
103
84
|
* Voice activity detection configuration.
|
|
@@ -2,7 +2,7 @@ import type { RerankingModelV4CallOptions } from './reranking-model-v4-call-opti
|
|
|
2
2
|
import type { RerankingModelV4Result } from './reranking-model-v4-result';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Specification for a reranking model that implements the reranking model interface version
|
|
5
|
+
* Specification for a reranking model that implements the reranking model interface version 4.
|
|
6
6
|
*/
|
|
7
7
|
export type RerankingModelV4 = {
|
|
8
8
|
/**
|
package/src/shared/v4/index.ts
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Audio format configuration shared by provider V4 model specifications.
|
|
3
|
+
*/
|
|
4
|
+
export type SharedV4AudioFormat = {
|
|
5
|
+
/**
|
|
6
|
+
* Audio format type, e.g. `audio/pcm`, `audio/pcmu`, or `audio/pcma`.
|
|
7
|
+
*/
|
|
8
|
+
type: string;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Sample rate in Hz. Only applicable for formats that require a rate.
|
|
12
|
+
*/
|
|
13
|
+
rate?: number;
|
|
14
|
+
};
|
|
@@ -2,7 +2,7 @@ import type { SpeechModelV4CallOptions } from './speech-model-v4-call-options';
|
|
|
2
2
|
import type { SpeechModelV4Result } from './speech-model-v4-result';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Speech model specification version
|
|
5
|
+
* Speech model specification version 4.
|
|
6
6
|
*/
|
|
7
7
|
export type SpeechModelV4 = {
|
|
8
8
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './v4/index';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type { SpeechTranslationModelV4 as Experimental_SpeechTranslationModelV4 } from './speech-translation-model-v4';
|
|
2
|
+
export type { SpeechTranslationModelV4StreamOptions as Experimental_SpeechTranslationModelV4StreamOptions } from './speech-translation-model-v4-stream-options';
|
|
3
|
+
export type { SpeechTranslationModelV4StreamPart as Experimental_SpeechTranslationModelV4StreamPart } from './speech-translation-model-v4-stream-part';
|
|
4
|
+
export type { SpeechTranslationModelV4StreamResult as Experimental_SpeechTranslationModelV4StreamResult } from './speech-translation-model-v4-stream-result';
|
|
5
|
+
export type { SpeechTranslationModelV4Usage as Experimental_SpeechTranslationModelV4Usage } from './speech-translation-model-v4-usage';
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { JSONObject } from '../../json-value/json-value';
|
|
2
|
+
import type { SharedV4AudioFormat } from '../../shared';
|
|
3
|
+
|
|
4
|
+
type SpeechTranslationModelV4ProviderOptions = Record<string, JSONObject>;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Options for a speech translation model stream call.
|
|
8
|
+
*/
|
|
9
|
+
export type SpeechTranslationModelV4StreamOptions = {
|
|
10
|
+
/**
|
|
11
|
+
* Source audio chunks to transform.
|
|
12
|
+
*
|
|
13
|
+
* `Uint8Array` chunks contain raw audio bytes. `string` chunks contain
|
|
14
|
+
* base64-encoded raw audio bytes.
|
|
15
|
+
*/
|
|
16
|
+
audio: ReadableStream<Uint8Array | string>;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* The input audio format for the raw audio chunks.
|
|
20
|
+
*/
|
|
21
|
+
inputAudioFormat: SharedV4AudioFormat;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The language to produce output audio and text in, as a BCP-47-style
|
|
25
|
+
* language tag (e.g. `en`, `es`, `fr-CA`). Supported values are
|
|
26
|
+
* provider-specific and validated by the provider.
|
|
27
|
+
*/
|
|
28
|
+
targetLanguage: string;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The language of the source audio, as a BCP-47-style language tag.
|
|
32
|
+
* When absent, providers should auto-detect the source language.
|
|
33
|
+
*/
|
|
34
|
+
sourceLanguage?: string;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* The desired audio format for output audio chunks.
|
|
38
|
+
* When absent, the provider default output format is used.
|
|
39
|
+
*/
|
|
40
|
+
outputAudioFormat?: SharedV4AudioFormat;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Additional provider-specific options that are passed through to the provider.
|
|
44
|
+
*
|
|
45
|
+
* The outer record is keyed by the provider name, and the inner record is keyed
|
|
46
|
+
* by provider-specific option names.
|
|
47
|
+
*/
|
|
48
|
+
providerOptions?: SpeechTranslationModelV4ProviderOptions;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Abort signal for cancelling the operation.
|
|
52
|
+
*/
|
|
53
|
+
abortSignal?: AbortSignal;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Additional HTTP headers to be sent with the request.
|
|
57
|
+
* Only applicable for HTTP/WebSocket-based providers that support headers.
|
|
58
|
+
*/
|
|
59
|
+
headers?: Record<string, string | undefined>;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* When true, providers should include raw provider chunks in the stream.
|
|
63
|
+
*/
|
|
64
|
+
includeRawChunks?: boolean;
|
|
65
|
+
};
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import type { JSONObject } from '../../json-value/json-value';
|
|
2
|
+
import type { SharedV4Headers } from '../../shared';
|
|
3
|
+
import type { SharedV4ProviderMetadata } from '../../shared/v4/shared-v4-provider-metadata';
|
|
4
|
+
import type { SharedV4Warning } from '../../shared/v4/shared-v4-warning';
|
|
5
|
+
import type { SpeechTranslationModelV4Usage } from './speech-translation-model-v4-usage';
|
|
6
|
+
|
|
7
|
+
export type SpeechTranslationModelV4StreamPart =
|
|
8
|
+
| {
|
|
9
|
+
/**
|
|
10
|
+
* Stream start event with warnings for the call, e.g. unsupported settings.
|
|
11
|
+
*/
|
|
12
|
+
type: 'stream-start';
|
|
13
|
+
warnings: Array<SharedV4Warning>;
|
|
14
|
+
}
|
|
15
|
+
| {
|
|
16
|
+
/**
|
|
17
|
+
* Output audio chunk.
|
|
18
|
+
*
|
|
19
|
+
* `Uint8Array` chunks contain raw audio bytes. `string` chunks contain
|
|
20
|
+
* base64-encoded raw audio bytes.
|
|
21
|
+
*/
|
|
22
|
+
type: 'audio';
|
|
23
|
+
id?: string;
|
|
24
|
+
audio: Uint8Array | string;
|
|
25
|
+
providerMetadata?: SharedV4ProviderMetadata;
|
|
26
|
+
}
|
|
27
|
+
| {
|
|
28
|
+
/**
|
|
29
|
+
* Append-only output text delta.
|
|
30
|
+
*
|
|
31
|
+
* Output text is append-only: providers stream `output-text-delta`
|
|
32
|
+
* parts and finalize per-utterance with `output-text-final`. There is
|
|
33
|
+
* no partial/revision part for output text by design for now.
|
|
34
|
+
*/
|
|
35
|
+
type: 'output-text-delta';
|
|
36
|
+
id?: string;
|
|
37
|
+
delta: string;
|
|
38
|
+
providerMetadata?: SharedV4ProviderMetadata;
|
|
39
|
+
}
|
|
40
|
+
| {
|
|
41
|
+
/**
|
|
42
|
+
* Final output text for a provider-defined segment or utterance.
|
|
43
|
+
*
|
|
44
|
+
* Output text is append-only: providers stream `output-text-delta`
|
|
45
|
+
* parts and finalize per-utterance with `output-text-final`. There is
|
|
46
|
+
* no partial/revision part for output text by design for now.
|
|
47
|
+
*/
|
|
48
|
+
type: 'output-text-final';
|
|
49
|
+
id?: string;
|
|
50
|
+
text: string;
|
|
51
|
+
providerMetadata?: SharedV4ProviderMetadata;
|
|
52
|
+
}
|
|
53
|
+
| {
|
|
54
|
+
/**
|
|
55
|
+
* Append-only source transcript delta.
|
|
56
|
+
*/
|
|
57
|
+
type: 'source-transcript-delta';
|
|
58
|
+
id?: string;
|
|
59
|
+
delta: string;
|
|
60
|
+
providerMetadata?: SharedV4ProviderMetadata;
|
|
61
|
+
}
|
|
62
|
+
| {
|
|
63
|
+
/**
|
|
64
|
+
* Non-final source transcript text. The text may be revised by later parts.
|
|
65
|
+
*/
|
|
66
|
+
type: 'source-transcript-partial';
|
|
67
|
+
id?: string;
|
|
68
|
+
text: string;
|
|
69
|
+
startSecond?: number;
|
|
70
|
+
endSecond?: number;
|
|
71
|
+
channelIndex?: number;
|
|
72
|
+
providerMetadata?: SharedV4ProviderMetadata;
|
|
73
|
+
}
|
|
74
|
+
| {
|
|
75
|
+
/**
|
|
76
|
+
* Final source transcript text for a provider-defined segment or utterance.
|
|
77
|
+
*/
|
|
78
|
+
type: 'source-transcript-final';
|
|
79
|
+
id?: string;
|
|
80
|
+
text: string;
|
|
81
|
+
startSecond?: number;
|
|
82
|
+
endSecond?: number;
|
|
83
|
+
channelIndex?: number;
|
|
84
|
+
providerMetadata?: SharedV4ProviderMetadata;
|
|
85
|
+
}
|
|
86
|
+
| {
|
|
87
|
+
/**
|
|
88
|
+
* Metadata for the response, emitted once available.
|
|
89
|
+
*/
|
|
90
|
+
type: 'response-metadata';
|
|
91
|
+
timestamp?: Date;
|
|
92
|
+
modelId?: string;
|
|
93
|
+
headers?: SharedV4Headers;
|
|
94
|
+
body?: unknown;
|
|
95
|
+
}
|
|
96
|
+
| {
|
|
97
|
+
/**
|
|
98
|
+
* Metadata that is available after the stream is finished.
|
|
99
|
+
*/
|
|
100
|
+
type: 'finish';
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* The final source-language transcript of the input audio.
|
|
104
|
+
*/
|
|
105
|
+
sourceText: string;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* The final output text. May be an empty string for providers that
|
|
109
|
+
* produce only audio output.
|
|
110
|
+
*/
|
|
111
|
+
outputText: string;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* The duration of the source audio in seconds, if available.
|
|
115
|
+
*/
|
|
116
|
+
durationInSeconds?: number;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Usage information for the call, if reported by the provider.
|
|
120
|
+
*/
|
|
121
|
+
usage?: SpeechTranslationModelV4Usage;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Additional provider-specific metadata.
|
|
125
|
+
*/
|
|
126
|
+
providerMetadata?: Record<string, JSONObject>;
|
|
127
|
+
}
|
|
128
|
+
| {
|
|
129
|
+
/**
|
|
130
|
+
* Raw provider chunks if enabled.
|
|
131
|
+
*/
|
|
132
|
+
type: 'raw';
|
|
133
|
+
rawValue: unknown;
|
|
134
|
+
}
|
|
135
|
+
| {
|
|
136
|
+
/**
|
|
137
|
+
* Error parts are streamed, allowing for multiple errors.
|
|
138
|
+
*/
|
|
139
|
+
type: 'error';
|
|
140
|
+
error: unknown;
|
|
141
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { SharedV4Headers } from '../../shared';
|
|
2
|
+
import type { SpeechTranslationModelV4StreamPart } from './speech-translation-model-v4-stream-part';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The result of a speech translation model doStream call.
|
|
6
|
+
*/
|
|
7
|
+
export type SpeechTranslationModelV4StreamResult = {
|
|
8
|
+
/**
|
|
9
|
+
* The stream.
|
|
10
|
+
*/
|
|
11
|
+
stream: ReadableStream<SpeechTranslationModelV4StreamPart>;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Optional request information for telemetry and debugging purposes.
|
|
15
|
+
*/
|
|
16
|
+
request?: {
|
|
17
|
+
/**
|
|
18
|
+
* Request body or setup payload that was sent to the provider API.
|
|
19
|
+
*/
|
|
20
|
+
body?: unknown;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Optional response data.
|
|
25
|
+
*/
|
|
26
|
+
response?: {
|
|
27
|
+
/**
|
|
28
|
+
* Timestamp for the start of the streamed response.
|
|
29
|
+
*/
|
|
30
|
+
timestamp?: Date;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* The ID of the response model that was used to generate the response.
|
|
34
|
+
*/
|
|
35
|
+
modelId?: string;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Response headers.
|
|
39
|
+
*/
|
|
40
|
+
headers?: SharedV4Headers;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Response body.
|
|
44
|
+
*/
|
|
45
|
+
body?: unknown;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Usage information for a speech translation call.
|
|
3
|
+
*
|
|
4
|
+
* All fields are optional because providers report usage with different
|
|
5
|
+
* granularity (seconds of audio, audio tokens, and/or text tokens).
|
|
6
|
+
*/
|
|
7
|
+
export type SpeechTranslationModelV4Usage = {
|
|
8
|
+
/**
|
|
9
|
+
* Seconds of input audio that were processed, if reported.
|
|
10
|
+
*/
|
|
11
|
+
inputAudioSeconds?: number;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Number of input audio tokens, if reported.
|
|
15
|
+
*/
|
|
16
|
+
inputAudioTokens?: number;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Number of output audio tokens, if reported.
|
|
20
|
+
*/
|
|
21
|
+
outputAudioTokens?: number;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Number of input text tokens, if reported.
|
|
25
|
+
*/
|
|
26
|
+
inputTextTokens?: number;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Number of output text tokens, if reported.
|
|
30
|
+
*/
|
|
31
|
+
outputTextTokens?: number;
|
|
32
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { SpeechTranslationModelV4StreamOptions } from './speech-translation-model-v4-stream-options';
|
|
2
|
+
import type { SpeechTranslationModelV4StreamResult } from './speech-translation-model-v4-stream-result';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Speech translation model specification version 4.
|
|
6
|
+
*
|
|
7
|
+
* Speech translation is a streaming-only modality: models translate live
|
|
8
|
+
* source audio into target-language audio and text.
|
|
9
|
+
*
|
|
10
|
+
* Experimental: the speech translation model contract may change in patch
|
|
11
|
+
* releases while the functions built on it are experimental. All types of
|
|
12
|
+
* this modality are exported with `Experimental_` prefixes for this reason.
|
|
13
|
+
*/
|
|
14
|
+
export type SpeechTranslationModelV4 = {
|
|
15
|
+
/**
|
|
16
|
+
* The speech translation model must specify which speech translation model
|
|
17
|
+
* interface version it implements. This will allow us to evolve the
|
|
18
|
+
* speech translation model interface and retain backwards compatibility.
|
|
19
|
+
* The different implementation versions can be handled as a discriminated
|
|
20
|
+
* union on our side.
|
|
21
|
+
*/
|
|
22
|
+
readonly specificationVersion: 'v4';
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Name of the provider for logging purposes.
|
|
26
|
+
*/
|
|
27
|
+
readonly provider: string;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Provider-specific model ID for logging purposes.
|
|
31
|
+
*/
|
|
32
|
+
readonly modelId: string;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Streams a speech translation for live audio.
|
|
36
|
+
*/
|
|
37
|
+
doStream(
|
|
38
|
+
options: SpeechTranslationModelV4StreamOptions,
|
|
39
|
+
): PromiseLike<SpeechTranslationModelV4StreamResult>;
|
|
40
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { JSONObject } from '../../json-value/json-value';
|
|
2
|
+
import type { SharedV4AudioFormat } from '../../shared';
|
|
2
3
|
|
|
3
4
|
type TranscriptionModelV4ProviderOptions = Record<string, JSONObject>;
|
|
4
5
|
|
|
@@ -14,17 +15,7 @@ export type TranscriptionModelV4StreamOptions = {
|
|
|
14
15
|
/**
|
|
15
16
|
* The input audio format for the raw audio chunks.
|
|
16
17
|
*/
|
|
17
|
-
inputAudioFormat:
|
|
18
|
-
/**
|
|
19
|
-
* Audio format type, e.g. `audio/pcm`, `audio/pcmu`, or `audio/pcma`.
|
|
20
|
-
*/
|
|
21
|
-
type: string;
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Sample rate in Hz. Only applicable for formats that require a rate.
|
|
25
|
-
*/
|
|
26
|
-
rate?: number;
|
|
27
|
-
};
|
|
18
|
+
inputAudioFormat: SharedV4AudioFormat;
|
|
28
19
|
|
|
29
20
|
/**
|
|
30
21
|
* Additional provider-specific options that are passed through to the provider.
|
|
@@ -4,7 +4,7 @@ import type { TranscriptionModelV4StreamOptions } from './transcription-model-v4
|
|
|
4
4
|
import type { TranscriptionModelV4StreamResult } from './transcription-model-v4-stream-result';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* Transcription model specification version
|
|
7
|
+
* Transcription model specification version 4.
|
|
8
8
|
*/
|
|
9
9
|
export type TranscriptionModelV4 = {
|
|
10
10
|
/**
|
|
@@ -5,6 +5,9 @@ export type {
|
|
|
5
5
|
VideoModelV4VideoData as Experimental_VideoModelV4VideoData,
|
|
6
6
|
} from './video-model-v4-result';
|
|
7
7
|
export type { VideoModelV4File as Experimental_VideoModelV4File } from './video-model-v4-file';
|
|
8
|
+
export type { VideoModelV4OperationStartResult as Experimental_VideoModelV4OperationStartResult } from './video-model-v4-operation-start-result';
|
|
9
|
+
export type { VideoModelV4OperationStatusResult as Experimental_VideoModelV4OperationStatusResult } from './video-model-v4-operation-status-result';
|
|
10
|
+
export type { VideoModelV4OperationWebhook as Experimental_VideoModelV4OperationWebhook } from './video-model-v4-operation-webhook';
|
|
8
11
|
export type {
|
|
9
12
|
VideoModelV4FrameImage as Experimental_VideoModelV4FrameImage,
|
|
10
13
|
VideoModelV4FrameType as Experimental_VideoModelV4FrameType,
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { JSONValue } from '../../json-value/json-value';
|
|
2
|
+
import type { SharedV4ProviderMetadata } from '../../shared/v4/shared-v4-provider-metadata';
|
|
3
|
+
import type { SharedV4Warning } from '../../shared/v4/shared-v4-warning';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Result returned by `doStart` when initiating an asynchronous video generation.
|
|
7
|
+
*/
|
|
8
|
+
export type VideoModelV4OperationStartResult = {
|
|
9
|
+
/**
|
|
10
|
+
* JSON-serializable opaque reference passed to `doStatus` to check the
|
|
11
|
+
* status of the generation (e.g., a task ID or prediction URL).
|
|
12
|
+
*/
|
|
13
|
+
operation: JSONValue;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Warnings for the call, e.g. unsupported features.
|
|
17
|
+
*/
|
|
18
|
+
warnings: Array<SharedV4Warning>;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Additional provider-specific metadata.
|
|
22
|
+
*/
|
|
23
|
+
providerMetadata?: SharedV4ProviderMetadata;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Response information for telemetry and debugging purposes.
|
|
27
|
+
*/
|
|
28
|
+
response: {
|
|
29
|
+
/**
|
|
30
|
+
* Timestamp for the start of the response.
|
|
31
|
+
*/
|
|
32
|
+
timestamp: Date;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The ID of the response model that was used.
|
|
36
|
+
*/
|
|
37
|
+
modelId: string;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Response headers.
|
|
41
|
+
*/
|
|
42
|
+
headers: Record<string, string> | undefined;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import type { SharedV4ProviderMetadata } from '../../shared/v4/shared-v4-provider-metadata';
|
|
2
|
+
import type { SharedV4Warning } from '../../shared/v4/shared-v4-warning';
|
|
3
|
+
import type { VideoModelV4VideoData } from './video-model-v4-result';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Result returned by `doStatus` when checking the status of an
|
|
7
|
+
* asynchronous video generation.
|
|
8
|
+
*/
|
|
9
|
+
export type VideoModelV4OperationStatusResult =
|
|
10
|
+
| {
|
|
11
|
+
/**
|
|
12
|
+
* The video generation is still in progress.
|
|
13
|
+
*/
|
|
14
|
+
status: 'pending';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Warnings for the call.
|
|
18
|
+
*/
|
|
19
|
+
warnings?: Array<SharedV4Warning>;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Additional provider-specific metadata.
|
|
23
|
+
*/
|
|
24
|
+
providerMetadata?: SharedV4ProviderMetadata;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Response information for telemetry and debugging purposes.
|
|
28
|
+
*/
|
|
29
|
+
response: {
|
|
30
|
+
timestamp: Date;
|
|
31
|
+
modelId: string;
|
|
32
|
+
headers: Record<string, string> | undefined;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
| {
|
|
36
|
+
/**
|
|
37
|
+
* The video generation is complete.
|
|
38
|
+
*/
|
|
39
|
+
status: 'completed';
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Generated videos.
|
|
43
|
+
*/
|
|
44
|
+
videos: Array<VideoModelV4VideoData>;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Warnings for the call.
|
|
48
|
+
*/
|
|
49
|
+
warnings: Array<SharedV4Warning>;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Additional provider-specific metadata.
|
|
53
|
+
*/
|
|
54
|
+
providerMetadata?: SharedV4ProviderMetadata;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Response information for telemetry and debugging purposes.
|
|
58
|
+
*/
|
|
59
|
+
response: {
|
|
60
|
+
timestamp: Date;
|
|
61
|
+
modelId: string;
|
|
62
|
+
headers: Record<string, string> | undefined;
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
| {
|
|
66
|
+
/**
|
|
67
|
+
* The video generation failed.
|
|
68
|
+
*/
|
|
69
|
+
status: 'error';
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* A human-readable error message describing why the generation failed.
|
|
73
|
+
*/
|
|
74
|
+
error: string;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Additional provider-specific metadata.
|
|
78
|
+
*/
|
|
79
|
+
providerMetadata?: SharedV4ProviderMetadata;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Response information for telemetry and debugging purposes.
|
|
83
|
+
*/
|
|
84
|
+
response: {
|
|
85
|
+
timestamp: Date;
|
|
86
|
+
modelId: string;
|
|
87
|
+
headers: Record<string, string> | undefined;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { JSONValue } from '../../json-value/json-value';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Data received from a webhook notification during asynchronous video
|
|
5
|
+
* generation. Generic over the body type so providers/consumers can
|
|
6
|
+
* narrow it to a specific shape.
|
|
7
|
+
*/
|
|
8
|
+
export type VideoModelV4OperationWebhook<TBody = JSONValue> = {
|
|
9
|
+
headers: Record<string, string>;
|
|
10
|
+
body: TBody;
|
|
11
|
+
};
|