@ai-sdk/provider 3.0.4 → 3.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/index.d.mts +733 -715
- package/dist/index.d.ts +733 -715
- package/dist/index.js +32 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +32 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -1
- package/src/embedding-model/v2/embedding-model-v2-embedding.ts +2 -2
- package/src/embedding-model/v2/embedding-model-v2.ts +39 -39
- package/src/embedding-model/v3/embedding-model-v3-call-options.ts +11 -11
- package/src/embedding-model/v3/embedding-model-v3-embedding.ts +2 -2
- package/src/embedding-model/v3/embedding-model-v3-result.ts +2 -2
- package/src/embedding-model/v3/embedding-model-v3.ts +19 -19
- package/src/errors/index.ts +1 -0
- package/src/errors/no-content-generated-error.ts +1 -1
- package/src/errors/type-validation-error.ts +63 -6
- package/src/image-model/v2/image-model-v2-call-options.ts +33 -33
- package/src/image-model/v2/image-model-v2-call-warning.ts +2 -2
- package/src/image-model/v2/image-model-v2.ts +42 -42
- package/src/image-model/v3/image-model-v3-usage.ts +4 -4
- package/src/image-model/v3/image-model-v3.ts +43 -43
- package/src/json-value/json-value.ts +2 -2
- package/src/language-model/v2/language-model-v2-call-options.ts +44 -44
- package/src/language-model/v2/language-model-v2-call-warning.ts +2 -2
- package/src/language-model/v2/language-model-v2-data-content.ts +2 -2
- package/src/language-model/v2/language-model-v2-file.ts +14 -14
- package/src/language-model/v2/language-model-v2-finish-reason.ts +10 -10
- package/src/language-model/v2/language-model-v2-function-tool.ts +11 -11
- package/src/language-model/v2/language-model-v2-prompt.ts +38 -38
- package/src/language-model/v2/language-model-v2-provider-defined-tool.ts +6 -6
- package/src/language-model/v2/language-model-v2-reasoning.ts +1 -1
- package/src/language-model/v2/language-model-v2-response-metadata.ts +6 -6
- package/src/language-model/v2/language-model-v2-source.ts +1 -1
- package/src/language-model/v2/language-model-v2-text.ts +2 -2
- package/src/language-model/v2/language-model-v2-tool-result.ts +1 -1
- package/src/language-model/v2/language-model-v2-usage.ts +11 -11
- package/src/language-model/v2/language-model-v2.ts +42 -42
- package/src/language-model/v3/language-model-v3-call-options.ts +44 -44
- package/src/language-model/v3/language-model-v3-data-content.ts +2 -2
- package/src/language-model/v3/language-model-v3-file.ts +14 -14
- package/src/language-model/v3/language-model-v3-function-tool.ts +11 -11
- package/src/language-model/v3/language-model-v3-prompt.ts +43 -43
- package/src/language-model/v3/language-model-v3-reasoning.ts +1 -1
- package/src/language-model/v3/language-model-v3-response-metadata.ts +6 -6
- package/src/language-model/v3/language-model-v3-source.ts +1 -1
- package/src/language-model/v3/language-model-v3-text.ts +2 -2
- package/src/language-model/v3/language-model-v3-tool-result.ts +1 -1
- package/src/language-model/v3/language-model-v3-usage.ts +1 -1
- package/src/provider/v2/provider-v2.ts +37 -37
- package/src/provider/v3/provider-v3.ts +55 -55
- package/src/transcription-model/v2/transcription-model-v2-call-options.ts +24 -24
- package/src/transcription-model/v2/transcription-model-v2-call-warning.ts +2 -2
- package/src/transcription-model/v2/transcription-model-v2.ts +25 -25
- package/src/transcription-model/v3/transcription-model-v3-call-options.ts +24 -24
- package/src/transcription-model/v3/transcription-model-v3.ts +25 -25
package/dist/index.d.mts
CHANGED
|
@@ -4,8 +4,8 @@ export { JSONSchema7, JSONSchema7Definition } from 'json-schema';
|
|
|
4
4
|
type SharedV3Headers = Record<string, string>;
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
A JSON value can be a string, number, boolean, object, array, or null.
|
|
8
|
-
JSON values can be serialized and deserialized by the JSON.stringify and JSON.parse methods.
|
|
7
|
+
* A JSON value can be a string, number, boolean, object, array, or null.
|
|
8
|
+
* JSON values can be serialized and deserialized by the JSON.stringify and JSON.parse methods.
|
|
9
9
|
*/
|
|
10
10
|
type JSONValue = null | string | number | boolean | JSONObject | JSONArray;
|
|
11
11
|
type JSONObject = {
|
|
@@ -152,29 +152,29 @@ type SharedV2ProviderOptions = Record<string, Record<string, JSONValue>>;
|
|
|
152
152
|
|
|
153
153
|
type EmbeddingModelV3CallOptions = {
|
|
154
154
|
/**
|
|
155
|
-
|
|
156
|
-
|
|
155
|
+
* List of text values to generate embeddings for.
|
|
156
|
+
*/
|
|
157
157
|
values: Array<string>;
|
|
158
158
|
/**
|
|
159
|
-
|
|
160
|
-
|
|
159
|
+
* Abort signal for cancelling the operation.
|
|
160
|
+
*/
|
|
161
161
|
abortSignal?: AbortSignal;
|
|
162
162
|
/**
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
163
|
+
* Additional provider-specific options. They are passed through
|
|
164
|
+
* to the provider from the AI SDK and enable provider-specific
|
|
165
|
+
* functionality that can be fully encapsulated in the provider.
|
|
166
|
+
*/
|
|
167
167
|
providerOptions?: SharedV3ProviderOptions;
|
|
168
168
|
/**
|
|
169
|
-
Additional HTTP headers to be sent with the request.
|
|
170
|
-
Only applicable for HTTP-based providers.
|
|
171
|
-
|
|
169
|
+
* Additional HTTP headers to be sent with the request.
|
|
170
|
+
* Only applicable for HTTP-based providers.
|
|
171
|
+
*/
|
|
172
172
|
headers?: SharedV3Headers;
|
|
173
173
|
};
|
|
174
174
|
|
|
175
175
|
/**
|
|
176
|
-
An embedding is a vector, i.e. an array of numbers.
|
|
177
|
-
It is e.g. used to represent a text as a vector of word embeddings.
|
|
176
|
+
* An embedding is a vector, i.e. an array of numbers.
|
|
177
|
+
* It is e.g. used to represent a text as a vector of word embeddings.
|
|
178
178
|
*/
|
|
179
179
|
type EmbeddingModelV3Embedding = Array<number>;
|
|
180
180
|
|
|
@@ -207,8 +207,8 @@ type EmbeddingModelV3Result = {
|
|
|
207
207
|
*/
|
|
208
208
|
headers?: SharedV3Headers;
|
|
209
209
|
/**
|
|
210
|
-
|
|
211
|
-
|
|
210
|
+
* The response body.
|
|
211
|
+
*/
|
|
212
212
|
body?: unknown;
|
|
213
213
|
};
|
|
214
214
|
/**
|
|
@@ -218,142 +218,142 @@ type EmbeddingModelV3Result = {
|
|
|
218
218
|
};
|
|
219
219
|
|
|
220
220
|
/**
|
|
221
|
-
Specification for an embedding model that implements the embedding model
|
|
222
|
-
interface version 3.
|
|
223
|
-
|
|
224
|
-
It is specific to text embeddings.
|
|
221
|
+
* Specification for an embedding model that implements the embedding model
|
|
222
|
+
* interface version 3.
|
|
223
|
+
*
|
|
224
|
+
* It is specific to text embeddings.
|
|
225
225
|
*/
|
|
226
226
|
type EmbeddingModelV3 = {
|
|
227
227
|
/**
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
228
|
+
* The embedding model must specify which embedding model interface
|
|
229
|
+
* version it implements. This will allow us to evolve the embedding
|
|
230
|
+
* model interface and retain backwards compatibility. The different
|
|
231
|
+
* implementation versions can be handled as a discriminated union
|
|
232
|
+
* on our side.
|
|
233
233
|
*/
|
|
234
234
|
readonly specificationVersion: 'v3';
|
|
235
235
|
/**
|
|
236
|
-
|
|
236
|
+
* Name of the provider for logging purposes.
|
|
237
237
|
*/
|
|
238
238
|
readonly provider: string;
|
|
239
239
|
/**
|
|
240
|
-
|
|
240
|
+
* Provider-specific model ID for logging purposes.
|
|
241
241
|
*/
|
|
242
242
|
readonly modelId: string;
|
|
243
243
|
/**
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
244
|
+
* Limit of how many embeddings can be generated in a single API call.
|
|
245
|
+
*
|
|
246
|
+
* Use Infinity for models that do not have a limit.
|
|
247
247
|
*/
|
|
248
248
|
readonly maxEmbeddingsPerCall: PromiseLike<number | undefined> | number | undefined;
|
|
249
249
|
/**
|
|
250
|
-
|
|
250
|
+
* True if the model can handle multiple embedding calls in parallel.
|
|
251
251
|
*/
|
|
252
252
|
readonly supportsParallelCalls: PromiseLike<boolean> | boolean;
|
|
253
253
|
/**
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
254
|
+
* Generates a list of embeddings for the given input text.
|
|
255
|
+
*
|
|
256
|
+
* Naming: "do" prefix to prevent accidental direct usage of the method
|
|
257
|
+
* by the user.
|
|
258
258
|
*/
|
|
259
259
|
doEmbed(options: EmbeddingModelV3CallOptions): PromiseLike<EmbeddingModelV3Result>;
|
|
260
260
|
};
|
|
261
261
|
|
|
262
262
|
/**
|
|
263
|
-
An embedding is a vector, i.e. an array of numbers.
|
|
264
|
-
It is e.g. used to represent a text as a vector of word embeddings.
|
|
263
|
+
* An embedding is a vector, i.e. an array of numbers.
|
|
264
|
+
* It is e.g. used to represent a text as a vector of word embeddings.
|
|
265
265
|
*/
|
|
266
266
|
type EmbeddingModelV2Embedding = Array<number>;
|
|
267
267
|
|
|
268
268
|
/**
|
|
269
|
-
Specification for an embedding model that implements the embedding model
|
|
270
|
-
interface version 2.
|
|
271
|
-
|
|
272
|
-
VALUE is the type of the values that the model can embed.
|
|
273
|
-
This will allow us to go beyond text embeddings in the future,
|
|
274
|
-
e.g. to support image embeddings
|
|
269
|
+
* Specification for an embedding model that implements the embedding model
|
|
270
|
+
* interface version 2.
|
|
271
|
+
*
|
|
272
|
+
* VALUE is the type of the values that the model can embed.
|
|
273
|
+
* This will allow us to go beyond text embeddings in the future,
|
|
274
|
+
* e.g. to support image embeddings
|
|
275
275
|
*/
|
|
276
276
|
type EmbeddingModelV2<VALUE> = {
|
|
277
277
|
/**
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
278
|
+
* The embedding model must specify which embedding model interface
|
|
279
|
+
* version it implements. This will allow us to evolve the embedding
|
|
280
|
+
* model interface and retain backwards compatibility. The different
|
|
281
|
+
* implementation versions can be handled as a discriminated union
|
|
282
|
+
* on our side.
|
|
283
283
|
*/
|
|
284
284
|
readonly specificationVersion: 'v2';
|
|
285
285
|
/**
|
|
286
|
-
|
|
286
|
+
* Name of the provider for logging purposes.
|
|
287
287
|
*/
|
|
288
288
|
readonly provider: string;
|
|
289
289
|
/**
|
|
290
|
-
|
|
290
|
+
* Provider-specific model ID for logging purposes.
|
|
291
291
|
*/
|
|
292
292
|
readonly modelId: string;
|
|
293
293
|
/**
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
294
|
+
* Limit of how many embeddings can be generated in a single API call.
|
|
295
|
+
*
|
|
296
|
+
* Use Infinity for models that do not have a limit.
|
|
297
297
|
*/
|
|
298
298
|
readonly maxEmbeddingsPerCall: PromiseLike<number | undefined> | number | undefined;
|
|
299
299
|
/**
|
|
300
|
-
|
|
300
|
+
* True if the model can handle multiple embedding calls in parallel.
|
|
301
301
|
*/
|
|
302
302
|
readonly supportsParallelCalls: PromiseLike<boolean> | boolean;
|
|
303
303
|
/**
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
304
|
+
* Generates a list of embeddings for the given input text.
|
|
305
|
+
*
|
|
306
|
+
* Naming: "do" prefix to prevent accidental direct usage of the method
|
|
307
|
+
* by the user.
|
|
308
308
|
*/
|
|
309
309
|
doEmbed(options: {
|
|
310
310
|
/**
|
|
311
|
-
|
|
311
|
+
* List of values to embed.
|
|
312
312
|
*/
|
|
313
313
|
values: Array<VALUE>;
|
|
314
314
|
/**
|
|
315
|
-
|
|
315
|
+
* Abort signal for cancelling the operation.
|
|
316
316
|
*/
|
|
317
317
|
abortSignal?: AbortSignal;
|
|
318
318
|
/**
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
319
|
+
* Additional provider-specific options. They are passed through
|
|
320
|
+
* to the provider from the AI SDK and enable provider-specific
|
|
321
|
+
* functionality that can be fully encapsulated in the provider.
|
|
322
|
+
*/
|
|
323
323
|
providerOptions?: SharedV2ProviderOptions;
|
|
324
324
|
/**
|
|
325
|
-
|
|
326
|
-
|
|
325
|
+
* Additional HTTP headers to be sent with the request.
|
|
326
|
+
* Only applicable for HTTP-based providers.
|
|
327
327
|
*/
|
|
328
328
|
headers?: Record<string, string | undefined>;
|
|
329
329
|
}): PromiseLike<{
|
|
330
330
|
/**
|
|
331
|
-
|
|
331
|
+
* Generated embeddings. They are in the same order as the input values.
|
|
332
332
|
*/
|
|
333
333
|
embeddings: Array<EmbeddingModelV2Embedding>;
|
|
334
334
|
/**
|
|
335
|
-
|
|
336
|
-
|
|
335
|
+
* Token usage. We only have input tokens for embeddings.
|
|
336
|
+
*/
|
|
337
337
|
usage?: {
|
|
338
338
|
tokens: number;
|
|
339
339
|
};
|
|
340
340
|
/**
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
341
|
+
* Additional provider-specific metadata. They are passed through
|
|
342
|
+
* from the provider to the AI SDK and enable provider-specific
|
|
343
|
+
* results that can be fully encapsulated in the provider.
|
|
344
344
|
*/
|
|
345
345
|
providerMetadata?: SharedV2ProviderMetadata;
|
|
346
346
|
/**
|
|
347
|
-
|
|
347
|
+
* Optional response information for debugging purposes.
|
|
348
348
|
*/
|
|
349
349
|
response?: {
|
|
350
350
|
/**
|
|
351
|
-
|
|
351
|
+
* Response headers.
|
|
352
352
|
*/
|
|
353
353
|
headers?: SharedV2Headers;
|
|
354
354
|
/**
|
|
355
|
-
|
|
356
|
-
|
|
355
|
+
* The response body.
|
|
356
|
+
*/
|
|
357
357
|
body?: unknown;
|
|
358
358
|
};
|
|
359
359
|
}>;
|
|
@@ -505,7 +505,7 @@ declare class LoadSettingError extends AISDKError {
|
|
|
505
505
|
|
|
506
506
|
declare const symbol$4: unique symbol;
|
|
507
507
|
/**
|
|
508
|
-
Thrown when the AI provider fails to generate any content.
|
|
508
|
+
* Thrown when the AI provider fails to generate any content.
|
|
509
509
|
*/
|
|
510
510
|
declare class NoContentGeneratedError extends AISDKError {
|
|
511
511
|
private readonly [symbol$4];
|
|
@@ -546,27 +546,45 @@ declare class TooManyEmbeddingValuesForCallError extends AISDKError {
|
|
|
546
546
|
}
|
|
547
547
|
|
|
548
548
|
declare const symbol$1: unique symbol;
|
|
549
|
+
interface TypeValidationContext {
|
|
550
|
+
/**
|
|
551
|
+
* Field path in dot notation (e.g., "message.metadata", "message.parts[3].data")
|
|
552
|
+
*/
|
|
553
|
+
field?: string;
|
|
554
|
+
/**
|
|
555
|
+
* Entity name (e.g., tool name, data type name)
|
|
556
|
+
*/
|
|
557
|
+
entityName?: string;
|
|
558
|
+
/**
|
|
559
|
+
* Entity identifier (e.g., message ID, tool call ID)
|
|
560
|
+
*/
|
|
561
|
+
entityId?: string;
|
|
562
|
+
}
|
|
549
563
|
declare class TypeValidationError extends AISDKError {
|
|
550
564
|
private readonly [symbol$1];
|
|
551
565
|
readonly value: unknown;
|
|
552
|
-
|
|
566
|
+
readonly context?: TypeValidationContext;
|
|
567
|
+
constructor({ value, cause, context, }: {
|
|
553
568
|
value: unknown;
|
|
554
569
|
cause: unknown;
|
|
570
|
+
context?: TypeValidationContext;
|
|
555
571
|
});
|
|
556
572
|
static isInstance(error: unknown): error is TypeValidationError;
|
|
557
573
|
/**
|
|
558
574
|
* Wraps an error into a TypeValidationError.
|
|
559
|
-
* If the cause is already a TypeValidationError with the same value, it returns the cause.
|
|
575
|
+
* If the cause is already a TypeValidationError with the same value and context, it returns the cause.
|
|
560
576
|
* Otherwise, it creates a new TypeValidationError.
|
|
561
577
|
*
|
|
562
578
|
* @param {Object} params - The parameters for wrapping the error.
|
|
563
579
|
* @param {unknown} params.value - The value that failed validation.
|
|
564
580
|
* @param {unknown} params.cause - The original error or cause of the validation failure.
|
|
581
|
+
* @param {TypeValidationContext} params.context - Optional context about what is being validated.
|
|
565
582
|
* @returns {TypeValidationError} A TypeValidationError instance.
|
|
566
583
|
*/
|
|
567
|
-
static wrap({ value, cause, }: {
|
|
584
|
+
static wrap({ value, cause, context, }: {
|
|
568
585
|
value: unknown;
|
|
569
586
|
cause: unknown;
|
|
587
|
+
context?: TypeValidationContext;
|
|
570
588
|
}): TypeValidationError;
|
|
571
589
|
}
|
|
572
590
|
|
|
@@ -586,19 +604,19 @@ declare function isJSONArray(value: unknown): value is JSONArray;
|
|
|
586
604
|
declare function isJSONObject(value: unknown): value is JSONObject;
|
|
587
605
|
|
|
588
606
|
/**
|
|
589
|
-
Usage information for an image model call.
|
|
607
|
+
* Usage information for an image model call.
|
|
590
608
|
*/
|
|
591
609
|
type ImageModelV3Usage = {
|
|
592
610
|
/**
|
|
593
|
-
|
|
611
|
+
* The number of input (prompt) tokens used.
|
|
594
612
|
*/
|
|
595
613
|
inputTokens: number | undefined;
|
|
596
614
|
/**
|
|
597
|
-
|
|
615
|
+
* The number of output tokens used, if reported by the provider.
|
|
598
616
|
*/
|
|
599
617
|
outputTokens: number | undefined;
|
|
600
618
|
/**
|
|
601
|
-
|
|
619
|
+
* The total number of tokens as reported by the provider.
|
|
602
620
|
*/
|
|
603
621
|
totalTokens: number | undefined;
|
|
604
622
|
};
|
|
@@ -709,85 +727,85 @@ type GetMaxImagesPerCallFunction$1 = (options: {
|
|
|
709
727
|
modelId: string;
|
|
710
728
|
}) => PromiseLike<number | undefined> | number | undefined;
|
|
711
729
|
/**
|
|
712
|
-
Image generation model specification version 3.
|
|
730
|
+
* Image generation model specification version 3.
|
|
713
731
|
*/
|
|
714
732
|
type ImageModelV3 = {
|
|
715
733
|
/**
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
734
|
+
* The image model must specify which image model interface
|
|
735
|
+
* version it implements. This will allow us to evolve the image
|
|
736
|
+
* model interface and retain backwards compatibility. The different
|
|
737
|
+
* implementation versions can be handled as a discriminated union
|
|
738
|
+
* on our side.
|
|
721
739
|
*/
|
|
722
740
|
readonly specificationVersion: 'v3';
|
|
723
741
|
/**
|
|
724
|
-
|
|
742
|
+
* Name of the provider for logging purposes.
|
|
725
743
|
*/
|
|
726
744
|
readonly provider: string;
|
|
727
745
|
/**
|
|
728
|
-
|
|
746
|
+
* Provider-specific model ID for logging purposes.
|
|
729
747
|
*/
|
|
730
748
|
readonly modelId: string;
|
|
731
749
|
/**
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
750
|
+
* Limit of how many images can be generated in a single API call.
|
|
751
|
+
* Can be set to a number for a fixed limit, to undefined to use
|
|
752
|
+
* the global limit, or a function that returns a number or undefined,
|
|
753
|
+
* optionally as a promise.
|
|
736
754
|
*/
|
|
737
755
|
readonly maxImagesPerCall: number | undefined | GetMaxImagesPerCallFunction$1;
|
|
738
756
|
/**
|
|
739
|
-
|
|
757
|
+
* Generates an array of images.
|
|
740
758
|
*/
|
|
741
759
|
doGenerate(options: ImageModelV3CallOptions): PromiseLike<{
|
|
742
760
|
/**
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
761
|
+
* Generated images as base64 encoded strings or binary data.
|
|
762
|
+
* The images should be returned without any unnecessary conversion.
|
|
763
|
+
* If the API returns base64 encoded strings, the images should be returned
|
|
764
|
+
* as base64 encoded strings. If the API returns binary data, the images should
|
|
765
|
+
* be returned as binary data.
|
|
748
766
|
*/
|
|
749
767
|
images: Array<string> | Array<Uint8Array>;
|
|
750
768
|
/**
|
|
751
|
-
|
|
769
|
+
* Warnings for the call, e.g. unsupported features.
|
|
752
770
|
*/
|
|
753
771
|
warnings: Array<SharedV3Warning>;
|
|
754
772
|
/**
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
773
|
+
* Additional provider-specific metadata. They are passed through
|
|
774
|
+
* from the provider to the AI SDK and enable provider-specific
|
|
775
|
+
* results that can be fully encapsulated in the provider.
|
|
776
|
+
*
|
|
777
|
+
* The outer record is keyed by the provider name, and the inner
|
|
778
|
+
* record is provider-specific metadata. It always includes an
|
|
779
|
+
* `images` key with image-specific metadata
|
|
780
|
+
*
|
|
781
|
+
* ```ts
|
|
782
|
+
* {
|
|
783
|
+
* "openai": {
|
|
784
|
+
* "images": ["revisedPrompt": "Revised prompt here."]
|
|
785
|
+
* }
|
|
786
|
+
* }
|
|
787
|
+
* ```
|
|
788
|
+
*/
|
|
771
789
|
providerMetadata?: ImageModelV3ProviderMetadata;
|
|
772
790
|
/**
|
|
773
|
-
|
|
791
|
+
* Response information for telemetry and debugging purposes.
|
|
774
792
|
*/
|
|
775
793
|
response: {
|
|
776
794
|
/**
|
|
777
|
-
|
|
778
|
-
|
|
795
|
+
* Timestamp for the start of the generated response.
|
|
796
|
+
*/
|
|
779
797
|
timestamp: Date;
|
|
780
798
|
/**
|
|
781
|
-
|
|
782
|
-
|
|
799
|
+
* The ID of the response model that was used to generate the response.
|
|
800
|
+
*/
|
|
783
801
|
modelId: string;
|
|
784
802
|
/**
|
|
785
|
-
|
|
786
|
-
|
|
803
|
+
* Response headers.
|
|
804
|
+
*/
|
|
787
805
|
headers: Record<string, string> | undefined;
|
|
788
806
|
};
|
|
789
807
|
/**
|
|
790
|
-
|
|
808
|
+
* Optional token usage for the image generation call (if the provider reports it).
|
|
791
809
|
*/
|
|
792
810
|
usage?: ImageModelV3Usage;
|
|
793
811
|
}>;
|
|
@@ -795,59 +813,59 @@ type ImageModelV3 = {
|
|
|
795
813
|
|
|
796
814
|
type ImageModelV2CallOptions = {
|
|
797
815
|
/**
|
|
798
|
-
|
|
799
|
-
|
|
816
|
+
* Prompt for the image generation.
|
|
817
|
+
*/
|
|
800
818
|
prompt: string;
|
|
801
819
|
/**
|
|
802
|
-
|
|
803
|
-
|
|
820
|
+
* Number of images to generate.
|
|
821
|
+
*/
|
|
804
822
|
n: number;
|
|
805
823
|
/**
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
824
|
+
* Size of the images to generate.
|
|
825
|
+
* Must have the format `{width}x{height}`.
|
|
826
|
+
* `undefined` will use the provider's default size.
|
|
827
|
+
*/
|
|
810
828
|
size: `${number}x${number}` | undefined;
|
|
811
829
|
/**
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
830
|
+
* Aspect ratio of the images to generate.
|
|
831
|
+
* Must have the format `{width}:{height}`.
|
|
832
|
+
* `undefined` will use the provider's default aspect ratio.
|
|
833
|
+
*/
|
|
816
834
|
aspectRatio: `${number}:${number}` | undefined;
|
|
817
835
|
/**
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
836
|
+
* Seed for the image generation.
|
|
837
|
+
* `undefined` will use the provider's default seed.
|
|
838
|
+
*/
|
|
821
839
|
seed: number | undefined;
|
|
822
840
|
/**
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
841
|
+
* Additional provider-specific options that are passed through to the provider
|
|
842
|
+
* as body parameters.
|
|
843
|
+
*
|
|
844
|
+
* The outer record is keyed by the provider name, and the inner
|
|
845
|
+
* record is keyed by the provider-specific metadata key.
|
|
846
|
+
* ```ts
|
|
847
|
+
* {
|
|
848
|
+
* "openai": {
|
|
849
|
+
* "style": "vivid"
|
|
850
|
+
* }
|
|
851
|
+
* }
|
|
852
|
+
* ```
|
|
853
|
+
*/
|
|
836
854
|
providerOptions: SharedV2ProviderOptions;
|
|
837
855
|
/**
|
|
838
|
-
|
|
839
|
-
|
|
856
|
+
* Abort signal for cancelling the operation.
|
|
857
|
+
*/
|
|
840
858
|
abortSignal?: AbortSignal;
|
|
841
859
|
/**
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
860
|
+
* Additional HTTP headers to be sent with the request.
|
|
861
|
+
* Only applicable for HTTP-based providers.
|
|
862
|
+
*/
|
|
845
863
|
headers?: Record<string, string | undefined>;
|
|
846
864
|
};
|
|
847
865
|
|
|
848
866
|
/**
|
|
849
|
-
Warning from the model provider for this call. The call will proceed, but e.g.
|
|
850
|
-
some settings might not be supported, which can lead to suboptimal results.
|
|
867
|
+
* Warning from the model provider for this call. The call will proceed, but e.g.
|
|
868
|
+
* some settings might not be supported, which can lead to suboptimal results.
|
|
851
869
|
*/
|
|
852
870
|
type ImageModelV2CallWarning = {
|
|
853
871
|
type: 'unsupported-setting';
|
|
@@ -865,81 +883,81 @@ type GetMaxImagesPerCallFunction = (options: {
|
|
|
865
883
|
modelId: string;
|
|
866
884
|
}) => PromiseLike<number | undefined> | number | undefined;
|
|
867
885
|
/**
|
|
868
|
-
Image generation model specification version 2.
|
|
886
|
+
* Image generation model specification version 2.
|
|
869
887
|
*/
|
|
870
888
|
type ImageModelV2 = {
|
|
871
889
|
/**
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
890
|
+
* The image model must specify which image model interface
|
|
891
|
+
* version it implements. This will allow us to evolve the image
|
|
892
|
+
* model interface and retain backwards compatibility. The different
|
|
893
|
+
* implementation versions can be handled as a discriminated union
|
|
894
|
+
* on our side.
|
|
877
895
|
*/
|
|
878
896
|
readonly specificationVersion: 'v2';
|
|
879
897
|
/**
|
|
880
|
-
|
|
898
|
+
* Name of the provider for logging purposes.
|
|
881
899
|
*/
|
|
882
900
|
readonly provider: string;
|
|
883
901
|
/**
|
|
884
|
-
|
|
902
|
+
* Provider-specific model ID for logging purposes.
|
|
885
903
|
*/
|
|
886
904
|
readonly modelId: string;
|
|
887
905
|
/**
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
906
|
+
* Limit of how many images can be generated in a single API call.
|
|
907
|
+
* Can be set to a number for a fixed limit, to undefined to use
|
|
908
|
+
* the global limit, or a function that returns a number or undefined,
|
|
909
|
+
* optionally as a promise.
|
|
892
910
|
*/
|
|
893
911
|
readonly maxImagesPerCall: number | undefined | GetMaxImagesPerCallFunction;
|
|
894
912
|
/**
|
|
895
|
-
|
|
913
|
+
* Generates an array of images.
|
|
896
914
|
*/
|
|
897
915
|
doGenerate(options: ImageModelV2CallOptions): PromiseLike<{
|
|
898
916
|
/**
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
917
|
+
* Generated images as base64 encoded strings or binary data.
|
|
918
|
+
* The images should be returned without any unnecessary conversion.
|
|
919
|
+
* If the API returns base64 encoded strings, the images should be returned
|
|
920
|
+
* as base64 encoded strings. If the API returns binary data, the images should
|
|
921
|
+
* be returned as binary data.
|
|
904
922
|
*/
|
|
905
923
|
images: Array<string> | Array<Uint8Array>;
|
|
906
924
|
/**
|
|
907
|
-
|
|
925
|
+
* Warnings for the call, e.g. unsupported settings.
|
|
908
926
|
*/
|
|
909
927
|
warnings: Array<ImageModelV2CallWarning>;
|
|
910
928
|
/**
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
929
|
+
* Additional provider-specific metadata. They are passed through
|
|
930
|
+
* from the provider to the AI SDK and enable provider-specific
|
|
931
|
+
* results that can be fully encapsulated in the provider.
|
|
932
|
+
*
|
|
933
|
+
* The outer record is keyed by the provider name, and the inner
|
|
934
|
+
* record is provider-specific metadata. It always includes an
|
|
935
|
+
* `images` key with image-specific metadata
|
|
936
|
+
*
|
|
937
|
+
* ```ts
|
|
938
|
+
* {
|
|
939
|
+
* "openai": {
|
|
940
|
+
* "images": ["revisedPrompt": "Revised prompt here."]
|
|
941
|
+
* }
|
|
942
|
+
* }
|
|
943
|
+
* ```
|
|
944
|
+
*/
|
|
927
945
|
providerMetadata?: ImageModelV2ProviderMetadata;
|
|
928
946
|
/**
|
|
929
|
-
|
|
947
|
+
* Response information for telemetry and debugging purposes.
|
|
930
948
|
*/
|
|
931
949
|
response: {
|
|
932
950
|
/**
|
|
933
|
-
|
|
934
|
-
|
|
951
|
+
* Timestamp for the start of the generated response.
|
|
952
|
+
*/
|
|
935
953
|
timestamp: Date;
|
|
936
954
|
/**
|
|
937
|
-
|
|
938
|
-
|
|
955
|
+
* The ID of the response model that was used to generate the response.
|
|
956
|
+
*/
|
|
939
957
|
modelId: string;
|
|
940
958
|
/**
|
|
941
|
-
|
|
942
|
-
|
|
959
|
+
* Response headers.
|
|
960
|
+
*/
|
|
943
961
|
headers: Record<string, string> | undefined;
|
|
944
962
|
};
|
|
945
963
|
}>;
|
|
@@ -1004,28 +1022,28 @@ type ImageModelV3Middleware = {
|
|
|
1004
1022
|
};
|
|
1005
1023
|
|
|
1006
1024
|
/**
|
|
1007
|
-
A tool has a name, a description, and a set of parameters.
|
|
1008
|
-
|
|
1009
|
-
Note: this is **not** the user-facing tool definition. The AI SDK methods will
|
|
1010
|
-
map the user-facing tool definitions to this format.
|
|
1025
|
+
* A tool has a name, a description, and a set of parameters.
|
|
1026
|
+
*
|
|
1027
|
+
* Note: this is **not** the user-facing tool definition. The AI SDK methods will
|
|
1028
|
+
* map the user-facing tool definitions to this format.
|
|
1011
1029
|
*/
|
|
1012
1030
|
type LanguageModelV3FunctionTool = {
|
|
1013
1031
|
/**
|
|
1014
|
-
|
|
1032
|
+
* The type of the tool (always 'function').
|
|
1015
1033
|
*/
|
|
1016
1034
|
type: 'function';
|
|
1017
1035
|
/**
|
|
1018
|
-
|
|
1036
|
+
* The name of the tool. Unique within this model call.
|
|
1019
1037
|
*/
|
|
1020
1038
|
name: string;
|
|
1021
1039
|
/**
|
|
1022
|
-
|
|
1023
|
-
|
|
1040
|
+
* A description of the tool. The language model uses this to understand the
|
|
1041
|
+
* tool's purpose and to provide better completion suggestions.
|
|
1024
1042
|
*/
|
|
1025
1043
|
description?: string;
|
|
1026
1044
|
/**
|
|
1027
|
-
|
|
1028
|
-
|
|
1045
|
+
* The parameters that the tool expects. The language model uses this to
|
|
1046
|
+
* understand the tool's input requirements and to provide matching suggestions.
|
|
1029
1047
|
*/
|
|
1030
1048
|
inputSchema: JSONSchema7;
|
|
1031
1049
|
/**
|
|
@@ -1044,24 +1062,24 @@ type LanguageModelV3FunctionTool = {
|
|
|
1044
1062
|
*/
|
|
1045
1063
|
strict?: boolean;
|
|
1046
1064
|
/**
|
|
1047
|
-
|
|
1065
|
+
* The provider-specific options for the tool.
|
|
1048
1066
|
*/
|
|
1049
1067
|
providerOptions?: SharedV3ProviderOptions;
|
|
1050
1068
|
};
|
|
1051
1069
|
|
|
1052
1070
|
/**
|
|
1053
|
-
Data content. Can be a Uint8Array, base64 encoded data as a string or a URL.
|
|
1054
|
-
*/
|
|
1071
|
+
* Data content. Can be a Uint8Array, base64 encoded data as a string or a URL.
|
|
1072
|
+
*/
|
|
1055
1073
|
type LanguageModelV3DataContent = Uint8Array | string | URL;
|
|
1056
1074
|
|
|
1057
1075
|
/**
|
|
1058
|
-
A prompt is a list of messages.
|
|
1059
|
-
|
|
1060
|
-
Note: Not all models and prompt formats support multi-modal inputs and
|
|
1061
|
-
tool calls. The validation happens at runtime.
|
|
1062
|
-
|
|
1063
|
-
Note: This is not a user-facing prompt. The AI SDK methods will map the
|
|
1064
|
-
user-facing prompt types such as chat or instruction prompts to this format.
|
|
1076
|
+
* A prompt is a list of messages.
|
|
1077
|
+
*
|
|
1078
|
+
* Note: Not all models and prompt formats support multi-modal inputs and
|
|
1079
|
+
* tool calls. The validation happens at runtime.
|
|
1080
|
+
*
|
|
1081
|
+
* Note: This is not a user-facing prompt. The AI SDK methods will map the
|
|
1082
|
+
* user-facing prompt types such as chat or instruction prompts to this format.
|
|
1065
1083
|
*/
|
|
1066
1084
|
type LanguageModelV3Prompt = Array<LanguageModelV3Message>;
|
|
1067
1085
|
type LanguageModelV3Message = ({
|
|
@@ -1085,12 +1103,12 @@ type LanguageModelV3Message = ({
|
|
|
1085
1103
|
providerOptions?: SharedV3ProviderOptions;
|
|
1086
1104
|
};
|
|
1087
1105
|
/**
|
|
1088
|
-
Text content part of a prompt. It contains a string of text.
|
|
1106
|
+
* Text content part of a prompt. It contains a string of text.
|
|
1089
1107
|
*/
|
|
1090
1108
|
interface LanguageModelV3TextPart {
|
|
1091
1109
|
type: 'text';
|
|
1092
1110
|
/**
|
|
1093
|
-
|
|
1111
|
+
* The text content.
|
|
1094
1112
|
*/
|
|
1095
1113
|
text: string;
|
|
1096
1114
|
/**
|
|
@@ -1101,12 +1119,12 @@ interface LanguageModelV3TextPart {
|
|
|
1101
1119
|
providerOptions?: SharedV3ProviderOptions;
|
|
1102
1120
|
}
|
|
1103
1121
|
/**
|
|
1104
|
-
Reasoning content part of a prompt. It contains a string of reasoning text.
|
|
1122
|
+
* Reasoning content part of a prompt. It contains a string of reasoning text.
|
|
1105
1123
|
*/
|
|
1106
1124
|
interface LanguageModelV3ReasoningPart {
|
|
1107
1125
|
type: 'reasoning';
|
|
1108
1126
|
/**
|
|
1109
|
-
|
|
1127
|
+
* The reasoning text.
|
|
1110
1128
|
*/
|
|
1111
1129
|
text: string;
|
|
1112
1130
|
/**
|
|
@@ -1117,7 +1135,7 @@ interface LanguageModelV3ReasoningPart {
|
|
|
1117
1135
|
providerOptions?: SharedV3ProviderOptions;
|
|
1118
1136
|
}
|
|
1119
1137
|
/**
|
|
1120
|
-
File content part of a prompt. It contains a file.
|
|
1138
|
+
* File content part of a prompt. It contains a file.
|
|
1121
1139
|
*/
|
|
1122
1140
|
interface LanguageModelV3FilePart {
|
|
1123
1141
|
type: 'file';
|
|
@@ -1126,15 +1144,15 @@ interface LanguageModelV3FilePart {
|
|
|
1126
1144
|
*/
|
|
1127
1145
|
filename?: string;
|
|
1128
1146
|
/**
|
|
1129
|
-
|
|
1130
|
-
|
|
1147
|
+
* File data. Can be a Uint8Array, base64 encoded data as a string or a URL.
|
|
1148
|
+
*/
|
|
1131
1149
|
data: LanguageModelV3DataContent;
|
|
1132
1150
|
/**
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1151
|
+
* IANA media type of the file.
|
|
1152
|
+
*
|
|
1153
|
+
* Can support wildcards, e.g. `image/*` (in which case the provider needs to take appropriate action).
|
|
1154
|
+
*
|
|
1155
|
+
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
1138
1156
|
*/
|
|
1139
1157
|
mediaType: string;
|
|
1140
1158
|
/**
|
|
@@ -1145,20 +1163,20 @@ interface LanguageModelV3FilePart {
|
|
|
1145
1163
|
providerOptions?: SharedV3ProviderOptions;
|
|
1146
1164
|
}
|
|
1147
1165
|
/**
|
|
1148
|
-
Tool call content part of a prompt. It contains a tool call (usually generated by the AI model).
|
|
1166
|
+
* Tool call content part of a prompt. It contains a tool call (usually generated by the AI model).
|
|
1149
1167
|
*/
|
|
1150
1168
|
interface LanguageModelV3ToolCallPart {
|
|
1151
1169
|
type: 'tool-call';
|
|
1152
1170
|
/**
|
|
1153
|
-
|
|
1154
|
-
|
|
1171
|
+
* ID of the tool call. This ID is used to match the tool call with the tool result.
|
|
1172
|
+
*/
|
|
1155
1173
|
toolCallId: string;
|
|
1156
1174
|
/**
|
|
1157
|
-
|
|
1158
|
-
|
|
1175
|
+
* Name of the tool that is being called.
|
|
1176
|
+
*/
|
|
1159
1177
|
toolName: string;
|
|
1160
1178
|
/**
|
|
1161
|
-
|
|
1179
|
+
* Arguments of the tool call. This is a JSON-serializable object that matches the tool's input schema.
|
|
1162
1180
|
*/
|
|
1163
1181
|
input: unknown;
|
|
1164
1182
|
/**
|
|
@@ -1174,20 +1192,20 @@ interface LanguageModelV3ToolCallPart {
|
|
|
1174
1192
|
providerOptions?: SharedV3ProviderOptions;
|
|
1175
1193
|
}
|
|
1176
1194
|
/**
|
|
1177
|
-
Tool result content part of a prompt. It contains the result of the tool call with the matching ID.
|
|
1195
|
+
* Tool result content part of a prompt. It contains the result of the tool call with the matching ID.
|
|
1178
1196
|
*/
|
|
1179
1197
|
interface LanguageModelV3ToolResultPart {
|
|
1180
1198
|
type: 'tool-result';
|
|
1181
1199
|
/**
|
|
1182
|
-
|
|
1183
|
-
|
|
1200
|
+
* ID of the tool call that this result is associated with.
|
|
1201
|
+
*/
|
|
1184
1202
|
toolCallId: string;
|
|
1185
1203
|
/**
|
|
1186
|
-
|
|
1187
|
-
|
|
1204
|
+
* Name of the tool that generated this result.
|
|
1205
|
+
*/
|
|
1188
1206
|
toolName: string;
|
|
1189
1207
|
/**
|
|
1190
|
-
|
|
1208
|
+
* Result of the tool call.
|
|
1191
1209
|
*/
|
|
1192
1210
|
output: LanguageModelV3ToolResultOutput;
|
|
1193
1211
|
/**
|
|
@@ -1274,8 +1292,8 @@ type LanguageModelV3ToolResultOutput = {
|
|
|
1274
1292
|
value: Array<{
|
|
1275
1293
|
type: 'text';
|
|
1276
1294
|
/**
|
|
1277
|
-
Text content.
|
|
1278
|
-
*/
|
|
1295
|
+
* Text content.
|
|
1296
|
+
*/
|
|
1279
1297
|
text: string;
|
|
1280
1298
|
/**
|
|
1281
1299
|
* Provider-specific options.
|
|
@@ -1284,13 +1302,13 @@ Text content.
|
|
|
1284
1302
|
} | {
|
|
1285
1303
|
type: 'file-data';
|
|
1286
1304
|
/**
|
|
1287
|
-
Base-64 encoded media data.
|
|
1288
|
-
*/
|
|
1305
|
+
* Base-64 encoded media data.
|
|
1306
|
+
*/
|
|
1289
1307
|
data: string;
|
|
1290
1308
|
/**
|
|
1291
|
-
IANA media type.
|
|
1292
|
-
@see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
1293
|
-
*/
|
|
1309
|
+
* IANA media type.
|
|
1310
|
+
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
1311
|
+
*/
|
|
1294
1312
|
mediaType: string;
|
|
1295
1313
|
/**
|
|
1296
1314
|
* Optional filename of the file.
|
|
@@ -1331,13 +1349,13 @@ IANA media type.
|
|
|
1331
1349
|
*/
|
|
1332
1350
|
type: 'image-data';
|
|
1333
1351
|
/**
|
|
1334
|
-
Base-64 encoded image data.
|
|
1335
|
-
*/
|
|
1352
|
+
* Base-64 encoded image data.
|
|
1353
|
+
*/
|
|
1336
1354
|
data: string;
|
|
1337
1355
|
/**
|
|
1338
|
-
IANA media type.
|
|
1339
|
-
@see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
1340
|
-
*/
|
|
1356
|
+
* IANA media type.
|
|
1357
|
+
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
1358
|
+
*/
|
|
1341
1359
|
mediaType: string;
|
|
1342
1360
|
/**
|
|
1343
1361
|
* Provider-specific options.
|
|
@@ -1426,54 +1444,54 @@ type LanguageModelV3ToolChoice = {
|
|
|
1426
1444
|
|
|
1427
1445
|
type LanguageModelV3CallOptions = {
|
|
1428
1446
|
/**
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1447
|
+
* A language mode prompt is a standardized prompt type.
|
|
1448
|
+
*
|
|
1449
|
+
* Note: This is **not** the user-facing prompt. The AI SDK methods will map the
|
|
1450
|
+
* user-facing prompt types such as chat or instruction prompts to this format.
|
|
1451
|
+
* That approach allows us to evolve the user facing prompts without breaking
|
|
1452
|
+
* the language model interface.
|
|
1435
1453
|
*/
|
|
1436
1454
|
prompt: LanguageModelV3Prompt;
|
|
1437
1455
|
/**
|
|
1438
|
-
|
|
1456
|
+
* Maximum number of tokens to generate.
|
|
1439
1457
|
*/
|
|
1440
1458
|
maxOutputTokens?: number;
|
|
1441
1459
|
/**
|
|
1442
|
-
|
|
1443
|
-
|
|
1460
|
+
* Temperature setting. The range depends on the provider and model.
|
|
1461
|
+
*/
|
|
1444
1462
|
temperature?: number;
|
|
1445
1463
|
/**
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1464
|
+
* Stop sequences.
|
|
1465
|
+
* If set, the model will stop generating text when one of the stop sequences is generated.
|
|
1466
|
+
* Providers may have limits on the number of stop sequences.
|
|
1467
|
+
*/
|
|
1450
1468
|
stopSequences?: string[];
|
|
1451
1469
|
/**
|
|
1452
|
-
|
|
1453
|
-
|
|
1470
|
+
* Nucleus sampling.
|
|
1471
|
+
*/
|
|
1454
1472
|
topP?: number;
|
|
1455
1473
|
/**
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1474
|
+
* Only sample from the top K options for each subsequent token.
|
|
1475
|
+
*
|
|
1476
|
+
* Used to remove "long tail" low probability responses.
|
|
1477
|
+
* Recommended for advanced use cases only. You usually only need to use temperature.
|
|
1478
|
+
*/
|
|
1461
1479
|
topK?: number;
|
|
1462
1480
|
/**
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1481
|
+
* Presence penalty setting. It affects the likelihood of the model to
|
|
1482
|
+
* repeat information that is already in the prompt.
|
|
1483
|
+
*/
|
|
1466
1484
|
presencePenalty?: number;
|
|
1467
1485
|
/**
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1486
|
+
* Frequency penalty setting. It affects the likelihood of the model
|
|
1487
|
+
* to repeatedly use the same words or phrases.
|
|
1488
|
+
*/
|
|
1471
1489
|
frequencyPenalty?: number;
|
|
1472
1490
|
/**
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1491
|
+
* Response format. The output can either be text or JSON. Default is text.
|
|
1492
|
+
*
|
|
1493
|
+
* If JSON is selected, a schema can optionally be provided to guide the LLM.
|
|
1494
|
+
*/
|
|
1477
1495
|
responseFormat?: {
|
|
1478
1496
|
type: 'text';
|
|
1479
1497
|
} | {
|
|
@@ -1492,30 +1510,30 @@ type LanguageModelV3CallOptions = {
|
|
|
1492
1510
|
description?: string;
|
|
1493
1511
|
};
|
|
1494
1512
|
/**
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1513
|
+
* The seed (integer) to use for random sampling. If set and supported
|
|
1514
|
+
* by the model, calls will generate deterministic results.
|
|
1515
|
+
*/
|
|
1498
1516
|
seed?: number;
|
|
1499
1517
|
/**
|
|
1500
|
-
|
|
1501
|
-
|
|
1518
|
+
* The tools that are available for the model.
|
|
1519
|
+
*/
|
|
1502
1520
|
tools?: Array<LanguageModelV3FunctionTool | LanguageModelV3ProviderTool>;
|
|
1503
1521
|
/**
|
|
1504
|
-
|
|
1505
|
-
|
|
1522
|
+
* Specifies how the tool should be selected. Defaults to 'auto'.
|
|
1523
|
+
*/
|
|
1506
1524
|
toolChoice?: LanguageModelV3ToolChoice;
|
|
1507
1525
|
/**
|
|
1508
|
-
|
|
1509
|
-
|
|
1526
|
+
* Include raw chunks in the stream. Only applicable for streaming calls.
|
|
1527
|
+
*/
|
|
1510
1528
|
includeRawChunks?: boolean;
|
|
1511
1529
|
/**
|
|
1512
|
-
|
|
1513
|
-
|
|
1530
|
+
* Abort signal for cancelling the operation.
|
|
1531
|
+
*/
|
|
1514
1532
|
abortSignal?: AbortSignal;
|
|
1515
1533
|
/**
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1534
|
+
* Additional HTTP headers to be sent with the request.
|
|
1535
|
+
* Only applicable for HTTP-based providers.
|
|
1536
|
+
*/
|
|
1519
1537
|
headers?: Record<string, string | undefined>;
|
|
1520
1538
|
/**
|
|
1521
1539
|
* Additional provider-specific options. They are passed through
|
|
@@ -1526,26 +1544,26 @@ type LanguageModelV3CallOptions = {
|
|
|
1526
1544
|
};
|
|
1527
1545
|
|
|
1528
1546
|
/**
|
|
1529
|
-
A file that has been generated by the model.
|
|
1530
|
-
Generated files as base64 encoded strings or binary data.
|
|
1531
|
-
The files should be returned without any unnecessary conversion.
|
|
1547
|
+
* A file that has been generated by the model.
|
|
1548
|
+
* Generated files as base64 encoded strings or binary data.
|
|
1549
|
+
* The files should be returned without any unnecessary conversion.
|
|
1532
1550
|
*/
|
|
1533
1551
|
type LanguageModelV3File = {
|
|
1534
1552
|
type: 'file';
|
|
1535
1553
|
/**
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1554
|
+
* The IANA media type of the file, e.g. `image/png` or `audio/mp3`.
|
|
1555
|
+
*
|
|
1556
|
+
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
1557
|
+
*/
|
|
1540
1558
|
mediaType: string;
|
|
1541
1559
|
/**
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1560
|
+
* Generated file data as base64 encoded strings or binary data.
|
|
1561
|
+
*
|
|
1562
|
+
* The file data should be returned without any unnecessary conversion.
|
|
1563
|
+
* If the API returns base64 encoded strings, the file data should be returned
|
|
1564
|
+
* as base64 encoded strings. If the API returns binary data, the file data should
|
|
1565
|
+
* be returned as binary data.
|
|
1566
|
+
*/
|
|
1549
1567
|
data: string | Uint8Array;
|
|
1550
1568
|
/**
|
|
1551
1569
|
* Optional provider-specific metadata for the file part.
|
|
@@ -1554,7 +1572,7 @@ type LanguageModelV3File = {
|
|
|
1554
1572
|
};
|
|
1555
1573
|
|
|
1556
1574
|
/**
|
|
1557
|
-
Reasoning that the model has generated.
|
|
1575
|
+
* Reasoning that the model has generated.
|
|
1558
1576
|
*/
|
|
1559
1577
|
type LanguageModelV3Reasoning = {
|
|
1560
1578
|
type: 'reasoning';
|
|
@@ -1566,7 +1584,7 @@ type LanguageModelV3Reasoning = {
|
|
|
1566
1584
|
};
|
|
1567
1585
|
|
|
1568
1586
|
/**
|
|
1569
|
-
A source that has been used as input to generate the response.
|
|
1587
|
+
* A source that has been used as input to generate the response.
|
|
1570
1588
|
*/
|
|
1571
1589
|
type LanguageModelV3Source = {
|
|
1572
1590
|
type: 'source';
|
|
@@ -1619,12 +1637,12 @@ type LanguageModelV3Source = {
|
|
|
1619
1637
|
};
|
|
1620
1638
|
|
|
1621
1639
|
/**
|
|
1622
|
-
Text that the model has generated.
|
|
1640
|
+
* Text that the model has generated.
|
|
1623
1641
|
*/
|
|
1624
1642
|
type LanguageModelV3Text = {
|
|
1625
1643
|
type: 'text';
|
|
1626
1644
|
/**
|
|
1627
|
-
|
|
1645
|
+
* The text content.
|
|
1628
1646
|
*/
|
|
1629
1647
|
text: string;
|
|
1630
1648
|
providerMetadata?: SharedV3ProviderMetadata;
|
|
@@ -1688,7 +1706,7 @@ type LanguageModelV3ToolCall = {
|
|
|
1688
1706
|
};
|
|
1689
1707
|
|
|
1690
1708
|
/**
|
|
1691
|
-
Result of a tool call that has been executed by the provider.
|
|
1709
|
+
* Result of a tool call that has been executed by the provider.
|
|
1692
1710
|
*/
|
|
1693
1711
|
type LanguageModelV3ToolResult = {
|
|
1694
1712
|
type: 'tool-result';
|
|
@@ -1760,16 +1778,16 @@ type LanguageModelV3FinishReason = {
|
|
|
1760
1778
|
|
|
1761
1779
|
interface LanguageModelV3ResponseMetadata {
|
|
1762
1780
|
/**
|
|
1763
|
-
|
|
1764
|
-
|
|
1781
|
+
* ID for the generated response, if the provider sends one.
|
|
1782
|
+
*/
|
|
1765
1783
|
id?: string;
|
|
1766
1784
|
/**
|
|
1767
|
-
|
|
1768
|
-
|
|
1785
|
+
* Timestamp for the start of the generated response, if the provider sends one.
|
|
1786
|
+
*/
|
|
1769
1787
|
timestamp?: Date;
|
|
1770
1788
|
/**
|
|
1771
|
-
|
|
1772
|
-
|
|
1789
|
+
* The ID of the response model that was used to generate the response, if the provider sends one.
|
|
1790
|
+
*/
|
|
1773
1791
|
modelId?: string;
|
|
1774
1792
|
}
|
|
1775
1793
|
|
|
@@ -1782,7 +1800,7 @@ type LanguageModelV3Usage = {
|
|
|
1782
1800
|
*/
|
|
1783
1801
|
inputTokens: {
|
|
1784
1802
|
/**
|
|
1785
|
-
*The total number of input (prompt) tokens used.
|
|
1803
|
+
* The total number of input (prompt) tokens used.
|
|
1786
1804
|
*/
|
|
1787
1805
|
total: number | undefined;
|
|
1788
1806
|
/**
|
|
@@ -2089,49 +2107,49 @@ type LanguageModelV3Middleware = {
|
|
|
2089
2107
|
};
|
|
2090
2108
|
|
|
2091
2109
|
/**
|
|
2092
|
-
A tool has a name, a description, and a set of parameters.
|
|
2093
|
-
|
|
2094
|
-
Note: this is **not** the user-facing tool definition. The AI SDK methods will
|
|
2095
|
-
map the user-facing tool definitions to this format.
|
|
2110
|
+
* A tool has a name, a description, and a set of parameters.
|
|
2111
|
+
*
|
|
2112
|
+
* Note: this is **not** the user-facing tool definition. The AI SDK methods will
|
|
2113
|
+
* map the user-facing tool definitions to this format.
|
|
2096
2114
|
*/
|
|
2097
2115
|
type LanguageModelV2FunctionTool = {
|
|
2098
2116
|
/**
|
|
2099
|
-
|
|
2117
|
+
* The type of the tool (always 'function').
|
|
2100
2118
|
*/
|
|
2101
2119
|
type: 'function';
|
|
2102
2120
|
/**
|
|
2103
|
-
|
|
2121
|
+
* The name of the tool. Unique within this model call.
|
|
2104
2122
|
*/
|
|
2105
2123
|
name: string;
|
|
2106
2124
|
/**
|
|
2107
|
-
|
|
2108
|
-
|
|
2125
|
+
* A description of the tool. The language model uses this to understand the
|
|
2126
|
+
* tool's purpose and to provide better completion suggestions.
|
|
2109
2127
|
*/
|
|
2110
2128
|
description?: string;
|
|
2111
2129
|
/**
|
|
2112
|
-
|
|
2113
|
-
|
|
2130
|
+
* The parameters that the tool expects. The language model uses this to
|
|
2131
|
+
* understand the tool's input requirements and to provide matching suggestions.
|
|
2114
2132
|
*/
|
|
2115
2133
|
inputSchema: JSONSchema7;
|
|
2116
2134
|
/**
|
|
2117
|
-
|
|
2135
|
+
* The provider-specific options for the tool.
|
|
2118
2136
|
*/
|
|
2119
2137
|
providerOptions?: SharedV2ProviderOptions;
|
|
2120
2138
|
};
|
|
2121
2139
|
|
|
2122
2140
|
/**
|
|
2123
|
-
Data content. Can be a Uint8Array, base64 encoded data as a string or a URL.
|
|
2124
|
-
*/
|
|
2141
|
+
* Data content. Can be a Uint8Array, base64 encoded data as a string or a URL.
|
|
2142
|
+
*/
|
|
2125
2143
|
type LanguageModelV2DataContent = Uint8Array | string | URL;
|
|
2126
2144
|
|
|
2127
2145
|
/**
|
|
2128
|
-
A prompt is a list of messages.
|
|
2129
|
-
|
|
2130
|
-
Note: Not all models and prompt formats support multi-modal inputs and
|
|
2131
|
-
tool calls. The validation happens at runtime.
|
|
2132
|
-
|
|
2133
|
-
Note: This is not a user-facing prompt. The AI SDK methods will map the
|
|
2134
|
-
user-facing prompt types such as chat or instruction prompts to this format.
|
|
2146
|
+
* A prompt is a list of messages.
|
|
2147
|
+
*
|
|
2148
|
+
* Note: Not all models and prompt formats support multi-modal inputs and
|
|
2149
|
+
* tool calls. The validation happens at runtime.
|
|
2150
|
+
*
|
|
2151
|
+
* Note: This is not a user-facing prompt. The AI SDK methods will map the
|
|
2152
|
+
* user-facing prompt types such as chat or instruction prompts to this format.
|
|
2135
2153
|
*/
|
|
2136
2154
|
type LanguageModelV2Prompt = Array<LanguageModelV2Message>;
|
|
2137
2155
|
type LanguageModelV2Message = ({
|
|
@@ -2155,12 +2173,12 @@ type LanguageModelV2Message = ({
|
|
|
2155
2173
|
providerOptions?: SharedV2ProviderOptions;
|
|
2156
2174
|
};
|
|
2157
2175
|
/**
|
|
2158
|
-
Text content part of a prompt. It contains a string of text.
|
|
2176
|
+
* Text content part of a prompt. It contains a string of text.
|
|
2159
2177
|
*/
|
|
2160
2178
|
interface LanguageModelV2TextPart {
|
|
2161
2179
|
type: 'text';
|
|
2162
2180
|
/**
|
|
2163
|
-
|
|
2181
|
+
* The text content.
|
|
2164
2182
|
*/
|
|
2165
2183
|
text: string;
|
|
2166
2184
|
/**
|
|
@@ -2171,12 +2189,12 @@ interface LanguageModelV2TextPart {
|
|
|
2171
2189
|
providerOptions?: SharedV2ProviderOptions;
|
|
2172
2190
|
}
|
|
2173
2191
|
/**
|
|
2174
|
-
Reasoning content part of a prompt. It contains a string of reasoning text.
|
|
2192
|
+
* Reasoning content part of a prompt. It contains a string of reasoning text.
|
|
2175
2193
|
*/
|
|
2176
2194
|
interface LanguageModelV2ReasoningPart {
|
|
2177
2195
|
type: 'reasoning';
|
|
2178
2196
|
/**
|
|
2179
|
-
|
|
2197
|
+
* The reasoning text.
|
|
2180
2198
|
*/
|
|
2181
2199
|
text: string;
|
|
2182
2200
|
/**
|
|
@@ -2187,7 +2205,7 @@ interface LanguageModelV2ReasoningPart {
|
|
|
2187
2205
|
providerOptions?: SharedV2ProviderOptions;
|
|
2188
2206
|
}
|
|
2189
2207
|
/**
|
|
2190
|
-
File content part of a prompt. It contains a file.
|
|
2208
|
+
* File content part of a prompt. It contains a file.
|
|
2191
2209
|
*/
|
|
2192
2210
|
interface LanguageModelV2FilePart {
|
|
2193
2211
|
type: 'file';
|
|
@@ -2196,15 +2214,15 @@ interface LanguageModelV2FilePart {
|
|
|
2196
2214
|
*/
|
|
2197
2215
|
filename?: string;
|
|
2198
2216
|
/**
|
|
2199
|
-
|
|
2200
|
-
|
|
2217
|
+
* File data. Can be a Uint8Array, base64 encoded data as a string or a URL.
|
|
2218
|
+
*/
|
|
2201
2219
|
data: LanguageModelV2DataContent;
|
|
2202
2220
|
/**
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2221
|
+
* IANA media type of the file.
|
|
2222
|
+
*
|
|
2223
|
+
* Can support wildcards, e.g. `image/*` (in which case the provider needs to take appropriate action).
|
|
2224
|
+
*
|
|
2225
|
+
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
2208
2226
|
*/
|
|
2209
2227
|
mediaType: string;
|
|
2210
2228
|
/**
|
|
@@ -2215,20 +2233,20 @@ interface LanguageModelV2FilePart {
|
|
|
2215
2233
|
providerOptions?: SharedV2ProviderOptions;
|
|
2216
2234
|
}
|
|
2217
2235
|
/**
|
|
2218
|
-
Tool call content part of a prompt. It contains a tool call (usually generated by the AI model).
|
|
2236
|
+
* Tool call content part of a prompt. It contains a tool call (usually generated by the AI model).
|
|
2219
2237
|
*/
|
|
2220
2238
|
interface LanguageModelV2ToolCallPart {
|
|
2221
2239
|
type: 'tool-call';
|
|
2222
2240
|
/**
|
|
2223
|
-
|
|
2224
|
-
|
|
2241
|
+
* ID of the tool call. This ID is used to match the tool call with the tool result.
|
|
2242
|
+
*/
|
|
2225
2243
|
toolCallId: string;
|
|
2226
2244
|
/**
|
|
2227
|
-
|
|
2228
|
-
|
|
2245
|
+
* Name of the tool that is being called.
|
|
2246
|
+
*/
|
|
2229
2247
|
toolName: string;
|
|
2230
2248
|
/**
|
|
2231
|
-
|
|
2249
|
+
* Arguments of the tool call. This is a JSON-serializable object that matches the tool's input schema.
|
|
2232
2250
|
*/
|
|
2233
2251
|
input: unknown;
|
|
2234
2252
|
/**
|
|
@@ -2244,20 +2262,20 @@ interface LanguageModelV2ToolCallPart {
|
|
|
2244
2262
|
providerOptions?: SharedV2ProviderOptions;
|
|
2245
2263
|
}
|
|
2246
2264
|
/**
|
|
2247
|
-
Tool result content part of a prompt. It contains the result of the tool call with the matching ID.
|
|
2265
|
+
* Tool result content part of a prompt. It contains the result of the tool call with the matching ID.
|
|
2248
2266
|
*/
|
|
2249
2267
|
interface LanguageModelV2ToolResultPart {
|
|
2250
2268
|
type: 'tool-result';
|
|
2251
2269
|
/**
|
|
2252
|
-
|
|
2253
|
-
|
|
2270
|
+
* ID of the tool call that this result is associated with.
|
|
2271
|
+
*/
|
|
2254
2272
|
toolCallId: string;
|
|
2255
2273
|
/**
|
|
2256
|
-
|
|
2257
|
-
|
|
2274
|
+
* Name of the tool that generated this result.
|
|
2275
|
+
*/
|
|
2258
2276
|
toolName: string;
|
|
2259
2277
|
/**
|
|
2260
|
-
|
|
2278
|
+
* Result of the tool call.
|
|
2261
2279
|
*/
|
|
2262
2280
|
output: LanguageModelV2ToolResultOutput;
|
|
2263
2281
|
/**
|
|
@@ -2284,42 +2302,42 @@ type LanguageModelV2ToolResultOutput = {
|
|
|
2284
2302
|
value: Array<{
|
|
2285
2303
|
type: 'text';
|
|
2286
2304
|
/**
|
|
2287
|
-
Text content.
|
|
2288
|
-
*/
|
|
2305
|
+
* Text content.
|
|
2306
|
+
*/
|
|
2289
2307
|
text: string;
|
|
2290
2308
|
} | {
|
|
2291
2309
|
type: 'media';
|
|
2292
2310
|
/**
|
|
2293
|
-
Base-64 encoded media data.
|
|
2294
|
-
*/
|
|
2311
|
+
* Base-64 encoded media data.
|
|
2312
|
+
*/
|
|
2295
2313
|
data: string;
|
|
2296
2314
|
/**
|
|
2297
|
-
IANA media type.
|
|
2298
|
-
@see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
2299
|
-
*/
|
|
2315
|
+
* IANA media type.
|
|
2316
|
+
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
2317
|
+
*/
|
|
2300
2318
|
mediaType: string;
|
|
2301
2319
|
}>;
|
|
2302
2320
|
};
|
|
2303
2321
|
|
|
2304
2322
|
/**
|
|
2305
|
-
The configuration of a tool that is defined by the provider.
|
|
2323
|
+
* The configuration of a tool that is defined by the provider.
|
|
2306
2324
|
*/
|
|
2307
2325
|
type LanguageModelV2ProviderDefinedTool = {
|
|
2308
2326
|
/**
|
|
2309
|
-
|
|
2327
|
+
* The type of the tool (always 'provider-defined').
|
|
2310
2328
|
*/
|
|
2311
2329
|
type: 'provider-defined';
|
|
2312
2330
|
/**
|
|
2313
|
-
|
|
2331
|
+
* The ID of the tool. Should follow the format `<provider-name>.<unique-tool-name>`.
|
|
2314
2332
|
*/
|
|
2315
2333
|
id: `${string}.${string}`;
|
|
2316
2334
|
/**
|
|
2317
|
-
|
|
2335
|
+
* The name of the tool that the user must use in the tool set.
|
|
2318
2336
|
*/
|
|
2319
2337
|
name: string;
|
|
2320
2338
|
/**
|
|
2321
|
-
|
|
2322
|
-
|
|
2339
|
+
* The arguments for configuring the tool. Must match the expected arguments defined by the provider for this tool.
|
|
2340
|
+
*/
|
|
2323
2341
|
args: Record<string, unknown>;
|
|
2324
2342
|
};
|
|
2325
2343
|
|
|
@@ -2336,54 +2354,54 @@ type LanguageModelV2ToolChoice = {
|
|
|
2336
2354
|
|
|
2337
2355
|
type LanguageModelV2CallOptions = {
|
|
2338
2356
|
/**
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2357
|
+
* A language mode prompt is a standardized prompt type.
|
|
2358
|
+
*
|
|
2359
|
+
* Note: This is **not** the user-facing prompt. The AI SDK methods will map the
|
|
2360
|
+
* user-facing prompt types such as chat or instruction prompts to this format.
|
|
2361
|
+
* That approach allows us to evolve the user facing prompts without breaking
|
|
2362
|
+
* the language model interface.
|
|
2345
2363
|
*/
|
|
2346
2364
|
prompt: LanguageModelV2Prompt;
|
|
2347
2365
|
/**
|
|
2348
|
-
|
|
2366
|
+
* Maximum number of tokens to generate.
|
|
2349
2367
|
*/
|
|
2350
2368
|
maxOutputTokens?: number;
|
|
2351
2369
|
/**
|
|
2352
|
-
|
|
2353
|
-
|
|
2370
|
+
* Temperature setting. The range depends on the provider and model.
|
|
2371
|
+
*/
|
|
2354
2372
|
temperature?: number;
|
|
2355
2373
|
/**
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2374
|
+
* Stop sequences.
|
|
2375
|
+
* If set, the model will stop generating text when one of the stop sequences is generated.
|
|
2376
|
+
* Providers may have limits on the number of stop sequences.
|
|
2377
|
+
*/
|
|
2360
2378
|
stopSequences?: string[];
|
|
2361
2379
|
/**
|
|
2362
|
-
|
|
2363
|
-
|
|
2380
|
+
* Nucleus sampling.
|
|
2381
|
+
*/
|
|
2364
2382
|
topP?: number;
|
|
2365
2383
|
/**
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2384
|
+
* Only sample from the top K options for each subsequent token.
|
|
2385
|
+
*
|
|
2386
|
+
* Used to remove "long tail" low probability responses.
|
|
2387
|
+
* Recommended for advanced use cases only. You usually only need to use temperature.
|
|
2388
|
+
*/
|
|
2371
2389
|
topK?: number;
|
|
2372
2390
|
/**
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2391
|
+
* Presence penalty setting. It affects the likelihood of the model to
|
|
2392
|
+
* repeat information that is already in the prompt.
|
|
2393
|
+
*/
|
|
2376
2394
|
presencePenalty?: number;
|
|
2377
2395
|
/**
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2396
|
+
* Frequency penalty setting. It affects the likelihood of the model
|
|
2397
|
+
* to repeatedly use the same words or phrases.
|
|
2398
|
+
*/
|
|
2381
2399
|
frequencyPenalty?: number;
|
|
2382
2400
|
/**
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2401
|
+
* Response format. The output can either be text or JSON. Default is text.
|
|
2402
|
+
*
|
|
2403
|
+
* If JSON is selected, a schema can optionally be provided to guide the LLM.
|
|
2404
|
+
*/
|
|
2387
2405
|
responseFormat?: {
|
|
2388
2406
|
type: 'text';
|
|
2389
2407
|
} | {
|
|
@@ -2402,30 +2420,30 @@ type LanguageModelV2CallOptions = {
|
|
|
2402
2420
|
description?: string;
|
|
2403
2421
|
};
|
|
2404
2422
|
/**
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2423
|
+
* The seed (integer) to use for random sampling. If set and supported
|
|
2424
|
+
* by the model, calls will generate deterministic results.
|
|
2425
|
+
*/
|
|
2408
2426
|
seed?: number;
|
|
2409
2427
|
/**
|
|
2410
|
-
|
|
2411
|
-
|
|
2428
|
+
* The tools that are available for the model.
|
|
2429
|
+
*/
|
|
2412
2430
|
tools?: Array<LanguageModelV2FunctionTool | LanguageModelV2ProviderDefinedTool>;
|
|
2413
2431
|
/**
|
|
2414
|
-
|
|
2415
|
-
|
|
2432
|
+
* Specifies how the tool should be selected. Defaults to 'auto'.
|
|
2433
|
+
*/
|
|
2416
2434
|
toolChoice?: LanguageModelV2ToolChoice;
|
|
2417
2435
|
/**
|
|
2418
|
-
|
|
2419
|
-
|
|
2436
|
+
* Include raw chunks in the stream. Only applicable for streaming calls.
|
|
2437
|
+
*/
|
|
2420
2438
|
includeRawChunks?: boolean;
|
|
2421
2439
|
/**
|
|
2422
|
-
|
|
2423
|
-
|
|
2440
|
+
* Abort signal for cancelling the operation.
|
|
2441
|
+
*/
|
|
2424
2442
|
abortSignal?: AbortSignal;
|
|
2425
2443
|
/**
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2444
|
+
* Additional HTTP headers to be sent with the request.
|
|
2445
|
+
* Only applicable for HTTP-based providers.
|
|
2446
|
+
*/
|
|
2429
2447
|
headers?: Record<string, string | undefined>;
|
|
2430
2448
|
/**
|
|
2431
2449
|
* Additional provider-specific options. They are passed through
|
|
@@ -2436,8 +2454,8 @@ type LanguageModelV2CallOptions = {
|
|
|
2436
2454
|
};
|
|
2437
2455
|
|
|
2438
2456
|
/**
|
|
2439
|
-
Warning from the model provider for this call. The call will proceed, but e.g.
|
|
2440
|
-
some settings might not be supported, which can lead to suboptimal results.
|
|
2457
|
+
* Warning from the model provider for this call. The call will proceed, but e.g.
|
|
2458
|
+
* some settings might not be supported, which can lead to suboptimal results.
|
|
2441
2459
|
*/
|
|
2442
2460
|
type LanguageModelV2CallWarning = {
|
|
2443
2461
|
type: 'unsupported-setting';
|
|
@@ -2453,31 +2471,31 @@ type LanguageModelV2CallWarning = {
|
|
|
2453
2471
|
};
|
|
2454
2472
|
|
|
2455
2473
|
/**
|
|
2456
|
-
A file that has been generated by the model.
|
|
2457
|
-
Generated files as base64 encoded strings or binary data.
|
|
2458
|
-
The files should be returned without any unnecessary conversion.
|
|
2474
|
+
* A file that has been generated by the model.
|
|
2475
|
+
* Generated files as base64 encoded strings or binary data.
|
|
2476
|
+
* The files should be returned without any unnecessary conversion.
|
|
2459
2477
|
*/
|
|
2460
2478
|
type LanguageModelV2File = {
|
|
2461
2479
|
type: 'file';
|
|
2462
2480
|
/**
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2481
|
+
* The IANA media type of the file, e.g. `image/png` or `audio/mp3`.
|
|
2482
|
+
*
|
|
2483
|
+
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
2484
|
+
*/
|
|
2467
2485
|
mediaType: string;
|
|
2468
2486
|
/**
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2487
|
+
* Generated file data as base64 encoded strings or binary data.
|
|
2488
|
+
*
|
|
2489
|
+
* The file data should be returned without any unnecessary conversion.
|
|
2490
|
+
* If the API returns base64 encoded strings, the file data should be returned
|
|
2491
|
+
* as base64 encoded strings. If the API returns binary data, the file data should
|
|
2492
|
+
* be returned as binary data.
|
|
2493
|
+
*/
|
|
2476
2494
|
data: string | Uint8Array;
|
|
2477
2495
|
};
|
|
2478
2496
|
|
|
2479
2497
|
/**
|
|
2480
|
-
Reasoning that the model has generated.
|
|
2498
|
+
* Reasoning that the model has generated.
|
|
2481
2499
|
*/
|
|
2482
2500
|
type LanguageModelV2Reasoning = {
|
|
2483
2501
|
type: 'reasoning';
|
|
@@ -2489,7 +2507,7 @@ type LanguageModelV2Reasoning = {
|
|
|
2489
2507
|
};
|
|
2490
2508
|
|
|
2491
2509
|
/**
|
|
2492
|
-
A source that has been used as input to generate the response.
|
|
2510
|
+
* A source that has been used as input to generate the response.
|
|
2493
2511
|
*/
|
|
2494
2512
|
type LanguageModelV2Source = {
|
|
2495
2513
|
type: 'source';
|
|
@@ -2542,12 +2560,12 @@ type LanguageModelV2Source = {
|
|
|
2542
2560
|
};
|
|
2543
2561
|
|
|
2544
2562
|
/**
|
|
2545
|
-
Text that the model has generated.
|
|
2563
|
+
* Text that the model has generated.
|
|
2546
2564
|
*/
|
|
2547
2565
|
type LanguageModelV2Text = {
|
|
2548
2566
|
type: 'text';
|
|
2549
2567
|
/**
|
|
2550
|
-
|
|
2568
|
+
* The text content.
|
|
2551
2569
|
*/
|
|
2552
2570
|
text: string;
|
|
2553
2571
|
providerMetadata?: SharedV2ProviderMetadata;
|
|
@@ -2583,7 +2601,7 @@ type LanguageModelV2ToolCall = {
|
|
|
2583
2601
|
};
|
|
2584
2602
|
|
|
2585
2603
|
/**
|
|
2586
|
-
Result of a tool call that has been executed by the provider.
|
|
2604
|
+
* Result of a tool call that has been executed by the provider.
|
|
2587
2605
|
*/
|
|
2588
2606
|
type LanguageModelV2ToolResult = {
|
|
2589
2607
|
type: 'tool-result';
|
|
@@ -2618,61 +2636,61 @@ type LanguageModelV2ToolResult = {
|
|
|
2618
2636
|
type LanguageModelV2Content = LanguageModelV2Text | LanguageModelV2Reasoning | LanguageModelV2File | LanguageModelV2Source | LanguageModelV2ToolCall | LanguageModelV2ToolResult;
|
|
2619
2637
|
|
|
2620
2638
|
/**
|
|
2621
|
-
Reason why a language model finished generating a response.
|
|
2622
|
-
|
|
2623
|
-
Can be one of the following:
|
|
2624
|
-
- `stop`: model generated stop sequence
|
|
2625
|
-
- `length`: model generated maximum number of tokens
|
|
2626
|
-
- `content-filter`: content filter violation stopped the model
|
|
2627
|
-
- `tool-calls`: model triggered tool calls
|
|
2628
|
-
- `error`: model stopped because of an error
|
|
2629
|
-
- `other`: model stopped for other reasons
|
|
2630
|
-
- `unknown`: the model has not transmitted a finish reason
|
|
2639
|
+
* Reason why a language model finished generating a response.
|
|
2640
|
+
*
|
|
2641
|
+
* Can be one of the following:
|
|
2642
|
+
* - `stop`: model generated stop sequence
|
|
2643
|
+
* - `length`: model generated maximum number of tokens
|
|
2644
|
+
* - `content-filter`: content filter violation stopped the model
|
|
2645
|
+
* - `tool-calls`: model triggered tool calls
|
|
2646
|
+
* - `error`: model stopped because of an error
|
|
2647
|
+
* - `other`: model stopped for other reasons
|
|
2648
|
+
* - `unknown`: the model has not transmitted a finish reason
|
|
2631
2649
|
*/
|
|
2632
2650
|
type LanguageModelV2FinishReason = 'stop' | 'length' | 'content-filter' | 'tool-calls' | 'error' | 'other' | 'unknown';
|
|
2633
2651
|
|
|
2634
2652
|
interface LanguageModelV2ResponseMetadata {
|
|
2635
2653
|
/**
|
|
2636
|
-
|
|
2637
|
-
|
|
2654
|
+
* ID for the generated response, if the provider sends one.
|
|
2655
|
+
*/
|
|
2638
2656
|
id?: string;
|
|
2639
2657
|
/**
|
|
2640
|
-
|
|
2641
|
-
|
|
2658
|
+
* Timestamp for the start of the generated response, if the provider sends one.
|
|
2659
|
+
*/
|
|
2642
2660
|
timestamp?: Date;
|
|
2643
2661
|
/**
|
|
2644
|
-
|
|
2645
|
-
|
|
2662
|
+
* The ID of the response model that was used to generate the response, if the provider sends one.
|
|
2663
|
+
*/
|
|
2646
2664
|
modelId?: string;
|
|
2647
2665
|
}
|
|
2648
2666
|
|
|
2649
2667
|
/**
|
|
2650
|
-
Usage information for a language model call.
|
|
2651
|
-
|
|
2652
|
-
If your API return additional usage information, you can add it to the
|
|
2653
|
-
provider metadata under your provider's key.
|
|
2668
|
+
* Usage information for a language model call.
|
|
2669
|
+
*
|
|
2670
|
+
* If your API return additional usage information, you can add it to the
|
|
2671
|
+
* provider metadata under your provider's key.
|
|
2654
2672
|
*/
|
|
2655
2673
|
type LanguageModelV2Usage = {
|
|
2656
2674
|
/**
|
|
2657
|
-
|
|
2675
|
+
* The number of input (prompt) tokens used.
|
|
2658
2676
|
*/
|
|
2659
2677
|
inputTokens: number | undefined;
|
|
2660
2678
|
/**
|
|
2661
|
-
|
|
2679
|
+
* The number of output (completion) tokens used.
|
|
2662
2680
|
*/
|
|
2663
2681
|
outputTokens: number | undefined;
|
|
2664
2682
|
/**
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2683
|
+
* The total number of tokens as reported by the provider.
|
|
2684
|
+
* This number might be different from the sum of `inputTokens` and `outputTokens`
|
|
2685
|
+
* and e.g. include reasoning tokens or other overhead.
|
|
2668
2686
|
*/
|
|
2669
2687
|
totalTokens: number | undefined;
|
|
2670
2688
|
/**
|
|
2671
|
-
|
|
2689
|
+
* The number of reasoning tokens used.
|
|
2672
2690
|
*/
|
|
2673
2691
|
reasoningTokens?: number | undefined;
|
|
2674
2692
|
/**
|
|
2675
|
-
|
|
2693
|
+
* The number of cached input tokens.
|
|
2676
2694
|
*/
|
|
2677
2695
|
cachedInputTokens?: number | undefined;
|
|
2678
2696
|
};
|
|
@@ -2737,111 +2755,111 @@ type LanguageModelV2StreamPart = {
|
|
|
2737
2755
|
};
|
|
2738
2756
|
|
|
2739
2757
|
/**
|
|
2740
|
-
Specification for a language model that implements the language model interface version 2.
|
|
2758
|
+
* Specification for a language model that implements the language model interface version 2.
|
|
2741
2759
|
*/
|
|
2742
2760
|
type LanguageModelV2 = {
|
|
2743
2761
|
/**
|
|
2744
|
-
|
|
2762
|
+
* The language model must specify which language model interface version it implements.
|
|
2745
2763
|
*/
|
|
2746
2764
|
readonly specificationVersion: 'v2';
|
|
2747
2765
|
/**
|
|
2748
|
-
|
|
2766
|
+
* Name of the provider for logging purposes.
|
|
2749
2767
|
*/
|
|
2750
2768
|
readonly provider: string;
|
|
2751
2769
|
/**
|
|
2752
|
-
|
|
2770
|
+
* Provider-specific model ID for logging purposes.
|
|
2753
2771
|
*/
|
|
2754
2772
|
readonly modelId: string;
|
|
2755
2773
|
/**
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2774
|
+
* Supported URL patterns by media type for the provider.
|
|
2775
|
+
*
|
|
2776
|
+
* The keys are media type patterns or full media types (e.g. `*\/*` for everything, `audio/*`, `video/*`, or `application/pdf`).
|
|
2777
|
+
* and the values are arrays of regular expressions that match the URL paths.
|
|
2778
|
+
*
|
|
2779
|
+
* The matching should be against lower-case URLs.
|
|
2780
|
+
*
|
|
2781
|
+
* Matched URLs are supported natively by the model and are not downloaded.
|
|
2782
|
+
*
|
|
2783
|
+
* @returns A map of supported URL patterns by media type (as a promise or a plain object).
|
|
2766
2784
|
*/
|
|
2767
2785
|
supportedUrls: PromiseLike<Record<string, RegExp[]>> | Record<string, RegExp[]>;
|
|
2768
2786
|
/**
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2787
|
+
* Generates a language model output (non-streaming).
|
|
2788
|
+
*
|
|
2789
|
+
* Naming: "do" prefix to prevent accidental direct usage of the method
|
|
2790
|
+
* by the user.
|
|
2773
2791
|
*/
|
|
2774
2792
|
doGenerate(options: LanguageModelV2CallOptions): PromiseLike<{
|
|
2775
2793
|
/**
|
|
2776
|
-
|
|
2794
|
+
* Ordered content that the model has generated.
|
|
2777
2795
|
*/
|
|
2778
2796
|
content: Array<LanguageModelV2Content>;
|
|
2779
2797
|
/**
|
|
2780
|
-
|
|
2798
|
+
* Finish reason.
|
|
2781
2799
|
*/
|
|
2782
2800
|
finishReason: LanguageModelV2FinishReason;
|
|
2783
2801
|
/**
|
|
2784
|
-
|
|
2802
|
+
* Usage information.
|
|
2785
2803
|
*/
|
|
2786
2804
|
usage: LanguageModelV2Usage;
|
|
2787
2805
|
/**
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2806
|
+
* Additional provider-specific metadata. They are passed through
|
|
2807
|
+
* from the provider to the AI SDK and enable provider-specific
|
|
2808
|
+
* results that can be fully encapsulated in the provider.
|
|
2791
2809
|
*/
|
|
2792
2810
|
providerMetadata?: SharedV2ProviderMetadata;
|
|
2793
2811
|
/**
|
|
2794
|
-
|
|
2812
|
+
* Optional request information for telemetry and debugging purposes.
|
|
2795
2813
|
*/
|
|
2796
2814
|
request?: {
|
|
2797
2815
|
/**
|
|
2798
|
-
|
|
2816
|
+
* Request HTTP body that was sent to the provider API.
|
|
2799
2817
|
*/
|
|
2800
2818
|
body?: unknown;
|
|
2801
2819
|
};
|
|
2802
2820
|
/**
|
|
2803
|
-
|
|
2821
|
+
* Optional response information for telemetry and debugging purposes.
|
|
2804
2822
|
*/
|
|
2805
2823
|
response?: LanguageModelV2ResponseMetadata & {
|
|
2806
2824
|
/**
|
|
2807
|
-
|
|
2808
|
-
|
|
2825
|
+
* Response headers.
|
|
2826
|
+
*/
|
|
2809
2827
|
headers?: SharedV2Headers;
|
|
2810
2828
|
/**
|
|
2811
|
-
|
|
2812
|
-
|
|
2829
|
+
* Response HTTP body.
|
|
2830
|
+
*/
|
|
2813
2831
|
body?: unknown;
|
|
2814
2832
|
};
|
|
2815
2833
|
/**
|
|
2816
|
-
|
|
2834
|
+
* Warnings for the call, e.g. unsupported settings.
|
|
2817
2835
|
*/
|
|
2818
2836
|
warnings: Array<LanguageModelV2CallWarning>;
|
|
2819
2837
|
}>;
|
|
2820
2838
|
/**
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
Naming: "do" prefix to prevent accidental direct usage of the method
|
|
2824
|
-
by the user.
|
|
2839
|
+
* Generates a language model output (streaming).
|
|
2825
2840
|
*
|
|
2826
|
-
|
|
2841
|
+
* Naming: "do" prefix to prevent accidental direct usage of the method
|
|
2842
|
+
* by the user.
|
|
2843
|
+
*
|
|
2844
|
+
* @return A stream of higher-level language model output parts.
|
|
2827
2845
|
*/
|
|
2828
2846
|
doStream(options: LanguageModelV2CallOptions): PromiseLike<{
|
|
2829
2847
|
stream: ReadableStream<LanguageModelV2StreamPart>;
|
|
2830
2848
|
/**
|
|
2831
|
-
|
|
2849
|
+
* Optional request information for telemetry and debugging purposes.
|
|
2832
2850
|
*/
|
|
2833
2851
|
request?: {
|
|
2834
2852
|
/**
|
|
2835
|
-
|
|
2836
|
-
|
|
2853
|
+
* Request HTTP body that was sent to the provider API.
|
|
2854
|
+
*/
|
|
2837
2855
|
body?: unknown;
|
|
2838
2856
|
};
|
|
2839
2857
|
/**
|
|
2840
|
-
|
|
2858
|
+
* Optional response data.
|
|
2841
2859
|
*/
|
|
2842
2860
|
response?: {
|
|
2843
2861
|
/**
|
|
2844
|
-
|
|
2862
|
+
* Response headers.
|
|
2845
2863
|
*/
|
|
2846
2864
|
headers?: SharedV2Headers;
|
|
2847
2865
|
};
|
|
@@ -3230,64 +3248,64 @@ type SpeechModelV3 = {
|
|
|
3230
3248
|
type TranscriptionModelV3ProviderOptions = Record<string, JSONObject>;
|
|
3231
3249
|
type TranscriptionModelV3CallOptions = {
|
|
3232
3250
|
/**
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3251
|
+
* Audio data to transcribe.
|
|
3252
|
+
* Accepts a `Uint8Array` or `string`, where `string` is a base64 encoded audio file.
|
|
3253
|
+
*/
|
|
3236
3254
|
audio: Uint8Array | string;
|
|
3237
3255
|
/**
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3256
|
+
* The IANA media type of the audio data.
|
|
3257
|
+
*
|
|
3258
|
+
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
3241
3259
|
*/
|
|
3242
3260
|
mediaType: string;
|
|
3243
3261
|
/**
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3262
|
+
* Additional provider-specific options that are passed through to the provider
|
|
3263
|
+
* as body parameters.
|
|
3264
|
+
*
|
|
3265
|
+
* The outer record is keyed by the provider name, and the inner
|
|
3266
|
+
* record is keyed by the provider-specific metadata key.
|
|
3267
|
+
* ```ts
|
|
3268
|
+
* {
|
|
3269
|
+
* "openai": {
|
|
3270
|
+
* "timestampGranularities": ["word"]
|
|
3271
|
+
* }
|
|
3272
|
+
* }
|
|
3273
|
+
* ```
|
|
3274
|
+
*/
|
|
3257
3275
|
providerOptions?: TranscriptionModelV3ProviderOptions;
|
|
3258
3276
|
/**
|
|
3259
|
-
|
|
3260
|
-
|
|
3277
|
+
* Abort signal for cancelling the operation.
|
|
3278
|
+
*/
|
|
3261
3279
|
abortSignal?: AbortSignal;
|
|
3262
3280
|
/**
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3281
|
+
* Additional HTTP headers to be sent with the request.
|
|
3282
|
+
* Only applicable for HTTP-based providers.
|
|
3283
|
+
*/
|
|
3266
3284
|
headers?: Record<string, string | undefined>;
|
|
3267
3285
|
};
|
|
3268
3286
|
|
|
3269
3287
|
/**
|
|
3270
|
-
Transcription model specification version 3.
|
|
3288
|
+
* Transcription model specification version 3.
|
|
3271
3289
|
*/
|
|
3272
3290
|
type TranscriptionModelV3 = {
|
|
3273
3291
|
/**
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3292
|
+
* The transcription model must specify which transcription model interface
|
|
3293
|
+
* version it implements. This will allow us to evolve the transcription
|
|
3294
|
+
* model interface and retain backwards compatibility. The different
|
|
3295
|
+
* implementation versions can be handled as a discriminated union
|
|
3296
|
+
* on our side.
|
|
3279
3297
|
*/
|
|
3280
3298
|
readonly specificationVersion: 'v3';
|
|
3281
3299
|
/**
|
|
3282
|
-
|
|
3300
|
+
* Name of the provider for logging purposes.
|
|
3283
3301
|
*/
|
|
3284
3302
|
readonly provider: string;
|
|
3285
3303
|
/**
|
|
3286
|
-
|
|
3304
|
+
* Provider-specific model ID for logging purposes.
|
|
3287
3305
|
*/
|
|
3288
3306
|
readonly modelId: string;
|
|
3289
3307
|
/**
|
|
3290
|
-
|
|
3308
|
+
* Generates a transcript.
|
|
3291
3309
|
*/
|
|
3292
3310
|
doGenerate(options: TranscriptionModelV3CallOptions): PromiseLike<{
|
|
3293
3311
|
/**
|
|
@@ -3323,44 +3341,44 @@ type TranscriptionModelV3 = {
|
|
|
3323
3341
|
*/
|
|
3324
3342
|
durationInSeconds: number | undefined;
|
|
3325
3343
|
/**
|
|
3326
|
-
|
|
3344
|
+
* Warnings for the call, e.g. unsupported settings.
|
|
3327
3345
|
*/
|
|
3328
3346
|
warnings: Array<SharedV3Warning>;
|
|
3329
3347
|
/**
|
|
3330
|
-
|
|
3348
|
+
* Optional request information for telemetry and debugging purposes.
|
|
3331
3349
|
*/
|
|
3332
3350
|
request?: {
|
|
3333
3351
|
/**
|
|
3334
|
-
|
|
3335
|
-
|
|
3352
|
+
* Raw request HTTP body that was sent to the provider API as a string (JSON should be stringified).
|
|
3353
|
+
* Non-HTTP(s) providers should not set this.
|
|
3336
3354
|
*/
|
|
3337
3355
|
body?: string;
|
|
3338
3356
|
};
|
|
3339
3357
|
/**
|
|
3340
|
-
|
|
3358
|
+
* Response information for telemetry and debugging purposes.
|
|
3341
3359
|
*/
|
|
3342
3360
|
response: {
|
|
3343
3361
|
/**
|
|
3344
|
-
|
|
3345
|
-
|
|
3362
|
+
* Timestamp for the start of the generated response.
|
|
3363
|
+
*/
|
|
3346
3364
|
timestamp: Date;
|
|
3347
3365
|
/**
|
|
3348
|
-
|
|
3349
|
-
|
|
3366
|
+
* The ID of the response model that was used to generate the response.
|
|
3367
|
+
*/
|
|
3350
3368
|
modelId: string;
|
|
3351
3369
|
/**
|
|
3352
|
-
|
|
3353
|
-
|
|
3370
|
+
* Response headers.
|
|
3371
|
+
*/
|
|
3354
3372
|
headers?: SharedV3Headers;
|
|
3355
3373
|
/**
|
|
3356
|
-
|
|
3357
|
-
|
|
3374
|
+
* Response body.
|
|
3375
|
+
*/
|
|
3358
3376
|
body?: unknown;
|
|
3359
3377
|
};
|
|
3360
3378
|
/**
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3379
|
+
* Additional provider-specific metadata. They are passed through
|
|
3380
|
+
* from the provider to the AI SDK and enable provider-specific
|
|
3381
|
+
* results that can be fully encapsulated in the provider.
|
|
3364
3382
|
*/
|
|
3365
3383
|
providerMetadata?: Record<string, JSONObject>;
|
|
3366
3384
|
}>;
|
|
@@ -3372,76 +3390,76 @@ type TranscriptionModelV3 = {
|
|
|
3372
3390
|
interface ProviderV3 {
|
|
3373
3391
|
readonly specificationVersion: 'v3';
|
|
3374
3392
|
/**
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3393
|
+
* Returns the language model with the given id.
|
|
3394
|
+
* The model id is then passed to the provider function to get the model.
|
|
3395
|
+
*
|
|
3396
|
+
* @param {string} modelId - The id of the model to return.
|
|
3397
|
+
*
|
|
3398
|
+
* @returns {LanguageModel} The language model associated with the id
|
|
3399
|
+
*
|
|
3400
|
+
* @throws {NoSuchModelError} If no such model exists.
|
|
3383
3401
|
*/
|
|
3384
3402
|
languageModel(modelId: string): LanguageModelV3;
|
|
3385
3403
|
/**
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3404
|
+
* Returns the text embedding model with the given id.
|
|
3405
|
+
* The model id is then passed to the provider function to get the model.
|
|
3406
|
+
*
|
|
3407
|
+
* @param {string} modelId - The id of the model to return.
|
|
3408
|
+
*
|
|
3409
|
+
* @returns {LanguageModel} The language model associated with the id
|
|
3410
|
+
*
|
|
3411
|
+
* @throws {NoSuchModelError} If no such model exists.
|
|
3394
3412
|
*/
|
|
3395
3413
|
embeddingModel(modelId: string): EmbeddingModelV3;
|
|
3396
3414
|
/**
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3415
|
+
* Returns the text embedding model with the given id.
|
|
3416
|
+
* The model id is then passed to the provider function to get the model.
|
|
3417
|
+
*
|
|
3418
|
+
* @param {string} modelId - The id of the model to return.
|
|
3419
|
+
*
|
|
3420
|
+
* @returns {EmbeddingModel} The embedding model associated with the id
|
|
3421
|
+
*
|
|
3422
|
+
* @throws {NoSuchModelError} If no such model exists.
|
|
3423
|
+
*
|
|
3424
|
+
* @deprecated Use `embeddingModel` instead.
|
|
3407
3425
|
*/
|
|
3408
3426
|
textEmbeddingModel?(modelId: string): EmbeddingModelV3;
|
|
3409
3427
|
/**
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3428
|
+
* Returns the image model with the given id.
|
|
3429
|
+
* The model id is then passed to the provider function to get the model.
|
|
3430
|
+
*
|
|
3431
|
+
* @param {string} modelId - The id of the model to return.
|
|
3432
|
+
*
|
|
3433
|
+
* @returns {ImageModel} The image model associated with the id
|
|
3434
|
+
*/
|
|
3417
3435
|
imageModel(modelId: string): ImageModelV3;
|
|
3418
3436
|
/**
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3437
|
+
* Returns the transcription model with the given id.
|
|
3438
|
+
* The model id is then passed to the provider function to get the model.
|
|
3439
|
+
*
|
|
3440
|
+
* @param {string} modelId - The id of the model to return.
|
|
3441
|
+
*
|
|
3442
|
+
* @returns {TranscriptionModel} The transcription model associated with the id
|
|
3443
|
+
*/
|
|
3426
3444
|
transcriptionModel?(modelId: string): TranscriptionModelV3;
|
|
3427
3445
|
/**
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3446
|
+
* Returns the speech model with the given id.
|
|
3447
|
+
* The model id is then passed to the provider function to get the model.
|
|
3448
|
+
*
|
|
3449
|
+
* @param {string} modelId - The id of the model to return.
|
|
3450
|
+
*
|
|
3451
|
+
* @returns {SpeechModel} The speech model associated with the id
|
|
3452
|
+
*/
|
|
3435
3453
|
speechModel?(modelId: string): SpeechModelV3;
|
|
3436
3454
|
/**
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3455
|
+
* Returns the reranking model with the given id.
|
|
3456
|
+
* The model id is then passed to the provider function to get the model.
|
|
3457
|
+
*
|
|
3458
|
+
* @param {string} modelId - The id of the model to return.
|
|
3459
|
+
*
|
|
3460
|
+
* @returns {RerankingModel} The reranking model associated with the id
|
|
3461
|
+
*
|
|
3462
|
+
* @throws {NoSuchModelError} If no such model exists.
|
|
3445
3463
|
*/
|
|
3446
3464
|
rerankingModel?(modelId: string): RerankingModelV3;
|
|
3447
3465
|
}
|
|
@@ -3589,45 +3607,45 @@ type SpeechModelV2 = {
|
|
|
3589
3607
|
type TranscriptionModelV2ProviderOptions = Record<string, Record<string, JSONValue>>;
|
|
3590
3608
|
type TranscriptionModelV2CallOptions = {
|
|
3591
3609
|
/**
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3610
|
+
* Audio data to transcribe.
|
|
3611
|
+
* Accepts a `Uint8Array` or `string`, where `string` is a base64 encoded audio file.
|
|
3612
|
+
*/
|
|
3595
3613
|
audio: Uint8Array | string;
|
|
3596
3614
|
/**
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3615
|
+
* The IANA media type of the audio data.
|
|
3616
|
+
*
|
|
3617
|
+
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
3600
3618
|
*/
|
|
3601
3619
|
mediaType: string;
|
|
3602
3620
|
/**
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3621
|
+
* Additional provider-specific options that are passed through to the provider
|
|
3622
|
+
* as body parameters.
|
|
3623
|
+
*
|
|
3624
|
+
* The outer record is keyed by the provider name, and the inner
|
|
3625
|
+
* record is keyed by the provider-specific metadata key.
|
|
3626
|
+
* ```ts
|
|
3627
|
+
* {
|
|
3628
|
+
* "openai": {
|
|
3629
|
+
* "timestampGranularities": ["word"]
|
|
3630
|
+
* }
|
|
3631
|
+
* }
|
|
3632
|
+
* ```
|
|
3633
|
+
*/
|
|
3616
3634
|
providerOptions?: TranscriptionModelV2ProviderOptions;
|
|
3617
3635
|
/**
|
|
3618
|
-
|
|
3619
|
-
|
|
3636
|
+
* Abort signal for cancelling the operation.
|
|
3637
|
+
*/
|
|
3620
3638
|
abortSignal?: AbortSignal;
|
|
3621
3639
|
/**
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3640
|
+
* Additional HTTP headers to be sent with the request.
|
|
3641
|
+
* Only applicable for HTTP-based providers.
|
|
3642
|
+
*/
|
|
3625
3643
|
headers?: Record<string, string | undefined>;
|
|
3626
3644
|
};
|
|
3627
3645
|
|
|
3628
3646
|
/**
|
|
3629
|
-
Warning from the model provider for this call. The call will proceed, but e.g.
|
|
3630
|
-
some settings might not be supported, which can lead to suboptimal results.
|
|
3647
|
+
* Warning from the model provider for this call. The call will proceed, but e.g.
|
|
3648
|
+
* some settings might not be supported, which can lead to suboptimal results.
|
|
3631
3649
|
*/
|
|
3632
3650
|
type TranscriptionModelV2CallWarning = {
|
|
3633
3651
|
type: 'unsupported-setting';
|
|
@@ -3639,27 +3657,27 @@ type TranscriptionModelV2CallWarning = {
|
|
|
3639
3657
|
};
|
|
3640
3658
|
|
|
3641
3659
|
/**
|
|
3642
|
-
Transcription model specification version 2.
|
|
3660
|
+
* Transcription model specification version 2.
|
|
3643
3661
|
*/
|
|
3644
3662
|
type TranscriptionModelV2 = {
|
|
3645
3663
|
/**
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3664
|
+
* The transcription model must specify which transcription model interface
|
|
3665
|
+
* version it implements. This will allow us to evolve the transcription
|
|
3666
|
+
* model interface and retain backwards compatibility. The different
|
|
3667
|
+
* implementation versions can be handled as a discriminated union
|
|
3668
|
+
* on our side.
|
|
3651
3669
|
*/
|
|
3652
3670
|
readonly specificationVersion: 'v2';
|
|
3653
3671
|
/**
|
|
3654
|
-
|
|
3672
|
+
* Name of the provider for logging purposes.
|
|
3655
3673
|
*/
|
|
3656
3674
|
readonly provider: string;
|
|
3657
3675
|
/**
|
|
3658
|
-
|
|
3676
|
+
* Provider-specific model ID for logging purposes.
|
|
3659
3677
|
*/
|
|
3660
3678
|
readonly modelId: string;
|
|
3661
3679
|
/**
|
|
3662
|
-
|
|
3680
|
+
* Generates a transcript.
|
|
3663
3681
|
*/
|
|
3664
3682
|
doGenerate(options: TranscriptionModelV2CallOptions): PromiseLike<{
|
|
3665
3683
|
/**
|
|
@@ -3695,44 +3713,44 @@ type TranscriptionModelV2 = {
|
|
|
3695
3713
|
*/
|
|
3696
3714
|
durationInSeconds: number | undefined;
|
|
3697
3715
|
/**
|
|
3698
|
-
|
|
3716
|
+
* Warnings for the call, e.g. unsupported settings.
|
|
3699
3717
|
*/
|
|
3700
3718
|
warnings: Array<TranscriptionModelV2CallWarning>;
|
|
3701
3719
|
/**
|
|
3702
|
-
|
|
3720
|
+
* Optional request information for telemetry and debugging purposes.
|
|
3703
3721
|
*/
|
|
3704
3722
|
request?: {
|
|
3705
3723
|
/**
|
|
3706
|
-
|
|
3707
|
-
|
|
3724
|
+
* Raw request HTTP body that was sent to the provider API as a string (JSON should be stringified).
|
|
3725
|
+
* Non-HTTP(s) providers should not set this.
|
|
3708
3726
|
*/
|
|
3709
3727
|
body?: string;
|
|
3710
3728
|
};
|
|
3711
3729
|
/**
|
|
3712
|
-
|
|
3730
|
+
* Response information for telemetry and debugging purposes.
|
|
3713
3731
|
*/
|
|
3714
3732
|
response: {
|
|
3715
3733
|
/**
|
|
3716
|
-
|
|
3717
|
-
|
|
3734
|
+
* Timestamp for the start of the generated response.
|
|
3735
|
+
*/
|
|
3718
3736
|
timestamp: Date;
|
|
3719
3737
|
/**
|
|
3720
|
-
|
|
3721
|
-
|
|
3738
|
+
* The ID of the response model that was used to generate the response.
|
|
3739
|
+
*/
|
|
3722
3740
|
modelId: string;
|
|
3723
3741
|
/**
|
|
3724
|
-
|
|
3725
|
-
|
|
3742
|
+
* Response headers.
|
|
3743
|
+
*/
|
|
3726
3744
|
headers?: SharedV2Headers;
|
|
3727
3745
|
/**
|
|
3728
|
-
|
|
3729
|
-
|
|
3746
|
+
* Response body.
|
|
3747
|
+
*/
|
|
3730
3748
|
body?: unknown;
|
|
3731
3749
|
};
|
|
3732
3750
|
/**
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3751
|
+
* Additional provider-specific metadata. They are passed through
|
|
3752
|
+
* from the provider to the AI SDK and enable provider-specific
|
|
3753
|
+
* results that can be fully encapsulated in the provider.
|
|
3736
3754
|
*/
|
|
3737
3755
|
providerMetadata?: Record<string, Record<string, JSONValue>>;
|
|
3738
3756
|
}>;
|
|
@@ -3743,54 +3761,54 @@ type TranscriptionModelV2 = {
|
|
|
3743
3761
|
*/
|
|
3744
3762
|
interface ProviderV2 {
|
|
3745
3763
|
/**
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3764
|
+
* Returns the language model with the given id.
|
|
3765
|
+
* The model id is then passed to the provider function to get the model.
|
|
3766
|
+
*
|
|
3767
|
+
* @param {string} modelId - The id of the model to return.
|
|
3768
|
+
*
|
|
3769
|
+
* @returns {LanguageModel} The language model associated with the id
|
|
3770
|
+
*
|
|
3771
|
+
* @throws {NoSuchModelError} If no such model exists.
|
|
3754
3772
|
*/
|
|
3755
3773
|
languageModel(modelId: string): LanguageModelV2;
|
|
3756
3774
|
/**
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3775
|
+
* Returns the text embedding model with the given id.
|
|
3776
|
+
* The model id is then passed to the provider function to get the model.
|
|
3777
|
+
*
|
|
3778
|
+
* @param {string} modelId - The id of the model to return.
|
|
3779
|
+
*
|
|
3780
|
+
* @returns {LanguageModel} The language model associated with the id
|
|
3781
|
+
*
|
|
3782
|
+
* @throws {NoSuchModelError} If no such model exists.
|
|
3765
3783
|
*/
|
|
3766
3784
|
textEmbeddingModel(modelId: string): EmbeddingModelV2<string>;
|
|
3767
3785
|
/**
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3786
|
+
* Returns the image model with the given id.
|
|
3787
|
+
* The model id is then passed to the provider function to get the model.
|
|
3788
|
+
*
|
|
3789
|
+
* @param {string} modelId - The id of the model to return.
|
|
3790
|
+
*
|
|
3791
|
+
* @returns {ImageModel} The image model associated with the id
|
|
3792
|
+
*/
|
|
3775
3793
|
imageModel(modelId: string): ImageModelV2;
|
|
3776
3794
|
/**
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3795
|
+
* Returns the transcription model with the given id.
|
|
3796
|
+
* The model id is then passed to the provider function to get the model.
|
|
3797
|
+
*
|
|
3798
|
+
* @param {string} modelId - The id of the model to return.
|
|
3799
|
+
*
|
|
3800
|
+
* @returns {TranscriptionModel} The transcription model associated with the id
|
|
3801
|
+
*/
|
|
3784
3802
|
transcriptionModel?(modelId: string): TranscriptionModelV2;
|
|
3785
3803
|
/**
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3804
|
+
* Returns the speech model with the given id.
|
|
3805
|
+
* The model id is then passed to the provider function to get the model.
|
|
3806
|
+
*
|
|
3807
|
+
* @param {string} modelId - The id of the model to return.
|
|
3808
|
+
*
|
|
3809
|
+
* @returns {SpeechModel} The speech model associated with the id
|
|
3810
|
+
*/
|
|
3793
3811
|
speechModel?(modelId: string): SpeechModelV2;
|
|
3794
3812
|
}
|
|
3795
3813
|
|
|
3796
|
-
export { AISDKError, APICallError, type EmbeddingModelV2, type EmbeddingModelV2Embedding, type EmbeddingModelV3, type EmbeddingModelV3CallOptions, type EmbeddingModelV3Embedding, type EmbeddingModelV3Middleware, type EmbeddingModelV3Result, EmptyResponseBodyError, type ImageModelV2, type ImageModelV2CallOptions, type ImageModelV2CallWarning, type ImageModelV2ProviderMetadata, type ImageModelV3, type ImageModelV3CallOptions, type ImageModelV3File, type ImageModelV3Middleware, type ImageModelV3ProviderMetadata, type ImageModelV3Usage, InvalidArgumentError, InvalidPromptError, InvalidResponseDataError, type JSONArray, type JSONObject, JSONParseError, type JSONValue, type LanguageModelV2, type LanguageModelV2CallOptions, type LanguageModelV2CallWarning, type LanguageModelV2Content, type LanguageModelV2DataContent, type LanguageModelV2File, type LanguageModelV2FilePart, type LanguageModelV2FinishReason, type LanguageModelV2FunctionTool, type LanguageModelV2Message, type LanguageModelV2Middleware, type LanguageModelV2Prompt, type LanguageModelV2ProviderDefinedTool, type LanguageModelV2Reasoning, type LanguageModelV2ReasoningPart, type LanguageModelV2ResponseMetadata, type LanguageModelV2Source, type LanguageModelV2StreamPart, type LanguageModelV2Text, type LanguageModelV2TextPart, type LanguageModelV2ToolCall, type LanguageModelV2ToolCallPart, type LanguageModelV2ToolChoice, type LanguageModelV2ToolResultOutput, type LanguageModelV2ToolResultPart, type LanguageModelV2Usage, type LanguageModelV3, type LanguageModelV3CallOptions, type LanguageModelV3Content, type LanguageModelV3DataContent, type LanguageModelV3File, type LanguageModelV3FilePart, type LanguageModelV3FinishReason, type LanguageModelV3FunctionTool, type LanguageModelV3GenerateResult, type LanguageModelV3Message, type LanguageModelV3Middleware, type LanguageModelV3Prompt, type LanguageModelV3ProviderTool, type LanguageModelV3Reasoning, type LanguageModelV3ReasoningPart, type LanguageModelV3ResponseMetadata, type LanguageModelV3Source, type LanguageModelV3StreamPart, type LanguageModelV3StreamResult, type LanguageModelV3Text, type LanguageModelV3TextPart, type LanguageModelV3ToolApprovalRequest, type LanguageModelV3ToolApprovalResponsePart, type LanguageModelV3ToolCall, type LanguageModelV3ToolCallPart, type LanguageModelV3ToolChoice, type LanguageModelV3ToolResult, type LanguageModelV3ToolResultOutput, type LanguageModelV3ToolResultPart, type LanguageModelV3Usage, LoadAPIKeyError, LoadSettingError, NoContentGeneratedError, NoSuchModelError, type ProviderV2, type ProviderV3, type RerankingModelV3, type RerankingModelV3CallOptions, type SharedV2Headers, type SharedV2ProviderMetadata, type SharedV2ProviderOptions, type SharedV3Headers, type SharedV3ProviderMetadata, type SharedV3ProviderOptions, type SharedV3Warning, type SpeechModelV2, type SpeechModelV2CallOptions, type SpeechModelV2CallWarning, type SpeechModelV3, type SpeechModelV3CallOptions, TooManyEmbeddingValuesForCallError, type TranscriptionModelV2, type TranscriptionModelV2CallOptions, type TranscriptionModelV2CallWarning, type TranscriptionModelV3, type TranscriptionModelV3CallOptions, TypeValidationError, UnsupportedFunctionalityError, getErrorMessage, isJSONArray, isJSONObject, isJSONValue };
|
|
3814
|
+
export { AISDKError, APICallError, type EmbeddingModelV2, type EmbeddingModelV2Embedding, type EmbeddingModelV3, type EmbeddingModelV3CallOptions, type EmbeddingModelV3Embedding, type EmbeddingModelV3Middleware, type EmbeddingModelV3Result, EmptyResponseBodyError, type ImageModelV2, type ImageModelV2CallOptions, type ImageModelV2CallWarning, type ImageModelV2ProviderMetadata, type ImageModelV3, type ImageModelV3CallOptions, type ImageModelV3File, type ImageModelV3Middleware, type ImageModelV3ProviderMetadata, type ImageModelV3Usage, InvalidArgumentError, InvalidPromptError, InvalidResponseDataError, type JSONArray, type JSONObject, JSONParseError, type JSONValue, type LanguageModelV2, type LanguageModelV2CallOptions, type LanguageModelV2CallWarning, type LanguageModelV2Content, type LanguageModelV2DataContent, type LanguageModelV2File, type LanguageModelV2FilePart, type LanguageModelV2FinishReason, type LanguageModelV2FunctionTool, type LanguageModelV2Message, type LanguageModelV2Middleware, type LanguageModelV2Prompt, type LanguageModelV2ProviderDefinedTool, type LanguageModelV2Reasoning, type LanguageModelV2ReasoningPart, type LanguageModelV2ResponseMetadata, type LanguageModelV2Source, type LanguageModelV2StreamPart, type LanguageModelV2Text, type LanguageModelV2TextPart, type LanguageModelV2ToolCall, type LanguageModelV2ToolCallPart, type LanguageModelV2ToolChoice, type LanguageModelV2ToolResultOutput, type LanguageModelV2ToolResultPart, type LanguageModelV2Usage, type LanguageModelV3, type LanguageModelV3CallOptions, type LanguageModelV3Content, type LanguageModelV3DataContent, type LanguageModelV3File, type LanguageModelV3FilePart, type LanguageModelV3FinishReason, type LanguageModelV3FunctionTool, type LanguageModelV3GenerateResult, type LanguageModelV3Message, type LanguageModelV3Middleware, type LanguageModelV3Prompt, type LanguageModelV3ProviderTool, type LanguageModelV3Reasoning, type LanguageModelV3ReasoningPart, type LanguageModelV3ResponseMetadata, type LanguageModelV3Source, type LanguageModelV3StreamPart, type LanguageModelV3StreamResult, type LanguageModelV3Text, type LanguageModelV3TextPart, type LanguageModelV3ToolApprovalRequest, type LanguageModelV3ToolApprovalResponsePart, type LanguageModelV3ToolCall, type LanguageModelV3ToolCallPart, type LanguageModelV3ToolChoice, type LanguageModelV3ToolResult, type LanguageModelV3ToolResultOutput, type LanguageModelV3ToolResultPart, type LanguageModelV3Usage, LoadAPIKeyError, LoadSettingError, NoContentGeneratedError, NoSuchModelError, type ProviderV2, type ProviderV3, type RerankingModelV3, type RerankingModelV3CallOptions, type SharedV2Headers, type SharedV2ProviderMetadata, type SharedV2ProviderOptions, type SharedV3Headers, type SharedV3ProviderMetadata, type SharedV3ProviderOptions, type SharedV3Warning, type SpeechModelV2, type SpeechModelV2CallOptions, type SpeechModelV2CallWarning, type SpeechModelV3, type SpeechModelV3CallOptions, TooManyEmbeddingValuesForCallError, type TranscriptionModelV2, type TranscriptionModelV2CallOptions, type TranscriptionModelV2CallWarning, type TranscriptionModelV3, type TranscriptionModelV3CallOptions, type TypeValidationContext, TypeValidationError, UnsupportedFunctionalityError, getErrorMessage, isJSONArray, isJSONObject, isJSONValue };
|