@ai-sdk/gateway 3.0.218 → 3.0.220
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 +23 -0
- package/dist/index.d.mts +83 -32
- package/dist/index.d.ts +83 -32
- package/dist/index.js +138 -91
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +186 -131
- package/dist/index.mjs.map +1 -1
- package/docs/00-ai-gateway.mdx +30 -11
- package/package.json +2 -2
- package/src/gateway-embedding-model.ts +18 -17
- package/src/gateway-image-model.ts +49 -40
- package/src/gateway-language-model-settings.ts +3 -1
- package/src/gateway-reranking-model-settings.ts +2 -0
- package/src/gateway-reranking-model.ts +18 -17
- package/src/gateway-speech-model-settings.ts +1 -0
- package/src/gateway-speech-model.ts +36 -29
- package/src/gateway-transcription-model-settings.ts +2 -0
- package/src/gateway-transcription-model.ts +47 -40
- package/src/gateway-video-model.ts +64 -55
- package/src/tool/browserbase-fetch.ts +3 -3
- package/src/tool/parallel-search.ts +158 -46
- package/src/tool/tako-search.ts +220 -214
package/docs/00-ai-gateway.mdx
CHANGED
|
@@ -889,7 +889,7 @@ for await (const part of result.stream) {
|
|
|
889
889
|
|
|
890
890
|
#### Parallel Search
|
|
891
891
|
|
|
892
|
-
The Parallel Search tool enables models to search the web using [Parallel AI's Search API](https://docs.parallel.ai/api-reference/search
|
|
892
|
+
The Parallel Search tool enables models to search the web using [Parallel AI's Search API](https://docs.parallel.ai/api-reference/search/search). The model provides a research objective and a few keyword queries, and the tool returns relevant excerpts from web pages, optimized for LLM consumption.
|
|
893
893
|
|
|
894
894
|
```ts
|
|
895
895
|
import { gateway, generateText } from "ai";
|
|
@@ -917,7 +917,8 @@ const result = await generateText({
|
|
|
917
917
|
prompt: "Find detailed information about TypeScript 5.0 features.",
|
|
918
918
|
tools: {
|
|
919
919
|
parallel_search: gateway.tools.parallelSearch({
|
|
920
|
-
mode: "
|
|
920
|
+
mode: "advanced",
|
|
921
|
+
location: "us",
|
|
921
922
|
maxResults: 5,
|
|
922
923
|
sourcePolicy: {
|
|
923
924
|
includeDomains: ["typescriptlang.org", "github.com"],
|
|
@@ -936,12 +937,16 @@ console.log("Tool results:", JSON.stringify(result.toolResults, null, 2));
|
|
|
936
937
|
|
|
937
938
|
The Parallel Search tool supports the following optional configuration options:
|
|
938
939
|
|
|
939
|
-
- **mode** _'
|
|
940
|
+
- **mode** _'turbo' | 'fast' | 'basic' | 'advanced'_
|
|
940
941
|
|
|
941
|
-
|
|
942
|
+
Search mode. Defaults to `'basic'`. See the [AI Gateway web search docs](https://vercel.com/docs/ai-gateway/models-and-providers/web-search#using-parallel-search) for pricing.
|
|
942
943
|
|
|
943
|
-
- `'
|
|
944
|
-
- `'
|
|
944
|
+
- `'turbo'` - Lowest latency, shorter excerpts. Supports English and Japanese only.
|
|
945
|
+
- `'fast'` - Low latency, shorter excerpts.
|
|
946
|
+
- `'basic'` - Balanced latency and excerpt depth (default).
|
|
947
|
+
- `'advanced'` - Most thorough retrieval, higher latency.
|
|
948
|
+
|
|
949
|
+
`'one-shot'` and `'agentic'` are deprecated but still accepted: `'one-shot'` runs as `'basic'` and `'agentic'` runs as `'advanced'`.
|
|
945
950
|
|
|
946
951
|
- **maxResults** _number_
|
|
947
952
|
|
|
@@ -951,22 +956,36 @@ The Parallel Search tool supports the following optional configuration options:
|
|
|
951
956
|
|
|
952
957
|
Source policy for controlling which domains to include/exclude:
|
|
953
958
|
|
|
954
|
-
- `includeDomains` -
|
|
955
|
-
- `excludeDomains` -
|
|
956
|
-
- `afterDate` - Only include results published after this date (
|
|
959
|
+
- `includeDomains` - Domains or domain/path prefixes to include, such as `'wikipedia.org'` or `'docs.python.org/3'`. When set, `excludeDomains` is ignored.
|
|
960
|
+
- `excludeDomains` - Domains or domain/path prefixes to exclude
|
|
961
|
+
- `afterDate` - Only include results published on or after this date (`YYYY-MM-DD`)
|
|
962
|
+
|
|
963
|
+
The include and exclude lists can hold up to 200 entries combined.
|
|
964
|
+
|
|
965
|
+
- **maxCharsTotal** _number_
|
|
966
|
+
|
|
967
|
+
Maximum total characters across all result excerpts.
|
|
957
968
|
|
|
958
969
|
- **excerpts** _object_
|
|
959
970
|
|
|
960
971
|
Excerpt configuration for controlling result length:
|
|
961
972
|
|
|
962
973
|
- `maxCharsPerResult` - Maximum characters per result
|
|
963
|
-
- `maxCharsTotal` -
|
|
974
|
+
- `maxCharsTotal` - Deprecated; use the top-level `maxCharsTotal`
|
|
964
975
|
|
|
965
976
|
- **fetchPolicy** _object_
|
|
966
977
|
|
|
967
978
|
Fetch policy for controlling content freshness:
|
|
968
979
|
|
|
969
|
-
- `maxAgeSeconds` - Maximum age in seconds
|
|
980
|
+
- `maxAgeSeconds` - Maximum age of cached content, in seconds, before a live fetch is attempted. Minimum 600; lower values are raised to 600.
|
|
981
|
+
- `timeoutSeconds` - Timeout for a live fetch, in seconds. The gateway caps it to stay within its own tool timeout.
|
|
982
|
+
- `disableCacheFallback` - Return an error instead of older cached content when a live fetch fails. Defaults to `false`.
|
|
983
|
+
|
|
984
|
+
- **location** _string_
|
|
985
|
+
|
|
986
|
+
ISO 3166-1 alpha-2 country code to localize results, such as `'us'`. Invalid codes are ignored with a warning.
|
|
987
|
+
|
|
988
|
+
Each tool result contains a `search_id` and `results`, ordered by decreasing relevance, and may include a `session_id`. Each result has a `url`, a `title`, a `publish_date` (both may be `null`), and `excerpts` (an array of markdown strings). The result can also include `warnings`, for example when an invalid `location` is ignored.
|
|
970
989
|
|
|
971
990
|
The tool works with both `generateText` and `streamText`:
|
|
972
991
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/gateway",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "3.0.
|
|
4
|
+
"version": "3.0.220",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"main": "./dist/index.js",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@vercel/oidc": "3.2.0",
|
|
34
34
|
"@ai-sdk/provider": "3.0.19",
|
|
35
|
-
"@ai-sdk/provider-utils": "4.0.
|
|
35
|
+
"@ai-sdk/provider-utils": "4.0.62"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/node": "18.15.11",
|
|
@@ -97,29 +97,30 @@ export class GatewayEmbeddingModel implements EmbeddingModelV3 {
|
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
const gatewayEmbeddingWarningSchema =
|
|
101
|
-
z.
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
100
|
+
const gatewayEmbeddingWarningSchema = () =>
|
|
101
|
+
z.discriminatedUnion('type', [
|
|
102
|
+
z.object({
|
|
103
|
+
type: z.literal('unsupported'),
|
|
104
|
+
feature: z.string(),
|
|
105
|
+
details: z.string().optional(),
|
|
106
|
+
}),
|
|
107
|
+
z.object({
|
|
108
|
+
type: z.literal('compatibility'),
|
|
109
|
+
feature: z.string(),
|
|
110
|
+
details: z.string().optional(),
|
|
111
|
+
}),
|
|
112
|
+
z.object({
|
|
113
|
+
type: z.literal('other'),
|
|
114
|
+
message: z.string(),
|
|
115
|
+
}),
|
|
116
|
+
]);
|
|
116
117
|
|
|
117
118
|
const gatewayEmbeddingResponseSchema = lazySchema(() =>
|
|
118
119
|
zodSchema(
|
|
119
120
|
z.object({
|
|
120
121
|
embeddings: z.array(z.array(z.number())),
|
|
121
122
|
usage: z.object({ tokens: z.number() }).nullish(),
|
|
122
|
-
warnings: z.array(gatewayEmbeddingWarningSchema).optional(),
|
|
123
|
+
warnings: z.array(gatewayEmbeddingWarningSchema()).optional(),
|
|
123
124
|
providerMetadata: z
|
|
124
125
|
.record(z.string(), z.record(z.string(), z.unknown()))
|
|
125
126
|
.optional(),
|
|
@@ -4,6 +4,8 @@ import type {
|
|
|
4
4
|
ImageModelV3ProviderMetadata,
|
|
5
5
|
} from '@ai-sdk/provider';
|
|
6
6
|
import {
|
|
7
|
+
lazySchema,
|
|
8
|
+
zodSchema,
|
|
7
9
|
combineHeaders,
|
|
8
10
|
convertUint8ArrayToBase64,
|
|
9
11
|
createJsonErrorResponseHandler,
|
|
@@ -135,46 +137,53 @@ function maybeEncodeImageFile(file: ImageModelV3File) {
|
|
|
135
137
|
return file;
|
|
136
138
|
}
|
|
137
139
|
|
|
138
|
-
const providerMetadataEntrySchema =
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
140
|
+
const providerMetadataEntrySchema = () =>
|
|
141
|
+
z
|
|
142
|
+
.object({
|
|
143
|
+
images: z.array(z.unknown()).optional(),
|
|
144
|
+
})
|
|
145
|
+
.catchall(z.unknown());
|
|
143
146
|
|
|
144
|
-
const gatewayImageWarningSchema =
|
|
145
|
-
z.
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
147
|
+
const gatewayImageWarningSchema = () =>
|
|
148
|
+
z.discriminatedUnion('type', [
|
|
149
|
+
z.object({
|
|
150
|
+
type: z.literal('unsupported'),
|
|
151
|
+
feature: z.string(),
|
|
152
|
+
details: z.string().optional(),
|
|
153
|
+
}),
|
|
154
|
+
z.object({
|
|
155
|
+
type: z.literal('compatibility'),
|
|
156
|
+
feature: z.string(),
|
|
157
|
+
details: z.string().optional(),
|
|
158
|
+
}),
|
|
159
|
+
z.object({
|
|
160
|
+
type: z.literal('deprecated'),
|
|
161
|
+
setting: z.string(),
|
|
162
|
+
message: z.string(),
|
|
163
|
+
}),
|
|
164
|
+
z.object({
|
|
165
|
+
type: z.literal('other'),
|
|
166
|
+
message: z.string(),
|
|
167
|
+
}),
|
|
168
|
+
]);
|
|
165
169
|
|
|
166
|
-
const gatewayImageUsageSchema =
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
170
|
+
const gatewayImageUsageSchema = () =>
|
|
171
|
+
z.object({
|
|
172
|
+
inputTokens: z.number().nullish(),
|
|
173
|
+
outputTokens: z.number().nullish(),
|
|
174
|
+
totalTokens: z.number().nullish(),
|
|
175
|
+
});
|
|
171
176
|
|
|
172
|
-
const gatewayImageResponseSchema =
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
177
|
+
const gatewayImageResponseSchema = lazySchema(() =>
|
|
178
|
+
zodSchema(
|
|
179
|
+
z.object({
|
|
180
|
+
images: z.array(z.string()), // Always base64 strings over the wire
|
|
181
|
+
isRetryable: z.boolean().optional(),
|
|
182
|
+
warnings: z.array(gatewayImageWarningSchema()).optional(),
|
|
183
|
+
providerMetadata: z
|
|
184
|
+
.record(z.string(), providerMetadataEntrySchema())
|
|
185
|
+
.optional(),
|
|
186
|
+
usage: gatewayImageUsageSchema().optional(),
|
|
187
|
+
}),
|
|
188
|
+
),
|
|
189
|
+
);
|
|
@@ -113,6 +113,7 @@ export type GatewayModelId =
|
|
|
113
113
|
| 'google/gemma-4-31b-it'
|
|
114
114
|
| 'inception/mercury-2'
|
|
115
115
|
| 'inception/mercury-2.5'
|
|
116
|
+
| 'inception/mercury-3'
|
|
116
117
|
| 'inception/mercury-coder-small'
|
|
117
118
|
| 'inclusionai/ling-3.0-flash'
|
|
118
119
|
| 'inclusionai/ling-3.0-flash-fin'
|
|
@@ -270,6 +271,8 @@ export type GatewayModelId =
|
|
|
270
271
|
| 'sakana/fugu-ultra'
|
|
271
272
|
| 'sakana/fugu-ultra-v2'
|
|
272
273
|
| 'sakana/namazu'
|
|
274
|
+
| 'scaledown/scaledown-extract-1'
|
|
275
|
+
| 'scaledown/scaledown-summarize-1'
|
|
273
276
|
| 'spacexai/grok-4.1-fast-non-reasoning'
|
|
274
277
|
| 'spacexai/grok-4.1-fast-reasoning'
|
|
275
278
|
| 'spacexai/grok-4.20-multi-agent'
|
|
@@ -287,7 +290,6 @@ export type GatewayModelId =
|
|
|
287
290
|
| 'spacexai/grok-4.6'
|
|
288
291
|
| 'spacexai/grok-4.7'
|
|
289
292
|
| 'spacexai/grok-build-0.1'
|
|
290
|
-
| 'stealth/cat-jam'
|
|
291
293
|
| 'stealth/glyph-cluster'
|
|
292
294
|
| 'stepfun/step-3.7-flash'
|
|
293
295
|
| 'stepfun/step-5-preview'
|
|
@@ -98,22 +98,23 @@ export class GatewayRerankingModel implements RerankingModelV3 {
|
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
const gatewayRerankingWarningSchema =
|
|
102
|
-
z.
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
101
|
+
const gatewayRerankingWarningSchema = () =>
|
|
102
|
+
z.discriminatedUnion('type', [
|
|
103
|
+
z.object({
|
|
104
|
+
type: z.literal('unsupported'),
|
|
105
|
+
feature: z.string(),
|
|
106
|
+
details: z.string().optional(),
|
|
107
|
+
}),
|
|
108
|
+
z.object({
|
|
109
|
+
type: z.literal('compatibility'),
|
|
110
|
+
feature: z.string(),
|
|
111
|
+
details: z.string().optional(),
|
|
112
|
+
}),
|
|
113
|
+
z.object({
|
|
114
|
+
type: z.literal('other'),
|
|
115
|
+
message: z.string(),
|
|
116
|
+
}),
|
|
117
|
+
]);
|
|
117
118
|
|
|
118
119
|
const gatewayRerankingResponseSchema = lazySchema(() =>
|
|
119
120
|
zodSchema(
|
|
@@ -124,7 +125,7 @@ const gatewayRerankingResponseSchema = lazySchema(() =>
|
|
|
124
125
|
relevanceScore: z.number(),
|
|
125
126
|
}),
|
|
126
127
|
),
|
|
127
|
-
warnings: z.array(gatewayRerankingWarningSchema).optional(),
|
|
128
|
+
warnings: z.array(gatewayRerankingWarningSchema()).optional(),
|
|
128
129
|
providerMetadata: z
|
|
129
130
|
.record(z.string(), z.record(z.string(), z.unknown()))
|
|
130
131
|
.optional(),
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { SharedV3ProviderMetadata, SpeechModelV3 } from '@ai-sdk/provider';
|
|
2
2
|
import {
|
|
3
|
+
lazySchema,
|
|
4
|
+
zodSchema,
|
|
3
5
|
combineHeaders,
|
|
4
6
|
createJsonErrorResponseHandler,
|
|
5
7
|
createJsonResponseHandler,
|
|
@@ -108,34 +110,39 @@ export class GatewaySpeechModel implements SpeechModelV3 {
|
|
|
108
110
|
}
|
|
109
111
|
}
|
|
110
112
|
|
|
111
|
-
const providerMetadataEntrySchema = z.object({}).catchall(z.unknown());
|
|
113
|
+
const providerMetadataEntrySchema = () => z.object({}).catchall(z.unknown());
|
|
112
114
|
|
|
113
|
-
const gatewaySpeechWarningSchema =
|
|
114
|
-
z.
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
115
|
+
const gatewaySpeechWarningSchema = () =>
|
|
116
|
+
z.discriminatedUnion('type', [
|
|
117
|
+
z.object({
|
|
118
|
+
type: z.literal('unsupported'),
|
|
119
|
+
feature: z.string(),
|
|
120
|
+
details: z.string().optional(),
|
|
121
|
+
}),
|
|
122
|
+
z.object({
|
|
123
|
+
type: z.literal('compatibility'),
|
|
124
|
+
feature: z.string(),
|
|
125
|
+
details: z.string().optional(),
|
|
126
|
+
}),
|
|
127
|
+
z.object({
|
|
128
|
+
type: z.literal('deprecated'),
|
|
129
|
+
setting: z.string(),
|
|
130
|
+
message: z.string(),
|
|
131
|
+
}),
|
|
132
|
+
z.object({
|
|
133
|
+
type: z.literal('other'),
|
|
134
|
+
message: z.string(),
|
|
135
|
+
}),
|
|
136
|
+
]);
|
|
134
137
|
|
|
135
|
-
const gatewaySpeechResponseSchema =
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
138
|
+
const gatewaySpeechResponseSchema = lazySchema(() =>
|
|
139
|
+
zodSchema(
|
|
140
|
+
z.object({
|
|
141
|
+
audio: z.string(),
|
|
142
|
+
warnings: z.array(gatewaySpeechWarningSchema()).optional(),
|
|
143
|
+
providerMetadata: z
|
|
144
|
+
.record(z.string(), providerMetadataEntrySchema())
|
|
145
|
+
.optional(),
|
|
146
|
+
}),
|
|
147
|
+
),
|
|
148
|
+
);
|
|
@@ -4,6 +4,8 @@ export type GatewayTranscriptionModelId =
|
|
|
4
4
|
| 'google/gemini-3.5-transcribe-live'
|
|
5
5
|
| 'microsoft/mai-transcribe-2'
|
|
6
6
|
| 'microsoft/mai-transcribe-2-streaming'
|
|
7
|
+
| 'mistral/voxtral-mini-transcribe-3'
|
|
8
|
+
| 'mistral/voxtral-small-transcribe-3'
|
|
7
9
|
| 'openai/gpt-4o-mini-transcribe'
|
|
8
10
|
| 'openai/gpt-4o-transcribe'
|
|
9
11
|
| 'openai/gpt-realtime-whisper'
|
|
@@ -3,6 +3,8 @@ import type {
|
|
|
3
3
|
TranscriptionModelV3,
|
|
4
4
|
} from '@ai-sdk/provider';
|
|
5
5
|
import {
|
|
6
|
+
lazySchema,
|
|
7
|
+
zodSchema,
|
|
6
8
|
combineHeaders,
|
|
7
9
|
convertUint8ArrayToBase64,
|
|
8
10
|
createJsonErrorResponseHandler,
|
|
@@ -110,45 +112,50 @@ export class GatewayTranscriptionModel implements TranscriptionModelV3 {
|
|
|
110
112
|
}
|
|
111
113
|
}
|
|
112
114
|
|
|
113
|
-
const providerMetadataEntrySchema = z.object({}).catchall(z.unknown());
|
|
115
|
+
const providerMetadataEntrySchema = () => z.object({}).catchall(z.unknown());
|
|
114
116
|
|
|
115
|
-
const gatewayTranscriptionWarningSchema =
|
|
116
|
-
z.
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
117
|
+
const gatewayTranscriptionWarningSchema = () =>
|
|
118
|
+
z.discriminatedUnion('type', [
|
|
119
|
+
z.object({
|
|
120
|
+
type: z.literal('unsupported'),
|
|
121
|
+
feature: z.string(),
|
|
122
|
+
details: z.string().optional(),
|
|
123
|
+
}),
|
|
124
|
+
z.object({
|
|
125
|
+
type: z.literal('compatibility'),
|
|
126
|
+
feature: z.string(),
|
|
127
|
+
details: z.string().optional(),
|
|
128
|
+
}),
|
|
129
|
+
z.object({
|
|
130
|
+
type: z.literal('deprecated'),
|
|
131
|
+
setting: z.string(),
|
|
132
|
+
message: z.string(),
|
|
133
|
+
}),
|
|
134
|
+
z.object({
|
|
135
|
+
type: z.literal('other'),
|
|
136
|
+
message: z.string(),
|
|
137
|
+
}),
|
|
138
|
+
]);
|
|
136
139
|
|
|
137
|
-
const gatewayTranscriptionResponseSchema =
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
z
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
140
|
+
const gatewayTranscriptionResponseSchema = lazySchema(() =>
|
|
141
|
+
zodSchema(
|
|
142
|
+
z.object({
|
|
143
|
+
text: z.string(),
|
|
144
|
+
segments: z
|
|
145
|
+
.array(
|
|
146
|
+
z.object({
|
|
147
|
+
text: z.string(),
|
|
148
|
+
startSecond: z.number(),
|
|
149
|
+
endSecond: z.number(),
|
|
150
|
+
}),
|
|
151
|
+
)
|
|
152
|
+
.optional(),
|
|
153
|
+
language: z.string().nullish(),
|
|
154
|
+
durationInSeconds: z.number().nullish(),
|
|
155
|
+
warnings: z.array(gatewayTranscriptionWarningSchema()).optional(),
|
|
156
|
+
providerMetadata: z
|
|
157
|
+
.record(z.string(), providerMetadataEntrySchema())
|
|
158
|
+
.optional(),
|
|
159
|
+
}),
|
|
160
|
+
),
|
|
161
|
+
);
|