@lmnr-ai/lmnr 0.8.44 → 0.8.45
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/dist/cli.cjs +23 -25
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.d.cts +1 -1
- package/dist/cli.d.mts +1 -1
- package/dist/cli.mjs +7 -8
- package/dist/cli.mjs.map +1 -1
- package/dist/{evaluations-RbBZb5yl.d.cts → evaluations-BHEE6fmA.d.cts} +17934 -8631
- package/dist/{evaluations-CVo0ms_r.d.mts → evaluations-BbIIQMLr.d.mts} +17934 -8631
- package/dist/{file-utils-1olUHMKC.mjs → file-utils-BtzEDUy6.mjs} +2 -2
- package/dist/file-utils-BtzEDUy6.mjs.map +1 -0
- package/dist/{file-utils-CMO5MuV9.cjs → file-utils-pZG20hHb.cjs} +6 -6
- package/dist/file-utils-pZG20hHb.cjs.map +1 -0
- package/dist/index.cjs +574 -435
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1533 -437
- package/dist/index.d.mts +1533 -437
- package/dist/index.mjs +287 -148
- package/dist/index.mjs.map +1 -1
- package/dist/opentelemetry-lib/instrumentation/temporal/workflow-interceptors.cjs +159 -62
- package/dist/opentelemetry-lib/instrumentation/temporal/workflow-interceptors.cjs.map +1 -1
- package/dist/opentelemetry-lib/instrumentation/temporal/workflow-interceptors.d.cts +3388 -250
- package/dist/opentelemetry-lib/instrumentation/temporal/workflow-interceptors.d.mts +3388 -250
- package/dist/opentelemetry-lib/instrumentation/temporal/workflow-interceptors.mjs +159 -62
- package/dist/opentelemetry-lib/instrumentation/temporal/workflow-interceptors.mjs.map +1 -1
- package/dist/{dist-BtB31bk1.cjs → utils-CatgN6Pb.cjs} +558 -558
- package/dist/utils-CatgN6Pb.cjs.map +1 -0
- package/dist/{dist-Cjres0a5.mjs → utils-UmlDPMxe.mjs} +552 -552
- package/dist/utils-UmlDPMxe.mjs.map +1 -0
- package/package.json +30 -30
- package/dist/dist-BtB31bk1.cjs.map +0 -1
- package/dist/dist-Cjres0a5.mjs.map +0 -1
- package/dist/file-utils-1olUHMKC.mjs.map +0 -1
- package/dist/file-utils-CMO5MuV9.cjs.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { C as __exportAll, S as TracingLevel, _ as MaskInputOptions, a as HumanEvaluator, b as SpanType, c as InitializeOptions, d as LaminarClient, f as Dataset, g as LaminarSpanContext, h as Event, i as EvaluatorFunctionReturn, l as EvaluationDataset, m as EvaluationDatapointDatasetLink, o as evaluate, p as EvaluationDatapoint, r as EvaluatorFunction, s as StringUUID, t as Datapoint, u as LaminarDataset, v as PushDatapointsResponse, x as TraceType, y as SessionRecordingOptions } from "./evaluations-
|
|
1
|
+
import { C as __exportAll, S as TracingLevel, _ as MaskInputOptions, a as HumanEvaluator, b as SpanType, c as InitializeOptions, d as LaminarClient, f as Dataset, g as LaminarSpanContext, h as Event, i as EvaluatorFunctionReturn, l as EvaluationDataset, m as EvaluationDatapointDatasetLink, o as evaluate, p as EvaluationDatapoint, r as EvaluatorFunction, s as StringUUID, t as Datapoint, u as LaminarDataset, v as PushDatapointsResponse, x as TraceType, y as SessionRecordingOptions } from "./evaluations-BHEE6fmA.cjs";
|
|
2
2
|
import { ServerResponse } from "node:http";
|
|
3
3
|
import { ReadableSpan, SpanExporter, SpanProcessor, TimedEvent } from "@opentelemetry/sdk-trace-base";
|
|
4
4
|
import { AttributeValue, Attributes, Context, Exception, HrTime, Link, Span, Span as Span$1, SpanContext, SpanKind, SpanStatus, TimeInput, Tracer, TracerProvider } from "@opentelemetry/api";
|
|
5
5
|
import { JSONSchema7, JSONSchema7 as JSONSchema7$1 } from "json-schema";
|
|
6
6
|
import { InstrumentationScope } from "@opentelemetry/core";
|
|
7
7
|
import * as z3 from "zod/v3";
|
|
8
|
-
import
|
|
9
|
-
import { z } from "zod/v4";
|
|
8
|
+
import { $ZodType } from "zod/v4/core";
|
|
10
9
|
import { ServerResponse as ServerResponse$1 } from "http";
|
|
10
|
+
import { ZodType } from "zod/v4";
|
|
11
11
|
import { Instrumentation } from "@opentelemetry/instrumentation";
|
|
12
12
|
|
|
13
13
|
//#region src/decorators.d.ts
|
|
@@ -16,7 +16,7 @@ interface ObserveOptions {
|
|
|
16
16
|
sessionId?: string;
|
|
17
17
|
userId?: string;
|
|
18
18
|
traceType?: TraceType;
|
|
19
|
-
spanType?:
|
|
19
|
+
spanType?: "DEFAULT" | "LLM" | "TOOL" | "EVALUATOR" | "EVALUATION" | "EXECUTOR";
|
|
20
20
|
input?: unknown;
|
|
21
21
|
ignoreInput?: boolean;
|
|
22
22
|
ignoreOutput?: boolean;
|
|
@@ -412,7 +412,20 @@ declare class LaminarReporter implements EvalReporter {
|
|
|
412
412
|
private resolveDatapointTrace;
|
|
413
413
|
}
|
|
414
414
|
//#endregion
|
|
415
|
-
//#region ../../node_modules/.pnpm/@ai-sdk+provider@4.0.
|
|
415
|
+
//#region ../../node_modules/.pnpm/@ai-sdk+provider@4.0.7/node_modules/@ai-sdk/provider/dist/index.d.ts
|
|
416
|
+
/**
|
|
417
|
+
* Audio format configuration shared by provider V4 model specifications.
|
|
418
|
+
*/
|
|
419
|
+
type SharedV4AudioFormat = {
|
|
420
|
+
/**
|
|
421
|
+
* Audio format type, e.g. `audio/pcm`, `audio/pcmu`, or `audio/pcma`.
|
|
422
|
+
*/
|
|
423
|
+
type: string;
|
|
424
|
+
/**
|
|
425
|
+
* Sample rate in Hz. Only applicable for formats that require a rate.
|
|
426
|
+
*/
|
|
427
|
+
rate?: number;
|
|
428
|
+
};
|
|
416
429
|
/**
|
|
417
430
|
* A mapping of provider names to provider-specific file identifiers.
|
|
418
431
|
*
|
|
@@ -715,6 +728,87 @@ type SharedV2ProviderMetadata$1 = Record<string, Record<string, JSONValue$3>>;
|
|
|
715
728
|
* ```
|
|
716
729
|
*/
|
|
717
730
|
type SharedV2ProviderOptions$1 = Record<string, Record<string, JSONValue$3>>;
|
|
731
|
+
/**
|
|
732
|
+
* Serializable error information for a batch or batch item.
|
|
733
|
+
*/
|
|
734
|
+
type BatchV4Error = {
|
|
735
|
+
readonly message: string;
|
|
736
|
+
readonly type?: string;
|
|
737
|
+
readonly code?: string;
|
|
738
|
+
readonly statusCode?: number;
|
|
739
|
+
};
|
|
740
|
+
/**
|
|
741
|
+
* Normalized lifecycle status for a batch.
|
|
742
|
+
*/
|
|
743
|
+
type BatchV4Status = {
|
|
744
|
+
readonly status: 'pending' | 'completed' | 'failed';
|
|
745
|
+
readonly rawStatus?: string;
|
|
746
|
+
readonly requestCounts?: {
|
|
747
|
+
readonly total: number;
|
|
748
|
+
readonly pending: number;
|
|
749
|
+
readonly completed: number;
|
|
750
|
+
readonly failed: number;
|
|
751
|
+
};
|
|
752
|
+
readonly error?: BatchV4Error;
|
|
753
|
+
readonly createdAt?: string;
|
|
754
|
+
readonly expiresAt?: string;
|
|
755
|
+
readonly providerMetadata?: SharedV4ProviderMetadata;
|
|
756
|
+
};
|
|
757
|
+
/**
|
|
758
|
+
* Options for starting a batch.
|
|
759
|
+
*/
|
|
760
|
+
type BatchV4StartOptions<REQUEST> = {
|
|
761
|
+
readonly requests: ReadonlyArray<REQUEST>;
|
|
762
|
+
readonly providerOptions?: SharedV4ProviderOptions;
|
|
763
|
+
readonly abortSignal?: AbortSignal;
|
|
764
|
+
readonly headers?: Record<string, string | undefined>;
|
|
765
|
+
};
|
|
766
|
+
/**
|
|
767
|
+
* Result of starting a batch.
|
|
768
|
+
*/
|
|
769
|
+
type BatchV4StartResult = BatchV4Status & {
|
|
770
|
+
readonly batchId: string;
|
|
771
|
+
readonly warnings: Array<{
|
|
772
|
+
readonly requestId?: string;
|
|
773
|
+
readonly warning: SharedV4Warning;
|
|
774
|
+
}>;
|
|
775
|
+
};
|
|
776
|
+
/**
|
|
777
|
+
* Options for a batch status or results operation.
|
|
778
|
+
*/
|
|
779
|
+
type BatchV4OperationOptions = {
|
|
780
|
+
readonly batchId: string;
|
|
781
|
+
readonly providerOptions?: SharedV4ProviderOptions;
|
|
782
|
+
readonly abortSignal?: AbortSignal;
|
|
783
|
+
readonly headers?: Record<string, string | undefined>;
|
|
784
|
+
};
|
|
785
|
+
/**
|
|
786
|
+
* A complete terminal result for one request in a batch.
|
|
787
|
+
*/
|
|
788
|
+
type BatchV4ItemResult<RESULT> = {
|
|
789
|
+
readonly id: string;
|
|
790
|
+
readonly status: 'succeeded';
|
|
791
|
+
readonly result: RESULT;
|
|
792
|
+
} | {
|
|
793
|
+
readonly id: string;
|
|
794
|
+
readonly status: 'failed';
|
|
795
|
+
readonly error: BatchV4Error;
|
|
796
|
+
readonly providerMetadata?: SharedV4ProviderMetadata;
|
|
797
|
+
} | {
|
|
798
|
+
readonly id: string;
|
|
799
|
+
readonly status: 'cancelled' | 'expired';
|
|
800
|
+
readonly error?: BatchV4Error;
|
|
801
|
+
readonly providerMetadata?: SharedV4ProviderMetadata;
|
|
802
|
+
};
|
|
803
|
+
/**
|
|
804
|
+
* Experimental structural capability for models that support durable batch
|
|
805
|
+
* processing.
|
|
806
|
+
*/
|
|
807
|
+
type BatchModelV4<REQUEST, RESULT> = {
|
|
808
|
+
experimental_doStartBatch(options: BatchV4StartOptions<REQUEST>): PromiseLike<BatchV4StartResult>;
|
|
809
|
+
experimental_doGetBatchStatus(options: BatchV4OperationOptions): PromiseLike<BatchV4Status>;
|
|
810
|
+
experimental_doGetBatchResults(options: BatchV4OperationOptions): PromiseLike<ReadableStream<BatchV4ItemResult<RESULT>>>;
|
|
811
|
+
};
|
|
718
812
|
type EmbeddingModelV4CallOptions = {
|
|
719
813
|
/**
|
|
720
814
|
* List of text values to generate embeddings for.
|
|
@@ -781,7 +875,7 @@ type EmbeddingModelV4Result = {
|
|
|
781
875
|
};
|
|
782
876
|
/**
|
|
783
877
|
* Specification for an embedding model that implements the embedding model
|
|
784
|
-
* interface version
|
|
878
|
+
* interface version 4.
|
|
785
879
|
*
|
|
786
880
|
* It is specific to text embeddings.
|
|
787
881
|
*/
|
|
@@ -1122,13 +1216,13 @@ declare class InvalidPromptError extends AISDKError {
|
|
|
1122
1216
|
});
|
|
1123
1217
|
static isInstance(error: unknown): error is InvalidPromptError;
|
|
1124
1218
|
}
|
|
1125
|
-
declare const symbol$9$
|
|
1219
|
+
declare const symbol$9$1: unique symbol;
|
|
1126
1220
|
/**
|
|
1127
1221
|
* Server returned a response with invalid data content.
|
|
1128
1222
|
* This should be thrown by providers when they cannot parse the response from the API.
|
|
1129
1223
|
*/
|
|
1130
1224
|
declare class InvalidResponseDataError extends AISDKError {
|
|
1131
|
-
private readonly [symbol$9$
|
|
1225
|
+
private readonly [symbol$9$1];
|
|
1132
1226
|
readonly data: unknown;
|
|
1133
1227
|
constructor({
|
|
1134
1228
|
data,
|
|
@@ -1139,9 +1233,9 @@ declare class InvalidResponseDataError extends AISDKError {
|
|
|
1139
1233
|
});
|
|
1140
1234
|
static isInstance(error: unknown): error is InvalidResponseDataError;
|
|
1141
1235
|
}
|
|
1142
|
-
declare const symbol$8$
|
|
1236
|
+
declare const symbol$8$1: unique symbol;
|
|
1143
1237
|
declare class JSONParseError extends AISDKError {
|
|
1144
|
-
private readonly [symbol$8$
|
|
1238
|
+
private readonly [symbol$8$1];
|
|
1145
1239
|
readonly text: string;
|
|
1146
1240
|
constructor({
|
|
1147
1241
|
text,
|
|
@@ -1152,9 +1246,9 @@ declare class JSONParseError extends AISDKError {
|
|
|
1152
1246
|
});
|
|
1153
1247
|
static isInstance(error: unknown): error is JSONParseError;
|
|
1154
1248
|
}
|
|
1155
|
-
declare const symbol$7$
|
|
1249
|
+
declare const symbol$7$1: unique symbol;
|
|
1156
1250
|
declare class LoadAPIKeyError extends AISDKError {
|
|
1157
|
-
private readonly [symbol$7$
|
|
1251
|
+
private readonly [symbol$7$1];
|
|
1158
1252
|
constructor({
|
|
1159
1253
|
message
|
|
1160
1254
|
}: {
|
|
@@ -1162,9 +1256,9 @@ declare class LoadAPIKeyError extends AISDKError {
|
|
|
1162
1256
|
});
|
|
1163
1257
|
static isInstance(error: unknown): error is LoadAPIKeyError;
|
|
1164
1258
|
}
|
|
1165
|
-
declare const symbol$6$
|
|
1259
|
+
declare const symbol$6$1: unique symbol;
|
|
1166
1260
|
declare class LoadSettingError extends AISDKError {
|
|
1167
|
-
private readonly [symbol$6$
|
|
1261
|
+
private readonly [symbol$6$1];
|
|
1168
1262
|
constructor({
|
|
1169
1263
|
message
|
|
1170
1264
|
}: {
|
|
@@ -1172,12 +1266,12 @@ declare class LoadSettingError extends AISDKError {
|
|
|
1172
1266
|
});
|
|
1173
1267
|
static isInstance(error: unknown): error is LoadSettingError;
|
|
1174
1268
|
}
|
|
1175
|
-
declare const symbol$5$
|
|
1269
|
+
declare const symbol$5$1: unique symbol;
|
|
1176
1270
|
/**
|
|
1177
1271
|
* Thrown when the AI provider fails to generate any content.
|
|
1178
1272
|
*/
|
|
1179
1273
|
declare class NoContentGeneratedError extends AISDKError {
|
|
1180
|
-
private readonly [symbol$5$
|
|
1274
|
+
private readonly [symbol$5$1];
|
|
1181
1275
|
constructor({
|
|
1182
1276
|
message
|
|
1183
1277
|
}?: {
|
|
@@ -1185,9 +1279,9 @@ declare class NoContentGeneratedError extends AISDKError {
|
|
|
1185
1279
|
});
|
|
1186
1280
|
static isInstance(error: unknown): error is NoContentGeneratedError;
|
|
1187
1281
|
}
|
|
1188
|
-
declare const symbol$4$
|
|
1282
|
+
declare const symbol$4$1: unique symbol;
|
|
1189
1283
|
declare class NoSuchModelError extends AISDKError {
|
|
1190
|
-
private readonly [symbol$4$
|
|
1284
|
+
private readonly [symbol$4$1];
|
|
1191
1285
|
readonly modelId: string;
|
|
1192
1286
|
readonly modelType: 'languageModel' | 'embeddingModel' | 'imageModel' | 'transcriptionModel' | 'speechModel' | 'rerankingModel' | 'videoModel';
|
|
1193
1287
|
constructor({
|
|
@@ -1203,13 +1297,13 @@ declare class NoSuchModelError extends AISDKError {
|
|
|
1203
1297
|
});
|
|
1204
1298
|
static isInstance(error: unknown): error is NoSuchModelError;
|
|
1205
1299
|
}
|
|
1206
|
-
declare const symbol$3$
|
|
1300
|
+
declare const symbol$3$1: unique symbol;
|
|
1207
1301
|
/**
|
|
1208
1302
|
* Thrown when a provider reference cannot be resolved because the specified
|
|
1209
1303
|
* provider is not found in the provider reference mapping.
|
|
1210
1304
|
*/
|
|
1211
1305
|
declare class NoSuchProviderReferenceError extends AISDKError {
|
|
1212
|
-
private readonly [symbol$3$
|
|
1306
|
+
private readonly [symbol$3$1];
|
|
1213
1307
|
readonly provider: string;
|
|
1214
1308
|
readonly reference: SharedV4ProviderReference;
|
|
1215
1309
|
constructor({
|
|
@@ -1223,9 +1317,9 @@ declare class NoSuchProviderReferenceError extends AISDKError {
|
|
|
1223
1317
|
});
|
|
1224
1318
|
static isInstance(error: unknown): error is NoSuchProviderReferenceError;
|
|
1225
1319
|
}
|
|
1226
|
-
declare const symbol$2$
|
|
1320
|
+
declare const symbol$2$1: unique symbol;
|
|
1227
1321
|
declare class TooManyEmbeddingValuesForCallError extends AISDKError {
|
|
1228
|
-
private readonly [symbol$2$
|
|
1322
|
+
private readonly [symbol$2$1];
|
|
1229
1323
|
readonly provider: string;
|
|
1230
1324
|
readonly modelId: string;
|
|
1231
1325
|
readonly maxEmbeddingsPerCall: number;
|
|
@@ -1238,7 +1332,7 @@ declare class TooManyEmbeddingValuesForCallError extends AISDKError {
|
|
|
1238
1332
|
});
|
|
1239
1333
|
static isInstance(error: unknown): error is TooManyEmbeddingValuesForCallError;
|
|
1240
1334
|
}
|
|
1241
|
-
declare const symbol$1$
|
|
1335
|
+
declare const symbol$1$2: unique symbol;
|
|
1242
1336
|
interface TypeValidationContext {
|
|
1243
1337
|
/**
|
|
1244
1338
|
* Field path in dot notation (e.g., "message.metadata", "message.parts[3].data")
|
|
@@ -1254,7 +1348,7 @@ interface TypeValidationContext {
|
|
|
1254
1348
|
entityId?: string;
|
|
1255
1349
|
}
|
|
1256
1350
|
declare class TypeValidationError extends AISDKError {
|
|
1257
|
-
private readonly [symbol$1$
|
|
1351
|
+
private readonly [symbol$1$2];
|
|
1258
1352
|
readonly value: unknown;
|
|
1259
1353
|
readonly context?: TypeValidationContext;
|
|
1260
1354
|
constructor({
|
|
@@ -1288,9 +1382,9 @@ declare class TypeValidationError extends AISDKError {
|
|
|
1288
1382
|
context?: TypeValidationContext;
|
|
1289
1383
|
}): TypeValidationError;
|
|
1290
1384
|
}
|
|
1291
|
-
declare const symbol$
|
|
1385
|
+
declare const symbol$10: unique symbol;
|
|
1292
1386
|
declare class UnsupportedFunctionalityError extends AISDKError {
|
|
1293
|
-
private readonly [symbol$
|
|
1387
|
+
private readonly [symbol$10];
|
|
1294
1388
|
readonly functionality: string;
|
|
1295
1389
|
constructor({
|
|
1296
1390
|
functionality,
|
|
@@ -1549,7 +1643,7 @@ type GetMaxImagesPerCallFunction$2 = (options: {
|
|
|
1549
1643
|
modelId: string;
|
|
1550
1644
|
}) => PromiseLike<number | undefined> | number | undefined;
|
|
1551
1645
|
/**
|
|
1552
|
-
* Image generation model specification version
|
|
1646
|
+
* Image generation model specification version 4.
|
|
1553
1647
|
*/
|
|
1554
1648
|
type ImageModelV4 = {
|
|
1555
1649
|
/**
|
|
@@ -4905,6 +4999,24 @@ type EmbeddingModelV4Middleware = {
|
|
|
4905
4999
|
* This type defines the structure for middleware that can be used to modify
|
|
4906
5000
|
* the behavior of EmbeddingModelV3 operations.
|
|
4907
5001
|
*/
|
|
5002
|
+
/**
|
|
5003
|
+
* A normalized language model call within a batch.
|
|
5004
|
+
*/
|
|
5005
|
+
type LanguageModelV4BatchRequest = {
|
|
5006
|
+
/**
|
|
5007
|
+
* Application-provided identifier used to correlate the request with its
|
|
5008
|
+
* result.
|
|
5009
|
+
*/
|
|
5010
|
+
readonly id: string;
|
|
5011
|
+
/**
|
|
5012
|
+
* Normalized text-generation options for the request.
|
|
5013
|
+
*/
|
|
5014
|
+
readonly options: Pick<LanguageModelV4CallOptions, 'prompt' | 'maxOutputTokens' | 'temperature' | 'stopSequences' | 'topP' | 'topK' | 'presencePenalty' | 'frequencyPenalty' | 'seed' | 'reasoning' | 'providerOptions'>;
|
|
5015
|
+
};
|
|
5016
|
+
/**
|
|
5017
|
+
* Language model V4 with durable batch-processing support.
|
|
5018
|
+
*/
|
|
5019
|
+
type BatchLanguageModelV4 = LanguageModelV4 & BatchModelV4<LanguageModelV4BatchRequest, LanguageModelV4GenerateResult>;
|
|
4908
5020
|
type RerankingModelV4CallOptions = {
|
|
4909
5021
|
/**
|
|
4910
5022
|
* Documents to rerank.
|
|
@@ -4996,7 +5108,7 @@ type RerankingModelV4Result = {
|
|
|
4996
5108
|
};
|
|
4997
5109
|
};
|
|
4998
5110
|
/**
|
|
4999
|
-
* Specification for a reranking model that implements the reranking model interface version
|
|
5111
|
+
* Specification for a reranking model that implements the reranking model interface version 4.
|
|
5000
5112
|
*/
|
|
5001
5113
|
type RerankingModelV4 = {
|
|
5002
5114
|
/**
|
|
@@ -5121,7 +5233,7 @@ type SpeechModelV4Result = {
|
|
|
5121
5233
|
providerMetadata?: Record<string, JSONObject$2>;
|
|
5122
5234
|
};
|
|
5123
5235
|
/**
|
|
5124
|
-
* Speech model specification version
|
|
5236
|
+
* Speech model specification version 4.
|
|
5125
5237
|
*/
|
|
5126
5238
|
type SpeechModelV4 = {
|
|
5127
5239
|
/**
|
|
@@ -5273,16 +5385,7 @@ type TranscriptionModelV4StreamOptions = {
|
|
|
5273
5385
|
/**
|
|
5274
5386
|
* The input audio format for the raw audio chunks.
|
|
5275
5387
|
*/
|
|
5276
|
-
inputAudioFormat:
|
|
5277
|
-
/**
|
|
5278
|
-
* Audio format type, e.g. `audio/pcm`, `audio/pcmu`, or `audio/pcma`.
|
|
5279
|
-
*/
|
|
5280
|
-
type: string;
|
|
5281
|
-
/**
|
|
5282
|
-
* Sample rate in Hz. Only applicable for formats that require a rate.
|
|
5283
|
-
*/
|
|
5284
|
-
rate?: number;
|
|
5285
|
-
};
|
|
5388
|
+
inputAudioFormat: SharedV4AudioFormat;
|
|
5286
5389
|
/**
|
|
5287
5390
|
* Additional provider-specific options that are passed through to the provider.
|
|
5288
5391
|
*
|
|
@@ -5416,7 +5519,7 @@ type TranscriptionModelV4StreamResult = {
|
|
|
5416
5519
|
};
|
|
5417
5520
|
};
|
|
5418
5521
|
/**
|
|
5419
|
-
* Transcription model specification version
|
|
5522
|
+
* Transcription model specification version 4.
|
|
5420
5523
|
*/
|
|
5421
5524
|
type TranscriptionModelV4 = {
|
|
5422
5525
|
/**
|
|
@@ -6436,16 +6539,7 @@ type RealtimeModelV4SessionConfig = {
|
|
|
6436
6539
|
/**
|
|
6437
6540
|
* Audio format configuration for input audio.
|
|
6438
6541
|
*/
|
|
6439
|
-
inputAudioFormat?:
|
|
6440
|
-
/**
|
|
6441
|
-
* Audio format type (e.g. "audio/pcm", "audio/pcmu", "audio/pcma").
|
|
6442
|
-
*/
|
|
6443
|
-
type: string;
|
|
6444
|
-
/**
|
|
6445
|
-
* Sample rate in Hz. Only applicable for PCM format.
|
|
6446
|
-
*/
|
|
6447
|
-
rate?: number;
|
|
6448
|
-
};
|
|
6542
|
+
inputAudioFormat?: SharedV4AudioFormat;
|
|
6449
6543
|
/**
|
|
6450
6544
|
* Input audio transcription configuration.
|
|
6451
6545
|
*
|
|
@@ -6492,16 +6586,7 @@ type RealtimeModelV4SessionConfig = {
|
|
|
6492
6586
|
/**
|
|
6493
6587
|
* Audio format configuration for output audio.
|
|
6494
6588
|
*/
|
|
6495
|
-
outputAudioFormat?:
|
|
6496
|
-
/**
|
|
6497
|
-
* Audio format type (e.g. "audio/pcm", "audio/pcmu", "audio/pcma").
|
|
6498
|
-
*/
|
|
6499
|
-
type: string;
|
|
6500
|
-
/**
|
|
6501
|
-
* Sample rate in Hz. Only applicable for PCM format.
|
|
6502
|
-
*/
|
|
6503
|
-
rate?: number;
|
|
6504
|
-
};
|
|
6589
|
+
outputAudioFormat?: SharedV4AudioFormat;
|
|
6505
6590
|
/**
|
|
6506
6591
|
* Voice activity detection configuration.
|
|
6507
6592
|
* Set to null or type 'disabled' to turn off VAD (push-to-talk mode).
|
|
@@ -6891,166 +6976,448 @@ interface RealtimeFactoryV4 {
|
|
|
6891
6976
|
(modelId: string): RealtimeModelV4;
|
|
6892
6977
|
getToken(options: RealtimeFactoryV4GetTokenOptions): Promise<RealtimeFactoryV4GetTokenResult>;
|
|
6893
6978
|
}
|
|
6979
|
+
type SpeechTranslationModelV4ProviderOptions = Record<string, JSONObject$2>;
|
|
6894
6980
|
/**
|
|
6895
|
-
*
|
|
6896
|
-
* Supports both image inputs (for image-to-video) and video inputs (for editing).
|
|
6981
|
+
* Options for a speech translation model stream call.
|
|
6897
6982
|
*/
|
|
6898
|
-
type
|
|
6899
|
-
type: 'file';
|
|
6983
|
+
type SpeechTranslationModelV4StreamOptions = {
|
|
6900
6984
|
/**
|
|
6901
|
-
*
|
|
6902
|
-
*
|
|
6903
|
-
*
|
|
6985
|
+
* Source audio chunks to transform.
|
|
6986
|
+
*
|
|
6987
|
+
* `Uint8Array` chunks contain raw audio bytes. `string` chunks contain
|
|
6988
|
+
* base64-encoded raw audio bytes.
|
|
6904
6989
|
*/
|
|
6905
|
-
|
|
6990
|
+
audio: ReadableStream<Uint8Array | string>;
|
|
6906
6991
|
/**
|
|
6907
|
-
*
|
|
6992
|
+
* The input audio format for the raw audio chunks.
|
|
6908
6993
|
*/
|
|
6909
|
-
|
|
6994
|
+
inputAudioFormat: SharedV4AudioFormat;
|
|
6910
6995
|
/**
|
|
6911
|
-
*
|
|
6996
|
+
* The language to produce output audio and text in, as a BCP-47-style
|
|
6997
|
+
* language tag (e.g. `en`, `es`, `fr-CA`). Supported values are
|
|
6998
|
+
* provider-specific and validated by the provider.
|
|
6912
6999
|
*/
|
|
6913
|
-
|
|
6914
|
-
} | {
|
|
6915
|
-
type: 'url';
|
|
7000
|
+
targetLanguage: string;
|
|
6916
7001
|
/**
|
|
6917
|
-
* The
|
|
7002
|
+
* The language of the source audio, as a BCP-47-style language tag.
|
|
7003
|
+
* When absent, providers should auto-detect the source language.
|
|
6918
7004
|
*/
|
|
6919
|
-
|
|
7005
|
+
sourceLanguage?: string;
|
|
6920
7006
|
/**
|
|
6921
|
-
*
|
|
7007
|
+
* The desired audio format for output audio chunks.
|
|
7008
|
+
* When absent, the provider default output format is used.
|
|
6922
7009
|
*/
|
|
6923
|
-
|
|
7010
|
+
outputAudioFormat?: SharedV4AudioFormat;
|
|
7011
|
+
/**
|
|
7012
|
+
* Additional provider-specific options that are passed through to the provider.
|
|
7013
|
+
*
|
|
7014
|
+
* The outer record is keyed by the provider name, and the inner record is keyed
|
|
7015
|
+
* by provider-specific option names.
|
|
7016
|
+
*/
|
|
7017
|
+
providerOptions?: SpeechTranslationModelV4ProviderOptions;
|
|
7018
|
+
/**
|
|
7019
|
+
* Abort signal for cancelling the operation.
|
|
7020
|
+
*/
|
|
7021
|
+
abortSignal?: AbortSignal;
|
|
7022
|
+
/**
|
|
7023
|
+
* Additional HTTP headers to be sent with the request.
|
|
7024
|
+
* Only applicable for HTTP/WebSocket-based providers that support headers.
|
|
7025
|
+
*/
|
|
7026
|
+
headers?: Record<string, string | undefined>;
|
|
7027
|
+
/**
|
|
7028
|
+
* When true, providers should include raw provider chunks in the stream.
|
|
7029
|
+
*/
|
|
7030
|
+
includeRawChunks?: boolean;
|
|
6924
7031
|
};
|
|
6925
7032
|
/**
|
|
6926
|
-
*
|
|
7033
|
+
* Usage information for a speech translation call.
|
|
6927
7034
|
*
|
|
6928
|
-
*
|
|
6929
|
-
*
|
|
6930
|
-
*/
|
|
6931
|
-
type VideoModelV4FrameType = 'first_frame' | 'last_frame';
|
|
6932
|
-
/**
|
|
6933
|
-
* A role-tagged image input for image-to-video and first-last-frame generation.
|
|
7035
|
+
* All fields are optional because providers report usage with different
|
|
7036
|
+
* granularity (seconds of audio, audio tokens, and/or text tokens).
|
|
6934
7037
|
*/
|
|
6935
|
-
type
|
|
7038
|
+
type SpeechTranslationModelV4Usage = {
|
|
6936
7039
|
/**
|
|
6937
|
-
*
|
|
7040
|
+
* Seconds of input audio that were processed, if reported.
|
|
6938
7041
|
*/
|
|
6939
|
-
|
|
7042
|
+
inputAudioSeconds?: number;
|
|
6940
7043
|
/**
|
|
6941
|
-
*
|
|
7044
|
+
* Number of input audio tokens, if reported.
|
|
6942
7045
|
*/
|
|
6943
|
-
|
|
6944
|
-
};
|
|
6945
|
-
type VideoModelV4CallOptions = {
|
|
7046
|
+
inputAudioTokens?: number;
|
|
6946
7047
|
/**
|
|
6947
|
-
*
|
|
7048
|
+
* Number of output audio tokens, if reported.
|
|
6948
7049
|
*/
|
|
6949
|
-
|
|
7050
|
+
outputAudioTokens?: number;
|
|
6950
7051
|
/**
|
|
6951
|
-
* Number of
|
|
6952
|
-
* Most video models only support n=1 due to computational cost.
|
|
7052
|
+
* Number of input text tokens, if reported.
|
|
6953
7053
|
*/
|
|
6954
|
-
|
|
7054
|
+
inputTextTokens?: number;
|
|
6955
7055
|
/**
|
|
6956
|
-
*
|
|
6957
|
-
* Must have the format `{width}:{height}`.
|
|
6958
|
-
* `undefined` will use the provider's default aspect ratio.
|
|
6959
|
-
* Common values: '16:9', '9:16', '1:1', '21:9', '4:3'
|
|
7056
|
+
* Number of output text tokens, if reported.
|
|
6960
7057
|
*/
|
|
6961
|
-
|
|
7058
|
+
outputTextTokens?: number;
|
|
7059
|
+
};
|
|
7060
|
+
type SpeechTranslationModelV4StreamPart = {
|
|
6962
7061
|
/**
|
|
6963
|
-
*
|
|
6964
|
-
* Format: `{width}x{height}` (e.g., '1280x720', '1920x1080')
|
|
6965
|
-
* `undefined` will use the provider's default resolution.
|
|
7062
|
+
* Stream start event with warnings for the call, e.g. unsupported settings.
|
|
6966
7063
|
*/
|
|
6967
|
-
|
|
7064
|
+
type: 'stream-start';
|
|
7065
|
+
warnings: Array<SharedV4Warning>;
|
|
7066
|
+
} | {
|
|
6968
7067
|
/**
|
|
6969
|
-
*
|
|
6970
|
-
*
|
|
6971
|
-
*
|
|
7068
|
+
* Output audio chunk.
|
|
7069
|
+
*
|
|
7070
|
+
* `Uint8Array` chunks contain raw audio bytes. `string` chunks contain
|
|
7071
|
+
* base64-encoded raw audio bytes.
|
|
6972
7072
|
*/
|
|
6973
|
-
|
|
7073
|
+
type: 'audio';
|
|
7074
|
+
id?: string;
|
|
7075
|
+
audio: Uint8Array | string;
|
|
7076
|
+
providerMetadata?: SharedV4ProviderMetadata;
|
|
7077
|
+
} | {
|
|
6974
7078
|
/**
|
|
6975
|
-
*
|
|
6976
|
-
*
|
|
6977
|
-
*
|
|
7079
|
+
* Append-only output text delta.
|
|
7080
|
+
*
|
|
7081
|
+
* Output text is append-only: providers stream `output-text-delta`
|
|
7082
|
+
* parts and finalize per-utterance with `output-text-final`. There is
|
|
7083
|
+
* no partial/revision part for output text by design for now.
|
|
6978
7084
|
*/
|
|
6979
|
-
|
|
7085
|
+
type: 'output-text-delta';
|
|
7086
|
+
id?: string;
|
|
7087
|
+
delta: string;
|
|
7088
|
+
providerMetadata?: SharedV4ProviderMetadata;
|
|
7089
|
+
} | {
|
|
6980
7090
|
/**
|
|
6981
|
-
*
|
|
6982
|
-
*
|
|
7091
|
+
* Final output text for a provider-defined segment or utterance.
|
|
7092
|
+
*
|
|
7093
|
+
* Output text is append-only: providers stream `output-text-delta`
|
|
7094
|
+
* parts and finalize per-utterance with `output-text-final`. There is
|
|
7095
|
+
* no partial/revision part for output text by design for now.
|
|
6983
7096
|
*/
|
|
6984
|
-
|
|
7097
|
+
type: 'output-text-final';
|
|
7098
|
+
id?: string;
|
|
7099
|
+
text: string;
|
|
7100
|
+
providerMetadata?: SharedV4ProviderMetadata;
|
|
7101
|
+
} | {
|
|
6985
7102
|
/**
|
|
6986
|
-
*
|
|
6987
|
-
* The image serves as the starting frame that the model will animate.
|
|
7103
|
+
* Append-only source transcript delta.
|
|
6988
7104
|
*/
|
|
6989
|
-
|
|
7105
|
+
type: 'source-transcript-delta';
|
|
7106
|
+
id?: string;
|
|
7107
|
+
delta: string;
|
|
7108
|
+
providerMetadata?: SharedV4ProviderMetadata;
|
|
7109
|
+
} | {
|
|
6990
7110
|
/**
|
|
6991
|
-
*
|
|
6992
|
-
* Each entry declares whether it is the `first_frame` or the
|
|
6993
|
-
* `last_frame` of the generated video.
|
|
7111
|
+
* Non-final source transcript text. The text may be revised by later parts.
|
|
6994
7112
|
*/
|
|
6995
|
-
|
|
7113
|
+
type: 'source-transcript-partial';
|
|
7114
|
+
id?: string;
|
|
7115
|
+
text: string;
|
|
7116
|
+
startSecond?: number;
|
|
7117
|
+
endSecond?: number;
|
|
7118
|
+
channelIndex?: number;
|
|
7119
|
+
providerMetadata?: SharedV4ProviderMetadata;
|
|
7120
|
+
} | {
|
|
6996
7121
|
/**
|
|
6997
|
-
*
|
|
7122
|
+
* Final source transcript text for a provider-defined segment or utterance.
|
|
6998
7123
|
*/
|
|
6999
|
-
|
|
7124
|
+
type: 'source-transcript-final';
|
|
7125
|
+
id?: string;
|
|
7126
|
+
text: string;
|
|
7127
|
+
startSecond?: number;
|
|
7128
|
+
endSecond?: number;
|
|
7129
|
+
channelIndex?: number;
|
|
7130
|
+
providerMetadata?: SharedV4ProviderMetadata;
|
|
7131
|
+
} | {
|
|
7000
7132
|
/**
|
|
7001
|
-
*
|
|
7133
|
+
* Metadata for the response, emitted once available.
|
|
7002
7134
|
*/
|
|
7003
|
-
|
|
7135
|
+
type: 'response-metadata';
|
|
7136
|
+
timestamp?: Date;
|
|
7137
|
+
modelId?: string;
|
|
7138
|
+
headers?: SharedV4Headers;
|
|
7139
|
+
body?: unknown;
|
|
7140
|
+
} | {
|
|
7004
7141
|
/**
|
|
7005
|
-
*
|
|
7006
|
-
* as body parameters.
|
|
7007
|
-
*
|
|
7008
|
-
* Example:
|
|
7009
|
-
* {
|
|
7010
|
-
* "fal": {
|
|
7011
|
-
* "loop": true,
|
|
7012
|
-
* "motionStrength": 0.8
|
|
7013
|
-
* }
|
|
7014
|
-
* }
|
|
7142
|
+
* Metadata that is available after the stream is finished.
|
|
7015
7143
|
*/
|
|
7016
|
-
|
|
7144
|
+
type: 'finish';
|
|
7017
7145
|
/**
|
|
7018
|
-
*
|
|
7146
|
+
* The final source-language transcript of the input audio.
|
|
7019
7147
|
*/
|
|
7020
|
-
|
|
7148
|
+
sourceText: string;
|
|
7021
7149
|
/**
|
|
7022
|
-
*
|
|
7023
|
-
*
|
|
7150
|
+
* The final output text. May be an empty string for providers that
|
|
7151
|
+
* produce only audio output.
|
|
7024
7152
|
*/
|
|
7025
|
-
|
|
7026
|
-
};
|
|
7027
|
-
/**
|
|
7028
|
-
* Generated video data. Can be a URL, base64-encoded string, or binary data.
|
|
7029
|
-
*/
|
|
7030
|
-
type VideoModelV4VideoData = {
|
|
7153
|
+
outputText: string;
|
|
7031
7154
|
/**
|
|
7032
|
-
*
|
|
7155
|
+
* The duration of the source audio in seconds, if available.
|
|
7033
7156
|
*/
|
|
7034
|
-
|
|
7035
|
-
|
|
7036
|
-
|
|
7157
|
+
durationInSeconds?: number;
|
|
7158
|
+
/**
|
|
7159
|
+
* Usage information for the call, if reported by the provider.
|
|
7160
|
+
*/
|
|
7161
|
+
usage?: SpeechTranslationModelV4Usage;
|
|
7162
|
+
/**
|
|
7163
|
+
* Additional provider-specific metadata.
|
|
7164
|
+
*/
|
|
7165
|
+
providerMetadata?: Record<string, JSONObject$2>;
|
|
7037
7166
|
} | {
|
|
7038
7167
|
/**
|
|
7039
|
-
*
|
|
7168
|
+
* Raw provider chunks if enabled.
|
|
7040
7169
|
*/
|
|
7041
|
-
type: '
|
|
7042
|
-
|
|
7043
|
-
mediaType: string;
|
|
7170
|
+
type: 'raw';
|
|
7171
|
+
rawValue: unknown;
|
|
7044
7172
|
} | {
|
|
7045
7173
|
/**
|
|
7046
|
-
*
|
|
7174
|
+
* Error parts are streamed, allowing for multiple errors.
|
|
7047
7175
|
*/
|
|
7048
|
-
type: '
|
|
7049
|
-
|
|
7050
|
-
mediaType: string;
|
|
7176
|
+
type: 'error';
|
|
7177
|
+
error: unknown;
|
|
7051
7178
|
};
|
|
7052
7179
|
/**
|
|
7053
|
-
* The result of a
|
|
7180
|
+
* The result of a speech translation model doStream call.
|
|
7181
|
+
*/
|
|
7182
|
+
type SpeechTranslationModelV4StreamResult = {
|
|
7183
|
+
/**
|
|
7184
|
+
* The stream.
|
|
7185
|
+
*/
|
|
7186
|
+
stream: ReadableStream<SpeechTranslationModelV4StreamPart>;
|
|
7187
|
+
/**
|
|
7188
|
+
* Optional request information for telemetry and debugging purposes.
|
|
7189
|
+
*/
|
|
7190
|
+
request?: {
|
|
7191
|
+
/**
|
|
7192
|
+
* Request body or setup payload that was sent to the provider API.
|
|
7193
|
+
*/
|
|
7194
|
+
body?: unknown;
|
|
7195
|
+
};
|
|
7196
|
+
/**
|
|
7197
|
+
* Optional response data.
|
|
7198
|
+
*/
|
|
7199
|
+
response?: {
|
|
7200
|
+
/**
|
|
7201
|
+
* Timestamp for the start of the streamed response.
|
|
7202
|
+
*/
|
|
7203
|
+
timestamp?: Date;
|
|
7204
|
+
/**
|
|
7205
|
+
* The ID of the response model that was used to generate the response.
|
|
7206
|
+
*/
|
|
7207
|
+
modelId?: string;
|
|
7208
|
+
/**
|
|
7209
|
+
* Response headers.
|
|
7210
|
+
*/
|
|
7211
|
+
headers?: SharedV4Headers;
|
|
7212
|
+
/**
|
|
7213
|
+
* Response body.
|
|
7214
|
+
*/
|
|
7215
|
+
body?: unknown;
|
|
7216
|
+
};
|
|
7217
|
+
};
|
|
7218
|
+
/**
|
|
7219
|
+
* Speech translation model specification version 4.
|
|
7220
|
+
*
|
|
7221
|
+
* Speech translation is a streaming-only modality: models translate live
|
|
7222
|
+
* source audio into target-language audio and text.
|
|
7223
|
+
*
|
|
7224
|
+
* Experimental: the speech translation model contract may change in patch
|
|
7225
|
+
* releases while the functions built on it are experimental. All types of
|
|
7226
|
+
* this modality are exported with `Experimental_` prefixes for this reason.
|
|
7227
|
+
*/
|
|
7228
|
+
type SpeechTranslationModelV4 = {
|
|
7229
|
+
/**
|
|
7230
|
+
* The speech translation model must specify which speech translation model
|
|
7231
|
+
* interface version it implements. This will allow us to evolve the
|
|
7232
|
+
* speech translation model interface and retain backwards compatibility.
|
|
7233
|
+
* The different implementation versions can be handled as a discriminated
|
|
7234
|
+
* union on our side.
|
|
7235
|
+
*/
|
|
7236
|
+
readonly specificationVersion: 'v4';
|
|
7237
|
+
/**
|
|
7238
|
+
* Name of the provider for logging purposes.
|
|
7239
|
+
*/
|
|
7240
|
+
readonly provider: string;
|
|
7241
|
+
/**
|
|
7242
|
+
* Provider-specific model ID for logging purposes.
|
|
7243
|
+
*/
|
|
7244
|
+
readonly modelId: string;
|
|
7245
|
+
/**
|
|
7246
|
+
* Streams a speech translation for live audio.
|
|
7247
|
+
*/
|
|
7248
|
+
doStream(options: SpeechTranslationModelV4StreamOptions): PromiseLike<SpeechTranslationModelV4StreamResult>;
|
|
7249
|
+
};
|
|
7250
|
+
/**
|
|
7251
|
+
* A video or image file that can be used for video editing or image-to-video generation.
|
|
7252
|
+
* Supports both image inputs (for image-to-video) and video inputs (for editing).
|
|
7253
|
+
*/
|
|
7254
|
+
type VideoModelV4File = {
|
|
7255
|
+
type: 'file';
|
|
7256
|
+
/**
|
|
7257
|
+
* The IANA media type of the file.
|
|
7258
|
+
* Video types: 'video/mp4', 'video/webm', 'video/quicktime'
|
|
7259
|
+
* Image types: 'image/png', 'image/jpeg', 'image/webp'
|
|
7260
|
+
*/
|
|
7261
|
+
mediaType: string;
|
|
7262
|
+
/**
|
|
7263
|
+
* File data as base64 encoded string or binary data.
|
|
7264
|
+
*/
|
|
7265
|
+
data: string | Uint8Array;
|
|
7266
|
+
/**
|
|
7267
|
+
* Optional provider-specific metadata for the file part.
|
|
7268
|
+
*/
|
|
7269
|
+
providerOptions?: SharedV4ProviderMetadata;
|
|
7270
|
+
} | {
|
|
7271
|
+
type: 'url';
|
|
7272
|
+
/**
|
|
7273
|
+
* The URL of the video or image file.
|
|
7274
|
+
*/
|
|
7275
|
+
url: string;
|
|
7276
|
+
/**
|
|
7277
|
+
* The media type of the referenced file, when known.
|
|
7278
|
+
* Video types: 'video/mp4', 'video/webm', 'video/quicktime'
|
|
7279
|
+
* Image types: 'image/png', 'image/jpeg', 'image/webp'
|
|
7280
|
+
*/
|
|
7281
|
+
mediaType?: string;
|
|
7282
|
+
/**
|
|
7283
|
+
* Optional provider-specific metadata for the file part.
|
|
7284
|
+
*/
|
|
7285
|
+
providerOptions?: SharedV4ProviderMetadata;
|
|
7286
|
+
};
|
|
7287
|
+
/**
|
|
7288
|
+
* The role a frame image plays in video generation.
|
|
7289
|
+
*
|
|
7290
|
+
* - `first_frame`: the starting frame the model animates from
|
|
7291
|
+
* - `last_frame`: the ending frame the model animates towards
|
|
7292
|
+
*/
|
|
7293
|
+
type VideoModelV4FrameType = 'first_frame' | 'last_frame';
|
|
7294
|
+
/**
|
|
7295
|
+
* A role-tagged image input for image-to-video and first-last-frame generation.
|
|
7296
|
+
*/
|
|
7297
|
+
type VideoModelV4FrameImage = {
|
|
7298
|
+
/**
|
|
7299
|
+
* The image file used for this frame.
|
|
7300
|
+
*/
|
|
7301
|
+
image: VideoModelV4File;
|
|
7302
|
+
/**
|
|
7303
|
+
* Which frame this image represents.
|
|
7304
|
+
*/
|
|
7305
|
+
frameType: VideoModelV4FrameType;
|
|
7306
|
+
};
|
|
7307
|
+
type VideoModelV4CallOptions = {
|
|
7308
|
+
/**
|
|
7309
|
+
* Text prompt for the video generation.
|
|
7310
|
+
*/
|
|
7311
|
+
prompt: string | undefined;
|
|
7312
|
+
/**
|
|
7313
|
+
* Number of videos to generate. Default: 1.
|
|
7314
|
+
* Most video models only support n=1 due to computational cost.
|
|
7315
|
+
*/
|
|
7316
|
+
n: number;
|
|
7317
|
+
/**
|
|
7318
|
+
* Aspect ratio of the videos to generate.
|
|
7319
|
+
* Must have the format `{width}:{height}`, or `'adaptive'` to inherit the
|
|
7320
|
+
* ratio from the input media.
|
|
7321
|
+
* `undefined` will use the provider's default aspect ratio.
|
|
7322
|
+
* Common values: '16:9', '9:16', '1:1', '21:9', '4:3'
|
|
7323
|
+
*/
|
|
7324
|
+
aspectRatio: `${number}:${number}` | 'adaptive' | undefined;
|
|
7325
|
+
/**
|
|
7326
|
+
* Resolution of the video to generate.
|
|
7327
|
+
* Format: `{width}x{height}` (e.g., '1280x720', '1920x1080')
|
|
7328
|
+
* `undefined` will use the provider's default resolution.
|
|
7329
|
+
*/
|
|
7330
|
+
resolution: `${number}x${number}` | undefined;
|
|
7331
|
+
/**
|
|
7332
|
+
* Duration of the video in seconds.
|
|
7333
|
+
* `undefined` will use the provider's default duration.
|
|
7334
|
+
* Typically 3-10 seconds for most models.
|
|
7335
|
+
*/
|
|
7336
|
+
duration: number | undefined;
|
|
7337
|
+
/**
|
|
7338
|
+
* Frames per second (FPS) for the video.
|
|
7339
|
+
* `undefined` will use the provider's default FPS.
|
|
7340
|
+
* Common values: 24, 30, 60
|
|
7341
|
+
*/
|
|
7342
|
+
fps: number | undefined;
|
|
7343
|
+
/**
|
|
7344
|
+
* Seed for deterministic video generation.
|
|
7345
|
+
* `undefined` will use a random seed.
|
|
7346
|
+
*/
|
|
7347
|
+
seed: number | undefined;
|
|
7348
|
+
/**
|
|
7349
|
+
* Input image for image-to-video generation.
|
|
7350
|
+
* The image serves as the starting frame that the model will animate.
|
|
7351
|
+
*/
|
|
7352
|
+
image: VideoModelV4File | undefined;
|
|
7353
|
+
/**
|
|
7354
|
+
* Role-tagged image inputs for first-last-frame generation.
|
|
7355
|
+
* Each entry declares whether it is the `first_frame` or the
|
|
7356
|
+
* `last_frame` of the generated video.
|
|
7357
|
+
*/
|
|
7358
|
+
frameImages: Array<VideoModelV4FrameImage> | undefined;
|
|
7359
|
+
/**
|
|
7360
|
+
* Reference inputs for reference-to-video generation.
|
|
7361
|
+
*
|
|
7362
|
+
* Each entry is an image or video file. Providers route each reference by
|
|
7363
|
+
* its media type (image vs. video) and warn when a reference kind is
|
|
7364
|
+
* unsupported.
|
|
7365
|
+
*/
|
|
7366
|
+
inputReferences: Array<VideoModelV4File> | undefined;
|
|
7367
|
+
/**
|
|
7368
|
+
* Whether the model should generate audio alongside the video.
|
|
7369
|
+
*/
|
|
7370
|
+
generateAudio: boolean | undefined;
|
|
7371
|
+
/**
|
|
7372
|
+
* Additional provider-specific options that are passed through to the provider
|
|
7373
|
+
* as body parameters.
|
|
7374
|
+
*
|
|
7375
|
+
* Example:
|
|
7376
|
+
* {
|
|
7377
|
+
* "fal": {
|
|
7378
|
+
* "loop": true,
|
|
7379
|
+
* "motionStrength": 0.8
|
|
7380
|
+
* }
|
|
7381
|
+
* }
|
|
7382
|
+
*/
|
|
7383
|
+
providerOptions: SharedV4ProviderOptions;
|
|
7384
|
+
/**
|
|
7385
|
+
* Abort signal for cancelling the operation.
|
|
7386
|
+
*/
|
|
7387
|
+
abortSignal?: AbortSignal;
|
|
7388
|
+
/**
|
|
7389
|
+
* Additional HTTP headers to be sent with the request.
|
|
7390
|
+
* Only applicable for HTTP-based providers.
|
|
7391
|
+
*/
|
|
7392
|
+
headers?: Record<string, string | undefined>;
|
|
7393
|
+
};
|
|
7394
|
+
/**
|
|
7395
|
+
* Generated video data. Can be a URL, base64-encoded string, or binary data.
|
|
7396
|
+
*/
|
|
7397
|
+
type VideoModelV4VideoData = {
|
|
7398
|
+
/**
|
|
7399
|
+
* Video available as a URL (most common for video providers).
|
|
7400
|
+
*/
|
|
7401
|
+
type: 'url';
|
|
7402
|
+
url: string;
|
|
7403
|
+
mediaType: string;
|
|
7404
|
+
} | {
|
|
7405
|
+
/**
|
|
7406
|
+
* Video as base64-encoded string.
|
|
7407
|
+
*/
|
|
7408
|
+
type: 'base64';
|
|
7409
|
+
data: string;
|
|
7410
|
+
mediaType: string;
|
|
7411
|
+
} | {
|
|
7412
|
+
/**
|
|
7413
|
+
* Video as binary data.
|
|
7414
|
+
*/
|
|
7415
|
+
type: 'binary';
|
|
7416
|
+
data: Uint8Array;
|
|
7417
|
+
mediaType: string;
|
|
7418
|
+
};
|
|
7419
|
+
/**
|
|
7420
|
+
* The result of a video model doGenerate call.
|
|
7054
7421
|
*/
|
|
7055
7422
|
type VideoModelV4Result = {
|
|
7056
7423
|
/**
|
|
@@ -7104,11 +7471,127 @@ type VideoModelV4Result = {
|
|
|
7104
7471
|
headers: Record<string, string> | undefined;
|
|
7105
7472
|
};
|
|
7106
7473
|
};
|
|
7474
|
+
/**
|
|
7475
|
+
* Result returned by `doStart` when initiating an asynchronous video generation.
|
|
7476
|
+
*/
|
|
7477
|
+
type VideoModelV4OperationStartResult = {
|
|
7478
|
+
/**
|
|
7479
|
+
* JSON-serializable opaque reference passed to `doStatus` to check the
|
|
7480
|
+
* status of the generation (e.g., a task ID or prediction URL).
|
|
7481
|
+
*/
|
|
7482
|
+
operation: JSONValue$3;
|
|
7483
|
+
/**
|
|
7484
|
+
* Warnings for the call, e.g. unsupported features.
|
|
7485
|
+
*/
|
|
7486
|
+
warnings: Array<SharedV4Warning>;
|
|
7487
|
+
/**
|
|
7488
|
+
* Additional provider-specific metadata.
|
|
7489
|
+
*/
|
|
7490
|
+
providerMetadata?: SharedV4ProviderMetadata;
|
|
7491
|
+
/**
|
|
7492
|
+
* Response information for telemetry and debugging purposes.
|
|
7493
|
+
*/
|
|
7494
|
+
response: {
|
|
7495
|
+
/**
|
|
7496
|
+
* Timestamp for the start of the response.
|
|
7497
|
+
*/
|
|
7498
|
+
timestamp: Date;
|
|
7499
|
+
/**
|
|
7500
|
+
* The ID of the response model that was used.
|
|
7501
|
+
*/
|
|
7502
|
+
modelId: string;
|
|
7503
|
+
/**
|
|
7504
|
+
* Response headers.
|
|
7505
|
+
*/
|
|
7506
|
+
headers: Record<string, string> | undefined;
|
|
7507
|
+
};
|
|
7508
|
+
};
|
|
7509
|
+
/**
|
|
7510
|
+
* Result returned by `doStatus` when checking the status of an
|
|
7511
|
+
* asynchronous video generation.
|
|
7512
|
+
*/
|
|
7513
|
+
type VideoModelV4OperationStatusResult = {
|
|
7514
|
+
/**
|
|
7515
|
+
* The video generation is still in progress.
|
|
7516
|
+
*/
|
|
7517
|
+
status: 'pending';
|
|
7518
|
+
/**
|
|
7519
|
+
* Warnings for the call.
|
|
7520
|
+
*/
|
|
7521
|
+
warnings?: Array<SharedV4Warning>;
|
|
7522
|
+
/**
|
|
7523
|
+
* Additional provider-specific metadata.
|
|
7524
|
+
*/
|
|
7525
|
+
providerMetadata?: SharedV4ProviderMetadata;
|
|
7526
|
+
/**
|
|
7527
|
+
* Response information for telemetry and debugging purposes.
|
|
7528
|
+
*/
|
|
7529
|
+
response: {
|
|
7530
|
+
timestamp: Date;
|
|
7531
|
+
modelId: string;
|
|
7532
|
+
headers: Record<string, string> | undefined;
|
|
7533
|
+
};
|
|
7534
|
+
} | {
|
|
7535
|
+
/**
|
|
7536
|
+
* The video generation is complete.
|
|
7537
|
+
*/
|
|
7538
|
+
status: 'completed';
|
|
7539
|
+
/**
|
|
7540
|
+
* Generated videos.
|
|
7541
|
+
*/
|
|
7542
|
+
videos: Array<VideoModelV4VideoData>;
|
|
7543
|
+
/**
|
|
7544
|
+
* Warnings for the call.
|
|
7545
|
+
*/
|
|
7546
|
+
warnings: Array<SharedV4Warning>;
|
|
7547
|
+
/**
|
|
7548
|
+
* Additional provider-specific metadata.
|
|
7549
|
+
*/
|
|
7550
|
+
providerMetadata?: SharedV4ProviderMetadata;
|
|
7551
|
+
/**
|
|
7552
|
+
* Response information for telemetry and debugging purposes.
|
|
7553
|
+
*/
|
|
7554
|
+
response: {
|
|
7555
|
+
timestamp: Date;
|
|
7556
|
+
modelId: string;
|
|
7557
|
+
headers: Record<string, string> | undefined;
|
|
7558
|
+
};
|
|
7559
|
+
} | {
|
|
7560
|
+
/**
|
|
7561
|
+
* The video generation failed.
|
|
7562
|
+
*/
|
|
7563
|
+
status: 'error';
|
|
7564
|
+
/**
|
|
7565
|
+
* A human-readable error message describing why the generation failed.
|
|
7566
|
+
*/
|
|
7567
|
+
error: string;
|
|
7568
|
+
/**
|
|
7569
|
+
* Additional provider-specific metadata.
|
|
7570
|
+
*/
|
|
7571
|
+
providerMetadata?: SharedV4ProviderMetadata;
|
|
7572
|
+
/**
|
|
7573
|
+
* Response information for telemetry and debugging purposes.
|
|
7574
|
+
*/
|
|
7575
|
+
response: {
|
|
7576
|
+
timestamp: Date;
|
|
7577
|
+
modelId: string;
|
|
7578
|
+
headers: Record<string, string> | undefined;
|
|
7579
|
+
};
|
|
7580
|
+
};
|
|
7581
|
+
/**
|
|
7582
|
+
* Data received from a webhook notification during asynchronous video
|
|
7583
|
+
* generation. Generic over the body type so providers/consumers can
|
|
7584
|
+
* narrow it to a specific shape.
|
|
7585
|
+
*/
|
|
7586
|
+
type VideoModelV4OperationWebhook<TBody = JSONValue$3> = {
|
|
7587
|
+
headers: Record<string, string>;
|
|
7588
|
+
body: TBody;
|
|
7589
|
+
};
|
|
7107
7590
|
type GetMaxVideosPerCallFunction$1 = (options: {
|
|
7108
7591
|
modelId: string;
|
|
7109
7592
|
}) => PromiseLike<number | undefined> | number | undefined;
|
|
7110
7593
|
/**
|
|
7111
|
-
* Video generation model specification version
|
|
7594
|
+
* Video generation model specification version 4.
|
|
7112
7595
|
*/
|
|
7113
7596
|
type VideoModelV4 = {
|
|
7114
7597
|
/**
|
|
@@ -7139,8 +7622,80 @@ type VideoModelV4 = {
|
|
|
7139
7622
|
readonly maxVideosPerCall: number | undefined | GetMaxVideosPerCallFunction$1;
|
|
7140
7623
|
/**
|
|
7141
7624
|
* Generates an array of videos.
|
|
7625
|
+
*
|
|
7626
|
+
* Optional when `doStart` and `doStatus` are provided to support
|
|
7627
|
+
* the asynchronous start/status flow.
|
|
7628
|
+
*/
|
|
7629
|
+
doGenerate?(options: VideoModelV4CallOptions): PromiseLike<VideoModelV4Result>;
|
|
7630
|
+
/**
|
|
7631
|
+
* Optional method that handles the user's `webhook` option for the
|
|
7632
|
+
* asynchronous start/status flow.
|
|
7633
|
+
*
|
|
7634
|
+
* Its presence on the model signals that the provider's API natively
|
|
7635
|
+
* supports webhooks. The SDK checks for this method before invoking the
|
|
7636
|
+
* user-provided `webhook` factory:
|
|
7637
|
+
*
|
|
7638
|
+
* - **Present**: The SDK calls this method with the user's webhook factory.
|
|
7639
|
+
* The implementation should invoke the factory to obtain a webhook URL
|
|
7640
|
+
* and a `received` promise. The URL is then forwarded to `doStart` via
|
|
7641
|
+
* `webhookUrl`, and the SDK awaits `received` instead of polling.
|
|
7642
|
+
*
|
|
7643
|
+
* - **Absent**: The SDK never calls the user's `webhook` factory and falls
|
|
7644
|
+
* back to polling via `doStatus`. This avoids unnecessary webhook
|
|
7645
|
+
* endpoint creation for providers whose APIs have no native webhook
|
|
7646
|
+
* mechanism.
|
|
7647
|
+
*
|
|
7648
|
+
* This method exists because the SDK must decide whether to invoke the
|
|
7649
|
+
* user's webhook factory — which may create real HTTP endpoints or
|
|
7650
|
+
* external resources — *before* calling `doStart`. Without an explicit
|
|
7651
|
+
* capability signal on the model, the SDK would eagerly create a webhook
|
|
7652
|
+
* endpoint for every provider, even those that silently ignore the URL.
|
|
7653
|
+
*/
|
|
7654
|
+
handleWebhookOption?: (options: {
|
|
7655
|
+
webhook: () => PromiseLike<{
|
|
7656
|
+
url: string;
|
|
7657
|
+
received: PromiseLike<VideoModelV4OperationWebhook>;
|
|
7658
|
+
}>;
|
|
7659
|
+
}) => PromiseLike<{
|
|
7660
|
+
webhookUrl: string;
|
|
7661
|
+
received: PromiseLike<VideoModelV4OperationWebhook>;
|
|
7662
|
+
}>;
|
|
7663
|
+
/**
|
|
7664
|
+
* Starts an asynchronous video generation and returns an opaque operation
|
|
7665
|
+
* reference that can be passed to `doStatus` to poll for completion.
|
|
7666
|
+
*
|
|
7667
|
+
* When both `doStart` and `doStatus` are implemented, the SDK core can
|
|
7668
|
+
* orchestrate polling or webhook-based completion instead of requiring
|
|
7669
|
+
* the provider to implement its own polling loop in `doGenerate`.
|
|
7670
|
+
*/
|
|
7671
|
+
doStart?(options: VideoModelV4CallOptions & {
|
|
7672
|
+
/**
|
|
7673
|
+
* When provided, the provider should register this URL to receive
|
|
7674
|
+
* a webhook notification when the video generation completes.
|
|
7675
|
+
*/
|
|
7676
|
+
webhookUrl?: string;
|
|
7677
|
+
}): PromiseLike<VideoModelV4OperationStartResult>;
|
|
7678
|
+
/**
|
|
7679
|
+
* Checks the status of an asynchronous video generation that was
|
|
7680
|
+
* started with `doStart`.
|
|
7681
|
+
*
|
|
7682
|
+
* Returns either a `pending` status or a `completed` status with the
|
|
7683
|
+
* generated videos.
|
|
7142
7684
|
*/
|
|
7143
|
-
|
|
7685
|
+
doStatus?(options: {
|
|
7686
|
+
/**
|
|
7687
|
+
* The JSON-serializable opaque operation reference returned by `doStart`.
|
|
7688
|
+
*/
|
|
7689
|
+
operation: JSONValue$3;
|
|
7690
|
+
/**
|
|
7691
|
+
* Abort signal for cancelling the operation.
|
|
7692
|
+
*/
|
|
7693
|
+
abortSignal?: AbortSignal;
|
|
7694
|
+
/**
|
|
7695
|
+
* Additional HTTP headers.
|
|
7696
|
+
*/
|
|
7697
|
+
headers?: Record<string, string | undefined>;
|
|
7698
|
+
}): PromiseLike<VideoModelV4OperationStatusResult>;
|
|
7144
7699
|
};
|
|
7145
7700
|
/**
|
|
7146
7701
|
* A video or image file that can be used for video editing or image-to-video generation.
|
|
@@ -7205,11 +7760,12 @@ type VideoModelV3CallOptions = {
|
|
|
7205
7760
|
n: number;
|
|
7206
7761
|
/**
|
|
7207
7762
|
* Aspect ratio of the videos to generate.
|
|
7208
|
-
* Must have the format `{width}:{height}
|
|
7763
|
+
* Must have the format `{width}:{height}`, or `'adaptive'` to inherit the
|
|
7764
|
+
* ratio from the input media.
|
|
7209
7765
|
* `undefined` will use the provider's default aspect ratio.
|
|
7210
7766
|
* Common values: '16:9', '9:16', '1:1', '21:9', '4:3'
|
|
7211
7767
|
*/
|
|
7212
|
-
aspectRatio: `${number}:${number}` | undefined;
|
|
7768
|
+
aspectRatio: `${number}:${number}` | 'adaptive' | undefined;
|
|
7213
7769
|
/**
|
|
7214
7770
|
* Resolution of the video to generate.
|
|
7215
7771
|
* Format: `{width}x{height}` (e.g., '1280x720', '1920x1080')
|
|
@@ -7245,7 +7801,11 @@ type VideoModelV3CallOptions = {
|
|
|
7245
7801
|
*/
|
|
7246
7802
|
frameImages: Array<VideoModelV3FrameImage> | undefined;
|
|
7247
7803
|
/**
|
|
7248
|
-
* Reference
|
|
7804
|
+
* Reference inputs for reference-to-video generation.
|
|
7805
|
+
*
|
|
7806
|
+
* Each entry is an image or video file. Providers route each reference by
|
|
7807
|
+
* its media type (image vs. video) and warn when a reference kind is
|
|
7808
|
+
* unsupported.
|
|
7249
7809
|
*/
|
|
7250
7810
|
inputReferences: Array<VideoModelV3File> | undefined;
|
|
7251
7811
|
/**
|
|
@@ -8183,7 +8743,7 @@ type LanguageModelV2 = {
|
|
|
8183
8743
|
* the behavior of LanguageModelV2 operations.
|
|
8184
8744
|
*/
|
|
8185
8745
|
//#endregion
|
|
8186
|
-
//#region ../../node_modules/.pnpm/@ai-sdk+provider@3.0.
|
|
8746
|
+
//#region ../../node_modules/.pnpm/@ai-sdk+provider@3.0.15/node_modules/@ai-sdk/provider/dist/index.d.ts
|
|
8187
8747
|
type SharedV3Headers = Record<string, string>;
|
|
8188
8748
|
/**
|
|
8189
8749
|
* A JSON value can be a string, number, boolean, object, array, or null.
|
|
@@ -9298,6 +9858,17 @@ interface LaminarSpanProcessorOptions {
|
|
|
9298
9858
|
* Defaults to false.
|
|
9299
9859
|
*/
|
|
9300
9860
|
disableBatch?: boolean;
|
|
9861
|
+
/**
|
|
9862
|
+
* Approximate maximum size, in bytes, of the spans buffered in a single batch.
|
|
9863
|
+
* Only used when `flushBySize` is true. Optional.
|
|
9864
|
+
* Defaults to 32 MiB.
|
|
9865
|
+
*/
|
|
9866
|
+
maxExportBatchSizeBytes?: number;
|
|
9867
|
+
/**
|
|
9868
|
+
* Whether to also flush batches by approximate payload size. Optional.
|
|
9869
|
+
* Defaults to false.
|
|
9870
|
+
*/
|
|
9871
|
+
flushBySize?: boolean;
|
|
9301
9872
|
/**
|
|
9302
9873
|
* Whether to force HTTP and use OpenTelemetry HTTP/protobuf exporter.
|
|
9303
9874
|
* Not recommended with Laminar backends.
|
|
@@ -9461,6 +10032,8 @@ interface LaminarInitializeProps {
|
|
|
9461
10032
|
traceExportTimeoutMillis?: number;
|
|
9462
10033
|
logLevel?: "debug" | "info" | "warn" | "error";
|
|
9463
10034
|
maxExportBatchSize?: number;
|
|
10035
|
+
maxExportBatchSizeBytes?: number;
|
|
10036
|
+
flushBySize?: boolean;
|
|
9464
10037
|
forceHttp?: boolean;
|
|
9465
10038
|
sessionRecordingOptions?: SessionRecordingOptions;
|
|
9466
10039
|
metadata?: Record<string, any>;
|
|
@@ -9516,6 +10089,13 @@ declare class Laminar {
|
|
|
9516
10089
|
* @param {string} props.logLevel - OTel log level. Defaults to "error".
|
|
9517
10090
|
* @param {number} props.maxExportBatchSize - Maximum number of spans to export in a single batch.
|
|
9518
10091
|
* Ignored when `disableBatch` is true.
|
|
10092
|
+
* @param {boolean} props.flushBySize - Whether to also flush batches by approximate payload
|
|
10093
|
+
* size, not just by span count and schedule delay. The batch is flushed when the next span
|
|
10094
|
+
* would push it past `maxExportBatchSizeBytes`, so a few large spans are exported without
|
|
10095
|
+
* waiting for `maxExportBatchSize` spans to accumulate. Useful when spans carry large prompts
|
|
10096
|
+
* or completions and exports get rejected for being too big. Defaults to false.
|
|
10097
|
+
* @param {number} props.maxExportBatchSizeBytes - Approximate maximum size, in bytes, of the
|
|
10098
|
+
* spans buffered in one batch. Only used when `flushBySize` is true. Defaults to 32 MiB.
|
|
9519
10099
|
* @param {boolean} props.forceHttp - Whether to force HTTP export. Not recommended.
|
|
9520
10100
|
* @param {SessionRecordingOptions} props.sessionRecordingOptions - Options for browser
|
|
9521
10101
|
* session recording.
|
|
@@ -9559,6 +10139,8 @@ declare class Laminar {
|
|
|
9559
10139
|
traceExportTimeoutMillis,
|
|
9560
10140
|
logLevel,
|
|
9561
10141
|
maxExportBatchSize,
|
|
10142
|
+
maxExportBatchSizeBytes,
|
|
10143
|
+
flushBySize,
|
|
9562
10144
|
forceHttp,
|
|
9563
10145
|
sessionRecordingOptions,
|
|
9564
10146
|
metadata,
|
|
@@ -10002,7 +10584,7 @@ declare namespace StandardJSONSchemaV1 {
|
|
|
10002
10584
|
type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
|
|
10003
10585
|
}
|
|
10004
10586
|
//#endregion
|
|
10005
|
-
//#region ../../node_modules/.pnpm/@ai-sdk+provider-utils@5.0.
|
|
10587
|
+
//#region ../../node_modules/.pnpm/@ai-sdk+provider-utils@5.0.27_zod@4.4.3/node_modules/@ai-sdk/provider-utils/dist/index.d.ts
|
|
10006
10588
|
/**
|
|
10007
10589
|
* A value that can be provided either as a single item, an array of items,
|
|
10008
10590
|
* or be left undefined.
|
|
@@ -10011,6 +10593,21 @@ type Arrayable<T> = T | T[] | undefined;
|
|
|
10011
10593
|
/**
|
|
10012
10594
|
* Normalizes a possibly undefined or non-array value into an array.
|
|
10013
10595
|
*/
|
|
10596
|
+
type WebSocketLike = {
|
|
10597
|
+
readyState: number; /** Bytes queued by `send` but not yet transmitted (native + `ws`). */
|
|
10598
|
+
readonly bufferedAmount?: number;
|
|
10599
|
+
send(data: string | Uint8Array | ArrayBuffer): void;
|
|
10600
|
+
close(code?: number, reason?: string): void;
|
|
10601
|
+
onopen: ((event: unknown) => void) | null;
|
|
10602
|
+
onmessage: ((event: {
|
|
10603
|
+
data: unknown;
|
|
10604
|
+
}) => void) | null;
|
|
10605
|
+
onerror: ((event: unknown) => void) | null;
|
|
10606
|
+
onclose: ((event: unknown) => void) | null;
|
|
10607
|
+
};
|
|
10608
|
+
type WebSocketConstructor = new (url: string | URL, protocols?: string | string[], options?: {
|
|
10609
|
+
headers?: Record<string, string | undefined>;
|
|
10610
|
+
}) => WebSocketLike;
|
|
10014
10611
|
/**
|
|
10015
10612
|
* Data content. Can either be a base64-encoded string, a Uint8Array, an ArrayBuffer, or a Buffer.
|
|
10016
10613
|
*/
|
|
@@ -10520,9 +11117,9 @@ type ToolResultOutput = {
|
|
|
10520
11117
|
providerOptions?: ProviderOptions;
|
|
10521
11118
|
}>;
|
|
10522
11119
|
};
|
|
10523
|
-
declare const symbol$
|
|
11120
|
+
declare const symbol$1$1: unique symbol;
|
|
10524
11121
|
declare class DownloadError extends AISDKError {
|
|
10525
|
-
private readonly [symbol$
|
|
11122
|
+
private readonly [symbol$1$1];
|
|
10526
11123
|
readonly url: string;
|
|
10527
11124
|
readonly statusCode?: number;
|
|
10528
11125
|
readonly statusText?: string;
|
|
@@ -10542,38 +11139,53 @@ declare class DownloadError extends AISDKError {
|
|
|
10542
11139
|
static isInstance(error: unknown): error is DownloadError;
|
|
10543
11140
|
}
|
|
10544
11141
|
/**
|
|
10545
|
-
*
|
|
11142
|
+
* Fetch function type (standardizes the version of fetch used).
|
|
11143
|
+
*/
|
|
11144
|
+
type FetchFunction = typeof globalThis.fetch;
|
|
11145
|
+
/**
|
|
11146
|
+
* Fetches a URL while enforcing the download guard on every hop.
|
|
10546
11147
|
*
|
|
10547
11148
|
* Redirects are followed manually (`redirect: 'manual'`) so each hop is
|
|
10548
11149
|
* validated with {@link validateDownloadUrl} *before* it is requested. Relying
|
|
10549
11150
|
* on the default `redirect: 'follow'` would issue the request to a redirect
|
|
10550
11151
|
* target (e.g. an internal address) before we ever see its URL, defeating the
|
|
10551
|
-
*
|
|
11152
|
+
* guard.
|
|
11153
|
+
*
|
|
11154
|
+
* Request headers are also protected: {@link sanitizeRequestHeaders} strips
|
|
11155
|
+
* proxy/metadata/cookie/hop-by-hop headers before the first request, and all
|
|
11156
|
+
* caller headers except `User-Agent` are dropped on a cross-origin redirect.
|
|
11157
|
+
* The fetch spec only strips `Authorization` on cross-origin redirects because
|
|
11158
|
+
* in a browser, CORS preflighting protects custom headers; there is no CORS on
|
|
11159
|
+
* the server, so provider API keys carried in custom headers (e.g. `x-key`)
|
|
11160
|
+
* must be dropped here as well.
|
|
10552
11161
|
*
|
|
10553
11162
|
* A `redirect: 'manual'` request yields an unreadable opaque response in the
|
|
10554
11163
|
* browser (and in other spec-compliant fetch implementations), so the redirect
|
|
10555
11164
|
* target cannot be validated here. In a real browser this is safe to follow
|
|
10556
|
-
* natively because
|
|
10557
|
-
* cannot reach a server's internal network or
|
|
10558
|
-
* runtime we cannot validate the hop, so we fail
|
|
10559
|
-
* blindly and bypass the
|
|
11165
|
+
* natively because reaching an internal network is not possible (fetch is
|
|
11166
|
+
* constrained by CORS and cannot reach a server's internal network or
|
|
11167
|
+
* cloud-metadata). On any other runtime we cannot validate the hop, so we fail
|
|
11168
|
+
* closed rather than follow it blindly and bypass the guard.
|
|
11169
|
+
*
|
|
11170
|
+
* A hop that is same-origin with `trustedOrigin` (the developer-configured
|
|
11171
|
+
* provider endpoint) skips target validation: that origin is exactly what an
|
|
11172
|
+
* unvalidated, config-derived request would fetch anyway, and validating it
|
|
11173
|
+
* would break legitimate self-hosted / localhost deployments whose response
|
|
11174
|
+
* URLs point back at the configured host. Hops on any other origin are always
|
|
11175
|
+
* validated.
|
|
10560
11176
|
*
|
|
10561
11177
|
* The returned response is the final (non-redirect) response. The caller is
|
|
10562
11178
|
* responsible for checking `response.ok` and reading the body.
|
|
10563
11179
|
*
|
|
11180
|
+
* On Node.js, the default fetch resolves every hostname through a validating
|
|
11181
|
+
* lookup hook and passes those exact addresses to the connector, preventing
|
|
11182
|
+
* hostname-to-private-IP and DNS-rebinding bypasses. An injected fetch is
|
|
11183
|
+
* responsible for equivalent connect-time validation. Other runtimes should
|
|
11184
|
+
* constrain egress at the network layer when handling untrusted URLs.
|
|
11185
|
+
*
|
|
10564
11186
|
* @throws DownloadError if a hop is unsafe, the redirect limit is exceeded, or
|
|
10565
11187
|
* a redirect cannot be validated on a non-browser runtime.
|
|
10566
11188
|
*/
|
|
10567
|
-
/**
|
|
10568
|
-
* Fetch function type (standardizes the version of fetch used).
|
|
10569
|
-
*/
|
|
10570
|
-
type FetchFunction = typeof globalThis.fetch;
|
|
10571
|
-
/**
|
|
10572
|
-
* Filters `null` and `undefined` values out of a list of values.
|
|
10573
|
-
*
|
|
10574
|
-
* @param values - The values to filter.
|
|
10575
|
-
* @returns A new array containing only non-nullish values.
|
|
10576
|
-
*/
|
|
10577
11189
|
/**
|
|
10578
11190
|
* Creates an ID generator.
|
|
10579
11191
|
* The total length of the ID is the sum of the prefix, separator, and random part length.
|
|
@@ -10643,8 +11255,12 @@ type Schema<OBJECT = unknown> = {
|
|
|
10643
11255
|
* @returns A function that returns a schema.
|
|
10644
11256
|
*/
|
|
10645
11257
|
type LazySchema<SCHEMA> = () => Schema<SCHEMA>;
|
|
10646
|
-
type ZodSchema<SCHEMA = any> = z3.Schema<SCHEMA, z3.ZodTypeDef, any> |
|
|
10647
|
-
type StandardSchema<SCHEMA = any> = StandardSchemaV1<unknown, SCHEMA> &
|
|
11258
|
+
type ZodSchema<SCHEMA = any> = z3.Schema<SCHEMA, z3.ZodTypeDef, any> | $ZodType<SCHEMA, any>;
|
|
11259
|
+
type StandardSchema<SCHEMA = any> = StandardSchemaV1<unknown, SCHEMA> & {
|
|
11260
|
+
readonly '~standard': StandardSchemaV1.Props<unknown, SCHEMA> & {
|
|
11261
|
+
readonly jsonSchema?: StandardJSONSchemaV1.Converter;
|
|
11262
|
+
};
|
|
11263
|
+
};
|
|
10648
11264
|
type FlexibleSchema<SCHEMA = any> = Schema<SCHEMA> | LazySchema<SCHEMA> | ZodSchema<SCHEMA> | StandardSchema<SCHEMA>;
|
|
10649
11265
|
type InferSchema<SCHEMA> = SCHEMA extends ZodSchema<infer T> ? T : SCHEMA extends StandardSchema<infer T> ? T : SCHEMA extends LazySchema<infer T> ? T : SCHEMA extends Schema<infer T> ? T : never;
|
|
10650
11266
|
/**
|
|
@@ -10659,7 +11275,7 @@ declare function jsonSchema<OBJECT = unknown>(jsonSchema: JSONSchema7$1 | Promis
|
|
|
10659
11275
|
validate?: (value: unknown) => ValidationResult<OBJECT> | PromiseLike<ValidationResult<OBJECT>>;
|
|
10660
11276
|
}): Schema<OBJECT>;
|
|
10661
11277
|
declare function asSchema<OBJECT>(schema: FlexibleSchema<OBJECT> | undefined): Schema<OBJECT>;
|
|
10662
|
-
declare function zodSchema<OBJECT>(zodSchema:
|
|
11278
|
+
declare function zodSchema<OBJECT>(zodSchema: $ZodType<OBJECT, any> | z3.Schema<OBJECT, z3.ZodTypeDef, any>, options?: {
|
|
10663
11279
|
/**
|
|
10664
11280
|
* Enables support for references in the schema.
|
|
10665
11281
|
* This is required for recursive schemas, e.g. with `z.lazy`.
|
|
@@ -11173,8 +11789,8 @@ type BaseTool<INPUT extends JSONValue$3 | unknown | never = any, OUTPUT extends
|
|
|
11173
11789
|
*/
|
|
11174
11790
|
needsApproval?: boolean | ToolNeedsApprovalFunction<[INPUT] extends [never] ? unknown : INPUT, NoInfer<CONTEXT>>;
|
|
11175
11791
|
/**
|
|
11176
|
-
* Optional function that is called when the
|
|
11177
|
-
*
|
|
11792
|
+
* Optional function that is called when the model starts generating the tool input.
|
|
11793
|
+
* In non-streaming contexts, it is called immediately before `onInputAvailable`.
|
|
11178
11794
|
*/
|
|
11179
11795
|
onInputStart?: (options: ToolExecutionOptions<NoInfer<CONTEXT>>) => void | PromiseLike<void>;
|
|
11180
11796
|
/**
|
|
@@ -11478,15 +12094,25 @@ interface ToolCall<NAME extends string, INPUT> {
|
|
|
11478
12094
|
*/
|
|
11479
12095
|
dynamic?: boolean;
|
|
11480
12096
|
}
|
|
11481
|
-
|
|
11482
|
-
|
|
11483
|
-
|
|
11484
|
-
|
|
12097
|
+
type ToolCallerDefinition = {
|
|
12098
|
+
type: 'local';
|
|
12099
|
+
bind: (tools: ToolSet) => Tool;
|
|
12100
|
+
} | {
|
|
12101
|
+
type: 'provider';
|
|
12102
|
+
prepareProviderOptions: (providerOptions: ProviderOptions | undefined) => ProviderOptions;
|
|
12103
|
+
};
|
|
12104
|
+
type ToolCallerTool<TOOL extends Tool = Tool> = TOOL & {
|
|
12105
|
+
readonly experimental_toolCaller: ToolCallerDefinition;
|
|
12106
|
+
};
|
|
12107
|
+
declare function toolCaller<TOOL extends Tool>(tool: TOOL, definition: ToolCallerDefinition): ToolCallerTool<TOOL>;
|
|
11485
12108
|
//#endregion
|
|
11486
|
-
//#region ../../node_modules/.pnpm/@ai-sdk+gateway@4.0.
|
|
11487
|
-
type
|
|
12109
|
+
//#region ../../node_modules/.pnpm/@ai-sdk+gateway@4.0.52_zod@4.4.3/node_modules/@ai-sdk/gateway/dist/index.d.ts
|
|
12110
|
+
type GatewayEmbeddingModelId = 'alibaba/qwen3-embedding-0.6b' | 'alibaba/qwen3-embedding-4b' | 'alibaba/qwen3-embedding-8b' | 'amazon/titan-embed-text-v2' | 'cohere/embed-v4.0' | 'google/gemini-embedding-001' | 'google/gemini-embedding-2' | 'google/text-embedding-005' | 'google/text-multilingual-embedding-002' | 'mistral/codestral-embed' | 'mistral/mistral-embed' | 'openai/text-embedding-3-large' | 'openai/text-embedding-3-small' | 'openai/text-embedding-ada-002' | 'perplexity/pplx-embed-v1-0.6b' | 'perplexity/pplx-embed-v1-4b' | 'voyage/voyage-3-large' | 'voyage/voyage-3.5' | 'voyage/voyage-3.5-lite' | 'voyage/voyage-4' | 'voyage/voyage-4-large' | 'voyage/voyage-4-lite' | 'voyage/voyage-code-2' | 'voyage/voyage-code-3' | 'voyage/voyage-finance-2' | 'voyage/voyage-law-2' | (string & {});
|
|
12111
|
+
type GatewayImageModelId = 'bfl/flux-2-flex' | 'bfl/flux-2-klein-4b' | 'bfl/flux-2-klein-9b' | 'bfl/flux-2-max' | 'bfl/flux-2-pro' | 'bfl/flux-kontext-max' | 'bfl/flux-kontext-pro' | 'bfl/flux-pro-1.0-fill' | 'bfl/flux-pro-1.1' | 'bfl/flux-pro-1.1-ultra' | 'bytedance/seedream-4.0' | 'bytedance/seedream-4.5' | 'bytedance/seedream-5.0-lite' | 'bytedance/seedream-5.0-pro' | 'google/imagen-4.0-fast-generate-001' | 'google/imagen-4.0-generate-001' | 'google/imagen-4.0-ultra-generate-001' | 'openai/gpt-image-1' | 'openai/gpt-image-1-mini' | 'openai/gpt-image-1.5' | 'openai/gpt-image-2' | 'prodia/flux-fast-schnell' | 'quiverai/arrow-1.1' | 'recraft/recraft-v2' | 'recraft/recraft-v3' | 'recraft/recraft-v4' | 'recraft/recraft-v4-pro' | 'recraft/recraft-v4.1' | 'recraft/recraft-v4.1-pro' | 'recraft/recraft-v4.1-utility' | 'recraft/recraft-v4.1-utility-pro' | 'xai/grok-imagine-image' | 'xai/grok-imagine-image-2.0' | (string & {});
|
|
12112
|
+
type GatewayModelId = 'alibaba/qwen-3-14b' | 'alibaba/qwen-3-235b' | 'alibaba/qwen-3-30b' | 'alibaba/qwen-3-32b' | 'alibaba/qwen-3.6-max-preview' | 'alibaba/qwen3-235b-a22b-thinking' | 'alibaba/qwen3-coder' | 'alibaba/qwen3-coder-30b-a3b' | 'alibaba/qwen3-coder-next' | 'alibaba/qwen3-coder-plus' | 'alibaba/qwen3-max' | 'alibaba/qwen3-max-preview' | 'alibaba/qwen3-max-thinking' | 'alibaba/qwen3-next-80b-a3b-instruct' | 'alibaba/qwen3-next-80b-a3b-thinking' | 'alibaba/qwen3-vl-235b-a22b-instruct' | 'alibaba/qwen3-vl-instruct' | 'alibaba/qwen3-vl-thinking' | 'alibaba/qwen3.5-flash' | 'alibaba/qwen3.5-plus' | 'alibaba/qwen3.6-27b' | 'alibaba/qwen3.6-plus' | 'alibaba/qwen3.7-flash' | 'alibaba/qwen3.7-max' | 'alibaba/qwen3.7-plus' | 'alibaba/qwen3.8-max' | 'amazon/nova-2-lite' | 'amazon/nova-lite' | 'amazon/nova-micro' | 'amazon/nova-pro' | 'anthropic/claude-3-haiku' | 'anthropic/claude-fable-5' | 'anthropic/claude-haiku-4.5' | 'anthropic/claude-opus-4' | 'anthropic/claude-opus-4.5' | 'anthropic/claude-opus-4.6' | 'anthropic/claude-opus-4.7' | 'anthropic/claude-opus-4.8' | 'anthropic/claude-opus-4.8-fast' | 'anthropic/claude-opus-5' | 'anthropic/claude-opus-5-fast' | 'anthropic/claude-sonnet-4' | 'anthropic/claude-sonnet-4.5' | 'anthropic/claude-sonnet-4.6' | 'anthropic/claude-sonnet-5' | 'arcee-ai/trinity-large-thinking' | 'arcee-ai/trinity-mini' | 'bytedance/seed-1.6' | 'bytedance/seed-1.8' | 'cohere/command-a' | 'deepseek/deepseek-r1' | 'deepseek/deepseek-v3' | 'deepseek/deepseek-v3.1' | 'deepseek/deepseek-v3.1-terminus' | 'deepseek/deepseek-v3.2' | 'deepseek/deepseek-v3.2-thinking' | 'deepseek/deepseek-v4-flash' | 'deepseek/deepseek-v4-flash-0731' | 'deepseek/deepseek-v4-pro' | 'deepseek/deepseek-v4-pro-0813' | 'google/gemini-2.5-flash' | 'google/gemini-2.5-flash-image' | 'google/gemini-2.5-flash-lite' | 'google/gemini-2.5-pro' | 'google/gemini-3-flash' | 'google/gemini-3-pro-image' | 'google/gemini-3.1-flash-image' | 'google/gemini-3.1-flash-image-preview' | 'google/gemini-3.1-flash-lite' | 'google/gemini-3.1-flash-lite-image' | 'google/gemini-3.1-pro-preview' | 'google/gemini-3.5-flash' | 'google/gemini-3.5-flash-lite' | 'google/gemini-3.6-flash' | 'google/gemini-3.7-flash' | 'google/gemini-omni-flash-preview' | 'google/gemma-4-26b-a4b-it' | 'google/gemma-4-31b-it' | 'inception/mercury-2' | 'inception/mercury-coder-small' | 'inclusionai/ling-3.0-flash' | 'inclusionai/ling-3.0-tiny-free' | 'interfaze/interfaze-beta' | 'kwaipilot/kat-coder-air-v2.5' | 'kwaipilot/kat-coder-pro-v1' | 'kwaipilot/kat-coder-pro-v2' | 'kwaipilot/kat-coder-pro-v2.5' | 'meta/llama-3.1-70b' | 'meta/llama-3.1-8b' | 'meta/llama-3.3-70b' | 'meta/llama-4-maverick' | 'meta/llama-4-scout' | 'meta/muse-glimmer-30b' | 'meta/muse-spark-1.1' | 'meta/muse-spark-1.2' | 'meta/muse-spark-1.2-contributor' | 'minimax/minimax-m2' | 'minimax/minimax-m2.1' | 'minimax/minimax-m2.1-lightning' | 'minimax/minimax-m2.5' | 'minimax/minimax-m2.5-highspeed' | 'minimax/minimax-m2.7' | 'minimax/minimax-m2.7-highspeed' | 'minimax/minimax-m3' | 'mistral/codestral' | 'mistral/devstral-2' | 'mistral/devstral-small-2' | 'mistral/magistral-medium' | 'mistral/magistral-small' | 'mistral/ministral-14b' | 'mistral/ministral-3b' | 'mistral/ministral-8b' | 'mistral/mistral-large-3' | 'mistral/mistral-medium' | 'mistral/mistral-medium-3.5' | 'mistral/mistral-nemo' | 'mistral/mistral-small' | 'mistral/pixtral-12b' | 'moonshotai/kimi-k2' | 'moonshotai/kimi-k2-thinking' | 'moonshotai/kimi-k2.5' | 'moonshotai/kimi-k2.6' | 'moonshotai/kimi-k2.7-code' | 'moonshotai/kimi-k2.7-code-highspeed' | 'moonshotai/kimi-k3' | 'moonshotai/kimi-k3-fast' | 'morph/morph-v3-fast' | 'morph/morph-v3-large' | 'nvidia/nemotron-3-nano-30b-a3b' | 'nvidia/nemotron-3-super-120b-a12b' | 'nvidia/nemotron-3-ultra-550b-a55b' | 'nvidia/nemotron-nano-12b-v2-vl' | 'nvidia/nemotron-nano-9b-v2' | 'openai/gpt-3.5-turbo' | 'openai/gpt-4-turbo' | 'openai/gpt-4.1' | 'openai/gpt-4.1-mini' | 'openai/gpt-4.1-nano' | 'openai/gpt-4o' | 'openai/gpt-4o-mini' | 'openai/gpt-4o-mini-search-preview' | 'openai/gpt-5' | 'openai/gpt-5-codex' | 'openai/gpt-5-mini' | 'openai/gpt-5-nano' | 'openai/gpt-5-pro' | 'openai/gpt-5.1-codex' | 'openai/gpt-5.1-codex-max' | 'openai/gpt-5.1-codex-mini' | 'openai/gpt-5.1-thinking' | 'openai/gpt-5.2' | 'openai/gpt-5.2-codex' | 'openai/gpt-5.2-pro' | 'openai/gpt-5.3-codex' | 'openai/gpt-5.4' | 'openai/gpt-5.4-mini' | 'openai/gpt-5.4-nano' | 'openai/gpt-5.4-pro' | 'openai/gpt-5.5' | 'openai/gpt-5.5-pro' | 'openai/gpt-5.6-luna' | 'openai/gpt-5.6-sol' | 'openai/gpt-5.6-terra' | 'openai/gpt-oss-120b' | 'openai/gpt-oss-20b' | 'openai/gpt-oss-safeguard-20b' | 'openai/o1' | 'openai/o3' | 'openai/o3-deep-research' | 'openai/o3-mini' | 'openai/o3-pro' | 'openai/o4-mini' | 'perplexity/sonar' | 'perplexity/sonar-pro' | 'perplexity/sonar-reasoning-pro' | 'poolside/laguna-s-2.1' | 'poolside/laguna-s-2.1-free' | 'sakana/fugu-ultra' | 'sakana/namazu' | 'stepfun/step-3.5-flash' | 'stepfun/step-3.7-flash' | 'tencent/hy3' | 'thinkingmachines/inkling' | 'thinkingmachines/inkling-small' | 'xai/grok-4.1-fast-non-reasoning' | 'xai/grok-4.1-fast-reasoning' | 'xai/grok-4.20-multi-agent' | 'xai/grok-4.20-multi-agent-beta' | 'xai/grok-4.20-non-reasoning' | 'xai/grok-4.20-non-reasoning-beta' | 'xai/grok-4.20-reasoning' | 'xai/grok-4.20-reasoning-beta' | 'xai/grok-4.3' | 'xai/grok-4.5' | 'xai/grok-4.6' | 'xai/grok-build-0.1' | 'xiaomi/mimo-v2.5' | 'xiaomi/mimo-v2.5-pro' | 'zai/glm-4.5' | 'zai/glm-4.5-air' | 'zai/glm-4.5v' | 'zai/glm-4.6' | 'zai/glm-4.6v' | 'zai/glm-4.6v-flash' | 'zai/glm-4.7' | 'zai/glm-4.7-flash' | 'zai/glm-4.7-flashx' | 'zai/glm-5' | 'zai/glm-5-turbo' | 'zai/glm-5.1' | 'zai/glm-5.2' | 'zai/glm-5.2-fast' | 'zai/glm-5v-turbo' | (string & {});
|
|
11488
12113
|
/**
|
|
11489
|
-
* Shared WebSocket subprotocol contract for AI Gateway realtime
|
|
12114
|
+
* Shared WebSocket subprotocol contract for AI Gateway realtime and streaming
|
|
12115
|
+
* transcription auth.
|
|
11490
12116
|
*
|
|
11491
12117
|
* The browser `WebSocket` API cannot set request headers, so the Gateway auth
|
|
11492
12118
|
* (bearer) token is carried through the `Sec-WebSocket-Protocol` handshake
|
|
@@ -11495,8 +12121,9 @@ type GatewayModelId = 'alibaba/qwen-3-14b' | 'alibaba/qwen-3-235b' | 'alibaba/qw
|
|
|
11495
12121
|
*
|
|
11496
12122
|
* This module is the single source of truth for that contract so the client and
|
|
11497
12123
|
* the Gateway server can't drift: the client encodes values with
|
|
11498
|
-
* `getGatewayRealtimeProtocols`, and the
|
|
11499
|
-
* `getGatewayRealtimeAuthToken` /
|
|
12124
|
+
* `getGatewayRealtimeProtocols` / `getGatewayTranscriptionProtocols`, and the
|
|
12125
|
+
* Gateway server decodes them with `getGatewayRealtimeAuthToken` /
|
|
12126
|
+
* `getGatewayRealtimeTeamIdOrSlug`.
|
|
11500
12127
|
*
|
|
11501
12128
|
* WebSocket subprotocol values must fit the RFC token grammar. The auth token is
|
|
11502
12129
|
* sent as-is, so callers must use tokens that are valid subprotocol tokens; the
|
|
@@ -11505,14 +12132,14 @@ type GatewayModelId = 'alibaba/qwen-3-14b' | 'alibaba/qwen-3-235b' | 'alibaba/qw
|
|
|
11505
12132
|
* budget) because intermediaries may reject large upgrade headers.
|
|
11506
12133
|
*/
|
|
11507
12134
|
/**
|
|
11508
|
-
* Marker subprotocol offered on every handshake so the Gateway can
|
|
11509
|
-
* negotiated subprotocol on the 101 response (some clients require the
|
|
11510
|
-
* select one of the offered subprotocols).
|
|
12135
|
+
* Marker subprotocol offered on every realtime handshake so the Gateway can
|
|
12136
|
+
* echo a negotiated subprotocol on the 101 response (some clients require the
|
|
12137
|
+
* server to select one of the offered subprotocols).
|
|
11511
12138
|
*/
|
|
11512
12139
|
type GatewayRerankingModelId = 'cohere/rerank-v3.5' | 'cohere/rerank-v4-fast' | 'cohere/rerank-v4-pro' | 'voyage/rerank-2.5' | 'voyage/rerank-2.5-lite' | (string & {});
|
|
11513
|
-
type GatewaySpeechModelId = 'openai/tts-1' | 'openai/tts-1-hd' | 'xai/grok-tts' | (string & {});
|
|
11514
|
-
type GatewayTranscriptionModelId = 'openai/gpt-4o-mini-transcribe' | 'openai/gpt-4o-transcribe' | 'openai/whisper-1' | 'xai/grok-stt' | (string & {});
|
|
11515
|
-
type GatewayVideoModelId = 'alibaba/wan-v2.5-t2v-preview' | 'alibaba/wan-v2.6-i2v' | 'alibaba/wan-v2.6-i2v-flash' | 'alibaba/wan-v2.6-r2v' | 'alibaba/wan-v2.6-r2v-flash' | 'alibaba/wan-v2.6-t2v' | 'alibaba/wan-v2.7-r2v' | 'alibaba/wan-v2.7-t2v' | 'bytedance/seedance-2.0' | 'bytedance/seedance-2.0-fast' | 'bytedance/seedance-v1.0-pro' | 'bytedance/seedance-v1.0-pro-fast' | 'bytedance/seedance-v1.5-pro' | 'google/veo-3.0-fast-generate-001' | 'google/veo-3.0-generate-001' | 'google/veo-3.1-fast-generate-001' | 'google/veo-3.1-generate-001' | 'klingai/kling-v2.5-turbo-i2v' | 'klingai/kling-v2.5-turbo-t2v' | 'klingai/kling-v2.6-i2v' | 'klingai/kling-v2.6-motion-control' | 'klingai/kling-v2.6-t2v' | 'klingai/kling-v3.0-i2v' | 'klingai/kling-v3.0-motion-control' | 'klingai/kling-v3.0-t2v' | 'xai/grok-imagine-video' | 'xai/grok-imagine-video-1.5' | 'xai/grok-imagine-video-1.5-preview' | (string & {});
|
|
12140
|
+
type GatewaySpeechModelId = 'fish-audio/s1' | 'fish-audio/s2-pro' | 'fish-audio/s2.1-pro' | 'openai/tts-1' | 'openai/tts-1-hd' | 'xai/grok-tts' | (string & {});
|
|
12141
|
+
type GatewayTranscriptionModelId = 'fish-audio/transcribe-1' | 'openai/gpt-4o-mini-transcribe' | 'openai/gpt-4o-transcribe' | 'openai/gpt-realtime-whisper' | 'openai/whisper-1' | 'xai/grok-stt' | (string & {});
|
|
12142
|
+
type GatewayVideoModelId = 'alibaba/wan-v2.5-t2v-preview' | 'alibaba/wan-v2.6-i2v' | 'alibaba/wan-v2.6-i2v-flash' | 'alibaba/wan-v2.6-r2v' | 'alibaba/wan-v2.6-r2v-flash' | 'alibaba/wan-v2.6-t2v' | 'alibaba/wan-v2.7-r2v' | 'alibaba/wan-v2.7-t2v' | 'bfl/flux-3-video' | 'bytedance/seedance-2.0' | 'bytedance/seedance-2.0-fast' | 'bytedance/seedance-2.5' | 'bytedance/seedance-v1.0-pro' | 'bytedance/seedance-v1.0-pro-fast' | 'bytedance/seedance-v1.5-pro' | 'google/veo-3.0-fast-generate-001' | 'google/veo-3.0-generate-001' | 'google/veo-3.1-fast-generate-001' | 'google/veo-3.1-generate-001' | 'google/veo-3.1-lite-generate-001' | 'klingai/kling-v2.5-turbo-i2v' | 'klingai/kling-v2.5-turbo-t2v' | 'klingai/kling-v2.6-i2v' | 'klingai/kling-v2.6-motion-control' | 'klingai/kling-v2.6-t2v' | 'klingai/kling-v3.0-i2v' | 'klingai/kling-v3.0-motion-control' | 'klingai/kling-v3.0-t2v' | 'minimax/minimax-h3' | 'xai/grok-imagine-video' | 'xai/grok-imagine-video-1.5' | 'xai/grok-imagine-video-1.5-preview' | (string & {});
|
|
11516
12143
|
declare const KNOWN_MODEL_TYPES: readonly ["embedding", "image", "language", "realtime", "reranking", "speech", "transcription", "video"];
|
|
11517
12144
|
type KnownModelType = (typeof KNOWN_MODEL_TYPES)[number];
|
|
11518
12145
|
interface GatewayLanguageModelEntry {
|
|
@@ -11668,8 +12295,6 @@ interface GatewayGenerationInfo {
|
|
|
11668
12295
|
/** Billable web search calls */
|
|
11669
12296
|
billableWebSearchCalls: number;
|
|
11670
12297
|
}
|
|
11671
|
-
type GatewayEmbeddingModelId = 'alibaba/qwen3-embedding-0.6b' | 'alibaba/qwen3-embedding-4b' | 'alibaba/qwen3-embedding-8b' | 'amazon/titan-embed-text-v2' | 'cohere/embed-v4.0' | 'google/gemini-embedding-001' | 'google/gemini-embedding-2' | 'google/text-embedding-005' | 'google/text-multilingual-embedding-002' | 'mistral/codestral-embed' | 'mistral/mistral-embed' | 'openai/text-embedding-3-large' | 'openai/text-embedding-3-small' | 'openai/text-embedding-ada-002' | 'voyage/voyage-3-large' | 'voyage/voyage-3.5' | 'voyage/voyage-3.5-lite' | 'voyage/voyage-4' | 'voyage/voyage-4-large' | 'voyage/voyage-4-lite' | 'voyage/voyage-code-2' | 'voyage/voyage-code-3' | 'voyage/voyage-finance-2' | 'voyage/voyage-law-2' | (string & {});
|
|
11672
|
-
type GatewayImageModelId = 'bfl/flux-2-flex' | 'bfl/flux-2-klein-4b' | 'bfl/flux-2-klein-9b' | 'bfl/flux-2-max' | 'bfl/flux-2-pro' | 'bfl/flux-kontext-max' | 'bfl/flux-kontext-pro' | 'bfl/flux-pro-1.0-fill' | 'bfl/flux-pro-1.1' | 'bfl/flux-pro-1.1-ultra' | 'bytedance/seedream-4.0' | 'bytedance/seedream-4.5' | 'bytedance/seedream-5.0-lite' | 'google/imagen-4.0-fast-generate-001' | 'google/imagen-4.0-generate-001' | 'google/imagen-4.0-ultra-generate-001' | 'openai/gpt-image-1' | 'openai/gpt-image-1-mini' | 'openai/gpt-image-1.5' | 'openai/gpt-image-2' | 'prodia/flux-fast-schnell' | 'quiverai/arrow-1.1' | 'recraft/recraft-v2' | 'recraft/recraft-v3' | 'recraft/recraft-v4' | 'recraft/recraft-v4-pro' | 'recraft/recraft-v4.1' | 'recraft/recraft-v4.1-pro' | 'recraft/recraft-v4.1-utility' | 'recraft/recraft-v4.1-utility-pro' | 'xai/grok-imagine-image' | (string & {});
|
|
11673
12298
|
interface PerplexitySearchConfig {
|
|
11674
12299
|
/**
|
|
11675
12300
|
* Default maximum number of search results to return (1-20, default: 10).
|
|
@@ -12170,11 +12795,38 @@ interface GatewayProvider extends ProviderV4 {
|
|
|
12170
12795
|
* communication over WebSocket, normalized through the AI Gateway.
|
|
12171
12796
|
*/
|
|
12172
12797
|
experimental_realtime: RealtimeFactoryV4;
|
|
12798
|
+
/**
|
|
12799
|
+
* Experimental streaming-transcription entry point. Callable like
|
|
12800
|
+
* `transcription(modelId)`, plus `getToken` for minting a short-lived
|
|
12801
|
+
* client secret (`vcst_`) a browser can use to open the streaming
|
|
12802
|
+
* transcription WebSocket without holding the Gateway credential.
|
|
12803
|
+
*/
|
|
12804
|
+
experimental_transcription: GatewayTranscriptionFactory;
|
|
12173
12805
|
/**
|
|
12174
12806
|
* Gateway-specific tools executed server-side.
|
|
12175
12807
|
*/
|
|
12176
12808
|
tools: typeof gatewayTools;
|
|
12177
12809
|
}
|
|
12810
|
+
type GatewayTranscriptionFactoryGetTokenOptions = {
|
|
12811
|
+
model: GatewayTranscriptionModelId; /** Token lifetime in seconds. Gateway default is 60s (max 300s). */
|
|
12812
|
+
expiresAfterSeconds?: number;
|
|
12813
|
+
};
|
|
12814
|
+
type GatewayTranscriptionFactoryGetTokenResult = {
|
|
12815
|
+
/** The minted `vcst_` client secret. */token: string; /** WebSocket URL of the streaming transcription surface for this model. */
|
|
12816
|
+
url: string; /** Token expiry, epoch seconds. */
|
|
12817
|
+
expiresAt?: number;
|
|
12818
|
+
};
|
|
12819
|
+
/**
|
|
12820
|
+
* Streaming-transcription factory: callable like `transcription(modelId)`,
|
|
12821
|
+
* plus a server-side `getToken` that mints a transcription-bound short-lived
|
|
12822
|
+
* client secret (`vcst_`). The browser connects with
|
|
12823
|
+
* `createGateway({ apiKey: token }).transcription(modelId)` — the token rides
|
|
12824
|
+
* the same auth subprotocol an API key does, without exposing the credential.
|
|
12825
|
+
*/
|
|
12826
|
+
interface GatewayTranscriptionFactory {
|
|
12827
|
+
(modelId: GatewayTranscriptionModelId): TranscriptionModelV4;
|
|
12828
|
+
getToken(options: GatewayTranscriptionFactoryGetTokenOptions): Promise<GatewayTranscriptionFactoryGetTokenResult>;
|
|
12829
|
+
}
|
|
12178
12830
|
interface GatewayProviderSettings {
|
|
12179
12831
|
/**
|
|
12180
12832
|
* The base URL prefix for API calls. Defaults to `https://ai-gateway.vercel.sh/v4/ai`.
|
|
@@ -12199,6 +12851,13 @@ interface GatewayProviderSettings {
|
|
|
12199
12851
|
* or to provide a custom fetch implementation for e.g. testing.
|
|
12200
12852
|
*/
|
|
12201
12853
|
fetch?: FetchFunction;
|
|
12854
|
+
/**
|
|
12855
|
+
* Custom WebSocket implementation used for streaming transcription. This is
|
|
12856
|
+
* useful for testing or for runtimes without a global WebSocket. A
|
|
12857
|
+
* header-capable implementation is not required — Gateway WebSocket auth is
|
|
12858
|
+
* carried in the subprotocols.
|
|
12859
|
+
*/
|
|
12860
|
+
webSocket?: WebSocketConstructor;
|
|
12202
12861
|
/**
|
|
12203
12862
|
* How frequently to refresh the metadata cache in milliseconds.
|
|
12204
12863
|
*/
|
|
@@ -12210,7 +12869,7 @@ interface GatewayProviderSettings {
|
|
|
12210
12869
|
declare function createGateway(options?: GatewayProviderSettings): GatewayProvider;
|
|
12211
12870
|
declare const gateway: GatewayProvider;
|
|
12212
12871
|
declare namespace index_d_exports {
|
|
12213
|
-
export { AISDKError, AI_SDK_TELEMETRY_TRACING_CHANNEL, APICallError, AbstractChat, ActiveTools, Agent$1 as Agent, AgentCallParameters, AgentStreamParameters, AssistantContent, AssistantModelMessage, AsyncIterableStream, CallSettings, CallWarning, ChatAddToolApproveResponseFunction, ChatAddToolOutputFunction, ChatInit, ChatOnDataCallback, ChatOnErrorCallback, ChatOnFinishCallback, ChatOnToolCallCallback, ChatRequestOptions, ChatState, ChatStatus, ChatTransport, ChunkDetector, CompletionRequestOptions, ContentPart, CreateUIMessage, CustomContentUIPart, DataContent, DataUIPart, DeepPartial, DefaultChatTransport, DefaultGeneratedFile, DirectChatTransport, DirectChatTransportOptions, DownloadError, DynamicToolCall, DynamicToolError, DynamicToolResult, DynamicToolUIPart, EmbedEndEvent, EmbedManyResult, EmbedResult, EmbedStartEvent, Embedding, EmbeddingModel, EmbeddingModelCallEndEvent, EmbeddingModelCallStartEvent, EmbeddingModelMiddleware, EmbeddingModelUsage, EmptyResponseBodyError, ErrorHandler, AbstractRealtimeSession as Experimental_AbstractRealtimeSession, ToolLoopAgent as Experimental_Agent, ToolLoopAgentSettings as Experimental_AgentSettings, DownloadFunction as Experimental_DownloadFunction, GeneratedFile as Experimental_GeneratedImage, InferAgentUIMessage as Experimental_InferAgentUIMessage, LanguageModelStreamPart as Experimental_LanguageModelStreamPart, LogWarningsFunction as Experimental_LogWarningsFunction, RealtimeClientEvent as Experimental_RealtimeClientEvent, RealtimeFactory as Experimental_RealtimeFactory, RealtimeFactoryGetTokenOptions as Experimental_RealtimeFactoryGetTokenOptions, RealtimeFactoryGetTokenResult as Experimental_RealtimeFactoryGetTokenResult, RealtimeModel as Experimental_RealtimeModel, RealtimeServerEvent as Experimental_RealtimeServerEvent, RealtimeSessionConfig as Experimental_RealtimeSessionConfig, RealtimeSessionOptions as Experimental_RealtimeSessionOptions, RealtimeSetupResponse as Experimental_RealtimeSetupResponse, RealtimeState as Experimental_RealtimeState, RealtimeStatus as Experimental_RealtimeStatus, RealtimeToolDefinition as Experimental_RealtimeToolDefinition, SandboxProcess as Experimental_SandboxProcess, SandboxSession as Experimental_SandboxSession, Experimental_SpeechResult, Experimental_TranscriptionResult, FilePart, FileUIPart, FinishReason, FlexibleSchema, GatewayModelId, GenerateImageResult, GenerateObjectEndEvent, GenerateObjectResult, GenerateObjectStartEvent, GenerateObjectStepEndEvent, GenerateObjectStepStartEvent, GenerateTextAbortEvent, GenerateTextEndEvent, GenerateTextInclude, GenerateTextOnAbortCallback, GenerateTextOnEndCallback, GenerateTextOnFinishCallback, GenerateTextOnStartCallback, GenerateTextOnStepEndCallback, GenerateTextOnStepFinishCallback, GenerateTextOnStepStartCallback, GenerateTextResult, GenerateTextStartEvent, GenerateTextStepEndEvent, GenerateTextStepStartEvent, GenerateVideoPrompt, GenerateVideoResult, GeneratedAudioFile, GeneratedFile, GenericToolApprovalFunction, HttpChatTransport, HttpChatTransportInitOptions, IdGenerator, ImageModel, ImageModelMiddleware, ImageModelProviderMetadata, ImageModelResponseMetadata, ImageModelUsage, ImagePart, InferAgentUIMessage, InferCompleteOutput as InferGenerateOutput, InferSchema, InferPartialOutput as InferStreamOutput, InferTelemetryEvent, InferToolInput, InferToolOutput, InferUIDataParts, InferUIMessageChunk, InferUITool, InferUITools, Instructions, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidPromptError, InvalidResponseDataError, InvalidStreamPartError, InvalidToolApprovalError, InvalidToolApprovalSignatureError, InvalidToolInputError, JSONParseError, JSONSchema7$1 as JSONSchema7, JSONValue, JsonToSseTransformStream, LanguageModel, LanguageModelCallEndEvent, LanguageModelCallOptions, LanguageModelCallStartEvent, LanguageModelMiddleware, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, LoadAPIKeyError, LoadSettingError, LogWarningsFunction, MessageConversionError, MissingToolResultsError, ModelInfo, ModelMessage, NoContentGeneratedError, NoImageGeneratedError, NoObjectGeneratedError, NoOutputGeneratedError, NoSpeechGeneratedError, NoSuchModelError, NoSuchProviderError, NoSuchProviderReferenceError, NoSuchToolError, NoTranscriptGeneratedError, NoVideoGeneratedError, ObjectStreamPart, OnFinishEvent, OnLanguageModelCallEndCallback, OnLanguageModelCallStartCallback, OnStartEvent, OnStepFinishEvent, OnStepStartEvent, OnToolCallFinishEvent, OnToolCallStartEvent, OnToolExecutionEndCallback, OnToolExecutionStartCallback, output as Output, OutputChunkTimingStats, PrepareReconnectToStreamRequest, PrepareSendMessagesRequest, PrepareStepFunction, PrepareStepResult, Prompt, Provider, ProviderMetadata, ProviderReference, ProviderRegistryProvider, ReasoningFileOutput, ReasoningFileUIPart, ReasoningOutput, ReasoningUIPart, RepairTextFunction, RequestOptions, RerankEndEvent, RerankResult, RerankStartEvent, RerankingModel, RerankingModelCallEndEvent, RerankingModelCallStartEvent, RetryError, SafeValidateUIMessagesResult, Schema, SerialJobExecutor, SingleToolApprovalFunction, SourceDocumentUIPart, SourceUrlUIPart, SpeechModel, SpeechModelResponseMetadata, SpeechResult, StaticToolCall, StaticToolError, StaticToolOutputDenied, StaticToolResult, StepResult, StepResultPerformance, StepStartUIPart, StopCondition, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextInclude, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextResult, StreamTextTransform, StreamTranscriptionResult, SystemModelMessage, Telemetry, TelemetryOptions, TelemetryTracingChannelMessage, TelemetryTracingEventType, TextPart, TextStreamChatTransport, TextStreamPart, TextUIPart, TimeoutConfiguration, ToUIMessageChunkOptions, TooManyEmbeddingValuesForCallError, Tool, ToolApprovalConfiguration, ToolApprovalRequest, ToolApprovalRequestOutput, ToolApprovalResponse, ToolApprovalResponseOutput, ToolApprovalStatus, ToolCallNotFoundForApprovalError, ToolCallPart, ToolCallRepairError, ToolCallRepairFunction, ToolChoice, ToolContent, ToolExecuteFunction, ToolExecutionEndEvent, ToolExecutionOptions, ToolExecutionStartEvent, ToolInputRefinement, ToolLoopAgent, ToolLoopAgentSettings, ToolModelMessage, ToolOrder, ToolResultPart, ToolSet, ToolUIPart, TranscriptionModel, TranscriptionModelResponseMetadata, TranscriptionResult, TranscriptionStreamPart, TypeValidationError, TypedToolCall, TypedToolError, TypedToolOutputDenied, TypedToolResult, UIDataPartSchemas, UIDataTypes, UIMessage, UIMessageChunk, UIMessagePart, UIMessageStreamError, UIMessageStreamOnEndCallback, UIMessageStreamOnFinishCallback, UIMessageStreamOnStepEndCallback, UIMessageStreamOnStepFinishCallback, UIMessageStreamOptions, UIMessageStreamWriter, UITool, UIToolInvocation, UITools, UI_MESSAGE_STREAM_HEADERS, UnsupportedFunctionalityError, UnsupportedModelVersionError, UploadFileResult, UploadSkillResult, UseCompletionOptions, UserContent, UserModelMessage, Warning, addToolInputExamplesMiddleware, asSchema, assistantModelMessageSchema, callCompletionApi, consumeStream, convertDataContentToBase64String, convertFileListToFileUIParts, convertToModelMessages, cosineSimilarity, createAgentUIStream, createAgentUIStreamResponse, createDownload, createGateway, createIdGenerator, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, defaultEmbeddingSettingsMiddleware, defaultSettingsMiddleware, dynamicTool, embed, embedMany, experimental_createProviderRegistry, decodeRealtimeAudio as experimental_decodeRealtimeAudio, encodeRealtimeAudio as experimental_encodeRealtimeAudio, filterActiveTools as experimental_filterActiveTools, experimental_generateSpeech, experimental_generateVideo, getRealtimeToolDefinitions as experimental_getRealtimeToolDefinitions, resampleAudio as experimental_resampleAudio, streamLanguageModelCall as experimental_streamLanguageModelCall, streamTranscribe as experimental_streamTranscribe, experimental_transcribe, extractJsonMiddleware, extractReasoningMiddleware, gateway, generateId$1 as generateId, generateImage, generateObject, generateSpeech, generateText, getChunkTimeoutMs, getStaticToolName, getStepTimeoutMs, getTextFromDataUrl, getToolName, getToolOrDynamicToolName, getToolTimeoutMs, getTotalTimeoutMs, hasToolCall, isCustomContentUIPart, isDataUIPart, isDeepEqualData, isDynamicToolUIPart, isFileUIPart, isLoopFinished, isReasoningFileUIPart, isReasoningUIPart, isStaticToolUIPart, isStepCount, isTextUIPart, isToolUIPart, jsonSchema, lastAssistantMessageIsCompleteWithApprovalResponses, lastAssistantMessageIsCompleteWithToolCalls, modelMessageSchema, parseJsonEventStream, parsePartialJson, pipeAgentUIStreamToResponse, pipeTextStreamToResponse, pipeUIMessageStreamToResponse, pruneMessages, readUIMessageStream, registerTelemetry, rerank, safeValidateUIMessages, simulateReadableStream, simulateStreamingMiddleware, smoothStream, isStepCount as stepCountIs, streamObject, streamText, systemModelMessageSchema, toTextStream, toUIMessageChunk, toUIMessageStream, tool$1 as tool, toolModelMessageSchema, transcribe, uiMessageChunkSchema, uploadFile, uploadSkill, userModelMessageSchema, validateUIMessages, wrapEmbeddingModel, wrapImageModel, wrapLanguageModel$1 as wrapLanguageModel, wrapProvider, zodSchema };
|
|
12872
|
+
export { AISDKError, AI_SDK_TELEMETRY_TRACING_CHANNEL, APICallError, AbstractChat, ActiveTools, Agent$1 as Agent, AgentCallParameters, AgentStreamParameters, AssistantContent, AssistantModelMessage, AsyncIterableStream, CallSettings, CallWarning, ChatAddToolApproveResponseFunction, ChatAddToolOutputFunction, ChatInit, ChatOnDataCallback, ChatOnErrorCallback, ChatOnFinishCallback, ChatOnToolCallCallback, ChatRequestOptions, ChatState, ChatStatus, ChatTransport, ChunkDetector, CompletionRequestOptions, ContentPart, CreateUIMessage, CustomContentUIPart, DataContent, DataUIPart, DeepPartial, DefaultChatTransport, DefaultGeneratedFile, DirectChatTransport, DirectChatTransportOptions, DownloadError, DynamicToolCall, DynamicToolError, DynamicToolResult, DynamicToolUIPart, EmbedEndEvent, EmbedManyResult, EmbedResult, EmbedStartEvent, Embedding, EmbeddingModel, EmbeddingModelCallEndEvent, EmbeddingModelCallStartEvent, EmbeddingModelMiddleware, EmbeddingModelUsage, EmptyResponseBodyError, ErrorHandler, AbstractRealtimeSession as Experimental_AbstractRealtimeSession, ToolLoopAgent as Experimental_Agent, ToolLoopAgentSettings as Experimental_AgentSettings, BatchError as Experimental_BatchError, BatchLanguageModel as Experimental_BatchLanguageModel, BatchOperationOptions as Experimental_BatchOperationOptions, BatchReference as Experimental_BatchReference, BatchStatus as Experimental_BatchStatus, DownloadFunction as Experimental_DownloadFunction, Experimental_GeneratedImage, InferAgentUIMessage as Experimental_InferAgentUIMessage, LanguageModelStreamPart as Experimental_LanguageModelStreamPart, LogWarningsFunction as Experimental_LogWarningsFunction, RealtimeClientEvent as Experimental_RealtimeClientEvent, RealtimeFactory as Experimental_RealtimeFactory, RealtimeFactoryGetTokenOptions as Experimental_RealtimeFactoryGetTokenOptions, RealtimeFactoryGetTokenResult as Experimental_RealtimeFactoryGetTokenResult, RealtimeModel as Experimental_RealtimeModel, RealtimeServerEvent as Experimental_RealtimeServerEvent, RealtimeSessionConfig as Experimental_RealtimeSessionConfig, RealtimeSessionOptions as Experimental_RealtimeSessionOptions, RealtimeSetupResponse as Experimental_RealtimeSetupResponse, RealtimeState as Experimental_RealtimeState, RealtimeStatus as Experimental_RealtimeStatus, RealtimeToolDefinition as Experimental_RealtimeToolDefinition, SandboxProcess as Experimental_SandboxProcess, SandboxSession as Experimental_SandboxSession, Experimental_SpeechResult, StartTextBatchOptions as Experimental_StartTextBatchOptions, StartTextBatchResult as Experimental_StartTextBatchResult, StreamTranslationResult as Experimental_StreamTranslationResult, TextBatch as Experimental_TextBatch, TextBatchGenerationResult as Experimental_TextBatchGenerationResult, TextBatchItemResult as Experimental_TextBatchItemResult, TextBatchReference as Experimental_TextBatchReference, TextBatchRequest as Experimental_TextBatchRequest, ToolCallerTool as Experimental_ToolCallerTool, Experimental_ToolCallers, Experimental_TranscriptionResult, TranslationStreamPart as Experimental_TranslationStreamPart, FilePart, FileUIPart, FinishReason, FlexibleSchema, GatewayModelId, GenerateImageResult, GenerateObjectEndEvent, GenerateObjectResult, GenerateObjectStartEvent, GenerateObjectStepEndEvent, GenerateObjectStepStartEvent, GenerateTextAbortEvent, GenerateTextEndEvent, GenerateTextInclude, GenerateTextOnAbortCallback, GenerateTextOnEndCallback, GenerateTextOnFinishCallback, GenerateTextOnStartCallback, GenerateTextOnStepEndCallback, GenerateTextOnStepFinishCallback, GenerateTextOnStepStartCallback, GenerateTextResult, GenerateTextStartEvent, GenerateTextStepEndEvent, GenerateTextStepStartEvent, GenerateVideoPrompt, GenerateVideoResult, GeneratedAudioFile, GeneratedFile, GenericToolApprovalFunction, HttpChatTransport, HttpChatTransportInitOptions, IdGenerator, ImageModel, ImageModelMiddleware, ImageModelProviderMetadata, ImageModelResponseMetadata, ImageModelUsage, ImagePart, InferAgentUIMessage, InferCompleteOutput as InferGenerateOutput, InferSchema, InferPartialOutput as InferStreamOutput, InferTelemetryEvent, InferToolInput, InferToolOutput, InferUIDataParts, InferUIMessageChunk, InferUITool, InferUITools, Instructions, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidPromptError, InvalidResponseDataError, InvalidStreamPartError, InvalidToolApprovalError, InvalidToolApprovalSignatureError, InvalidToolInputError, JSONParseError, JSONSchema7$1 as JSONSchema7, JSONValue, JsonToSseTransformStream, LanguageModel, LanguageModelCallEndEvent, LanguageModelCallOptions, LanguageModelCallStartEvent, LanguageModelMiddleware, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, LoadAPIKeyError, LoadSettingError, LogWarningsFunction, MessageConversionError, MissingToolResultsError, ModelInfo, ModelMessage, NoContentGeneratedError, NoImageGeneratedError, NoObjectGeneratedError, NoOutputGeneratedError, NoSpeechGeneratedError, NoSuchModelError, NoSuchProviderError, NoSuchProviderReferenceError, NoSuchToolError, NoTranscriptGeneratedError, NoTranslationGeneratedError, NoVideoGeneratedError, ObjectStreamPart, OnFinishEvent, OnLanguageModelCallEndCallback, OnLanguageModelCallStartCallback, OnStartEvent, OnStepFinishEvent, OnStepStartEvent, OnToolCallFinishEvent, OnToolCallStartEvent, OnToolExecutionEndCallback, OnToolExecutionStartCallback, output as Output, OutputChunkTimingStats, Output as OutputInterface, PrepareReconnectToStreamRequest, PrepareSendMessagesRequest, PrepareStepFunction, PrepareStepResult, Prompt, Provider, ProviderMetadata, ProviderReference, ProviderRegistryProvider, ReasoningFileOutput, ReasoningFileUIPart, ReasoningOutput, ReasoningUIPart, RepairTextFunction, RequestOptions, RerankEndEvent, RerankResult, RerankStartEvent, RerankingModel, RerankingModelCallEndEvent, RerankingModelCallStartEvent, RetryError, SafeValidateUIMessagesResult, Schema, SerialJobExecutor, SingleToolApprovalFunction, SourceDocumentUIPart, SourceUrlUIPart, SpeechModel, SpeechModelResponseMetadata, SpeechResult, StaticToolCall, StaticToolError, StaticToolOutputDenied, StaticToolResult, StepResult, StepResultPerformance, StepStartUIPart, StopCondition, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextInclude, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextResult, StreamTextTransform, StreamTranscriptionResult, SystemModelMessage, Telemetry, TelemetryOptions, TelemetryTracingChannelMessage, TelemetryTracingEventType, TextPart, TextStreamChatTransport, TextStreamPart, TextUIPart, TimeoutConfiguration, ToUIMessageChunkOptions, TooManyEmbeddingValuesForCallError, Tool, ToolApprovalConfiguration, ToolApprovalRequest, ToolApprovalRequestOutput, ToolApprovalResponse, ToolApprovalResponseOutput, ToolApprovalStatus, ToolCallNotFoundForApprovalError, ToolCallPart, ToolCallRepairError, ToolCallRepairFunction, ToolChoice, ToolContent, ToolExecuteFunction, ToolExecutionEndEvent, ToolExecutionOptions, ToolExecutionStartEvent, ToolInputRefinement, ToolLoopAgent, ToolLoopAgentSettings, ToolModelMessage, ToolOrder, ToolResultPart, ToolSet, ToolUIPart, TranscriptionModel, TranscriptionModelResponseMetadata, TranscriptionResult, TranscriptionStreamPart, TypeValidationError, TypedToolCall, TypedToolError, TypedToolOutputDenied, TypedToolResult, UIDataPartSchemas, UIDataTypes, UIMessage, UIMessageChunk, UIMessagePart, UIMessageStreamError, UIMessageStreamOnEndCallback, UIMessageStreamOnFinishCallback, UIMessageStreamOnStepEndCallback, UIMessageStreamOnStepFinishCallback, UIMessageStreamOptions, UIMessageStreamWriter, UITool, UIToolInvocation, UITools, UI_MESSAGE_STREAM_HEADERS, UnsupportedFunctionalityError, UnsupportedModelVersionError, UploadFileResult, UploadSkillResult, UseCompletionOptions, UserContent, UserModelMessage, Warning, addToolInputExamplesMiddleware, asSchema, assistantModelMessageSchema, callCompletionApi, consumeStream, convertDataContentToBase64String, convertFileListToFileUIParts, convertToModelMessages, cosineSimilarity, createAgentUIStream, createAgentUIStreamResponse, createDownload, createGateway, createIdGenerator, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, defaultEmbeddingSettingsMiddleware, defaultInstructionsMiddleware, defaultSettingsMiddleware, detectToolDrift, dynamicTool, embed, embedMany, experimental_createProviderRegistry, decodeRealtimeAudio as experimental_decodeRealtimeAudio, encodeRealtimeAudio as experimental_encodeRealtimeAudio, filterActiveTools as experimental_filterActiveTools, experimental_generateSpeech, experimental_generateVideo, getBatchResults as experimental_getBatchResults, getBatchStatus as experimental_getBatchStatus, getRealtimeToolDefinitions as experimental_getRealtimeToolDefinitions, resampleAudio as experimental_resampleAudio, startTextBatch as experimental_startTextBatch, streamLanguageModelCall as experimental_streamLanguageModelCall, streamTranscribe as experimental_streamTranscribe, streamTranslate as experimental_streamTranslate, toolCaller as experimental_toolCaller, experimental_transcribe, extractJsonMiddleware, extractReasoningMiddleware, fingerprintTools, gateway, generateId$1 as generateId, generateImage, generateObject, generateSpeech, generateText, getChunkTimeoutMs, getFirstChunkTimeoutMs, getStaticToolName, getStepTimeoutMs, getTextFromDataUrl, getToolName, getToolOrDynamicToolName, getToolTimeoutMs, getTotalTimeoutMs, hasToolCall, isCustomContentUIPart, isDataUIPart, isDeepEqualData, isDynamicToolUIPart, isFileUIPart, isLoopFinished, isReasoningFileUIPart, isReasoningUIPart, isStaticToolUIPart, isStepCount, isTextUIPart, isToolUIPart, jsonSchema, lastAssistantMessageIsCompleteWithApprovalResponses, lastAssistantMessageIsCompleteWithToolCalls, modelMessageSchema, parseJsonEventStream, parsePartialJson, pipeAgentUIStreamToResponse, pipeTextStreamToResponse, pipeUIMessageStreamToResponse, pruneMessages, readUIMessageStream, registerTelemetry, rerank, safeValidateUIMessages, simulateReadableStream, simulateStreamingMiddleware, smoothStream, isStepCount as stepCountIs, streamObject, streamText, systemModelMessageSchema, toTextStream, toUIMessageChunk, toUIMessageStream, tool$1 as tool, toolModelMessageSchema, transcribe, uiMessageChunkSchema, uploadFile, uploadSkill, userModelMessageSchema, validateUIMessages, wrapEmbeddingModel, wrapImageModel, wrapLanguageModel$1 as wrapLanguageModel, wrapProvider, zodSchema };
|
|
12214
12873
|
}
|
|
12215
12874
|
/**
|
|
12216
12875
|
* Embedding model that is used by the AI SDK.
|
|
@@ -12445,7 +13104,7 @@ type Provider = {
|
|
|
12445
13104
|
*
|
|
12446
13105
|
* @throws {NoSuchModelError} If no such model exists.
|
|
12447
13106
|
*/
|
|
12448
|
-
rerankingModel(modelId: string): RerankingModel;
|
|
13107
|
+
rerankingModel?(modelId: string): RerankingModel;
|
|
12449
13108
|
};
|
|
12450
13109
|
/**
|
|
12451
13110
|
* Additional provider-specific metadata that is returned from the provider.
|
|
@@ -12733,13 +13392,15 @@ type LanguageModelCallOptions = {
|
|
|
12733
13392
|
* - A number representing milliseconds
|
|
12734
13393
|
* - An object with `totalMs` property for the total timeout in milliseconds
|
|
12735
13394
|
* - An object with `stepMs` property for the timeout of each step in milliseconds
|
|
12736
|
-
* - An object with `
|
|
13395
|
+
* - An object with `firstChunkMs` property for the timeout until the first content chunk of each step (streaming only)
|
|
13396
|
+
* - An object with `chunkMs` property for the timeout between content chunks (streaming only)
|
|
12737
13397
|
* - An object with `toolMs` property for the default timeout for all tool executions
|
|
12738
13398
|
* - An object with `tools` property for per-tool timeout overrides using `{toolName}Ms` keys
|
|
12739
13399
|
*/
|
|
12740
13400
|
type TimeoutConfiguration<TOOLS extends ToolSet> = number | {
|
|
12741
13401
|
totalMs?: number;
|
|
12742
13402
|
stepMs?: number;
|
|
13403
|
+
firstChunkMs?: number;
|
|
12743
13404
|
chunkMs?: number;
|
|
12744
13405
|
toolMs?: number;
|
|
12745
13406
|
tools?: Partial<Record<`${keyof TOOLS & string}Ms`, number>>;
|
|
@@ -12758,9 +13419,17 @@ declare function getTotalTimeoutMs(timeout: TimeoutConfiguration<any> | undefine
|
|
|
12758
13419
|
* @returns The step timeout in milliseconds, or undefined if no step timeout is configured.
|
|
12759
13420
|
*/
|
|
12760
13421
|
declare function getStepTimeoutMs(timeout: TimeoutConfiguration<any> | undefined): number | undefined;
|
|
13422
|
+
/**
|
|
13423
|
+
* Extracts the first chunk timeout value in milliseconds from a TimeoutConfiguration.
|
|
13424
|
+
* This timeout is for streaming only - it aborts if no content chunk is received within the specified duration.
|
|
13425
|
+
*
|
|
13426
|
+
* @param timeout - The timeout configuration.
|
|
13427
|
+
* @returns The first chunk timeout in milliseconds, or undefined if no first chunk timeout is configured.
|
|
13428
|
+
*/
|
|
13429
|
+
declare function getFirstChunkTimeoutMs(timeout: TimeoutConfiguration<any> | undefined): number | undefined;
|
|
12761
13430
|
/**
|
|
12762
13431
|
* Extracts the chunk timeout value in milliseconds from a TimeoutConfiguration.
|
|
12763
|
-
* This timeout is for streaming only - it aborts if no new chunk is received within the specified duration.
|
|
13432
|
+
* This timeout is for streaming only - it aborts if no new content chunk is received within the specified duration.
|
|
12764
13433
|
*
|
|
12765
13434
|
* @param timeout - The timeout configuration.
|
|
12766
13435
|
* @returns The chunk timeout in milliseconds, or undefined if no chunk timeout is configured.
|
|
@@ -12792,11 +13461,11 @@ type RequestOptions<TOOLS extends ToolSet = ToolSet> = {
|
|
|
12792
13461
|
*/
|
|
12793
13462
|
timeout?: TimeoutConfiguration<TOOLS>;
|
|
12794
13463
|
};
|
|
12795
|
-
declare const systemModelMessageSchema:
|
|
12796
|
-
declare const userModelMessageSchema:
|
|
12797
|
-
declare const assistantModelMessageSchema:
|
|
12798
|
-
declare const toolModelMessageSchema:
|
|
12799
|
-
declare const modelMessageSchema:
|
|
13464
|
+
declare const systemModelMessageSchema: ZodType<SystemModelMessage>;
|
|
13465
|
+
declare const userModelMessageSchema: ZodType<UserModelMessage>;
|
|
13466
|
+
declare const assistantModelMessageSchema: ZodType<AssistantModelMessage>;
|
|
13467
|
+
declare const toolModelMessageSchema: ZodType<ToolModelMessage>;
|
|
13468
|
+
declare const modelMessageSchema: ZodType<ModelMessage>;
|
|
12800
13469
|
/**
|
|
12801
13470
|
* Instructions to include in the prompt. Can be used with `prompt` or `messages`.
|
|
12802
13471
|
*/
|
|
@@ -13142,6 +13811,10 @@ interface GeneratedFile {
|
|
|
13142
13811
|
*/
|
|
13143
13812
|
readonly mediaType: string;
|
|
13144
13813
|
}
|
|
13814
|
+
/**
|
|
13815
|
+
* @deprecated Use `GeneratedFile` instead. This alias will be removed in v8.
|
|
13816
|
+
*/
|
|
13817
|
+
type Experimental_GeneratedImage = GeneratedFile;
|
|
13145
13818
|
declare class DefaultGeneratedFile implements GeneratedFile {
|
|
13146
13819
|
private base64Data;
|
|
13147
13820
|
private uint8ArrayData;
|
|
@@ -13515,7 +14188,8 @@ type StepResult<TOOLS extends ToolSet, RUNTIME_CONTEXT extends Context$1 = Conte
|
|
|
13515
14188
|
*/
|
|
13516
14189
|
readonly content: Array<ContentPart<TOOLS>>;
|
|
13517
14190
|
/**
|
|
13518
|
-
* The
|
|
14191
|
+
* The concatenation of all text parts generated in this step.
|
|
14192
|
+
* It is an empty string if the step contains no text parts.
|
|
13519
14193
|
*/
|
|
13520
14194
|
readonly text: string;
|
|
13521
14195
|
/**
|
|
@@ -13624,7 +14298,8 @@ type LanguageModelCallEndEvent<TOOLS extends ToolSet = ToolSet> = ModelInfo & {
|
|
|
13624
14298
|
readonly finishReason: FinishReason; /** The token usage reported by the model call. */
|
|
13625
14299
|
readonly usage: LanguageModelUsage; /** The content parts produced by the model call. */
|
|
13626
14300
|
readonly content: ReadonlyArray<ContentPart<TOOLS>>; /** The provider-returned response id for this model call. */
|
|
13627
|
-
readonly responseId: string; /**
|
|
14301
|
+
readonly responseId: string; /** Optional provider-specific metadata for this model call. */
|
|
14302
|
+
readonly providerMetadata?: ProviderMetadata; /** Performance metrics for the model call. */
|
|
13628
14303
|
readonly performance: {
|
|
13629
14304
|
/** Time spent waiting for the language model response in milliseconds. */readonly responseTimeMs: number;
|
|
13630
14305
|
/**
|
|
@@ -13758,9 +14433,13 @@ type PrepareStepFunction<TOOLS extends ToolSet, RUNTIME_CONTEXT extends Context$
|
|
|
13758
14433
|
}) => PromiseLike<PrepareStepResult<TOOLS, RUNTIME_CONTEXT>> | PrepareStepResult<TOOLS, RUNTIME_CONTEXT>;
|
|
13759
14434
|
/**
|
|
13760
14435
|
* The result type returned by a {@link PrepareStepFunction},
|
|
13761
|
-
* allowing per-step overrides of model,
|
|
14436
|
+
* allowing per-step overrides of model call settings, model, tools,
|
|
14437
|
+
* instructions, or messages.
|
|
14438
|
+
*
|
|
14439
|
+
* Model call setting overrides apply only to the current step. Undefined
|
|
14440
|
+
* settings fall back to the outer call settings.
|
|
13762
14441
|
*/
|
|
13763
|
-
type PrepareStepResult<TOOLS extends ToolSet, RUNTIME_CONTEXT extends Context$1 = Context$1> = {
|
|
14442
|
+
type PrepareStepResult<TOOLS extends ToolSet, RUNTIME_CONTEXT extends Context$1 = Context$1> = ({
|
|
13764
14443
|
/**
|
|
13765
14444
|
* Optionally override which LanguageModel instance is used for this step.
|
|
13766
14445
|
*/
|
|
@@ -13824,7 +14503,7 @@ type PrepareStepResult<TOOLS extends ToolSet, RUNTIME_CONTEXT extends Context$1
|
|
|
13824
14503
|
* container IDs for Anthropic's code execution.
|
|
13825
14504
|
*/
|
|
13826
14505
|
providerOptions?: ProviderOptions;
|
|
13827
|
-
} | undefined;
|
|
14506
|
+
} & LanguageModelCallOptions) | undefined;
|
|
13828
14507
|
/**
|
|
13829
14508
|
* A predicate that decides whether a tool-calling loop should stop after the
|
|
13830
14509
|
* current step.
|
|
@@ -13945,6 +14624,10 @@ type CustomContentUIPart = {
|
|
|
13945
14624
|
*/
|
|
13946
14625
|
type ReasoningUIPart = {
|
|
13947
14626
|
type: 'reasoning';
|
|
14627
|
+
/**
|
|
14628
|
+
* The reasoning part ID.
|
|
14629
|
+
*/
|
|
14630
|
+
id?: string;
|
|
13948
14631
|
/**
|
|
13949
14632
|
* The reasoning text.
|
|
13950
14633
|
*/
|
|
@@ -14323,153 +15006,7 @@ type InferUIMessageToolCall<UI_MESSAGE extends UIMessage> = ValueOf<{ [NAME in k
|
|
|
14323
15006
|
} }> | (ToolCall<string, unknown> & {
|
|
14324
15007
|
dynamic: true;
|
|
14325
15008
|
});
|
|
14326
|
-
declare const uiMessageChunkSchema: LazySchema<
|
|
14327
|
-
type: "text-start";
|
|
14328
|
-
id: string;
|
|
14329
|
-
providerMetadata?: SharedV4ProviderMetadata | undefined;
|
|
14330
|
-
} | {
|
|
14331
|
-
type: "text-delta";
|
|
14332
|
-
id: string;
|
|
14333
|
-
delta: string;
|
|
14334
|
-
providerMetadata?: SharedV4ProviderMetadata | undefined;
|
|
14335
|
-
} | {
|
|
14336
|
-
type: "text-end";
|
|
14337
|
-
id: string;
|
|
14338
|
-
providerMetadata?: SharedV4ProviderMetadata | undefined;
|
|
14339
|
-
} | {
|
|
14340
|
-
type: "error";
|
|
14341
|
-
errorText: string;
|
|
14342
|
-
} | {
|
|
14343
|
-
type: "tool-input-start";
|
|
14344
|
-
toolCallId: string;
|
|
14345
|
-
toolName: string;
|
|
14346
|
-
providerExecuted?: boolean | undefined;
|
|
14347
|
-
providerMetadata?: SharedV4ProviderMetadata | undefined;
|
|
14348
|
-
toolMetadata?: JSONObject$2 | undefined;
|
|
14349
|
-
dynamic?: boolean | undefined;
|
|
14350
|
-
title?: string | undefined;
|
|
14351
|
-
} | {
|
|
14352
|
-
type: "tool-input-delta";
|
|
14353
|
-
toolCallId: string;
|
|
14354
|
-
inputTextDelta: string;
|
|
14355
|
-
} | {
|
|
14356
|
-
type: "tool-input-available";
|
|
14357
|
-
toolCallId: string;
|
|
14358
|
-
toolName: string;
|
|
14359
|
-
input: unknown;
|
|
14360
|
-
providerExecuted?: boolean | undefined;
|
|
14361
|
-
providerMetadata?: SharedV4ProviderMetadata | undefined;
|
|
14362
|
-
toolMetadata?: JSONObject$2 | undefined;
|
|
14363
|
-
dynamic?: boolean | undefined;
|
|
14364
|
-
title?: string | undefined;
|
|
14365
|
-
} | {
|
|
14366
|
-
type: "tool-input-error";
|
|
14367
|
-
toolCallId: string;
|
|
14368
|
-
toolName: string;
|
|
14369
|
-
input: unknown;
|
|
14370
|
-
errorText: string;
|
|
14371
|
-
providerExecuted?: boolean | undefined;
|
|
14372
|
-
providerMetadata?: SharedV4ProviderMetadata | undefined;
|
|
14373
|
-
toolMetadata?: JSONObject$2 | undefined;
|
|
14374
|
-
dynamic?: boolean | undefined;
|
|
14375
|
-
title?: string | undefined;
|
|
14376
|
-
} | {
|
|
14377
|
-
type: "tool-approval-request";
|
|
14378
|
-
approvalId: string;
|
|
14379
|
-
toolCallId: string;
|
|
14380
|
-
isAutomatic?: boolean | undefined;
|
|
14381
|
-
signature?: string | undefined;
|
|
14382
|
-
} | {
|
|
14383
|
-
type: "tool-approval-response";
|
|
14384
|
-
approvalId: string;
|
|
14385
|
-
approved: boolean;
|
|
14386
|
-
reason?: string | undefined;
|
|
14387
|
-
providerExecuted?: boolean | undefined;
|
|
14388
|
-
providerMetadata?: SharedV4ProviderMetadata | undefined;
|
|
14389
|
-
} | {
|
|
14390
|
-
type: "tool-output-available";
|
|
14391
|
-
toolCallId: string;
|
|
14392
|
-
output: unknown;
|
|
14393
|
-
providerExecuted?: boolean | undefined;
|
|
14394
|
-
providerMetadata?: SharedV4ProviderMetadata | undefined;
|
|
14395
|
-
toolMetadata?: JSONObject$2 | undefined;
|
|
14396
|
-
dynamic?: boolean | undefined;
|
|
14397
|
-
preliminary?: boolean | undefined;
|
|
14398
|
-
} | {
|
|
14399
|
-
type: "tool-output-error";
|
|
14400
|
-
toolCallId: string;
|
|
14401
|
-
errorText: string;
|
|
14402
|
-
providerExecuted?: boolean | undefined;
|
|
14403
|
-
providerMetadata?: SharedV4ProviderMetadata | undefined;
|
|
14404
|
-
toolMetadata?: JSONObject$2 | undefined;
|
|
14405
|
-
dynamic?: boolean | undefined;
|
|
14406
|
-
} | {
|
|
14407
|
-
type: "tool-output-denied";
|
|
14408
|
-
toolCallId: string;
|
|
14409
|
-
} | {
|
|
14410
|
-
type: "reasoning-start";
|
|
14411
|
-
id: string;
|
|
14412
|
-
providerMetadata?: SharedV4ProviderMetadata | undefined;
|
|
14413
|
-
} | {
|
|
14414
|
-
type: "reasoning-delta";
|
|
14415
|
-
id: string;
|
|
14416
|
-
delta: string;
|
|
14417
|
-
providerMetadata?: SharedV4ProviderMetadata | undefined;
|
|
14418
|
-
} | {
|
|
14419
|
-
type: "reasoning-end";
|
|
14420
|
-
id: string;
|
|
14421
|
-
providerMetadata?: SharedV4ProviderMetadata | undefined;
|
|
14422
|
-
} | {
|
|
14423
|
-
type: "custom";
|
|
14424
|
-
kind: `${string}.${string}`;
|
|
14425
|
-
providerMetadata?: SharedV4ProviderMetadata | undefined;
|
|
14426
|
-
} | {
|
|
14427
|
-
type: "source-url";
|
|
14428
|
-
sourceId: string;
|
|
14429
|
-
url: string;
|
|
14430
|
-
title?: string | undefined;
|
|
14431
|
-
providerMetadata?: SharedV4ProviderMetadata | undefined;
|
|
14432
|
-
} | {
|
|
14433
|
-
type: "source-document";
|
|
14434
|
-
sourceId: string;
|
|
14435
|
-
mediaType: string;
|
|
14436
|
-
title: string;
|
|
14437
|
-
filename?: string | undefined;
|
|
14438
|
-
providerMetadata?: SharedV4ProviderMetadata | undefined;
|
|
14439
|
-
} | {
|
|
14440
|
-
type: "file";
|
|
14441
|
-
url: string;
|
|
14442
|
-
mediaType: string;
|
|
14443
|
-
providerMetadata?: SharedV4ProviderMetadata | undefined;
|
|
14444
|
-
} | {
|
|
14445
|
-
type: "reasoning-file";
|
|
14446
|
-
url: string;
|
|
14447
|
-
mediaType: string;
|
|
14448
|
-
providerMetadata?: SharedV4ProviderMetadata | undefined;
|
|
14449
|
-
} | {
|
|
14450
|
-
type: `data-${string}`;
|
|
14451
|
-
data: unknown;
|
|
14452
|
-
id?: string | undefined;
|
|
14453
|
-
transient?: boolean | undefined;
|
|
14454
|
-
} | {
|
|
14455
|
-
type: "start-step";
|
|
14456
|
-
} | {
|
|
14457
|
-
type: "finish-step";
|
|
14458
|
-
} | {
|
|
14459
|
-
type: "start";
|
|
14460
|
-
messageId?: string | undefined;
|
|
14461
|
-
messageMetadata?: unknown;
|
|
14462
|
-
} | {
|
|
14463
|
-
type: "finish";
|
|
14464
|
-
finishReason?: "length" | "error" | "stop" | "content-filter" | "tool-calls" | "other" | undefined;
|
|
14465
|
-
messageMetadata?: unknown;
|
|
14466
|
-
} | {
|
|
14467
|
-
type: "abort";
|
|
14468
|
-
reason?: string | undefined;
|
|
14469
|
-
} | {
|
|
14470
|
-
type: "message-metadata";
|
|
14471
|
-
messageMetadata: unknown;
|
|
14472
|
-
}>;
|
|
15009
|
+
declare const uiMessageChunkSchema: LazySchema<UIMessageChunk<unknown, UIDataTypes>>;
|
|
14473
15010
|
type DataUIMessageChunk<DATA_TYPES extends UIDataTypes> = ValueOf<{ [NAME in keyof DATA_TYPES & string]: {
|
|
14474
15011
|
type: `data-${NAME}`;
|
|
14475
15012
|
id?: string;
|
|
@@ -14909,8 +15446,9 @@ interface StreamTextResult<TOOLS extends ToolSet, RUNTIME_CONTEXT extends Contex
|
|
|
14909
15446
|
readonly providerMetadata: PromiseLike<ProviderMetadata | undefined>;
|
|
14910
15447
|
/**
|
|
14911
15448
|
* A text stream that returns only the generated text deltas. You can use it
|
|
14912
|
-
* as either an AsyncIterable or a ReadableStream.
|
|
14913
|
-
* stream
|
|
15449
|
+
* as either an AsyncIterable or a ReadableStream. Error parts are not
|
|
15450
|
+
* surfaced in this stream. Use the `onError` callback or `stream` to observe
|
|
15451
|
+
* them.
|
|
14914
15452
|
*/
|
|
14915
15453
|
readonly textStream: AsyncIterableStream<string>;
|
|
14916
15454
|
/**
|
|
@@ -14974,7 +15512,7 @@ interface StreamTextResult<TOOLS extends ToolSet, RUNTIME_CONTEXT extends Contex
|
|
|
14974
15512
|
* `pipeUIMessageStreamToResponse` helpers from `'ai'` with `result.stream`
|
|
14975
15513
|
* instead. This method will be removed in the next major release.
|
|
14976
15514
|
*/
|
|
14977
|
-
pipeUIMessageStreamToResponse<UI_MESSAGE extends UIMessage>(response: ServerResponse, options?: UIMessageStreamResponseInit & UIMessageStreamOptions<UI_MESSAGE>): void
|
|
15515
|
+
pipeUIMessageStreamToResponse<UI_MESSAGE extends UIMessage>(response: ServerResponse, options?: UIMessageStreamResponseInit & UIMessageStreamOptions<UI_MESSAGE>): Promise<void>;
|
|
14978
15516
|
/**
|
|
14979
15517
|
* Writes text delta output to a Node.js response-like object.
|
|
14980
15518
|
* It sets a `Content-Type` header to `text/plain; charset=utf-8` and
|
|
@@ -14987,7 +15525,7 @@ interface StreamTextResult<TOOLS extends ToolSet, RUNTIME_CONTEXT extends Contex
|
|
|
14987
15525
|
* `pipeTextStreamToResponse` helpers from `'ai'` with `result.stream`
|
|
14988
15526
|
* instead. This method will be removed in the next major release.
|
|
14989
15527
|
*/
|
|
14990
|
-
pipeTextStreamToResponse(response: ServerResponse, init?: ResponseInit): void
|
|
15528
|
+
pipeTextStreamToResponse(response: ServerResponse, init?: ResponseInit): Promise<void>;
|
|
14991
15529
|
/**
|
|
14992
15530
|
* Converts the result to a streamed response object with a stream data part stream.
|
|
14993
15531
|
*
|
|
@@ -15211,9 +15749,11 @@ type GenericToolApprovalFunction<TOOLS extends ToolSet, TOOLS_CONTEXT extends In
|
|
|
15211
15749
|
* In addition to the string statuses, you can also use object statuses with a reason property.
|
|
15212
15750
|
*/
|
|
15213
15751
|
type ToolApprovalConfiguration<TOOLS extends ToolSet, RUNTIME_CONTEXT extends Context$1 | unknown | never> = GenericToolApprovalFunction<TOOLS, InferToolSetContext<TOOLS>, RUNTIME_CONTEXT> | { [key in keyof TOOLS]?: ToolApprovalStatus | SingleToolApprovalFunction<InferToolInput<TOOLS[key]>, InferToolContext<TOOLS[key]>, RUNTIME_CONTEXT> };
|
|
15214
|
-
|
|
15752
|
+
type ToolCallerName<TOOLS extends ToolSet> = { [NAME in keyof TOOLS]: TOOLS[NAME] extends ToolCallerTool ? NAME : never }[keyof TOOLS] & string;
|
|
15753
|
+
type Experimental_ToolCallers<TOOLS extends ToolSet> = { [NAME in keyof TOOLS]?: ReadonlyArray<'AI_SDK_DIRECT_TOOL_CALL' | ToolCallerName<TOOLS>> };
|
|
15754
|
+
declare const symbol$l: unique symbol;
|
|
15215
15755
|
declare class InvalidToolInputError extends AISDKError {
|
|
15216
|
-
private readonly [symbol$
|
|
15756
|
+
private readonly [symbol$l];
|
|
15217
15757
|
readonly toolName: string;
|
|
15218
15758
|
readonly toolInput: string;
|
|
15219
15759
|
constructor({
|
|
@@ -15229,9 +15769,9 @@ declare class InvalidToolInputError extends AISDKError {
|
|
|
15229
15769
|
});
|
|
15230
15770
|
static isInstance(error: unknown): error is InvalidToolInputError;
|
|
15231
15771
|
}
|
|
15232
|
-
declare const symbol$
|
|
15772
|
+
declare const symbol$k: unique symbol;
|
|
15233
15773
|
declare class NoSuchToolError extends AISDKError {
|
|
15234
|
-
private readonly [symbol$
|
|
15774
|
+
private readonly [symbol$k];
|
|
15235
15775
|
readonly toolName: string;
|
|
15236
15776
|
readonly availableTools: string[] | undefined;
|
|
15237
15777
|
constructor({
|
|
@@ -15569,6 +16109,7 @@ declare function streamText<TOOLS extends ToolSet, RUNTIME_CONTEXT extends Conte
|
|
|
15569
16109
|
experimental_sandbox: sandbox,
|
|
15570
16110
|
output,
|
|
15571
16111
|
toolApproval,
|
|
16112
|
+
experimental_toolCallers,
|
|
15572
16113
|
experimental_toolApprovalSecret,
|
|
15573
16114
|
experimental_telemetry,
|
|
15574
16115
|
telemetry,
|
|
@@ -15576,7 +16117,8 @@ declare function streamText<TOOLS extends ToolSet, RUNTIME_CONTEXT extends Conte
|
|
|
15576
16117
|
providerOptions,
|
|
15577
16118
|
activeTools,
|
|
15578
16119
|
toolOrder,
|
|
15579
|
-
experimental_repairToolCall
|
|
16120
|
+
experimental_repairToolCall,
|
|
16121
|
+
repairToolCall,
|
|
15580
16122
|
experimental_refineToolInput: refineToolInput,
|
|
15581
16123
|
experimental_transform: transform,
|
|
15582
16124
|
experimental_download: download,
|
|
@@ -15674,6 +16216,10 @@ declare function streamText<TOOLS extends ToolSet, RUNTIME_CONTEXT extends Conte
|
|
|
15674
16216
|
* This configuration takes precedence over tool-defined approval settings.
|
|
15675
16217
|
*/
|
|
15676
16218
|
toolApproval?: ToolApprovalConfiguration<TOOLS, RUNTIME_CONTEXT>;
|
|
16219
|
+
/**
|
|
16220
|
+
* Configures which caller tools may invoke each tool.
|
|
16221
|
+
*/
|
|
16222
|
+
experimental_toolCallers?: Experimental_ToolCallers<NoInfer<TOOLS>>;
|
|
15677
16223
|
/**
|
|
15678
16224
|
* Secret for HMAC-signing tool approval requests. When set, the server
|
|
15679
16225
|
* signs each approval request at issuance and verifies the signature when
|
|
@@ -15695,6 +16241,12 @@ declare function streamText<TOOLS extends ToolSet, RUNTIME_CONTEXT extends Conte
|
|
|
15695
16241
|
/**
|
|
15696
16242
|
* A function that attempts to repair a tool call that failed to parse.
|
|
15697
16243
|
*/
|
|
16244
|
+
repairToolCall?: ToolCallRepairFunction<TOOLS>;
|
|
16245
|
+
/**
|
|
16246
|
+
* A function that attempts to repair a tool call that failed to parse.
|
|
16247
|
+
*
|
|
16248
|
+
* @deprecated Use `repairToolCall` instead.
|
|
16249
|
+
*/
|
|
15698
16250
|
experimental_repairToolCall?: ToolCallRepairFunction<TOOLS>;
|
|
15699
16251
|
/**
|
|
15700
16252
|
* Optional mapping of tool names to functions that refine parsed tool inputs.
|
|
@@ -16025,7 +16577,8 @@ type GenerateTextStartEvent<TOOLS extends ToolSet = ToolSet, RUNTIME_CONTEXT ext
|
|
|
16025
16577
|
readonly maxRetries: number;
|
|
16026
16578
|
/**
|
|
16027
16579
|
* Timeout configuration for the generation.
|
|
16028
|
-
* Can be a number (milliseconds) or an object with totalMs, stepMs,
|
|
16580
|
+
* Can be a number (milliseconds) or an object with totalMs, stepMs,
|
|
16581
|
+
* firstChunkMs (streaming only), chunkMs, toolMs, and per-tool overrides via tools.
|
|
16029
16582
|
*/
|
|
16030
16583
|
readonly timeout: TimeoutConfiguration<TOOLS> | undefined; /** Additional HTTP headers sent with the request. */
|
|
16031
16584
|
readonly headers: Record<string, string | undefined> | undefined; /** Additional provider-specific options. */
|
|
@@ -16303,7 +16856,7 @@ type RerankingModelCallEndEvent = {
|
|
|
16303
16856
|
}>;
|
|
16304
16857
|
};
|
|
16305
16858
|
declare const AI_SDK_TELEMETRY_TRACING_CHANNEL = "ai:telemetry";
|
|
16306
|
-
type TelemetryTracingEventType = 'generateText' | 'streamText' | 'step' | 'languageModelCall' | 'executeTool' | 'embed' | 'rerank';
|
|
16859
|
+
type TelemetryTracingEventType = 'generateText' | 'streamText' | 'step' | 'languageModelCall' | 'executeTool' | 'embed' | 'embedMany' | 'rerank';
|
|
16307
16860
|
type TelemetryTracingChannelMessage<EVENT = unknown> = {
|
|
16308
16861
|
readonly type: TelemetryTracingEventType;
|
|
16309
16862
|
readonly event: EVENT;
|
|
@@ -16494,7 +17047,9 @@ interface GenerateTextResult<TOOLS extends ToolSet, RUNTIME_CONTEXT extends Cont
|
|
|
16494
17047
|
*/
|
|
16495
17048
|
readonly content: Array<ContentPart<TOOLS>>;
|
|
16496
17049
|
/**
|
|
16497
|
-
* The text
|
|
17050
|
+
* The concatenation of all text parts generated in the final step.
|
|
17051
|
+
* It is an empty string if the final step contains no text parts.
|
|
17052
|
+
* Inspect `finalStep.content` to distinguish that case.
|
|
16498
17053
|
*/
|
|
16499
17054
|
readonly text: string;
|
|
16500
17055
|
/**
|
|
@@ -16602,8 +17157,10 @@ interface GenerateTextResult<TOOLS extends ToolSet, RUNTIME_CONTEXT extends Cont
|
|
|
16602
17157
|
*/
|
|
16603
17158
|
readonly finalStep: StepResult<TOOLS, RUNTIME_CONTEXT>;
|
|
16604
17159
|
/**
|
|
16605
|
-
* The generated
|
|
17160
|
+
* The generated output according to the `output` specification.
|
|
16606
17161
|
*
|
|
17162
|
+
* @throws {NoOutputGeneratedError} When no output is available, for example
|
|
17163
|
+
* when the final step does not finish with a `stop` reason.
|
|
16607
17164
|
*/
|
|
16608
17165
|
readonly output: InferCompleteOutput<OUTPUT>;
|
|
16609
17166
|
}
|
|
@@ -16646,7 +17203,10 @@ type AgentCallParameters<CALL_OPTIONS, TOOLS extends ToolSet = {}, RUNTIME_CONTE
|
|
|
16646
17203
|
*/
|
|
16647
17204
|
abortSignal?: AbortSignal;
|
|
16648
17205
|
/**
|
|
16649
|
-
* Timeout in milliseconds. Can be specified as a number or as an object
|
|
17206
|
+
* Timeout in milliseconds. Can be specified as a number or as an object
|
|
17207
|
+
* with total, per-step, first-content, inter-content, and tool timeouts.
|
|
17208
|
+
* First-content and inter-content timeouts are only enforced by streaming
|
|
17209
|
+
* calls.
|
|
16650
17210
|
*/
|
|
16651
17211
|
timeout?: TimeoutConfiguration<TOOLS>;
|
|
16652
17212
|
/**
|
|
@@ -16861,6 +17421,7 @@ declare function generateText<TOOLS extends ToolSet, RUNTIME_CONTEXT extends Con
|
|
|
16861
17421
|
experimental_sandbox: sandbox,
|
|
16862
17422
|
output,
|
|
16863
17423
|
toolApproval,
|
|
17424
|
+
experimental_toolCallers,
|
|
16864
17425
|
experimental_toolApprovalSecret,
|
|
16865
17426
|
experimental_telemetry,
|
|
16866
17427
|
telemetry,
|
|
@@ -16868,7 +17429,8 @@ declare function generateText<TOOLS extends ToolSet, RUNTIME_CONTEXT extends Con
|
|
|
16868
17429
|
activeTools,
|
|
16869
17430
|
toolOrder,
|
|
16870
17431
|
prepareStep,
|
|
16871
|
-
experimental_repairToolCall
|
|
17432
|
+
experimental_repairToolCall,
|
|
17433
|
+
repairToolCall,
|
|
16872
17434
|
experimental_refineToolInput: refineToolInput,
|
|
16873
17435
|
experimental_download: download,
|
|
16874
17436
|
runtimeContext,
|
|
@@ -16961,6 +17523,10 @@ declare function generateText<TOOLS extends ToolSet, RUNTIME_CONTEXT extends Con
|
|
|
16961
17523
|
* This configuration takes precedence over tool-defined approval settings.
|
|
16962
17524
|
*/
|
|
16963
17525
|
toolApproval?: ToolApprovalConfiguration<TOOLS, RUNTIME_CONTEXT>;
|
|
17526
|
+
/**
|
|
17527
|
+
* Configures which caller tools may invoke each tool.
|
|
17528
|
+
*/
|
|
17529
|
+
experimental_toolCallers?: Experimental_ToolCallers<NoInfer<TOOLS>>;
|
|
16964
17530
|
/**
|
|
16965
17531
|
* Secret for HMAC-signing tool approval requests. When set, the server
|
|
16966
17532
|
* signs each approval request at issuance and verifies the signature when
|
|
@@ -16980,6 +17546,12 @@ declare function generateText<TOOLS extends ToolSet, RUNTIME_CONTEXT extends Con
|
|
|
16980
17546
|
/**
|
|
16981
17547
|
* A function that attempts to repair a tool call that failed to parse.
|
|
16982
17548
|
*/
|
|
17549
|
+
repairToolCall?: ToolCallRepairFunction<NoInfer<TOOLS>>;
|
|
17550
|
+
/**
|
|
17551
|
+
* A function that attempts to repair a tool call that failed to parse.
|
|
17552
|
+
*
|
|
17553
|
+
* @deprecated Use `repairToolCall` instead.
|
|
17554
|
+
*/
|
|
16983
17555
|
experimental_repairToolCall?: ToolCallRepairFunction<NoInfer<TOOLS>>;
|
|
16984
17556
|
/**
|
|
16985
17557
|
* Optional mapping of tool names to functions that refine parsed tool inputs.
|
|
@@ -17174,6 +17746,10 @@ type ToolLoopAgentSettings<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, RUN
|
|
|
17174
17746
|
* This configuration takes precedence over tool-defined approval settings.
|
|
17175
17747
|
*/
|
|
17176
17748
|
toolApproval?: ToolApprovalConfiguration<NoInfer<TOOLS>, RUNTIME_CONTEXT>;
|
|
17749
|
+
/**
|
|
17750
|
+
* Configures which caller tools may invoke each tool.
|
|
17751
|
+
*/
|
|
17752
|
+
experimental_toolCallers?: Experimental_ToolCallers<NoInfer<TOOLS>>;
|
|
17177
17753
|
/**
|
|
17178
17754
|
* Optional function that you can use to provide different settings for a step.
|
|
17179
17755
|
*/
|
|
@@ -17181,6 +17757,12 @@ type ToolLoopAgentSettings<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, RUN
|
|
|
17181
17757
|
/**
|
|
17182
17758
|
* A function that attempts to repair a tool call that failed to parse.
|
|
17183
17759
|
*/
|
|
17760
|
+
repairToolCall?: ToolCallRepairFunction<NoInfer<TOOLS>>;
|
|
17761
|
+
/**
|
|
17762
|
+
* A function that attempts to repair a tool call that failed to parse.
|
|
17763
|
+
*
|
|
17764
|
+
* @deprecated Use `repairToolCall` instead.
|
|
17765
|
+
*/
|
|
17184
17766
|
experimental_repairToolCall?: ToolCallRepairFunction<NoInfer<TOOLS>>;
|
|
17185
17767
|
/**
|
|
17186
17768
|
* Optional mapping of tool names to functions that refine parsed tool inputs.
|
|
@@ -17284,9 +17866,9 @@ type ToolLoopAgentSettings<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, RUN
|
|
|
17284
17866
|
* }),
|
|
17285
17867
|
* ```
|
|
17286
17868
|
*/
|
|
17287
|
-
prepareCall?: (options: Omit<AgentCallParameters<CALL_OPTIONS, NoInfer<TOOLS>, NoInfer<RUNTIME_CONTEXT>>, 'onStepEnd' | 'onStepFinish'> & Pick<ToolLoopAgentSettings<CALL_OPTIONS, TOOLS, RUNTIME_CONTEXT, NoInfer<OUTPUT>>, 'model' | 'tools' | 'maxOutputTokens' | 'temperature' | 'topP' | 'topK' | 'presencePenalty' | 'frequencyPenalty' | 'stopSequences' | 'seed' | 'headers' | 'instructions' | 'allowSystemInMessages' | 'stopWhen' | 'telemetry' | 'experimental_telemetry' | 'activeTools' | 'toolOrder' | 'toolApproval' | 'providerOptions' | 'experimental_download' | 'experimental_refineToolInput' | 'include' | 'runtimeContext' | '_internal'> & {
|
|
17869
|
+
prepareCall?: (options: Omit<AgentCallParameters<CALL_OPTIONS, NoInfer<TOOLS>, NoInfer<RUNTIME_CONTEXT>>, 'abortSignal' | 'timeout' | 'onStart' | 'experimental_onStart' | 'onStepStart' | 'experimental_onStepStart' | 'onToolExecutionStart' | 'onToolExecutionEnd' | 'onStepEnd' | 'onStepFinish' | 'onEnd' | 'onFinish'> & Pick<ToolLoopAgentSettings<CALL_OPTIONS, TOOLS, RUNTIME_CONTEXT, NoInfer<OUTPUT>>, 'model' | 'tools' | 'toolChoice' | 'maxRetries' | 'maxOutputTokens' | 'temperature' | 'topP' | 'topK' | 'presencePenalty' | 'frequencyPenalty' | 'stopSequences' | 'seed' | 'reasoning' | 'headers' | 'instructions' | 'allowSystemInMessages' | 'stopWhen' | 'telemetry' | 'experimental_telemetry' | 'activeTools' | 'toolOrder' | 'toolApproval' | 'experimental_toolCallers' | 'prepareStep' | 'repairToolCall' | 'experimental_repairToolCall' | 'providerOptions' | 'experimental_download' | 'experimental_refineToolInput' | 'include' | 'runtimeContext' | '_internal'> & {
|
|
17288
17870
|
toolsContext: InferToolSetContext<TOOLS>;
|
|
17289
|
-
}) => MaybePromiseLike<Pick<ToolLoopAgentSettings<CALL_OPTIONS, TOOLS, RUNTIME_CONTEXT, NoInfer<OUTPUT>>, 'model' | 'tools' | 'maxOutputTokens' | 'temperature' | 'topP' | 'topK' | 'presencePenalty' | 'frequencyPenalty' | 'stopSequences' | 'seed' | 'headers' | 'instructions' | 'allowSystemInMessages' | 'stopWhen' | 'telemetry' | 'experimental_telemetry' | 'activeTools' | 'toolOrder' | 'toolApproval' | 'providerOptions' | 'experimental_download' | 'experimental_refineToolInput' | 'include' | 'runtimeContext' | '_internal'> & Omit<Prompt, 'system'> & {
|
|
17871
|
+
}) => MaybePromiseLike<Pick<ToolLoopAgentSettings<CALL_OPTIONS, TOOLS, RUNTIME_CONTEXT, NoInfer<OUTPUT>>, 'model' | 'tools' | 'toolChoice' | 'maxRetries' | 'maxOutputTokens' | 'temperature' | 'topP' | 'topK' | 'presencePenalty' | 'frequencyPenalty' | 'stopSequences' | 'seed' | 'reasoning' | 'headers' | 'instructions' | 'allowSystemInMessages' | 'stopWhen' | 'telemetry' | 'experimental_telemetry' | 'activeTools' | 'toolOrder' | 'toolApproval' | 'experimental_toolCallers' | 'prepareStep' | 'repairToolCall' | 'experimental_repairToolCall' | 'providerOptions' | 'experimental_download' | 'experimental_refineToolInput' | 'include' | 'runtimeContext' | '_internal'> & Omit<Prompt, 'system'> & {
|
|
17290
17872
|
toolsContext: InferToolSetContext<TOOLS>;
|
|
17291
17873
|
}>;
|
|
17292
17874
|
};
|
|
@@ -17515,6 +18097,7 @@ interface ChatTransport<UI_MESSAGE extends UIMessage> {
|
|
|
17515
18097
|
*
|
|
17516
18098
|
* @param options - Configuration object containing:
|
|
17517
18099
|
* @param options.chatId - Unique identifier for the chat session to reconnect to
|
|
18100
|
+
* @param options.abortSignal - Signal to abort the reconnection request if needed
|
|
17518
18101
|
* @param options.headers - Additional HTTP headers to include in the reconnection request
|
|
17519
18102
|
* @param options.body - Additional JSON properties to include in the request body
|
|
17520
18103
|
* @param options.metadata - Custom metadata to attach to the request
|
|
@@ -17526,7 +18109,8 @@ interface ChatTransport<UI_MESSAGE extends UIMessage> {
|
|
|
17526
18109
|
* @throws Error when the reconnection request fails or response is invalid
|
|
17527
18110
|
*/
|
|
17528
18111
|
reconnectToStream: (options: {
|
|
17529
|
-
/** Unique identifier for the chat session to reconnect to */chatId: string;
|
|
18112
|
+
/** Unique identifier for the chat session to reconnect to */chatId: string; /** Signal to abort the reconnection request if needed */
|
|
18113
|
+
abortSignal?: AbortSignal;
|
|
17530
18114
|
} & ChatRequestOptions) => Promise<ReadableStream<UIMessageChunk> | null>;
|
|
17531
18115
|
}
|
|
17532
18116
|
type CreateUIMessage<UI_MESSAGE extends UIMessage> = Omit<UI_MESSAGE, 'id' | 'role'> & {
|
|
@@ -17659,8 +18243,8 @@ interface ChatInit<UI_MESSAGE extends UIMessage> {
|
|
|
17659
18243
|
* Optional callback function that is invoked when a tool call is received.
|
|
17660
18244
|
* Intended for automatic client-side tool execution.
|
|
17661
18245
|
*
|
|
17662
|
-
*
|
|
17663
|
-
*
|
|
18246
|
+
* To add the tool output, call `addToolOutput` without awaiting it inside
|
|
18247
|
+
* this callback. The callback's return value is not used.
|
|
17664
18248
|
*/
|
|
17665
18249
|
onToolCall?: ChatOnToolCallCallback<UI_MESSAGE>;
|
|
17666
18250
|
/**
|
|
@@ -17693,7 +18277,9 @@ declare abstract class AbstractChat<UI_MESSAGE extends UIMessage> {
|
|
|
17693
18277
|
private onFinish?;
|
|
17694
18278
|
private onData?;
|
|
17695
18279
|
private sendAutomaticallyWhen?;
|
|
18280
|
+
private pendingMessagePreparations;
|
|
17696
18281
|
private activeResponse;
|
|
18282
|
+
private activeResumeRequest;
|
|
17697
18283
|
private jobExecutor;
|
|
17698
18284
|
constructor({
|
|
17699
18285
|
generateId,
|
|
@@ -17992,7 +18578,7 @@ declare class TextStreamChatTransport<UI_MESSAGE extends UIMessage> extends Http
|
|
|
17992
18578
|
constructor(options?: HttpChatTransportInitOptions<UI_MESSAGE>);
|
|
17993
18579
|
protected processResponseStream(stream: ReadableStream<Uint8Array<ArrayBufferLike>>): ReadableStream<UIMessageChunk>;
|
|
17994
18580
|
}
|
|
17995
|
-
type CompletionRequestOptions = {
|
|
18581
|
+
type CompletionRequestOptions<BODY extends object = object> = {
|
|
17996
18582
|
/**
|
|
17997
18583
|
* An optional object of headers to be passed to the API endpoint.
|
|
17998
18584
|
*/
|
|
@@ -18000,9 +18586,9 @@ type CompletionRequestOptions = {
|
|
|
18000
18586
|
/**
|
|
18001
18587
|
* An optional object to be passed to the API endpoint.
|
|
18002
18588
|
*/
|
|
18003
|
-
body?:
|
|
18589
|
+
body?: BODY;
|
|
18004
18590
|
};
|
|
18005
|
-
type UseCompletionOptions = {
|
|
18591
|
+
type UseCompletionOptions<BODY extends object = object> = {
|
|
18006
18592
|
/**
|
|
18007
18593
|
* The API endpoint that accepts a `{ prompt: string }` object and returns
|
|
18008
18594
|
* a stream of tokens of the AI completion response. Defaults to `/api/completion`.
|
|
@@ -18052,7 +18638,7 @@ type UseCompletionOptions = {
|
|
|
18052
18638
|
* })
|
|
18053
18639
|
* ```
|
|
18054
18640
|
*/
|
|
18055
|
-
body?:
|
|
18641
|
+
body?: BODY;
|
|
18056
18642
|
/**
|
|
18057
18643
|
* Streaming protocol that is used. Defaults to `data`.
|
|
18058
18644
|
*/
|
|
@@ -18211,6 +18797,7 @@ declare class JsonToSseTransformStream extends TransformStream<unknown, string>
|
|
|
18211
18797
|
* @param options.headers - Additional HTTP headers to include in the response.
|
|
18212
18798
|
* @param options.stream - The UI message chunk stream to send.
|
|
18213
18799
|
* @param options.consumeSseStream - Optional callback to consume a copy of the SSE stream independently.
|
|
18800
|
+
* @returns A promise that resolves when the stream has been written.
|
|
18214
18801
|
*/
|
|
18215
18802
|
declare function pipeUIMessageStreamToResponse({
|
|
18216
18803
|
response,
|
|
@@ -18222,7 +18809,7 @@ declare function pipeUIMessageStreamToResponse({
|
|
|
18222
18809
|
}: {
|
|
18223
18810
|
response: ServerResponse;
|
|
18224
18811
|
stream: ReadableStream<UIMessageChunk>;
|
|
18225
|
-
} & UIMessageStreamResponseInit): void
|
|
18812
|
+
} & UIMessageStreamResponseInit): Promise<void>;
|
|
18226
18813
|
/**
|
|
18227
18814
|
* Transforms a stream of `UIMessageChunk`s into an `AsyncIterableStream` of `UIMessage`s.
|
|
18228
18815
|
*
|
|
@@ -18381,6 +18968,145 @@ declare function pipeAgentUIStreamToResponse<CALL_OPTIONS = never, TOOLS extends
|
|
|
18381
18968
|
onStepEnd?: GenerateTextOnStepEndCallback<TOOLS>; /** @deprecated Use `onStepEnd` instead. */
|
|
18382
18969
|
onStepFinish?: GenerateTextOnStepFinishCallback<TOOLS>;
|
|
18383
18970
|
} & UIMessageStreamResponseInit & UIMessageStreamOptions<UIMessage<MESSAGE_METADATA, never, InferUITools<TOOLS>>>): Promise<void>;
|
|
18971
|
+
/**
|
|
18972
|
+
* Language model input that can be used for durable batch processing.
|
|
18973
|
+
*
|
|
18974
|
+
* String model IDs are resolved through the global provider and checked for
|
|
18975
|
+
* batch support at runtime.
|
|
18976
|
+
*/
|
|
18977
|
+
type BatchLanguageModel = GlobalProviderModelId | BatchLanguageModelV4;
|
|
18978
|
+
/**
|
|
18979
|
+
* The persisted reference for a text batch.
|
|
18980
|
+
*/
|
|
18981
|
+
type TextBatchReference = {
|
|
18982
|
+
readonly version: 1;
|
|
18983
|
+
readonly type: 'text';
|
|
18984
|
+
readonly id: string;
|
|
18985
|
+
readonly provider: string;
|
|
18986
|
+
readonly modelId: string;
|
|
18987
|
+
};
|
|
18988
|
+
/**
|
|
18989
|
+
* Persisted reference for any supported batch type.
|
|
18990
|
+
*
|
|
18991
|
+
* Additional modality-specific references can be added to this union.
|
|
18992
|
+
*/
|
|
18993
|
+
type BatchReference = TextBatchReference;
|
|
18994
|
+
/**
|
|
18995
|
+
* Serializable error information for a batch or batch item.
|
|
18996
|
+
*/
|
|
18997
|
+
type BatchError = BatchV4Error;
|
|
18998
|
+
/**
|
|
18999
|
+
* The latest normalized lifecycle status for a batch.
|
|
19000
|
+
*/
|
|
19001
|
+
type BatchStatus = BatchV4Status;
|
|
19002
|
+
/**
|
|
19003
|
+
* A text batch and its latest normalized lifecycle status.
|
|
19004
|
+
*/
|
|
19005
|
+
type TextBatch = TextBatchReference & BatchStatus;
|
|
19006
|
+
/**
|
|
19007
|
+
* One text generation request within a batch.
|
|
19008
|
+
*/
|
|
19009
|
+
type TextBatchRequest = Prompt & LanguageModelCallOptions & {
|
|
19010
|
+
id: string;
|
|
19011
|
+
providerOptions?: ProviderOptions;
|
|
19012
|
+
};
|
|
19013
|
+
type BatchRequestOptions = {
|
|
19014
|
+
abortSignal?: AbortSignal;
|
|
19015
|
+
headers?: Record<string, string | undefined>;
|
|
19016
|
+
timeout?: number | {
|
|
19017
|
+
totalMs?: number;
|
|
19018
|
+
};
|
|
19019
|
+
};
|
|
19020
|
+
/**
|
|
19021
|
+
* Options for starting a text batch.
|
|
19022
|
+
*/
|
|
19023
|
+
type StartTextBatchOptions = {
|
|
19024
|
+
model: BatchLanguageModel;
|
|
19025
|
+
requests: ReadonlyArray<TextBatchRequest>;
|
|
19026
|
+
providerOptions?: ProviderOptions;
|
|
19027
|
+
} & BatchRequestOptions;
|
|
19028
|
+
/**
|
|
19029
|
+
* The acknowledged text batch and warnings produced while starting it.
|
|
19030
|
+
*/
|
|
19031
|
+
type StartTextBatchResult = TextBatch & {
|
|
19032
|
+
readonly warnings: BatchV4StartResult['warnings'];
|
|
19033
|
+
};
|
|
19034
|
+
/**
|
|
19035
|
+
* Options shared by batch status and result retrieval operations.
|
|
19036
|
+
*/
|
|
19037
|
+
type BatchOperationOptions = {
|
|
19038
|
+
model: BatchLanguageModel;
|
|
19039
|
+
batch: BatchReference;
|
|
19040
|
+
providerOptions?: ProviderOptions;
|
|
19041
|
+
maxRetries?: number;
|
|
19042
|
+
} & BatchRequestOptions;
|
|
19043
|
+
/**
|
|
19044
|
+
* A normalized result for a successful text batch item.
|
|
19045
|
+
*/
|
|
19046
|
+
type TextBatchGenerationResult = {
|
|
19047
|
+
readonly text: string;
|
|
19048
|
+
readonly finishReason: FinishReason;
|
|
19049
|
+
readonly rawFinishReason?: string;
|
|
19050
|
+
readonly usage: LanguageModelUsage;
|
|
19051
|
+
readonly response?: {
|
|
19052
|
+
readonly id?: string;
|
|
19053
|
+
readonly timestamp?: string;
|
|
19054
|
+
readonly modelId?: string;
|
|
19055
|
+
};
|
|
19056
|
+
readonly providerMetadata?: ProviderMetadata;
|
|
19057
|
+
};
|
|
19058
|
+
/**
|
|
19059
|
+
* A complete terminal result for one request in a text batch.
|
|
19060
|
+
*/
|
|
19061
|
+
type TextBatchItemResult = (TextBatchGenerationResult & {
|
|
19062
|
+
readonly id: string;
|
|
19063
|
+
readonly status: 'succeeded';
|
|
19064
|
+
}) | {
|
|
19065
|
+
readonly id: string;
|
|
19066
|
+
readonly status: 'failed';
|
|
19067
|
+
readonly error: BatchError;
|
|
19068
|
+
readonly providerMetadata?: ProviderMetadata;
|
|
19069
|
+
} | {
|
|
19070
|
+
readonly id: string;
|
|
19071
|
+
readonly status: 'cancelled' | 'expired';
|
|
19072
|
+
readonly error?: BatchError;
|
|
19073
|
+
readonly providerMetadata?: ProviderMetadata;
|
|
19074
|
+
};
|
|
19075
|
+
/**
|
|
19076
|
+
* Starts a durable text-generation batch.
|
|
19077
|
+
*/
|
|
19078
|
+
declare function startTextBatch({
|
|
19079
|
+
model: modelArg,
|
|
19080
|
+
requests,
|
|
19081
|
+
providerOptions,
|
|
19082
|
+
abortSignal,
|
|
19083
|
+
headers,
|
|
19084
|
+
timeout
|
|
19085
|
+
}: StartTextBatchOptions): Promise<StartTextBatchResult>;
|
|
19086
|
+
/**
|
|
19087
|
+
* Retrieves the latest normalized status for a durable batch.
|
|
19088
|
+
*/
|
|
19089
|
+
declare function getBatchStatus({
|
|
19090
|
+
model: modelArg,
|
|
19091
|
+
batch,
|
|
19092
|
+
providerOptions,
|
|
19093
|
+
maxRetries,
|
|
19094
|
+
abortSignal,
|
|
19095
|
+
headers,
|
|
19096
|
+
timeout
|
|
19097
|
+
}: BatchOperationOptions): Promise<BatchStatus>;
|
|
19098
|
+
/**
|
|
19099
|
+
* Streams complete terminal results for the requests in a durable batch.
|
|
19100
|
+
*/
|
|
19101
|
+
declare function getBatchResults({
|
|
19102
|
+
model: modelArg,
|
|
19103
|
+
batch,
|
|
19104
|
+
providerOptions,
|
|
19105
|
+
maxRetries,
|
|
19106
|
+
abortSignal,
|
|
19107
|
+
headers,
|
|
19108
|
+
timeout
|
|
19109
|
+
}: BatchOperationOptions): AsyncIterableStream<TextBatchItemResult>;
|
|
18384
19110
|
/**
|
|
18385
19111
|
* The result of an `embed` call.
|
|
18386
19112
|
* It contains the embedding, the value, and additional information.
|
|
@@ -18682,9 +19408,9 @@ declare function embedMany({
|
|
|
18682
19408
|
generateCallId?: () => string;
|
|
18683
19409
|
};
|
|
18684
19410
|
}): Promise<EmbedManyResult>;
|
|
18685
|
-
declare const symbol$
|
|
19411
|
+
declare const symbol$j: unique symbol;
|
|
18686
19412
|
declare class InvalidArgumentError extends AISDKError {
|
|
18687
|
-
private readonly [symbol$
|
|
19413
|
+
private readonly [symbol$j];
|
|
18688
19414
|
readonly parameter: string;
|
|
18689
19415
|
readonly value: unknown;
|
|
18690
19416
|
constructor({
|
|
@@ -18862,9 +19588,9 @@ declare function streamLanguageModelCall<TOOLS extends ToolSet, OUTPUT extends O
|
|
|
18862
19588
|
headers?: SharedV4Headers;
|
|
18863
19589
|
};
|
|
18864
19590
|
}>;
|
|
18865
|
-
declare const symbol$
|
|
19591
|
+
declare const symbol$i: unique symbol;
|
|
18866
19592
|
declare class InvalidStreamPartError extends AISDKError {
|
|
18867
|
-
private readonly [symbol$
|
|
19593
|
+
private readonly [symbol$i];
|
|
18868
19594
|
readonly chunk: LanguageModelStreamPart<any>;
|
|
18869
19595
|
constructor({
|
|
18870
19596
|
chunk,
|
|
@@ -18875,9 +19601,9 @@ declare class InvalidStreamPartError extends AISDKError {
|
|
|
18875
19601
|
});
|
|
18876
19602
|
static isInstance(error: unknown): error is InvalidStreamPartError;
|
|
18877
19603
|
}
|
|
18878
|
-
declare const symbol$
|
|
19604
|
+
declare const symbol$h: unique symbol;
|
|
18879
19605
|
declare class InvalidToolApprovalError extends AISDKError {
|
|
18880
|
-
private readonly [symbol$
|
|
19606
|
+
private readonly [symbol$h];
|
|
18881
19607
|
readonly approvalId: string;
|
|
18882
19608
|
constructor({
|
|
18883
19609
|
approvalId
|
|
@@ -18886,9 +19612,9 @@ declare class InvalidToolApprovalError extends AISDKError {
|
|
|
18886
19612
|
});
|
|
18887
19613
|
static isInstance(error: unknown): error is InvalidToolApprovalError;
|
|
18888
19614
|
}
|
|
18889
|
-
declare const symbol$
|
|
19615
|
+
declare const symbol$g: unique symbol;
|
|
18890
19616
|
declare class InvalidToolApprovalSignatureError extends AISDKError {
|
|
18891
|
-
private readonly [symbol$
|
|
19617
|
+
private readonly [symbol$g];
|
|
18892
19618
|
readonly approvalId: string;
|
|
18893
19619
|
readonly toolCallId: string;
|
|
18894
19620
|
constructor({
|
|
@@ -18902,9 +19628,9 @@ declare class InvalidToolApprovalSignatureError extends AISDKError {
|
|
|
18902
19628
|
});
|
|
18903
19629
|
static isInstance(error: unknown): error is InvalidToolApprovalSignatureError;
|
|
18904
19630
|
}
|
|
18905
|
-
declare const symbol$
|
|
19631
|
+
declare const symbol$f: unique symbol;
|
|
18906
19632
|
declare class ToolCallNotFoundForApprovalError extends AISDKError {
|
|
18907
|
-
private readonly [symbol$
|
|
19633
|
+
private readonly [symbol$f];
|
|
18908
19634
|
readonly toolCallId: string;
|
|
18909
19635
|
readonly approvalId: string;
|
|
18910
19636
|
constructor({
|
|
@@ -18916,9 +19642,9 @@ declare class ToolCallNotFoundForApprovalError extends AISDKError {
|
|
|
18916
19642
|
});
|
|
18917
19643
|
static isInstance(error: unknown): error is ToolCallNotFoundForApprovalError;
|
|
18918
19644
|
}
|
|
18919
|
-
declare const symbol$
|
|
19645
|
+
declare const symbol$e: unique symbol;
|
|
18920
19646
|
declare class MissingToolResultsError extends AISDKError {
|
|
18921
|
-
private readonly [symbol$
|
|
19647
|
+
private readonly [symbol$e];
|
|
18922
19648
|
readonly toolCallIds: string[];
|
|
18923
19649
|
constructor({
|
|
18924
19650
|
toolCallIds
|
|
@@ -18927,7 +19653,7 @@ declare class MissingToolResultsError extends AISDKError {
|
|
|
18927
19653
|
});
|
|
18928
19654
|
static isInstance(error: unknown): error is MissingToolResultsError;
|
|
18929
19655
|
}
|
|
18930
|
-
declare const symbol$
|
|
19656
|
+
declare const symbol$d: unique symbol;
|
|
18931
19657
|
/**
|
|
18932
19658
|
* Thrown when no image could be generated. This can have multiple causes:
|
|
18933
19659
|
*
|
|
@@ -18935,7 +19661,7 @@ declare const symbol$c: unique symbol;
|
|
|
18935
19661
|
* - The model generated a response that could not be parsed.
|
|
18936
19662
|
*/
|
|
18937
19663
|
declare class NoImageGeneratedError extends AISDKError {
|
|
18938
|
-
private readonly [symbol$
|
|
19664
|
+
private readonly [symbol$d];
|
|
18939
19665
|
/**
|
|
18940
19666
|
* The response metadata for each call.
|
|
18941
19667
|
*/
|
|
@@ -18951,7 +19677,7 @@ declare class NoImageGeneratedError extends AISDKError {
|
|
|
18951
19677
|
});
|
|
18952
19678
|
static isInstance(error: unknown): error is NoImageGeneratedError;
|
|
18953
19679
|
}
|
|
18954
|
-
declare const symbol$
|
|
19680
|
+
declare const symbol$c: unique symbol;
|
|
18955
19681
|
/**
|
|
18956
19682
|
* Thrown when no object could be generated. This can have several causes:
|
|
18957
19683
|
*
|
|
@@ -18964,7 +19690,7 @@ declare const symbol$b: unique symbol;
|
|
|
18964
19690
|
* - `text`: The text that was generated by the model. This can be the raw text or the tool call text, depending on the model.
|
|
18965
19691
|
*/
|
|
18966
19692
|
declare class NoObjectGeneratedError extends AISDKError {
|
|
18967
|
-
private readonly [symbol$
|
|
19693
|
+
private readonly [symbol$c];
|
|
18968
19694
|
/**
|
|
18969
19695
|
* The text that was generated by the model. This can be the raw text or the tool call text, depending on the model.
|
|
18970
19696
|
*/
|
|
@@ -18998,12 +19724,12 @@ declare class NoObjectGeneratedError extends AISDKError {
|
|
|
18998
19724
|
});
|
|
18999
19725
|
static isInstance(error: unknown): error is NoObjectGeneratedError;
|
|
19000
19726
|
}
|
|
19001
|
-
declare const symbol$
|
|
19727
|
+
declare const symbol$b: unique symbol;
|
|
19002
19728
|
/**
|
|
19003
19729
|
* Thrown when no LLM output was generated, e.g. because of errors.
|
|
19004
19730
|
*/
|
|
19005
19731
|
declare class NoOutputGeneratedError extends AISDKError {
|
|
19006
|
-
private readonly [symbol$
|
|
19732
|
+
private readonly [symbol$b];
|
|
19007
19733
|
constructor({
|
|
19008
19734
|
message,
|
|
19009
19735
|
cause
|
|
@@ -19013,30 +19739,62 @@ declare class NoOutputGeneratedError extends AISDKError {
|
|
|
19013
19739
|
});
|
|
19014
19740
|
static isInstance(error: unknown): error is NoOutputGeneratedError;
|
|
19015
19741
|
}
|
|
19016
|
-
declare const symbol$
|
|
19742
|
+
declare const symbol$a: unique symbol;
|
|
19017
19743
|
/**
|
|
19018
19744
|
* Error that is thrown when no speech audio was generated.
|
|
19019
19745
|
*/
|
|
19020
19746
|
declare class NoSpeechGeneratedError extends AISDKError {
|
|
19021
|
-
private readonly [symbol$
|
|
19747
|
+
private readonly [symbol$a];
|
|
19022
19748
|
readonly responses: Array<SpeechModelResponseMetadata>;
|
|
19023
19749
|
constructor(options: {
|
|
19024
19750
|
responses: Array<SpeechModelResponseMetadata>;
|
|
19025
19751
|
});
|
|
19026
19752
|
static isInstance(error: unknown): error is NoSpeechGeneratedError;
|
|
19027
19753
|
}
|
|
19028
|
-
declare const symbol$
|
|
19754
|
+
declare const symbol$9: unique symbol;
|
|
19029
19755
|
/**
|
|
19030
19756
|
* Error that is thrown when no transcript was generated.
|
|
19031
19757
|
*/
|
|
19032
19758
|
declare class NoTranscriptGeneratedError extends AISDKError {
|
|
19033
|
-
private readonly [symbol$
|
|
19759
|
+
private readonly [symbol$9];
|
|
19034
19760
|
readonly responses: Array<TranscriptionModelResponseMetadata>;
|
|
19035
19761
|
constructor(options: {
|
|
19036
19762
|
responses: Array<TranscriptionModelResponseMetadata>;
|
|
19037
19763
|
});
|
|
19038
19764
|
static isInstance(error: unknown): error is NoTranscriptGeneratedError;
|
|
19039
19765
|
}
|
|
19766
|
+
/**
|
|
19767
|
+
* Response metadata for speech translation model calls.
|
|
19768
|
+
*
|
|
19769
|
+
* Experimental: part of the experimental speech translation modality and may
|
|
19770
|
+
* change in patch releases.
|
|
19771
|
+
*/
|
|
19772
|
+
type SpeechTranslationModelResponseMetadata = {
|
|
19773
|
+
/**
|
|
19774
|
+
* Timestamp for the start of the generated response.
|
|
19775
|
+
*/
|
|
19776
|
+
timestamp: Date;
|
|
19777
|
+
/**
|
|
19778
|
+
* The ID of the response model that was used to generate the response.
|
|
19779
|
+
*/
|
|
19780
|
+
modelId: string;
|
|
19781
|
+
/**
|
|
19782
|
+
* Response headers.
|
|
19783
|
+
*/
|
|
19784
|
+
headers?: Record<string, string>;
|
|
19785
|
+
};
|
|
19786
|
+
declare const symbol$8: unique symbol;
|
|
19787
|
+
/**
|
|
19788
|
+
* Error that is thrown when no translation was generated.
|
|
19789
|
+
*/
|
|
19790
|
+
declare class NoTranslationGeneratedError extends AISDKError {
|
|
19791
|
+
private readonly [symbol$8];
|
|
19792
|
+
readonly response: SpeechTranslationModelResponseMetadata;
|
|
19793
|
+
constructor(options: {
|
|
19794
|
+
response: SpeechTranslationModelResponseMetadata;
|
|
19795
|
+
});
|
|
19796
|
+
static isInstance(error: unknown): error is NoTranslationGeneratedError;
|
|
19797
|
+
}
|
|
19040
19798
|
/**
|
|
19041
19799
|
* Response metadata for a video model call.
|
|
19042
19800
|
*/
|
|
@@ -19282,6 +20040,27 @@ declare function smoothStream<TOOLS extends ToolSet>({
|
|
|
19282
20040
|
}): (options: {
|
|
19283
20041
|
tools: TOOLS;
|
|
19284
20042
|
}) => TransformStream<TextStreamPart<TOOLS>, TextStreamPart<TOOLS>>;
|
|
20043
|
+
/**
|
|
20044
|
+
* Fingerprint the server-controlled, security-relevant fields of each tool in a
|
|
20045
|
+
* `ToolSet`: `description` (string form only), the resolved input JSON schema,
|
|
20046
|
+
* and `title`. Returns a map of tool name to a stable digest.
|
|
20047
|
+
*
|
|
20048
|
+
* Capture a baseline at trust time (first connect, human-reviewed) and compare
|
|
20049
|
+
* later fetches with {@link detectToolDrift} to catch MCP tool-definition drift
|
|
20050
|
+
* ("rug pull"). Baseline storage and the drift response are the app's concern.
|
|
20051
|
+
*/
|
|
20052
|
+
declare function fingerprintTools(tools: ToolSet): Promise<Record<string, string>>;
|
|
20053
|
+
/**
|
|
20054
|
+
* Pure diff of two fingerprint maps produced by {@link fingerprintTools}.
|
|
20055
|
+
* `added`/`removed` are tools present in only one map; `changed` are tools whose
|
|
20056
|
+
* pinned definition differs. Uses own-property lookups so a tool literally named
|
|
20057
|
+
* `constructor` or `toString` diffs correctly.
|
|
20058
|
+
*/
|
|
20059
|
+
declare function detectToolDrift(current: Record<string, string>, baseline: Record<string, string>): {
|
|
20060
|
+
added: string[];
|
|
20061
|
+
removed: string[];
|
|
20062
|
+
changed: string[];
|
|
20063
|
+
};
|
|
19285
20064
|
/**
|
|
19286
20065
|
* The result of a `generateImage` call.
|
|
19287
20066
|
* It contains the images and additional information.
|
|
@@ -19515,8 +20294,9 @@ type RepairTextFunction = (options: {
|
|
|
19515
20294
|
* - 'enum': The output is an enum.
|
|
19516
20295
|
* - 'no-schema': The output is not a schema.
|
|
19517
20296
|
*
|
|
19518
|
-
* @param
|
|
20297
|
+
* @param repairText - A function that attempts to repair the raw output of the model
|
|
19519
20298
|
* to enable JSON parsing.
|
|
20299
|
+
* @param experimental_repairText - Deprecated alias for `repairText`.
|
|
19520
20300
|
*
|
|
19521
20301
|
* @param telemetry - Optional telemetry configuration.
|
|
19522
20302
|
*
|
|
@@ -19570,6 +20350,13 @@ declare function generateObject<SCHEMA extends FlexibleSchema<unknown> = Flexibl
|
|
|
19570
20350
|
* A function that attempts to repair the raw output of the model
|
|
19571
20351
|
* to enable JSON parsing.
|
|
19572
20352
|
*/
|
|
20353
|
+
repairText?: RepairTextFunction;
|
|
20354
|
+
/**
|
|
20355
|
+
* A function that attempts to repair the raw output of the model
|
|
20356
|
+
* to enable JSON parsing.
|
|
20357
|
+
*
|
|
20358
|
+
* @deprecated Use `repairText` instead.
|
|
20359
|
+
*/
|
|
19573
20360
|
experimental_repairText?: RepairTextFunction;
|
|
19574
20361
|
/**
|
|
19575
20362
|
* Optional telemetry configuration.
|
|
@@ -19656,10 +20443,12 @@ declare function generateObject<SCHEMA extends FlexibleSchema<unknown> = Flexibl
|
|
|
19656
20443
|
*/
|
|
19657
20444
|
declare function consumeStream({
|
|
19658
20445
|
stream,
|
|
19659
|
-
onError
|
|
20446
|
+
onError,
|
|
20447
|
+
abortSignal
|
|
19660
20448
|
}: {
|
|
19661
20449
|
stream: ReadableStream;
|
|
19662
20450
|
onError?: (error: unknown) => void;
|
|
20451
|
+
abortSignal?: AbortSignal;
|
|
19663
20452
|
}): Promise<void>;
|
|
19664
20453
|
/**
|
|
19665
20454
|
* Calculates the cosine similarity between two vectors. This is a useful metric for
|
|
@@ -19802,7 +20591,7 @@ interface StreamObjectResult<PARTIAL, RESULT, ELEMENT_STREAM> {
|
|
|
19802
20591
|
* @param response A Node.js response-like object (ServerResponse).
|
|
19803
20592
|
* @param init Optional headers, status code, and status text.
|
|
19804
20593
|
*/
|
|
19805
|
-
pipeTextStreamToResponse(response: ServerResponse$1, init?: ResponseInit): void
|
|
20594
|
+
pipeTextStreamToResponse(response: ServerResponse$1, init?: ResponseInit): Promise<void>;
|
|
19806
20595
|
/**
|
|
19807
20596
|
* Creates a simple text stream response.
|
|
19808
20597
|
* The response has a `Content-Type` header set to `text/plain; charset=utf-8`.
|
|
@@ -19922,6 +20711,10 @@ type StreamObjectOnFinishCallback<RESULT> = (event: {
|
|
|
19922
20711
|
* - 'enum': The output is an enum.
|
|
19923
20712
|
* - 'no-schema': The output is not a schema.
|
|
19924
20713
|
*
|
|
20714
|
+
* @param repairText - A function that attempts to repair the raw output of the model
|
|
20715
|
+
* to enable JSON parsing.
|
|
20716
|
+
* @param experimental_repairText - Deprecated alias for `repairText`.
|
|
20717
|
+
*
|
|
19925
20718
|
* @param telemetry - Optional telemetry configuration.
|
|
19926
20719
|
*
|
|
19927
20720
|
* @param providerOptions - Additional provider-specific options. They are passed through
|
|
@@ -19966,6 +20759,13 @@ declare function streamObject<SCHEMA extends FlexibleSchema<unknown> = FlexibleS
|
|
|
19966
20759
|
* A function that attempts to repair the raw output of the model
|
|
19967
20760
|
* to enable JSON parsing.
|
|
19968
20761
|
*/
|
|
20762
|
+
repairText?: RepairTextFunction;
|
|
20763
|
+
/**
|
|
20764
|
+
* A function that attempts to repair the raw output of the model
|
|
20765
|
+
* to enable JSON parsing.
|
|
20766
|
+
*
|
|
20767
|
+
* @deprecated Use `repairText` instead.
|
|
20768
|
+
*/
|
|
19969
20769
|
experimental_repairText?: RepairTextFunction;
|
|
19970
20770
|
/**
|
|
19971
20771
|
* Optional telemetry configuration.
|
|
@@ -20208,6 +21008,47 @@ type GenerateVideoPrompt = string | {
|
|
|
20208
21008
|
image: DataContent;
|
|
20209
21009
|
text?: string;
|
|
20210
21010
|
};
|
|
21011
|
+
/**
|
|
21012
|
+
* Polling configuration for models that support the asynchronous
|
|
21013
|
+
* start/status flow.
|
|
21014
|
+
*
|
|
21015
|
+
* When used with `webhook`, `timeoutMs` also limits how long the SDK waits for
|
|
21016
|
+
* the webhook notification. If the model does not support webhooks, these
|
|
21017
|
+
* options configure the automatic polling fallback.
|
|
21018
|
+
*/
|
|
21019
|
+
type GenerateVideoPollOptions = {
|
|
21020
|
+
/**
|
|
21021
|
+
* Interval between status checks in milliseconds.
|
|
21022
|
+
*
|
|
21023
|
+
* @default 5000
|
|
21024
|
+
*/
|
|
21025
|
+
intervalMs?: number;
|
|
21026
|
+
/**
|
|
21027
|
+
* Maximum time to wait for completion in milliseconds.
|
|
21028
|
+
*
|
|
21029
|
+
* @default 600000 (10 minutes)
|
|
21030
|
+
*/
|
|
21031
|
+
timeoutMs?: number;
|
|
21032
|
+
/**
|
|
21033
|
+
* Custom delay implementation for polling intervals and webhook timeouts.
|
|
21034
|
+
* This can be used with durable workflow sleep functions.
|
|
21035
|
+
*
|
|
21036
|
+
* @default the built-in timer-based delay
|
|
21037
|
+
*/
|
|
21038
|
+
delay?: (delayInMs: number, options?: {
|
|
21039
|
+
abortSignal?: AbortSignal;
|
|
21040
|
+
}) => PromiseLike<void>;
|
|
21041
|
+
};
|
|
21042
|
+
/**
|
|
21043
|
+
* Webhook factory for models that support the asynchronous start/status flow.
|
|
21044
|
+
*
|
|
21045
|
+
* The factory should return a URL for the provider to send notifications to,
|
|
21046
|
+
* and a `received` promise that resolves when the notification arrives.
|
|
21047
|
+
*/
|
|
21048
|
+
type GenerateVideoWebhookFactory = () => PromiseLike<{
|
|
21049
|
+
url: string;
|
|
21050
|
+
received: PromiseLike<VideoModelV4OperationWebhook>;
|
|
21051
|
+
}>;
|
|
20211
21052
|
declare function experimental_generateVideo({
|
|
20212
21053
|
model: modelArg,
|
|
20213
21054
|
prompt: promptArg,
|
|
@@ -20225,7 +21066,9 @@ declare function experimental_generateVideo({
|
|
|
20225
21066
|
maxRetries: maxRetriesArg,
|
|
20226
21067
|
abortSignal,
|
|
20227
21068
|
headers,
|
|
20228
|
-
download: downloadFn
|
|
21069
|
+
download: downloadFn,
|
|
21070
|
+
poll,
|
|
21071
|
+
webhook
|
|
20229
21072
|
}: {
|
|
20230
21073
|
/**
|
|
20231
21074
|
* The video model to use.
|
|
@@ -20244,11 +21087,12 @@ declare function experimental_generateVideo({
|
|
|
20244
21087
|
*/
|
|
20245
21088
|
maxVideosPerCall?: number;
|
|
20246
21089
|
/**
|
|
20247
|
-
* Aspect ratio of the videos to generate. Must have the format
|
|
21090
|
+
* Aspect ratio of the videos to generate. Must have the format
|
|
21091
|
+
* `{width}:{height}`, or `'adaptive'` to inherit the ratio from the input media.
|
|
20248
21092
|
*/
|
|
20249
|
-
aspectRatio?: `${number}:${number}
|
|
21093
|
+
aspectRatio?: `${number}:${number}` | 'adaptive';
|
|
20250
21094
|
/**
|
|
20251
|
-
* Resolution of the videos to generate. Must have the format `{width}x{height}`.
|
|
21095
|
+
* Resolution of the videos to generate. Must have the format `{width}x${height}`.
|
|
20252
21096
|
*/
|
|
20253
21097
|
resolution?: `${number}x${number}`;
|
|
20254
21098
|
/**
|
|
@@ -20277,9 +21121,22 @@ declare function experimental_generateVideo({
|
|
|
20277
21121
|
frameType: VideoModelV4FrameType;
|
|
20278
21122
|
}>;
|
|
20279
21123
|
/**
|
|
20280
|
-
* Reference
|
|
21124
|
+
* Reference inputs for reference-to-video generation.
|
|
21125
|
+
*
|
|
21126
|
+
* Each entry may be a plain image/video ({@link DataContent}), or an object
|
|
21127
|
+
* form that carries an explicit `mediaType`.
|
|
20281
21128
|
*/
|
|
20282
|
-
inputReferences?: Array<DataContent
|
|
21129
|
+
inputReferences?: Array<DataContent | {
|
|
21130
|
+
/**
|
|
21131
|
+
* The reference image or video.
|
|
21132
|
+
*/
|
|
21133
|
+
data: DataContent;
|
|
21134
|
+
/**
|
|
21135
|
+
* The media type of the reference (e.g. 'image/png',
|
|
21136
|
+
* 'video/mp4').
|
|
21137
|
+
*/
|
|
21138
|
+
mediaType?: string;
|
|
21139
|
+
}>;
|
|
20283
21140
|
/**
|
|
20284
21141
|
* Whether the model should generate audio alongside the video.
|
|
20285
21142
|
*/
|
|
@@ -20317,6 +21174,27 @@ declare function experimental_generateVideo({
|
|
|
20317
21174
|
data: Uint8Array;
|
|
20318
21175
|
mediaType: string | undefined;
|
|
20319
21176
|
}>;
|
|
21177
|
+
/**
|
|
21178
|
+
* Polling configuration for models that support the asynchronous
|
|
21179
|
+
* start/status flow. When provided and the model implements `doStart`
|
|
21180
|
+
* and `doStatus`, the SDK will orchestrate polling automatically.
|
|
21181
|
+
*
|
|
21182
|
+
* This option can be combined with `webhook`: `timeoutMs` limits the webhook
|
|
21183
|
+
* wait, and the polling settings apply if the model does not support
|
|
21184
|
+
* webhooks.
|
|
21185
|
+
*/
|
|
21186
|
+
poll?: GenerateVideoPollOptions;
|
|
21187
|
+
/**
|
|
21188
|
+
* Webhook factory for models that support the asynchronous
|
|
21189
|
+
* start/status flow. When provided and the model implements `doStart`
|
|
21190
|
+
* and `doStatus`, the SDK will use webhooks instead of polling.
|
|
21191
|
+
*
|
|
21192
|
+
* The factory should return a URL for the provider to send notifications to,
|
|
21193
|
+
* and a `received` promise that resolves when the notification arrives.
|
|
21194
|
+
* `poll` can also be provided to configure the webhook timeout and polling
|
|
21195
|
+
* fallback.
|
|
21196
|
+
*/
|
|
21197
|
+
webhook?: GenerateVideoWebhookFactory;
|
|
20320
21198
|
}): Promise<GenerateVideoResult>;
|
|
20321
21199
|
/**
|
|
20322
21200
|
* Applies default settings for an embedding model.
|
|
@@ -20329,6 +21207,19 @@ declare function defaultEmbeddingSettingsMiddleware({
|
|
|
20329
21207
|
providerOptions?: EmbeddingModelV4CallOptions['providerOptions'];
|
|
20330
21208
|
}>;
|
|
20331
21209
|
}): EmbeddingModelMiddleware;
|
|
21210
|
+
/**
|
|
21211
|
+
* Applies default instructions to a language model when a call does not
|
|
21212
|
+
* already contain a system message.
|
|
21213
|
+
*/
|
|
21214
|
+
declare function defaultInstructionsMiddleware({
|
|
21215
|
+
instructions
|
|
21216
|
+
}: {
|
|
21217
|
+
/**
|
|
21218
|
+
* Default instructions to prepend to calls that do not contain a system
|
|
21219
|
+
* message.
|
|
21220
|
+
*/
|
|
21221
|
+
instructions: Instructions;
|
|
21222
|
+
}): LanguageModelMiddleware;
|
|
20332
21223
|
/**
|
|
20333
21224
|
* Applies default settings for a language model.
|
|
20334
21225
|
*/
|
|
@@ -21006,6 +21897,7 @@ declare function createTextStreamResponse({
|
|
|
21006
21897
|
* @param options.statusText - Optional HTTP status text.
|
|
21007
21898
|
* @param options.headers - Optional response headers.
|
|
21008
21899
|
* @param options.stream - The text stream to pipe.
|
|
21900
|
+
* @returns A promise that resolves when the stream has been written.
|
|
21009
21901
|
*/
|
|
21010
21902
|
declare function pipeTextStreamToResponse({
|
|
21011
21903
|
response,
|
|
@@ -21016,7 +21908,7 @@ declare function pipeTextStreamToResponse({
|
|
|
21016
21908
|
}: {
|
|
21017
21909
|
response: ServerResponse;
|
|
21018
21910
|
stream: ReadableStream<string>;
|
|
21019
|
-
} & ResponseInit): void
|
|
21911
|
+
} & ResponseInit): Promise<void>;
|
|
21020
21912
|
/**
|
|
21021
21913
|
* Converts a stream of `TextStreamPart` chunks into a stream of text deltas.
|
|
21022
21914
|
*/
|
|
@@ -21199,6 +22091,11 @@ interface StreamTranscriptionResult {
|
|
|
21199
22091
|
readonly providerMetadata: PromiseLike<Record<string, JSONObject$2>>;
|
|
21200
22092
|
/**
|
|
21201
22093
|
* Full stream of transcription parts.
|
|
22094
|
+
*
|
|
22095
|
+
* This is a single-consumer live stream and can only be accessed once.
|
|
22096
|
+
* Access it before any result promise when both stream parts and final
|
|
22097
|
+
* results are needed; accessing a result promise first consumes the stream
|
|
22098
|
+
* internally and makes `fullStream` unavailable.
|
|
21202
22099
|
*/
|
|
21203
22100
|
readonly fullStream: AsyncIterableStream<TranscriptionStreamPart>;
|
|
21204
22101
|
}
|
|
@@ -21237,16 +22134,7 @@ declare function streamTranscribe({
|
|
|
21237
22134
|
/**
|
|
21238
22135
|
* The input audio format for the raw audio chunks.
|
|
21239
22136
|
*/
|
|
21240
|
-
inputAudioFormat:
|
|
21241
|
-
/**
|
|
21242
|
-
* Audio format type, e.g. `audio/pcm`, `audio/pcmu`, or `audio/pcma`.
|
|
21243
|
-
*/
|
|
21244
|
-
type: string;
|
|
21245
|
-
/**
|
|
21246
|
-
* Sample rate in Hz. Only applicable for formats that require a rate.
|
|
21247
|
-
*/
|
|
21248
|
-
rate?: number;
|
|
21249
|
-
};
|
|
22137
|
+
inputAudioFormat: SharedV4AudioFormat;
|
|
21250
22138
|
/**
|
|
21251
22139
|
* Additional provider-specific options.
|
|
21252
22140
|
*/
|
|
@@ -21278,6 +22166,214 @@ declare const experimental_transcribe: typeof transcribe;
|
|
|
21278
22166
|
* @deprecated Use `TranscriptionResult` instead.
|
|
21279
22167
|
*/
|
|
21280
22168
|
type Experimental_TranscriptionResult = TranscriptionResult;
|
|
22169
|
+
/**
|
|
22170
|
+
* Speech translation model that is used by the AI SDK.
|
|
22171
|
+
*
|
|
22172
|
+
* Experimental: part of the experimental speech translation modality and may
|
|
22173
|
+
* change in patch releases.
|
|
22174
|
+
*/
|
|
22175
|
+
type SpeechTranslationModel = string | SpeechTranslationModelV4;
|
|
22176
|
+
/**
|
|
22177
|
+
* Stream parts emitted by `experimental_streamTranslate`.
|
|
22178
|
+
*
|
|
22179
|
+
* Speech translation model stream parts are passed through unchanged, except
|
|
22180
|
+
* for `stream-start`, `response-metadata`, and `finish`, which are consumed
|
|
22181
|
+
* internally and surfaced via the result promises.
|
|
22182
|
+
*/
|
|
22183
|
+
type TranslationStreamPart = {
|
|
22184
|
+
/**
|
|
22185
|
+
* Translated audio chunk in the target language.
|
|
22186
|
+
*
|
|
22187
|
+
* `Uint8Array` chunks contain raw audio bytes. `string` chunks contain
|
|
22188
|
+
* base64-encoded raw audio bytes.
|
|
22189
|
+
*/
|
|
22190
|
+
type: 'audio';
|
|
22191
|
+
id?: string;
|
|
22192
|
+
audio: Uint8Array | string;
|
|
22193
|
+
providerMetadata?: SharedV4ProviderMetadata;
|
|
22194
|
+
} | {
|
|
22195
|
+
/**
|
|
22196
|
+
* Append-only translated text delta.
|
|
22197
|
+
*/
|
|
22198
|
+
type: 'output-text-delta';
|
|
22199
|
+
id?: string;
|
|
22200
|
+
delta: string;
|
|
22201
|
+
providerMetadata?: SharedV4ProviderMetadata;
|
|
22202
|
+
} | {
|
|
22203
|
+
/**
|
|
22204
|
+
* Final translated text for a provider-defined segment or utterance.
|
|
22205
|
+
*/
|
|
22206
|
+
type: 'output-text-final';
|
|
22207
|
+
id?: string;
|
|
22208
|
+
text: string;
|
|
22209
|
+
providerMetadata?: SharedV4ProviderMetadata;
|
|
22210
|
+
} | {
|
|
22211
|
+
/**
|
|
22212
|
+
* Append-only source transcript delta.
|
|
22213
|
+
*/
|
|
22214
|
+
type: 'source-transcript-delta';
|
|
22215
|
+
id?: string;
|
|
22216
|
+
delta: string;
|
|
22217
|
+
providerMetadata?: SharedV4ProviderMetadata;
|
|
22218
|
+
} | {
|
|
22219
|
+
/**
|
|
22220
|
+
* Non-final source transcript text. The text may be revised by later parts.
|
|
22221
|
+
*/
|
|
22222
|
+
type: 'source-transcript-partial';
|
|
22223
|
+
id?: string;
|
|
22224
|
+
text: string;
|
|
22225
|
+
startSecond?: number;
|
|
22226
|
+
endSecond?: number;
|
|
22227
|
+
channelIndex?: number;
|
|
22228
|
+
providerMetadata?: SharedV4ProviderMetadata;
|
|
22229
|
+
} | {
|
|
22230
|
+
/**
|
|
22231
|
+
* Final source transcript text for a provider-defined segment or utterance.
|
|
22232
|
+
*/
|
|
22233
|
+
type: 'source-transcript-final';
|
|
22234
|
+
id?: string;
|
|
22235
|
+
text: string;
|
|
22236
|
+
startSecond?: number;
|
|
22237
|
+
endSecond?: number;
|
|
22238
|
+
channelIndex?: number;
|
|
22239
|
+
providerMetadata?: SharedV4ProviderMetadata;
|
|
22240
|
+
} | {
|
|
22241
|
+
/**
|
|
22242
|
+
* Raw provider chunks if enabled via `includeRawChunks`.
|
|
22243
|
+
*/
|
|
22244
|
+
type: 'raw';
|
|
22245
|
+
rawValue: unknown;
|
|
22246
|
+
} | {
|
|
22247
|
+
/**
|
|
22248
|
+
* Error parts are streamed, allowing for multiple errors.
|
|
22249
|
+
*/
|
|
22250
|
+
type: 'error';
|
|
22251
|
+
error: unknown;
|
|
22252
|
+
};
|
|
22253
|
+
interface StreamTranslationResult {
|
|
22254
|
+
/**
|
|
22255
|
+
* The final source-language transcript of the input audio.
|
|
22256
|
+
*/
|
|
22257
|
+
readonly sourceText: PromiseLike<string>;
|
|
22258
|
+
/**
|
|
22259
|
+
* The final translated text in the target language.
|
|
22260
|
+
*
|
|
22261
|
+
* May resolve to an empty string for providers that produce only audio
|
|
22262
|
+
* output.
|
|
22263
|
+
*/
|
|
22264
|
+
readonly translationText: PromiseLike<string>;
|
|
22265
|
+
/**
|
|
22266
|
+
* The duration of the source audio in seconds, if available.
|
|
22267
|
+
*/
|
|
22268
|
+
readonly durationInSeconds: PromiseLike<number | undefined>;
|
|
22269
|
+
/**
|
|
22270
|
+
* Usage information for the translation call, if reported by the provider.
|
|
22271
|
+
*/
|
|
22272
|
+
readonly usage: PromiseLike<SpeechTranslationModelV4Usage | undefined>;
|
|
22273
|
+
/**
|
|
22274
|
+
* Warnings for the call, e.g. unsupported settings.
|
|
22275
|
+
*/
|
|
22276
|
+
readonly warnings: PromiseLike<Array<Warning>>;
|
|
22277
|
+
/**
|
|
22278
|
+
* Response metadata.
|
|
22279
|
+
*/
|
|
22280
|
+
readonly response: PromiseLike<SpeechTranslationModelResponseMetadata>;
|
|
22281
|
+
/**
|
|
22282
|
+
* Additional provider-specific metadata.
|
|
22283
|
+
*/
|
|
22284
|
+
readonly providerMetadata: PromiseLike<Record<string, JSONObject$2>>;
|
|
22285
|
+
/**
|
|
22286
|
+
* Full stream of translation parts.
|
|
22287
|
+
*
|
|
22288
|
+
* This is a single-consumer live stream and can only be accessed once.
|
|
22289
|
+
* Access it before any result promise when both stream parts and final
|
|
22290
|
+
* results are needed; accessing a result promise first consumes the stream
|
|
22291
|
+
* internally and makes `fullStream` unavailable.
|
|
22292
|
+
*/
|
|
22293
|
+
readonly fullStream: AsyncIterableStream<TranslationStreamPart>;
|
|
22294
|
+
}
|
|
22295
|
+
/**
|
|
22296
|
+
* Streams speech-to-speech translations using a speech translation model.
|
|
22297
|
+
*
|
|
22298
|
+
* @param model - The speech translation model to use.
|
|
22299
|
+
* @param audio - Raw audio chunks to translate.
|
|
22300
|
+
* @param inputAudioFormat - The input audio format for the raw audio chunks.
|
|
22301
|
+
* @param targetLanguage - The language to translate the audio into.
|
|
22302
|
+
* @param sourceLanguage - The language of the source audio. Auto-detected when absent.
|
|
22303
|
+
* @param outputAudioFormat - The desired audio format for translated audio chunks.
|
|
22304
|
+
* @param providerOptions - Additional provider-specific options.
|
|
22305
|
+
* @param abortSignal - An optional abort signal that can be used to cancel the call.
|
|
22306
|
+
* @param headers - Additional HTTP/WebSocket headers to send when supported by the provider.
|
|
22307
|
+
* @param includeRawChunks - When true, providers include raw provider chunks in the stream as `raw` parts.
|
|
22308
|
+
*
|
|
22309
|
+
* @returns A result object that contains the streaming translation and final translation metadata.
|
|
22310
|
+
*/
|
|
22311
|
+
declare function streamTranslate({
|
|
22312
|
+
model,
|
|
22313
|
+
audio,
|
|
22314
|
+
inputAudioFormat,
|
|
22315
|
+
targetLanguage,
|
|
22316
|
+
sourceLanguage,
|
|
22317
|
+
outputAudioFormat,
|
|
22318
|
+
providerOptions,
|
|
22319
|
+
abortSignal,
|
|
22320
|
+
headers,
|
|
22321
|
+
includeRawChunks,
|
|
22322
|
+
_internal: {
|
|
22323
|
+
currentDate
|
|
22324
|
+
}
|
|
22325
|
+
}: {
|
|
22326
|
+
/**
|
|
22327
|
+
* The speech translation model to use.
|
|
22328
|
+
*/
|
|
22329
|
+
model: SpeechTranslationModel;
|
|
22330
|
+
/**
|
|
22331
|
+
* Raw audio chunks to translate.
|
|
22332
|
+
*/
|
|
22333
|
+
audio: ReadableStream<Uint8Array | string>;
|
|
22334
|
+
/**
|
|
22335
|
+
* The input audio format for the raw audio chunks.
|
|
22336
|
+
*/
|
|
22337
|
+
inputAudioFormat: SharedV4AudioFormat;
|
|
22338
|
+
/**
|
|
22339
|
+
* The language to translate the audio into, as a BCP-47-style language
|
|
22340
|
+
* tag (e.g. `en`, `es`, `fr-CA`). Supported values are provider-specific
|
|
22341
|
+
* and validated by the provider.
|
|
22342
|
+
*/
|
|
22343
|
+
targetLanguage: string;
|
|
22344
|
+
/**
|
|
22345
|
+
* The language of the source audio, as a BCP-47-style language tag.
|
|
22346
|
+
* When absent, providers auto-detect the source language.
|
|
22347
|
+
*/
|
|
22348
|
+
sourceLanguage?: string;
|
|
22349
|
+
/**
|
|
22350
|
+
* The desired audio format for translated audio chunks.
|
|
22351
|
+
* When absent, the provider default output format is used.
|
|
22352
|
+
*/
|
|
22353
|
+
outputAudioFormat?: SharedV4AudioFormat;
|
|
22354
|
+
/**
|
|
22355
|
+
* Additional provider-specific options.
|
|
22356
|
+
*/
|
|
22357
|
+
providerOptions?: ProviderOptions;
|
|
22358
|
+
/**
|
|
22359
|
+
* Abort signal.
|
|
22360
|
+
*/
|
|
22361
|
+
abortSignal?: AbortSignal;
|
|
22362
|
+
/**
|
|
22363
|
+
* Additional headers to include in the request, if supported by the provider.
|
|
22364
|
+
*/
|
|
22365
|
+
headers?: Record<string, string>;
|
|
22366
|
+
/**
|
|
22367
|
+
* When true, providers should include raw provider chunks in the stream.
|
|
22368
|
+
*/
|
|
22369
|
+
includeRawChunks?: boolean;
|
|
22370
|
+
/**
|
|
22371
|
+
* Internal test hooks.
|
|
22372
|
+
*/
|
|
22373
|
+
_internal?: {
|
|
22374
|
+
currentDate?: () => Date;
|
|
22375
|
+
};
|
|
22376
|
+
}): StreamTranslationResult;
|
|
21281
22377
|
interface UploadFileResult {
|
|
21282
22378
|
readonly providerReference: ProviderReference;
|
|
21283
22379
|
readonly mediaType?: string;
|