@mastra/voice-google 0.14.2-alpha.1 → 0.14.3-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_types/@internal_voice/dist/_types/@internal_ai-sdk-v5/dist/index.d.ts +914 -36
- package/dist/_types/@internal_voice/dist/_types/@internal_core/dist/request-context/index.d.ts +69 -2
- package/dist/_types/@internal_voice/dist/_types/zod/v3/ZodError.d.ts +1 -1
- package/dist/_types/@internal_voice/dist/_types/zod/v4/classic/checks.d.ts +1 -1
- package/dist/_types/@internal_voice/dist/_types/zod/v4/classic/compat.d.ts +9 -11
- package/dist/_types/@internal_voice/dist/_types/zod/v4/classic/deep-partial.d.ts +14 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/classic/errors.d.ts +3 -4
- package/dist/_types/@internal_voice/dist/_types/zod/v4/classic/external.d.ts +5 -2
- package/dist/_types/@internal_voice/dist/_types/zod/v4/classic/in-out.d.ts +8 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/classic/index.d.ts +1 -2
- package/dist/_types/@internal_voice/dist/_types/zod/v4/classic/iso.d.ts +2 -17
- package/dist/_types/@internal_voice/dist/_types/zod/v4/classic/parse.d.ts +17 -4
- package/dist/_types/@internal_voice/dist/_types/zod/v4/classic/schemas.d.ts +68 -19
- package/dist/_types/@internal_voice/dist/_types/zod/v4/core/api.d.ts +22 -12
- package/dist/_types/@internal_voice/dist/_types/zod/v4/core/checks.d.ts +29 -13
- package/dist/_types/@internal_voice/dist/_types/zod/v4/core/compile.d.ts +65 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/core/core.d.ts +16 -4
- package/dist/_types/@internal_voice/dist/_types/zod/v4/core/doc.d.ts +3 -1
- package/dist/_types/@internal_voice/dist/_types/zod/v4/core/errors.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/core/index.d.ts +3 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/core/json-schema-generator.d.ts +2 -2
- package/dist/_types/@internal_voice/dist/_types/zod/v4/core/json-schema-processors.d.ts +16 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/core/json-schema.d.ts +2 -1
- package/dist/_types/@internal_voice/dist/_types/zod/v4/core/memoizer.d.ts +15 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/core/parse.d.ts +14 -11
- package/dist/_types/@internal_voice/dist/_types/zod/v4/core/regexes.d.ts +5 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/core/schemas.d.ts +123 -34
- package/dist/_types/@internal_voice/dist/_types/zod/v4/core/to-json-schema.d.ts +45 -5
- package/dist/_types/@internal_voice/dist/_types/zod/v4/core/util.d.ts +79 -1
- package/dist/_types/@internal_voice/dist/_types/zod/v4/core/versions.d.ts +1 -1
- package/dist/_types/@internal_voice/dist/_types/zod/v4/index.d.cts +2 -2
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/bn.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/ckb.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/gu.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/hi.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/index.d.ts +11 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/kn.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/ne.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/nn.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/pt-BR.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/sk.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/tg.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/tk.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/index.d.ts +2 -2
- package/dist/_types/@internal_voice/dist/voice/aisdk/speech.d.ts +1 -1
- package/dist/_types/@internal_voice/dist/voice/aisdk/transcription.d.ts +1 -1
- package/dist/_types/@internal_voice/dist/voice/composite-voice.d.ts +2 -2
- package/dist/_types/@internal_voice/dist/voice/voice.d.ts +2 -2
- package/dist/_types/@internal_voice/package.json +1 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/reference-voice-overview.md +25 -0
- package/dist/index.d.ts +1 -1
- package/package.json +7 -7
- package/dist/_types/@internal_voice/dist/_types/zod/v3/index.d.cts +0 -4
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { JSONSchema7 } from 'json-schema';
|
|
2
2
|
import { ServerResponse } from 'node:http';
|
|
3
3
|
import { ServerResponse as ServerResponse_2 } from 'http';
|
|
4
|
-
import { z } from '../../zod/v4/index.
|
|
5
|
-
import * as z3 from '../../zod/v3/index.
|
|
6
|
-
import * as z4 from '../../zod/v4/index.
|
|
7
|
-
import { ZodType } from '../../zod/v4/index.
|
|
4
|
+
import { z } from '../../zod/v4/index.cjs';
|
|
5
|
+
import * as z3 from '../../zod/v3/index.cjs';
|
|
6
|
+
import * as z4 from '../../zod/v4/index.cjs';
|
|
7
|
+
import { ZodType } from '../../zod/v4/index.cjs';
|
|
8
8
|
|
|
9
9
|
export declare abstract class AbstractChat<UI_MESSAGE extends UIMessage> {
|
|
10
10
|
readonly id: string;
|
|
@@ -121,6 +121,7 @@ declare namespace _ai_sdk_provider_utils {
|
|
|
121
121
|
DataContent,
|
|
122
122
|
DelayedPromise,
|
|
123
123
|
DownloadError_2 as DownloadError,
|
|
124
|
+
EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL as EXPERIMENTAL_EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL,
|
|
124
125
|
FetchFunction,
|
|
125
126
|
FilePart,
|
|
126
127
|
FlexibleSchema,
|
|
@@ -142,6 +143,9 @@ declare namespace _ai_sdk_provider_utils {
|
|
|
142
143
|
Resolvable,
|
|
143
144
|
ResponseHandler,
|
|
144
145
|
Schema,
|
|
146
|
+
StreamingToolCallDelta,
|
|
147
|
+
StreamingToolCallTracker,
|
|
148
|
+
StreamingToolCallTrackerOptions,
|
|
145
149
|
SystemModelMessage,
|
|
146
150
|
TextPart,
|
|
147
151
|
Tool,
|
|
@@ -256,6 +260,38 @@ export declare class AISDKError extends Error {
|
|
|
256
260
|
protected static hasMarker(error: unknown, marker: string): boolean;
|
|
257
261
|
}
|
|
258
262
|
|
|
263
|
+
/**
|
|
264
|
+
* Custom error class for AI SDK related errors.
|
|
265
|
+
* @extends Error
|
|
266
|
+
*/
|
|
267
|
+
declare class AISDKError_2 extends Error {
|
|
268
|
+
private readonly [symbol$d_2];
|
|
269
|
+
/**
|
|
270
|
+
* The underlying cause of the error, if any.
|
|
271
|
+
*/
|
|
272
|
+
readonly cause?: unknown;
|
|
273
|
+
/**
|
|
274
|
+
* Creates an AI SDK Error.
|
|
275
|
+
*
|
|
276
|
+
* @param {Object} params - The parameters for creating the error.
|
|
277
|
+
* @param {string} params.name - The name of the error.
|
|
278
|
+
* @param {string} params.message - The error message.
|
|
279
|
+
* @param {unknown} [params.cause] - The underlying cause of the error.
|
|
280
|
+
*/
|
|
281
|
+
constructor({ name, message, cause, }: {
|
|
282
|
+
name: string;
|
|
283
|
+
message: string;
|
|
284
|
+
cause?: unknown;
|
|
285
|
+
});
|
|
286
|
+
/**
|
|
287
|
+
* Checks if the given error is an AI SDK Error.
|
|
288
|
+
* @param {unknown} error - The error to check.
|
|
289
|
+
* @returns {boolean} True if the error is an AI SDK Error, false otherwise.
|
|
290
|
+
*/
|
|
291
|
+
static isInstance(error: unknown): error is AISDKError_2;
|
|
292
|
+
protected static hasMarker(error: unknown, marker: string): boolean;
|
|
293
|
+
}
|
|
294
|
+
|
|
259
295
|
export declare class APICallError extends AISDKError {
|
|
260
296
|
private readonly [symbol$c];
|
|
261
297
|
readonly url: string;
|
|
@@ -280,6 +316,30 @@ export declare class APICallError extends AISDKError {
|
|
|
280
316
|
static isInstance(error: unknown): error is APICallError;
|
|
281
317
|
}
|
|
282
318
|
|
|
319
|
+
declare class APICallError_2 extends AISDKError_2 {
|
|
320
|
+
private readonly [symbol$c_2];
|
|
321
|
+
readonly url: string;
|
|
322
|
+
readonly requestBodyValues: unknown;
|
|
323
|
+
readonly statusCode?: number;
|
|
324
|
+
readonly responseHeaders?: Record<string, string>;
|
|
325
|
+
readonly responseBody?: string;
|
|
326
|
+
readonly isRetryable: boolean;
|
|
327
|
+
readonly data?: unknown;
|
|
328
|
+
constructor({ message, url, requestBodyValues, statusCode, responseHeaders, responseBody, cause, isRetryable, // server error
|
|
329
|
+
data, }: {
|
|
330
|
+
message: string;
|
|
331
|
+
url: string;
|
|
332
|
+
requestBodyValues: unknown;
|
|
333
|
+
statusCode?: number;
|
|
334
|
+
responseHeaders?: Record<string, string>;
|
|
335
|
+
responseBody?: string;
|
|
336
|
+
cause?: unknown;
|
|
337
|
+
isRetryable?: boolean;
|
|
338
|
+
data?: unknown;
|
|
339
|
+
});
|
|
340
|
+
static isInstance(error: unknown): error is APICallError_2;
|
|
341
|
+
}
|
|
342
|
+
|
|
283
343
|
export declare function asSchema<OBJECT>(schema: FlexibleSchema<OBJECT> | undefined): Schema<OBJECT>;
|
|
284
344
|
|
|
285
345
|
/**
|
|
@@ -856,7 +916,7 @@ declare const createJsonErrorResponseHandler: <T>({ errorSchema, errorToMessage,
|
|
|
856
916
|
errorSchema: FlexibleValidator<T>;
|
|
857
917
|
errorToMessage: (error: T) => string;
|
|
858
918
|
isRetryable?: (response: Response, error?: T) => boolean;
|
|
859
|
-
}) => ResponseHandler<
|
|
919
|
+
}) => ResponseHandler<APICallError_2>;
|
|
860
920
|
|
|
861
921
|
declare const createJsonResponseHandler: <T>(responseSchema: FlexibleValidator<T>) => ResponseHandler<T>;
|
|
862
922
|
|
|
@@ -892,7 +952,7 @@ export declare function createProviderRegistry<PROVIDERS extends Record<string,
|
|
|
892
952
|
languageModelMiddleware?: LanguageModelMiddleware | LanguageModelMiddleware[];
|
|
893
953
|
}): ProviderRegistryProvider<PROVIDERS, SEPARATOR>;
|
|
894
954
|
|
|
895
|
-
declare const createStatusCodeErrorResponseHandler: () => ResponseHandler<
|
|
955
|
+
declare const createStatusCodeErrorResponseHandler: () => ResponseHandler<APICallError_2>;
|
|
896
956
|
|
|
897
957
|
export declare function createTextStreamResponse({ status, statusText, headers, textStream, }: ResponseInit & {
|
|
898
958
|
textStream: ReadableStream<string>;
|
|
@@ -1080,7 +1140,7 @@ export declare class DownloadError extends AISDKError {
|
|
|
1080
1140
|
static isInstance(error: unknown): error is DownloadError;
|
|
1081
1141
|
}
|
|
1082
1142
|
|
|
1083
|
-
declare class DownloadError_2 extends
|
|
1143
|
+
declare class DownloadError_2 extends AISDKError_2 {
|
|
1084
1144
|
private readonly [symbol_2];
|
|
1085
1145
|
readonly url: string;
|
|
1086
1146
|
readonly statusCode?: number;
|
|
@@ -1103,7 +1163,7 @@ export declare function dynamicTool(tool: {
|
|
|
1103
1163
|
providerOptions?: ProviderOptions;
|
|
1104
1164
|
inputSchema: FlexibleSchema<unknown>;
|
|
1105
1165
|
execute: ToolExecuteFunction<unknown, unknown>;
|
|
1106
|
-
toModelOutput?: (output: unknown) =>
|
|
1166
|
+
toModelOutput?: (output: unknown) => LanguageModelV2ToolResultPart_2['output'];
|
|
1107
1167
|
}): Tool<unknown, unknown> & {
|
|
1108
1168
|
type: 'dynamic';
|
|
1109
1169
|
};
|
|
@@ -1244,6 +1304,14 @@ export declare function embed<VALUE = string>({ model: modelArg, value, provider
|
|
|
1244
1304
|
*/
|
|
1245
1305
|
export declare type Embedding = EmbeddingModelV2Embedding;
|
|
1246
1306
|
|
|
1307
|
+
/**
|
|
1308
|
+
* Symbol for exposing the UTF-8 input byte budget of an embedding model.
|
|
1309
|
+
*
|
|
1310
|
+
* This capability is experimental and intentionally lives outside the versioned
|
|
1311
|
+
* embedding model specification.
|
|
1312
|
+
*/
|
|
1313
|
+
declare const EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL: unique symbol;
|
|
1314
|
+
|
|
1247
1315
|
/**
|
|
1248
1316
|
Embedding model that is used by the AI SDK Core functions.
|
|
1249
1317
|
*/
|
|
@@ -2110,6 +2178,11 @@ declare type FetchFunction = typeof globalThis.fetch;
|
|
|
2110
2178
|
* The returned response is the final (non-redirect) response. The caller is
|
|
2111
2179
|
* responsible for checking `response.ok` and reading the body.
|
|
2112
2180
|
*
|
|
2181
|
+
* On Node.js, the default fetch resolves every hostname through a validating
|
|
2182
|
+
* lookup hook and passes those exact addresses to the connector, preventing
|
|
2183
|
+
* hostname-to-private-IP and DNS-rebinding bypasses. Other runtimes should
|
|
2184
|
+
* constrain egress at the network layer when handling untrusted URLs.
|
|
2185
|
+
*
|
|
2113
2186
|
* @throws DownloadError if a hop is unsafe, the redirect limit is exceeded, or
|
|
2114
2187
|
* a redirect cannot be validated on a non-browser runtime.
|
|
2115
2188
|
*/
|
|
@@ -3308,14 +3381,14 @@ export declare type InferUITools<TOOLS extends ToolSet> = {
|
|
|
3308
3381
|
declare type InferValidator<SCHEMA> = SCHEMA extends StandardSchemaV1<unknown, infer T> ? T : SCHEMA extends LazyValidator<infer T> ? T : SCHEMA extends Validator<infer T> ? T : never;
|
|
3309
3382
|
|
|
3310
3383
|
declare function injectJsonInstructionIntoMessages({ messages, schema, schemaPrefix, schemaSuffix, }: {
|
|
3311
|
-
messages:
|
|
3384
|
+
messages: LanguageModelV2Prompt_2;
|
|
3312
3385
|
schema?: JSONSchema7;
|
|
3313
3386
|
schemaPrefix?: string;
|
|
3314
3387
|
schemaSuffix?: string;
|
|
3315
|
-
}):
|
|
3388
|
+
}): LanguageModelV2Prompt_2;
|
|
3316
3389
|
|
|
3317
3390
|
export declare class InvalidArgumentError extends AISDKError {
|
|
3318
|
-
private readonly [symbol$
|
|
3391
|
+
private readonly [symbol$c_3];
|
|
3319
3392
|
readonly parameter: string;
|
|
3320
3393
|
readonly value: unknown;
|
|
3321
3394
|
constructor({ parameter, value, message, }: {
|
|
@@ -3483,10 +3556,16 @@ declare type Job = () => Promise<void>;
|
|
|
3483
3556
|
|
|
3484
3557
|
declare type JSONArray = JSONValue_2[];
|
|
3485
3558
|
|
|
3559
|
+
declare type JSONArray_2 = JSONValue_3[];
|
|
3560
|
+
|
|
3486
3561
|
declare type JSONObject = {
|
|
3487
3562
|
[key: string]: JSONValue_2;
|
|
3488
3563
|
};
|
|
3489
3564
|
|
|
3565
|
+
declare type JSONObject_2 = {
|
|
3566
|
+
[key: string]: JSONValue_3;
|
|
3567
|
+
};
|
|
3568
|
+
|
|
3490
3569
|
export declare class JSONParseError extends AISDKError {
|
|
3491
3570
|
private readonly [symbol$7];
|
|
3492
3571
|
readonly text: string;
|
|
@@ -3497,6 +3576,16 @@ export declare class JSONParseError extends AISDKError {
|
|
|
3497
3576
|
static isInstance(error: unknown): error is JSONParseError;
|
|
3498
3577
|
}
|
|
3499
3578
|
|
|
3579
|
+
declare class JSONParseError_2 extends AISDKError_2 {
|
|
3580
|
+
private readonly [symbol$7_2];
|
|
3581
|
+
readonly text: string;
|
|
3582
|
+
constructor({ text, cause }: {
|
|
3583
|
+
text: string;
|
|
3584
|
+
cause: unknown;
|
|
3585
|
+
});
|
|
3586
|
+
static isInstance(error: unknown): error is JSONParseError_2;
|
|
3587
|
+
}
|
|
3588
|
+
|
|
3500
3589
|
/**
|
|
3501
3590
|
* Create a schema using a JSON Schema.
|
|
3502
3591
|
*
|
|
@@ -3521,6 +3610,12 @@ export declare type JSONValue = JSONValue_2;
|
|
|
3521
3610
|
*/
|
|
3522
3611
|
declare type JSONValue_2 = null | string | number | boolean | JSONObject | JSONArray;
|
|
3523
3612
|
|
|
3613
|
+
/**
|
|
3614
|
+
A JSON value can be a string, number, boolean, object, array, or null.
|
|
3615
|
+
JSON values can be serialized and deserialized by the JSON.stringify and JSON.parse methods.
|
|
3616
|
+
*/
|
|
3617
|
+
declare type JSONValue_3 = null | string | number | boolean | JSONObject_2 | JSONArray_2;
|
|
3618
|
+
|
|
3524
3619
|
declare const KNOWN_MODEL_TYPES: readonly ["embedding", "image", "language"];
|
|
3525
3620
|
|
|
3526
3621
|
declare type KnownModelType = (typeof KNOWN_MODEL_TYPES)[number];
|
|
@@ -3776,6 +3871,107 @@ declare type LanguageModelV2CallOptions = {
|
|
|
3776
3871
|
providerOptions?: SharedV2ProviderOptions;
|
|
3777
3872
|
};
|
|
3778
3873
|
|
|
3874
|
+
declare type LanguageModelV2CallOptions_2 = {
|
|
3875
|
+
/**
|
|
3876
|
+
A language mode prompt is a standardized prompt type.
|
|
3877
|
+
|
|
3878
|
+
Note: This is **not** the user-facing prompt. The AI SDK methods will map the
|
|
3879
|
+
user-facing prompt types such as chat or instruction prompts to this format.
|
|
3880
|
+
That approach allows us to evolve the user facing prompts without breaking
|
|
3881
|
+
the language model interface.
|
|
3882
|
+
*/
|
|
3883
|
+
prompt: LanguageModelV2Prompt_2;
|
|
3884
|
+
/**
|
|
3885
|
+
Maximum number of tokens to generate.
|
|
3886
|
+
*/
|
|
3887
|
+
maxOutputTokens?: number;
|
|
3888
|
+
/**
|
|
3889
|
+
Temperature setting. The range depends on the provider and model.
|
|
3890
|
+
*/
|
|
3891
|
+
temperature?: number;
|
|
3892
|
+
/**
|
|
3893
|
+
Stop sequences.
|
|
3894
|
+
If set, the model will stop generating text when one of the stop sequences is generated.
|
|
3895
|
+
Providers may have limits on the number of stop sequences.
|
|
3896
|
+
*/
|
|
3897
|
+
stopSequences?: string[];
|
|
3898
|
+
/**
|
|
3899
|
+
Nucleus sampling.
|
|
3900
|
+
*/
|
|
3901
|
+
topP?: number;
|
|
3902
|
+
/**
|
|
3903
|
+
Only sample from the top K options for each subsequent token.
|
|
3904
|
+
|
|
3905
|
+
Used to remove "long tail" low probability responses.
|
|
3906
|
+
Recommended for advanced use cases only. You usually only need to use temperature.
|
|
3907
|
+
*/
|
|
3908
|
+
topK?: number;
|
|
3909
|
+
/**
|
|
3910
|
+
Presence penalty setting. It affects the likelihood of the model to
|
|
3911
|
+
repeat information that is already in the prompt.
|
|
3912
|
+
*/
|
|
3913
|
+
presencePenalty?: number;
|
|
3914
|
+
/**
|
|
3915
|
+
Frequency penalty setting. It affects the likelihood of the model
|
|
3916
|
+
to repeatedly use the same words or phrases.
|
|
3917
|
+
*/
|
|
3918
|
+
frequencyPenalty?: number;
|
|
3919
|
+
/**
|
|
3920
|
+
Response format. The output can either be text or JSON. Default is text.
|
|
3921
|
+
|
|
3922
|
+
If JSON is selected, a schema can optionally be provided to guide the LLM.
|
|
3923
|
+
*/
|
|
3924
|
+
responseFormat?: {
|
|
3925
|
+
type: 'text';
|
|
3926
|
+
} | {
|
|
3927
|
+
type: 'json';
|
|
3928
|
+
/**
|
|
3929
|
+
* JSON schema that the generated output should conform to.
|
|
3930
|
+
*/
|
|
3931
|
+
schema?: JSONSchema7;
|
|
3932
|
+
/**
|
|
3933
|
+
* Name of output that should be generated. Used by some providers for additional LLM guidance.
|
|
3934
|
+
*/
|
|
3935
|
+
name?: string;
|
|
3936
|
+
/**
|
|
3937
|
+
* Description of the output that should be generated. Used by some providers for additional LLM guidance.
|
|
3938
|
+
*/
|
|
3939
|
+
description?: string;
|
|
3940
|
+
};
|
|
3941
|
+
/**
|
|
3942
|
+
The seed (integer) to use for random sampling. If set and supported
|
|
3943
|
+
by the model, calls will generate deterministic results.
|
|
3944
|
+
*/
|
|
3945
|
+
seed?: number;
|
|
3946
|
+
/**
|
|
3947
|
+
The tools that are available for the model.
|
|
3948
|
+
*/
|
|
3949
|
+
tools?: Array<LanguageModelV2FunctionTool_2 | LanguageModelV2ProviderDefinedTool_2>;
|
|
3950
|
+
/**
|
|
3951
|
+
Specifies how the tool should be selected. Defaults to 'auto'.
|
|
3952
|
+
*/
|
|
3953
|
+
toolChoice?: LanguageModelV2ToolChoice_2;
|
|
3954
|
+
/**
|
|
3955
|
+
Include raw chunks in the stream. Only applicable for streaming calls.
|
|
3956
|
+
*/
|
|
3957
|
+
includeRawChunks?: boolean;
|
|
3958
|
+
/**
|
|
3959
|
+
Abort signal for cancelling the operation.
|
|
3960
|
+
*/
|
|
3961
|
+
abortSignal?: AbortSignal;
|
|
3962
|
+
/**
|
|
3963
|
+
Additional HTTP headers to be sent with the request.
|
|
3964
|
+
Only applicable for HTTP-based providers.
|
|
3965
|
+
*/
|
|
3966
|
+
headers?: Record<string, string | undefined>;
|
|
3967
|
+
/**
|
|
3968
|
+
* Additional provider-specific options. They are passed through
|
|
3969
|
+
* to the provider from the AI SDK and enable provider-specific
|
|
3970
|
+
* functionality that can be fully encapsulated in the provider.
|
|
3971
|
+
*/
|
|
3972
|
+
providerOptions?: SharedV2ProviderOptions_2;
|
|
3973
|
+
};
|
|
3974
|
+
|
|
3779
3975
|
/**
|
|
3780
3976
|
Warning from the model provider for this call. The call will proceed, but e.g.
|
|
3781
3977
|
some settings might not be supported, which can lead to suboptimal results.
|
|
@@ -3793,6 +3989,23 @@ declare type LanguageModelV2CallWarning = {
|
|
|
3793
3989
|
message: string;
|
|
3794
3990
|
};
|
|
3795
3991
|
|
|
3992
|
+
/**
|
|
3993
|
+
Warning from the model provider for this call. The call will proceed, but e.g.
|
|
3994
|
+
some settings might not be supported, which can lead to suboptimal results.
|
|
3995
|
+
*/
|
|
3996
|
+
declare type LanguageModelV2CallWarning_2 = {
|
|
3997
|
+
type: 'unsupported-setting';
|
|
3998
|
+
setting: Omit<keyof LanguageModelV2CallOptions_2, 'prompt'>;
|
|
3999
|
+
details?: string;
|
|
4000
|
+
} | {
|
|
4001
|
+
type: 'unsupported-tool';
|
|
4002
|
+
tool: LanguageModelV2FunctionTool_2 | LanguageModelV2ProviderDefinedTool_2;
|
|
4003
|
+
details?: string;
|
|
4004
|
+
} | {
|
|
4005
|
+
type: 'other';
|
|
4006
|
+
message: string;
|
|
4007
|
+
};
|
|
4008
|
+
|
|
3796
4009
|
declare type LanguageModelV2Content = LanguageModelV2Text | LanguageModelV2Reasoning | LanguageModelV2File | LanguageModelV2Source | LanguageModelV2ToolCall | LanguageModelV2ToolResult;
|
|
3797
4010
|
|
|
3798
4011
|
/**
|
|
@@ -3800,6 +4013,11 @@ declare type LanguageModelV2Content = LanguageModelV2Text | LanguageModelV2Reaso
|
|
|
3800
4013
|
*/
|
|
3801
4014
|
declare type LanguageModelV2DataContent = Uint8Array | string | URL;
|
|
3802
4015
|
|
|
4016
|
+
/**
|
|
4017
|
+
Data content. Can be a Uint8Array, base64 encoded data as a string or a URL.
|
|
4018
|
+
*/
|
|
4019
|
+
declare type LanguageModelV2DataContent_2 = Uint8Array | string | URL;
|
|
4020
|
+
|
|
3803
4021
|
/**
|
|
3804
4022
|
A file that has been generated by the model.
|
|
3805
4023
|
Generated files as base64 encoded strings or binary data.
|
|
@@ -3824,6 +4042,30 @@ declare type LanguageModelV2File = {
|
|
|
3824
4042
|
data: string | Uint8Array;
|
|
3825
4043
|
};
|
|
3826
4044
|
|
|
4045
|
+
/**
|
|
4046
|
+
A file that has been generated by the model.
|
|
4047
|
+
Generated files as base64 encoded strings or binary data.
|
|
4048
|
+
The files should be returned without any unnecessary conversion.
|
|
4049
|
+
*/
|
|
4050
|
+
declare type LanguageModelV2File_2 = {
|
|
4051
|
+
type: 'file';
|
|
4052
|
+
/**
|
|
4053
|
+
The IANA media type of the file, e.g. `image/png` or `audio/mp3`.
|
|
4054
|
+
|
|
4055
|
+
@see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
4056
|
+
*/
|
|
4057
|
+
mediaType: string;
|
|
4058
|
+
/**
|
|
4059
|
+
Generated file data as base64 encoded strings or binary data.
|
|
4060
|
+
|
|
4061
|
+
The file data should be returned without any unnecessary conversion.
|
|
4062
|
+
If the API returns base64 encoded strings, the file data should be returned
|
|
4063
|
+
as base64 encoded strings. If the API returns binary data, the file data should
|
|
4064
|
+
be returned as binary data.
|
|
4065
|
+
*/
|
|
4066
|
+
data: string | Uint8Array;
|
|
4067
|
+
};
|
|
4068
|
+
|
|
3827
4069
|
/**
|
|
3828
4070
|
File content part of a prompt. It contains a file.
|
|
3829
4071
|
*/
|
|
@@ -3853,6 +4095,42 @@ declare interface LanguageModelV2FilePart {
|
|
|
3853
4095
|
providerOptions?: SharedV2ProviderOptions;
|
|
3854
4096
|
}
|
|
3855
4097
|
|
|
4098
|
+
/**
|
|
4099
|
+
File content part of a prompt. It contains a file.
|
|
4100
|
+
*/
|
|
4101
|
+
declare interface LanguageModelV2FilePart_2 {
|
|
4102
|
+
type: 'file';
|
|
4103
|
+
/**
|
|
4104
|
+
* Optional filename of the file.
|
|
4105
|
+
*/
|
|
4106
|
+
filename?: string;
|
|
4107
|
+
/**
|
|
4108
|
+
File data. Can be a Uint8Array, base64 encoded data as a string or a URL.
|
|
4109
|
+
*/
|
|
4110
|
+
data: LanguageModelV2DataContent_2;
|
|
4111
|
+
/**
|
|
4112
|
+
* The original URL string before it was parsed into a `URL`.
|
|
4113
|
+
*
|
|
4114
|
+
* This is available when parsing would change the string and a provider
|
|
4115
|
+
* needs to preserve an opaque non-HTTP URI exactly.
|
|
4116
|
+
*/
|
|
4117
|
+
originalUrl?: string;
|
|
4118
|
+
/**
|
|
4119
|
+
IANA media type of the file.
|
|
4120
|
+
|
|
4121
|
+
Can support wildcards, e.g. `image/*` (in which case the provider needs to take appropriate action).
|
|
4122
|
+
|
|
4123
|
+
@see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
4124
|
+
*/
|
|
4125
|
+
mediaType: string;
|
|
4126
|
+
/**
|
|
4127
|
+
* Additional provider-specific options. They are passed through
|
|
4128
|
+
* to the provider from the AI SDK and enable provider-specific
|
|
4129
|
+
* functionality that can be fully encapsulated in the provider.
|
|
4130
|
+
*/
|
|
4131
|
+
providerOptions?: SharedV2ProviderOptions_2;
|
|
4132
|
+
}
|
|
4133
|
+
|
|
3856
4134
|
/**
|
|
3857
4135
|
Reason why a language model finished generating a response.
|
|
3858
4136
|
|
|
@@ -3867,6 +4145,20 @@ declare interface LanguageModelV2FilePart {
|
|
|
3867
4145
|
*/
|
|
3868
4146
|
declare type LanguageModelV2FinishReason = 'stop' | 'length' | 'content-filter' | 'tool-calls' | 'error' | 'other' | 'unknown';
|
|
3869
4147
|
|
|
4148
|
+
/**
|
|
4149
|
+
Reason why a language model finished generating a response.
|
|
4150
|
+
|
|
4151
|
+
Can be one of the following:
|
|
4152
|
+
- `stop`: model generated stop sequence
|
|
4153
|
+
- `length`: model generated maximum number of tokens
|
|
4154
|
+
- `content-filter`: content filter violation stopped the model
|
|
4155
|
+
- `tool-calls`: model triggered tool calls
|
|
4156
|
+
- `error`: model stopped because of an error
|
|
4157
|
+
- `other`: model stopped for other reasons
|
|
4158
|
+
- `unknown`: the model has not transmitted a finish reason
|
|
4159
|
+
*/
|
|
4160
|
+
declare type LanguageModelV2FinishReason_2 = 'stop' | 'length' | 'content-filter' | 'tool-calls' | 'error' | 'other' | 'unknown';
|
|
4161
|
+
|
|
3870
4162
|
/**
|
|
3871
4163
|
A tool has a name, a description, and a set of parameters.
|
|
3872
4164
|
|
|
@@ -3898,6 +4190,37 @@ declare type LanguageModelV2FunctionTool = {
|
|
|
3898
4190
|
providerOptions?: SharedV2ProviderOptions;
|
|
3899
4191
|
};
|
|
3900
4192
|
|
|
4193
|
+
/**
|
|
4194
|
+
A tool has a name, a description, and a set of parameters.
|
|
4195
|
+
|
|
4196
|
+
Note: this is **not** the user-facing tool definition. The AI SDK methods will
|
|
4197
|
+
map the user-facing tool definitions to this format.
|
|
4198
|
+
*/
|
|
4199
|
+
declare type LanguageModelV2FunctionTool_2 = {
|
|
4200
|
+
/**
|
|
4201
|
+
The type of the tool (always 'function').
|
|
4202
|
+
*/
|
|
4203
|
+
type: 'function';
|
|
4204
|
+
/**
|
|
4205
|
+
The name of the tool. Unique within this model call.
|
|
4206
|
+
*/
|
|
4207
|
+
name: string;
|
|
4208
|
+
/**
|
|
4209
|
+
A description of the tool. The language model uses this to understand the
|
|
4210
|
+
tool's purpose and to provide better completion suggestions.
|
|
4211
|
+
*/
|
|
4212
|
+
description?: string;
|
|
4213
|
+
/**
|
|
4214
|
+
The parameters that the tool expects. The language model uses this to
|
|
4215
|
+
understand the tool's input requirements and to provide matching suggestions.
|
|
4216
|
+
*/
|
|
4217
|
+
inputSchema: JSONSchema7;
|
|
4218
|
+
/**
|
|
4219
|
+
The provider-specific options for the tool.
|
|
4220
|
+
*/
|
|
4221
|
+
providerOptions?: SharedV2ProviderOptions_2;
|
|
4222
|
+
};
|
|
4223
|
+
|
|
3901
4224
|
declare type LanguageModelV2Message = ({
|
|
3902
4225
|
role: 'system';
|
|
3903
4226
|
content: string;
|
|
@@ -3919,6 +4242,27 @@ declare type LanguageModelV2Message = ({
|
|
|
3919
4242
|
providerOptions?: SharedV2ProviderOptions;
|
|
3920
4243
|
};
|
|
3921
4244
|
|
|
4245
|
+
declare type LanguageModelV2Message_2 = ({
|
|
4246
|
+
role: 'system';
|
|
4247
|
+
content: string;
|
|
4248
|
+
} | {
|
|
4249
|
+
role: 'user';
|
|
4250
|
+
content: Array<LanguageModelV2TextPart_2 | LanguageModelV2FilePart_2>;
|
|
4251
|
+
} | {
|
|
4252
|
+
role: 'assistant';
|
|
4253
|
+
content: Array<LanguageModelV2TextPart_2 | LanguageModelV2FilePart_2 | LanguageModelV2ReasoningPart_2 | LanguageModelV2ToolCallPart_2 | LanguageModelV2ToolResultPart_2>;
|
|
4254
|
+
} | {
|
|
4255
|
+
role: 'tool';
|
|
4256
|
+
content: Array<LanguageModelV2ToolResultPart_2>;
|
|
4257
|
+
}) & {
|
|
4258
|
+
/**
|
|
4259
|
+
* Additional provider-specific options. They are passed through
|
|
4260
|
+
* to the provider from the AI SDK and enable provider-specific
|
|
4261
|
+
* functionality that can be fully encapsulated in the provider.
|
|
4262
|
+
*/
|
|
4263
|
+
providerOptions?: SharedV2ProviderOptions_2;
|
|
4264
|
+
};
|
|
4265
|
+
|
|
3922
4266
|
/**
|
|
3923
4267
|
* Experimental middleware for LanguageModelV2.
|
|
3924
4268
|
* This type defines the structure for middleware that can be used to modify
|
|
@@ -4008,6 +4352,17 @@ declare type LanguageModelV2Middleware = {
|
|
|
4008
4352
|
*/
|
|
4009
4353
|
declare type LanguageModelV2Prompt = Array<LanguageModelV2Message>;
|
|
4010
4354
|
|
|
4355
|
+
/**
|
|
4356
|
+
A prompt is a list of messages.
|
|
4357
|
+
|
|
4358
|
+
Note: Not all models and prompt formats support multi-modal inputs and
|
|
4359
|
+
tool calls. The validation happens at runtime.
|
|
4360
|
+
|
|
4361
|
+
Note: This is not a user-facing prompt. The AI SDK methods will map the
|
|
4362
|
+
user-facing prompt types such as chat or instruction prompts to this format.
|
|
4363
|
+
*/
|
|
4364
|
+
declare type LanguageModelV2Prompt_2 = Array<LanguageModelV2Message_2>;
|
|
4365
|
+
|
|
4011
4366
|
/**
|
|
4012
4367
|
The configuration of a tool that is defined by the provider.
|
|
4013
4368
|
*/
|
|
@@ -4030,6 +4385,28 @@ declare type LanguageModelV2ProviderDefinedTool = {
|
|
|
4030
4385
|
args: Record<string, unknown>;
|
|
4031
4386
|
};
|
|
4032
4387
|
|
|
4388
|
+
/**
|
|
4389
|
+
The configuration of a tool that is defined by the provider.
|
|
4390
|
+
*/
|
|
4391
|
+
declare type LanguageModelV2ProviderDefinedTool_2 = {
|
|
4392
|
+
/**
|
|
4393
|
+
The type of the tool (always 'provider-defined').
|
|
4394
|
+
*/
|
|
4395
|
+
type: 'provider-defined';
|
|
4396
|
+
/**
|
|
4397
|
+
The ID of the tool. Should follow the format `<provider-name>.<unique-tool-name>`.
|
|
4398
|
+
*/
|
|
4399
|
+
id: `${string}.${string}`;
|
|
4400
|
+
/**
|
|
4401
|
+
The name of the tool that the user must use in the tool set.
|
|
4402
|
+
*/
|
|
4403
|
+
name: string;
|
|
4404
|
+
/**
|
|
4405
|
+
The arguments for configuring the tool. Must match the expected arguments defined by the provider for this tool.
|
|
4406
|
+
*/
|
|
4407
|
+
args: Record<string, unknown>;
|
|
4408
|
+
};
|
|
4409
|
+
|
|
4033
4410
|
/**
|
|
4034
4411
|
Reasoning that the model has generated.
|
|
4035
4412
|
*/
|
|
@@ -4059,6 +4436,23 @@ declare interface LanguageModelV2ReasoningPart {
|
|
|
4059
4436
|
providerOptions?: SharedV2ProviderOptions;
|
|
4060
4437
|
}
|
|
4061
4438
|
|
|
4439
|
+
/**
|
|
4440
|
+
Reasoning content part of a prompt. It contains a string of reasoning text.
|
|
4441
|
+
*/
|
|
4442
|
+
declare interface LanguageModelV2ReasoningPart_2 {
|
|
4443
|
+
type: 'reasoning';
|
|
4444
|
+
/**
|
|
4445
|
+
The reasoning text.
|
|
4446
|
+
*/
|
|
4447
|
+
text: string;
|
|
4448
|
+
/**
|
|
4449
|
+
* Additional provider-specific options. They are passed through
|
|
4450
|
+
* to the provider from the AI SDK and enable provider-specific
|
|
4451
|
+
* functionality that can be fully encapsulated in the provider.
|
|
4452
|
+
*/
|
|
4453
|
+
providerOptions?: SharedV2ProviderOptions_2;
|
|
4454
|
+
}
|
|
4455
|
+
|
|
4062
4456
|
declare interface LanguageModelV2ResponseMetadata {
|
|
4063
4457
|
/**
|
|
4064
4458
|
ID for the generated response, if the provider sends one.
|
|
@@ -4074,6 +4468,21 @@ declare interface LanguageModelV2ResponseMetadata {
|
|
|
4074
4468
|
modelId?: string;
|
|
4075
4469
|
}
|
|
4076
4470
|
|
|
4471
|
+
declare interface LanguageModelV2ResponseMetadata_2 {
|
|
4472
|
+
/**
|
|
4473
|
+
ID for the generated response, if the provider sends one.
|
|
4474
|
+
*/
|
|
4475
|
+
id?: string;
|
|
4476
|
+
/**
|
|
4477
|
+
Timestamp for the start of the generated response, if the provider sends one.
|
|
4478
|
+
*/
|
|
4479
|
+
timestamp?: Date;
|
|
4480
|
+
/**
|
|
4481
|
+
The ID of the response model that was used to generate the response, if the provider sends one.
|
|
4482
|
+
*/
|
|
4483
|
+
modelId?: string;
|
|
4484
|
+
}
|
|
4485
|
+
|
|
4077
4486
|
/**
|
|
4078
4487
|
A source that has been used as input to generate the response.
|
|
4079
4488
|
*/
|
|
@@ -4127,6 +4536,59 @@ declare type LanguageModelV2Source = {
|
|
|
4127
4536
|
providerMetadata?: SharedV2ProviderMetadata;
|
|
4128
4537
|
};
|
|
4129
4538
|
|
|
4539
|
+
/**
|
|
4540
|
+
A source that has been used as input to generate the response.
|
|
4541
|
+
*/
|
|
4542
|
+
declare type LanguageModelV2Source_2 = {
|
|
4543
|
+
type: 'source';
|
|
4544
|
+
/**
|
|
4545
|
+
* The type of source - URL sources reference web content.
|
|
4546
|
+
*/
|
|
4547
|
+
sourceType: 'url';
|
|
4548
|
+
/**
|
|
4549
|
+
* The ID of the source.
|
|
4550
|
+
*/
|
|
4551
|
+
id: string;
|
|
4552
|
+
/**
|
|
4553
|
+
* The URL of the source.
|
|
4554
|
+
*/
|
|
4555
|
+
url: string;
|
|
4556
|
+
/**
|
|
4557
|
+
* The title of the source.
|
|
4558
|
+
*/
|
|
4559
|
+
title?: string;
|
|
4560
|
+
/**
|
|
4561
|
+
* Additional provider metadata for the source.
|
|
4562
|
+
*/
|
|
4563
|
+
providerMetadata?: SharedV2ProviderMetadata_2;
|
|
4564
|
+
} | {
|
|
4565
|
+
type: 'source';
|
|
4566
|
+
/**
|
|
4567
|
+
* The type of source - document sources reference files/documents.
|
|
4568
|
+
*/
|
|
4569
|
+
sourceType: 'document';
|
|
4570
|
+
/**
|
|
4571
|
+
* The ID of the source.
|
|
4572
|
+
*/
|
|
4573
|
+
id: string;
|
|
4574
|
+
/**
|
|
4575
|
+
* IANA media type of the document (e.g., 'application/pdf').
|
|
4576
|
+
*/
|
|
4577
|
+
mediaType: string;
|
|
4578
|
+
/**
|
|
4579
|
+
* The title of the document.
|
|
4580
|
+
*/
|
|
4581
|
+
title: string;
|
|
4582
|
+
/**
|
|
4583
|
+
* Optional filename of the document.
|
|
4584
|
+
*/
|
|
4585
|
+
filename?: string;
|
|
4586
|
+
/**
|
|
4587
|
+
* Additional provider metadata for the source.
|
|
4588
|
+
*/
|
|
4589
|
+
providerMetadata?: SharedV2ProviderMetadata_2;
|
|
4590
|
+
};
|
|
4591
|
+
|
|
4130
4592
|
declare type LanguageModelV2StreamPart = {
|
|
4131
4593
|
type: 'text-start';
|
|
4132
4594
|
providerMetadata?: SharedV2ProviderMetadata;
|
|
@@ -4186,6 +4648,65 @@ declare type LanguageModelV2StreamPart = {
|
|
|
4186
4648
|
error: unknown;
|
|
4187
4649
|
};
|
|
4188
4650
|
|
|
4651
|
+
declare type LanguageModelV2StreamPart_2 = {
|
|
4652
|
+
type: 'text-start';
|
|
4653
|
+
providerMetadata?: SharedV2ProviderMetadata_2;
|
|
4654
|
+
id: string;
|
|
4655
|
+
} | {
|
|
4656
|
+
type: 'text-delta';
|
|
4657
|
+
id: string;
|
|
4658
|
+
providerMetadata?: SharedV2ProviderMetadata_2;
|
|
4659
|
+
delta: string;
|
|
4660
|
+
} | {
|
|
4661
|
+
type: 'text-end';
|
|
4662
|
+
providerMetadata?: SharedV2ProviderMetadata_2;
|
|
4663
|
+
id: string;
|
|
4664
|
+
} | {
|
|
4665
|
+
type: 'reasoning-start';
|
|
4666
|
+
providerMetadata?: SharedV2ProviderMetadata_2;
|
|
4667
|
+
id: string;
|
|
4668
|
+
} | {
|
|
4669
|
+
type: 'reasoning-delta';
|
|
4670
|
+
id: string;
|
|
4671
|
+
providerMetadata?: SharedV2ProviderMetadata_2;
|
|
4672
|
+
delta: string;
|
|
4673
|
+
} | {
|
|
4674
|
+
type: 'reasoning-end';
|
|
4675
|
+
id: string;
|
|
4676
|
+
providerMetadata?: SharedV2ProviderMetadata_2;
|
|
4677
|
+
} | {
|
|
4678
|
+
type: 'tool-input-start';
|
|
4679
|
+
id: string;
|
|
4680
|
+
toolName: string;
|
|
4681
|
+
providerMetadata?: SharedV2ProviderMetadata_2;
|
|
4682
|
+
providerExecuted?: boolean;
|
|
4683
|
+
} | {
|
|
4684
|
+
type: 'tool-input-delta';
|
|
4685
|
+
id: string;
|
|
4686
|
+
delta: string;
|
|
4687
|
+
providerMetadata?: SharedV2ProviderMetadata_2;
|
|
4688
|
+
} | {
|
|
4689
|
+
type: 'tool-input-end';
|
|
4690
|
+
id: string;
|
|
4691
|
+
providerMetadata?: SharedV2ProviderMetadata_2;
|
|
4692
|
+
} | LanguageModelV2ToolCall_2 | LanguageModelV2ToolResult_2 | LanguageModelV2File_2 | LanguageModelV2Source_2 | {
|
|
4693
|
+
type: 'stream-start';
|
|
4694
|
+
warnings: Array<LanguageModelV2CallWarning_2>;
|
|
4695
|
+
} | ({
|
|
4696
|
+
type: 'response-metadata';
|
|
4697
|
+
} & LanguageModelV2ResponseMetadata_2) | {
|
|
4698
|
+
type: 'finish';
|
|
4699
|
+
usage: LanguageModelV2Usage_2;
|
|
4700
|
+
finishReason: LanguageModelV2FinishReason_2;
|
|
4701
|
+
providerMetadata?: SharedV2ProviderMetadata_2;
|
|
4702
|
+
} | {
|
|
4703
|
+
type: 'raw';
|
|
4704
|
+
rawValue: unknown;
|
|
4705
|
+
} | {
|
|
4706
|
+
type: 'error';
|
|
4707
|
+
error: unknown;
|
|
4708
|
+
};
|
|
4709
|
+
|
|
4189
4710
|
/**
|
|
4190
4711
|
Text that the model has generated.
|
|
4191
4712
|
*/
|
|
@@ -4208,17 +4729,63 @@ declare interface LanguageModelV2TextPart {
|
|
|
4208
4729
|
*/
|
|
4209
4730
|
text: string;
|
|
4210
4731
|
/**
|
|
4211
|
-
* Additional provider-specific options. They are passed through
|
|
4212
|
-
* to the provider from the AI SDK and enable provider-specific
|
|
4213
|
-
* functionality that can be fully encapsulated in the provider.
|
|
4732
|
+
* Additional provider-specific options. They are passed through
|
|
4733
|
+
* to the provider from the AI SDK and enable provider-specific
|
|
4734
|
+
* functionality that can be fully encapsulated in the provider.
|
|
4735
|
+
*/
|
|
4736
|
+
providerOptions?: SharedV2ProviderOptions;
|
|
4737
|
+
}
|
|
4738
|
+
|
|
4739
|
+
/**
|
|
4740
|
+
Text content part of a prompt. It contains a string of text.
|
|
4741
|
+
*/
|
|
4742
|
+
declare interface LanguageModelV2TextPart_2 {
|
|
4743
|
+
type: 'text';
|
|
4744
|
+
/**
|
|
4745
|
+
The text content.
|
|
4746
|
+
*/
|
|
4747
|
+
text: string;
|
|
4748
|
+
/**
|
|
4749
|
+
* Additional provider-specific options. They are passed through
|
|
4750
|
+
* to the provider from the AI SDK and enable provider-specific
|
|
4751
|
+
* functionality that can be fully encapsulated in the provider.
|
|
4752
|
+
*/
|
|
4753
|
+
providerOptions?: SharedV2ProviderOptions_2;
|
|
4754
|
+
}
|
|
4755
|
+
|
|
4756
|
+
/**
|
|
4757
|
+
* Tool calls that the model has generated.
|
|
4758
|
+
*/
|
|
4759
|
+
declare type LanguageModelV2ToolCall = {
|
|
4760
|
+
type: 'tool-call';
|
|
4761
|
+
/**
|
|
4762
|
+
* The identifier of the tool call. It must be unique across all tool calls.
|
|
4763
|
+
*/
|
|
4764
|
+
toolCallId: string;
|
|
4765
|
+
/**
|
|
4766
|
+
* The name of the tool that should be called.
|
|
4767
|
+
*/
|
|
4768
|
+
toolName: string;
|
|
4769
|
+
/**
|
|
4770
|
+
* Stringified JSON object with the tool call arguments. Must match the
|
|
4771
|
+
* parameters schema of the tool.
|
|
4772
|
+
*/
|
|
4773
|
+
input: string;
|
|
4774
|
+
/**
|
|
4775
|
+
* Whether the tool call will be executed by the provider.
|
|
4776
|
+
* If this flag is not set or is false, the tool call will be executed by the client.
|
|
4777
|
+
*/
|
|
4778
|
+
providerExecuted?: boolean;
|
|
4779
|
+
/**
|
|
4780
|
+
* Additional provider-specific metadata for the tool call.
|
|
4214
4781
|
*/
|
|
4215
|
-
|
|
4216
|
-
}
|
|
4782
|
+
providerMetadata?: SharedV2ProviderMetadata;
|
|
4783
|
+
};
|
|
4217
4784
|
|
|
4218
4785
|
/**
|
|
4219
4786
|
* Tool calls that the model has generated.
|
|
4220
4787
|
*/
|
|
4221
|
-
declare type
|
|
4788
|
+
declare type LanguageModelV2ToolCall_2 = {
|
|
4222
4789
|
type: 'tool-call';
|
|
4223
4790
|
/**
|
|
4224
4791
|
* The identifier of the tool call. It must be unique across all tool calls.
|
|
@@ -4241,7 +4808,7 @@ declare type LanguageModelV2ToolCall = {
|
|
|
4241
4808
|
/**
|
|
4242
4809
|
* Additional provider-specific metadata for the tool call.
|
|
4243
4810
|
*/
|
|
4244
|
-
providerMetadata?:
|
|
4811
|
+
providerMetadata?: SharedV2ProviderMetadata_2;
|
|
4245
4812
|
};
|
|
4246
4813
|
|
|
4247
4814
|
/**
|
|
@@ -4274,6 +4841,36 @@ declare interface LanguageModelV2ToolCallPart {
|
|
|
4274
4841
|
providerOptions?: SharedV2ProviderOptions;
|
|
4275
4842
|
}
|
|
4276
4843
|
|
|
4844
|
+
/**
|
|
4845
|
+
Tool call content part of a prompt. It contains a tool call (usually generated by the AI model).
|
|
4846
|
+
*/
|
|
4847
|
+
declare interface LanguageModelV2ToolCallPart_2 {
|
|
4848
|
+
type: 'tool-call';
|
|
4849
|
+
/**
|
|
4850
|
+
ID of the tool call. This ID is used to match the tool call with the tool result.
|
|
4851
|
+
*/
|
|
4852
|
+
toolCallId: string;
|
|
4853
|
+
/**
|
|
4854
|
+
Name of the tool that is being called.
|
|
4855
|
+
*/
|
|
4856
|
+
toolName: string;
|
|
4857
|
+
/**
|
|
4858
|
+
Arguments of the tool call. This is a JSON-serializable object that matches the tool's input schema.
|
|
4859
|
+
*/
|
|
4860
|
+
input: unknown;
|
|
4861
|
+
/**
|
|
4862
|
+
* Whether the tool call will be executed by the provider.
|
|
4863
|
+
* If this flag is not set or is false, the tool call will be executed by the client.
|
|
4864
|
+
*/
|
|
4865
|
+
providerExecuted?: boolean;
|
|
4866
|
+
/**
|
|
4867
|
+
* Additional provider-specific options. They are passed through
|
|
4868
|
+
* to the provider from the AI SDK and enable provider-specific
|
|
4869
|
+
* functionality that can be fully encapsulated in the provider.
|
|
4870
|
+
*/
|
|
4871
|
+
providerOptions?: SharedV2ProviderOptions_2;
|
|
4872
|
+
}
|
|
4873
|
+
|
|
4277
4874
|
declare type LanguageModelV2ToolChoice = {
|
|
4278
4875
|
type: 'auto';
|
|
4279
4876
|
} | {
|
|
@@ -4285,6 +4882,17 @@ declare type LanguageModelV2ToolChoice = {
|
|
|
4285
4882
|
toolName: string;
|
|
4286
4883
|
};
|
|
4287
4884
|
|
|
4885
|
+
declare type LanguageModelV2ToolChoice_2 = {
|
|
4886
|
+
type: 'auto';
|
|
4887
|
+
} | {
|
|
4888
|
+
type: 'none';
|
|
4889
|
+
} | {
|
|
4890
|
+
type: 'required';
|
|
4891
|
+
} | {
|
|
4892
|
+
type: 'tool';
|
|
4893
|
+
toolName: string;
|
|
4894
|
+
};
|
|
4895
|
+
|
|
4288
4896
|
/**
|
|
4289
4897
|
Result of a tool call that has been executed by the provider.
|
|
4290
4898
|
*/
|
|
@@ -4318,6 +4926,39 @@ declare type LanguageModelV2ToolResult = {
|
|
|
4318
4926
|
providerMetadata?: SharedV2ProviderMetadata;
|
|
4319
4927
|
};
|
|
4320
4928
|
|
|
4929
|
+
/**
|
|
4930
|
+
Result of a tool call that has been executed by the provider.
|
|
4931
|
+
*/
|
|
4932
|
+
declare type LanguageModelV2ToolResult_2 = {
|
|
4933
|
+
type: 'tool-result';
|
|
4934
|
+
/**
|
|
4935
|
+
* The ID of the tool call that this result is associated with.
|
|
4936
|
+
*/
|
|
4937
|
+
toolCallId: string;
|
|
4938
|
+
/**
|
|
4939
|
+
* Name of the tool that generated this result.
|
|
4940
|
+
*/
|
|
4941
|
+
toolName: string;
|
|
4942
|
+
/**
|
|
4943
|
+
* Result of the tool call. This is a JSON-serializable object.
|
|
4944
|
+
*/
|
|
4945
|
+
result: unknown;
|
|
4946
|
+
/**
|
|
4947
|
+
* Optional flag if the result is an error or an error message.
|
|
4948
|
+
*/
|
|
4949
|
+
isError?: boolean;
|
|
4950
|
+
/**
|
|
4951
|
+
* Whether the tool result was generated by the provider.
|
|
4952
|
+
* If this flag is set to true, the tool result was generated by the provider.
|
|
4953
|
+
* If this flag is not set or is false, the tool result was generated by the client.
|
|
4954
|
+
*/
|
|
4955
|
+
providerExecuted?: boolean;
|
|
4956
|
+
/**
|
|
4957
|
+
* Additional provider-specific metadata for the tool result.
|
|
4958
|
+
*/
|
|
4959
|
+
providerMetadata?: SharedV2ProviderMetadata_2;
|
|
4960
|
+
};
|
|
4961
|
+
|
|
4321
4962
|
declare type LanguageModelV2ToolResultOutput = {
|
|
4322
4963
|
type: 'text';
|
|
4323
4964
|
value: string;
|
|
@@ -4352,6 +4993,40 @@ declare type LanguageModelV2ToolResultOutput = {
|
|
|
4352
4993
|
}>;
|
|
4353
4994
|
};
|
|
4354
4995
|
|
|
4996
|
+
declare type LanguageModelV2ToolResultOutput_2 = {
|
|
4997
|
+
type: 'text';
|
|
4998
|
+
value: string;
|
|
4999
|
+
} | {
|
|
5000
|
+
type: 'json';
|
|
5001
|
+
value: JSONValue_3;
|
|
5002
|
+
} | {
|
|
5003
|
+
type: 'error-text';
|
|
5004
|
+
value: string;
|
|
5005
|
+
} | {
|
|
5006
|
+
type: 'error-json';
|
|
5007
|
+
value: JSONValue_3;
|
|
5008
|
+
} | {
|
|
5009
|
+
type: 'content';
|
|
5010
|
+
value: Array<{
|
|
5011
|
+
type: 'text';
|
|
5012
|
+
/**
|
|
5013
|
+
Text content.
|
|
5014
|
+
*/
|
|
5015
|
+
text: string;
|
|
5016
|
+
} | {
|
|
5017
|
+
type: 'media';
|
|
5018
|
+
/**
|
|
5019
|
+
Base-64 encoded media data.
|
|
5020
|
+
*/
|
|
5021
|
+
data: string;
|
|
5022
|
+
/**
|
|
5023
|
+
IANA media type.
|
|
5024
|
+
@see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
5025
|
+
*/
|
|
5026
|
+
mediaType: string;
|
|
5027
|
+
}>;
|
|
5028
|
+
};
|
|
5029
|
+
|
|
4355
5030
|
/**
|
|
4356
5031
|
Tool result content part of a prompt. It contains the result of the tool call with the matching ID.
|
|
4357
5032
|
*/
|
|
@@ -4377,6 +5052,31 @@ declare interface LanguageModelV2ToolResultPart {
|
|
|
4377
5052
|
providerOptions?: SharedV2ProviderOptions;
|
|
4378
5053
|
}
|
|
4379
5054
|
|
|
5055
|
+
/**
|
|
5056
|
+
Tool result content part of a prompt. It contains the result of the tool call with the matching ID.
|
|
5057
|
+
*/
|
|
5058
|
+
declare interface LanguageModelV2ToolResultPart_2 {
|
|
5059
|
+
type: 'tool-result';
|
|
5060
|
+
/**
|
|
5061
|
+
ID of the tool call that this result is associated with.
|
|
5062
|
+
*/
|
|
5063
|
+
toolCallId: string;
|
|
5064
|
+
/**
|
|
5065
|
+
Name of the tool that generated this result.
|
|
5066
|
+
*/
|
|
5067
|
+
toolName: string;
|
|
5068
|
+
/**
|
|
5069
|
+
Result of the tool call.
|
|
5070
|
+
*/
|
|
5071
|
+
output: LanguageModelV2ToolResultOutput_2;
|
|
5072
|
+
/**
|
|
5073
|
+
* Additional provider-specific options. They are passed through
|
|
5074
|
+
* to the provider from the AI SDK and enable provider-specific
|
|
5075
|
+
* functionality that can be fully encapsulated in the provider.
|
|
5076
|
+
*/
|
|
5077
|
+
providerOptions?: SharedV2ProviderOptions_2;
|
|
5078
|
+
}
|
|
5079
|
+
|
|
4380
5080
|
/**
|
|
4381
5081
|
Usage information for a language model call.
|
|
4382
5082
|
|
|
@@ -4408,6 +5108,37 @@ declare type LanguageModelV2Usage = {
|
|
|
4408
5108
|
cachedInputTokens?: number | undefined;
|
|
4409
5109
|
};
|
|
4410
5110
|
|
|
5111
|
+
/**
|
|
5112
|
+
Usage information for a language model call.
|
|
5113
|
+
|
|
5114
|
+
If your API return additional usage information, you can add it to the
|
|
5115
|
+
provider metadata under your provider's key.
|
|
5116
|
+
*/
|
|
5117
|
+
declare type LanguageModelV2Usage_2 = {
|
|
5118
|
+
/**
|
|
5119
|
+
The number of input (prompt) tokens used.
|
|
5120
|
+
*/
|
|
5121
|
+
inputTokens: number | undefined;
|
|
5122
|
+
/**
|
|
5123
|
+
The number of output (completion) tokens used.
|
|
5124
|
+
*/
|
|
5125
|
+
outputTokens: number | undefined;
|
|
5126
|
+
/**
|
|
5127
|
+
The total number of tokens as reported by the provider.
|
|
5128
|
+
This number might be different from the sum of `inputTokens` and `outputTokens`
|
|
5129
|
+
and e.g. include reasoning tokens or other overhead.
|
|
5130
|
+
*/
|
|
5131
|
+
totalTokens: number | undefined;
|
|
5132
|
+
/**
|
|
5133
|
+
The number of reasoning tokens used.
|
|
5134
|
+
*/
|
|
5135
|
+
reasoningTokens?: number | undefined;
|
|
5136
|
+
/**
|
|
5137
|
+
The number of cached input tokens.
|
|
5138
|
+
*/
|
|
5139
|
+
cachedInputTokens?: number | undefined;
|
|
5140
|
+
};
|
|
5141
|
+
|
|
4411
5142
|
/**
|
|
4412
5143
|
Check if the message is an assistant message with completed tool calls.
|
|
4413
5144
|
The last step of the message must have at least one tool invocation and
|
|
@@ -4636,7 +5367,7 @@ export declare class NoOutputGeneratedError extends AISDKError {
|
|
|
4636
5367
|
Thrown when no output type is specified and output-related methods are called.
|
|
4637
5368
|
*/
|
|
4638
5369
|
export declare class NoOutputSpecifiedError extends AISDKError {
|
|
4639
|
-
private readonly [symbol$
|
|
5370
|
+
private readonly [symbol$7_3];
|
|
4640
5371
|
constructor({ message }?: {
|
|
4641
5372
|
message?: string;
|
|
4642
5373
|
});
|
|
@@ -4690,7 +5421,7 @@ export declare class NoSuchProviderError extends NoSuchModelError {
|
|
|
4690
5421
|
}
|
|
4691
5422
|
|
|
4692
5423
|
export declare class NoSuchToolError extends AISDKError {
|
|
4693
|
-
private readonly [symbol$
|
|
5424
|
+
private readonly [symbol$d_3];
|
|
4694
5425
|
readonly toolName: string;
|
|
4695
5426
|
readonly availableTools: string[] | undefined;
|
|
4696
5427
|
constructor({ toolName, availableTools, message, }: {
|
|
@@ -4894,7 +5625,7 @@ declare const parallelSearchToolFactory: _ai_sdk_provider_utils.ProviderDefinedT
|
|
|
4894
5625
|
declare function parseJSON(options: {
|
|
4895
5626
|
text: string;
|
|
4896
5627
|
schema?: undefined;
|
|
4897
|
-
}): Promise<
|
|
5628
|
+
}): Promise<JSONValue_3>;
|
|
4898
5629
|
|
|
4899
5630
|
/**
|
|
4900
5631
|
* Parses a JSON string into a strongly-typed object using the provided schema.
|
|
@@ -4934,7 +5665,7 @@ declare type ParseResult<T> = {
|
|
|
4934
5665
|
rawValue: unknown;
|
|
4935
5666
|
} | {
|
|
4936
5667
|
success: false;
|
|
4937
|
-
error:
|
|
5668
|
+
error: JSONParseError_2 | TypeValidationError_2;
|
|
4938
5669
|
rawValue: unknown;
|
|
4939
5670
|
};
|
|
4940
5671
|
|
|
@@ -5098,7 +5829,7 @@ declare const postFormDataToApi: <T>({ url, headers, formData, failedResponseHan
|
|
|
5098
5829
|
url: string;
|
|
5099
5830
|
headers?: Record<string, string | undefined>;
|
|
5100
5831
|
formData: FormData;
|
|
5101
|
-
failedResponseHandler: ResponseHandler<
|
|
5832
|
+
failedResponseHandler: ResponseHandler<APICallError_2>;
|
|
5102
5833
|
successfulResponseHandler: ResponseHandler<T>;
|
|
5103
5834
|
abortSignal?: AbortSignal;
|
|
5104
5835
|
fetch?: FetchFunction;
|
|
@@ -5112,7 +5843,7 @@ declare const postJsonToApi: <T>({ url, headers, body, failedResponseHandler, su
|
|
|
5112
5843
|
url: string;
|
|
5113
5844
|
headers?: Record<string, string | undefined>;
|
|
5114
5845
|
body: unknown;
|
|
5115
|
-
failedResponseHandler: ResponseHandler<
|
|
5846
|
+
failedResponseHandler: ResponseHandler<APICallError_2>;
|
|
5116
5847
|
successfulResponseHandler: ResponseHandler<T>;
|
|
5117
5848
|
abortSignal?: AbortSignal;
|
|
5118
5849
|
fetch?: FetchFunction;
|
|
@@ -5318,7 +6049,7 @@ export declare type ProviderMetadata = SharedV2ProviderMetadata;
|
|
|
5318
6049
|
They are passed through to the provider from the AI SDK and enable
|
|
5319
6050
|
provider-specific functionality that can be fully encapsulated in the provider.
|
|
5320
6051
|
*/
|
|
5321
|
-
declare type ProviderOptions =
|
|
6052
|
+
declare type ProviderOptions = SharedV2ProviderOptions_2;
|
|
5322
6053
|
|
|
5323
6054
|
export declare interface ProviderRegistryProvider<PROVIDERS extends Record<string, ProviderV2> = Record<string, ProviderV2>, SEPARATOR extends string = ':'> {
|
|
5324
6055
|
languageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['languageModel']>>[0]>}` : never): LanguageModelV2;
|
|
@@ -5541,7 +6272,7 @@ declare type ResponseHandler<RETURN_TYPE> = (options: {
|
|
|
5541
6272
|
declare type ResponseMessage = AssistantModelMessage | ToolModelMessage;
|
|
5542
6273
|
|
|
5543
6274
|
export declare class RetryError extends AISDKError {
|
|
5544
|
-
private readonly [symbol$
|
|
6275
|
+
private readonly [symbol$1_3];
|
|
5545
6276
|
readonly reason: RetryErrorReason;
|
|
5546
6277
|
readonly lastError: unknown;
|
|
5547
6278
|
readonly errors: Array<unknown>;
|
|
@@ -5564,7 +6295,7 @@ declare type RetryErrorReason = 'maxRetriesExceeded' | 'errorNotRetryable' | 'ab
|
|
|
5564
6295
|
declare function safeParseJSON(options: {
|
|
5565
6296
|
text: string;
|
|
5566
6297
|
schema?: undefined;
|
|
5567
|
-
}): Promise<ParseResult<
|
|
6298
|
+
}): Promise<ParseResult<JSONValue_3>>;
|
|
5568
6299
|
|
|
5569
6300
|
/**
|
|
5570
6301
|
* Safely parses a JSON string into a strongly-typed object, using a provided schema to validate the object.
|
|
@@ -5597,7 +6328,7 @@ declare function safeValidateTypes<OBJECT>({ value, schema, }: {
|
|
|
5597
6328
|
rawValue: unknown;
|
|
5598
6329
|
} | {
|
|
5599
6330
|
success: false;
|
|
5600
|
-
error:
|
|
6331
|
+
error: TypeValidationError_2;
|
|
5601
6332
|
rawValue: unknown;
|
|
5602
6333
|
}>;
|
|
5603
6334
|
|
|
@@ -5677,6 +6408,29 @@ declare type SharedV2Headers = Record<string, string>;
|
|
|
5677
6408
|
*/
|
|
5678
6409
|
declare type SharedV2ProviderMetadata = Record<string, Record<string, JSONValue_2>>;
|
|
5679
6410
|
|
|
6411
|
+
/**
|
|
6412
|
+
* Additional provider-specific metadata.
|
|
6413
|
+
* Metadata are additional outputs from the provider.
|
|
6414
|
+
* They are passed through to the provider from the AI SDK
|
|
6415
|
+
* and enable provider-specific functionality
|
|
6416
|
+
* that can be fully encapsulated in the provider.
|
|
6417
|
+
*
|
|
6418
|
+
* This enables us to quickly ship provider-specific functionality
|
|
6419
|
+
* without affecting the core AI SDK.
|
|
6420
|
+
*
|
|
6421
|
+
* The outer record is keyed by the provider name, and the inner
|
|
6422
|
+
* record is keyed by the provider-specific metadata key.
|
|
6423
|
+
*
|
|
6424
|
+
* ```ts
|
|
6425
|
+
* {
|
|
6426
|
+
* "anthropic": {
|
|
6427
|
+
* "cacheControl": { "type": "ephemeral" }
|
|
6428
|
+
* }
|
|
6429
|
+
* }
|
|
6430
|
+
* ```
|
|
6431
|
+
*/
|
|
6432
|
+
declare type SharedV2ProviderMetadata_2 = Record<string, Record<string, JSONValue_3>>;
|
|
6433
|
+
|
|
5680
6434
|
/**
|
|
5681
6435
|
* Additional provider-specific options.
|
|
5682
6436
|
* Options are additional input to the provider.
|
|
@@ -5700,6 +6454,29 @@ declare type SharedV2ProviderMetadata = Record<string, Record<string, JSONValue_
|
|
|
5700
6454
|
*/
|
|
5701
6455
|
declare type SharedV2ProviderOptions = Record<string, Record<string, JSONValue_2>>;
|
|
5702
6456
|
|
|
6457
|
+
/**
|
|
6458
|
+
* Additional provider-specific options.
|
|
6459
|
+
* Options are additional input to the provider.
|
|
6460
|
+
* They are passed through to the provider from the AI SDK
|
|
6461
|
+
* and enable provider-specific functionality
|
|
6462
|
+
* that can be fully encapsulated in the provider.
|
|
6463
|
+
*
|
|
6464
|
+
* This enables us to quickly ship provider-specific functionality
|
|
6465
|
+
* without affecting the core AI SDK.
|
|
6466
|
+
*
|
|
6467
|
+
* The outer record is keyed by the provider name, and the inner
|
|
6468
|
+
* record is keyed by the provider-specific metadata key.
|
|
6469
|
+
*
|
|
6470
|
+
* ```ts
|
|
6471
|
+
* {
|
|
6472
|
+
* "anthropic": {
|
|
6473
|
+
* "cacheControl": { "type": "ephemeral" }
|
|
6474
|
+
* }
|
|
6475
|
+
* }
|
|
6476
|
+
* ```
|
|
6477
|
+
*/
|
|
6478
|
+
declare type SharedV2ProviderOptions_2 = Record<string, Record<string, JSONValue_3>>;
|
|
6479
|
+
|
|
5703
6480
|
/**
|
|
5704
6481
|
* Creates a ReadableStream that emits the provided values with an optional delay between each value.
|
|
5705
6482
|
*
|
|
@@ -6563,6 +7340,76 @@ export declare type StopCondition<TOOLS extends ToolSet> = (options: {
|
|
|
6563
7340
|
steps: Array<StepResult<TOOLS>>;
|
|
6564
7341
|
}) => PromiseLike<boolean> | boolean;
|
|
6565
7342
|
|
|
7343
|
+
/**
|
|
7344
|
+
* Minimal interface for a streaming tool call delta from an OpenAI-compatible API.
|
|
7345
|
+
*/
|
|
7346
|
+
declare interface StreamingToolCallDelta {
|
|
7347
|
+
index?: number | null;
|
|
7348
|
+
id?: string | null;
|
|
7349
|
+
type?: string | null;
|
|
7350
|
+
function?: {
|
|
7351
|
+
name?: string | null;
|
|
7352
|
+
arguments?: string | null;
|
|
7353
|
+
} | null;
|
|
7354
|
+
}
|
|
7355
|
+
|
|
7356
|
+
/**
|
|
7357
|
+
* Tracks streaming tool call state across multiple deltas from an
|
|
7358
|
+
* OpenAI-compatible chat completion stream.
|
|
7359
|
+
*/
|
|
7360
|
+
declare class StreamingToolCallTracker<DELTA extends StreamingToolCallDelta = StreamingToolCallDelta> {
|
|
7361
|
+
private toolCalls;
|
|
7362
|
+
private toolCallsById;
|
|
7363
|
+
private toolCallsByIndex;
|
|
7364
|
+
private usedToolCallIds;
|
|
7365
|
+
private nextGeneratedIdSuffixes;
|
|
7366
|
+
private readonly controller;
|
|
7367
|
+
private readonly _generateId;
|
|
7368
|
+
private readonly typeValidation;
|
|
7369
|
+
private readonly extractMetadata?;
|
|
7370
|
+
private readonly buildToolCallProviderMetadata?;
|
|
7371
|
+
constructor(controller: StreamingToolCallTrackerController, options?: StreamingToolCallTrackerOptions<DELTA>);
|
|
7372
|
+
processDelta(toolCallDelta: DELTA): void;
|
|
7373
|
+
flush(): void;
|
|
7374
|
+
private resolveToolCall;
|
|
7375
|
+
private filterToolCallsByName;
|
|
7376
|
+
private resolveMatchingToolCall;
|
|
7377
|
+
private processNewToolCall;
|
|
7378
|
+
private associateWireId;
|
|
7379
|
+
private associateIndex;
|
|
7380
|
+
private createToolCallId;
|
|
7381
|
+
private getNonBlankString;
|
|
7382
|
+
private processExistingToolCall;
|
|
7383
|
+
private finishToolCall;
|
|
7384
|
+
}
|
|
7385
|
+
|
|
7386
|
+
declare type StreamingToolCallTrackerController = Pick<TransformStreamDefaultController<LanguageModelV2StreamPart_2>, 'enqueue'>;
|
|
7387
|
+
|
|
7388
|
+
declare interface StreamingToolCallTrackerOptions<DELTA extends StreamingToolCallDelta = StreamingToolCallDelta> {
|
|
7389
|
+
/**
|
|
7390
|
+
* ID generator function for tool call IDs.
|
|
7391
|
+
* Blank or repeated outputs are converted to usable unique IDs.
|
|
7392
|
+
* Defaults to the standard generateId.
|
|
7393
|
+
*/
|
|
7394
|
+
generateId?: () => string;
|
|
7395
|
+
/**
|
|
7396
|
+
* How to validate the `type` field on new tool call deltas.
|
|
7397
|
+
* - `'none'`: no validation (default)
|
|
7398
|
+
* - `'if-present'`: throw if type is present and not `'function'`
|
|
7399
|
+
* - `'required'`: throw if type is not exactly `'function'`
|
|
7400
|
+
*/
|
|
7401
|
+
typeValidation?: 'none' | 'if-present' | 'required';
|
|
7402
|
+
/**
|
|
7403
|
+
* Extract provider-specific metadata from a tool call delta.
|
|
7404
|
+
* Called once when a new tool call is detected.
|
|
7405
|
+
*/
|
|
7406
|
+
extractMetadata?: (delta: DELTA) => SharedV2ProviderMetadata_2 | undefined;
|
|
7407
|
+
/**
|
|
7408
|
+
* Build the `providerMetadata` object for a `tool-call` event.
|
|
7409
|
+
*/
|
|
7410
|
+
buildToolCallProviderMetadata?: (metadata: SharedV2ProviderMetadata_2 | undefined) => SharedV2ProviderMetadata_2 | undefined;
|
|
7411
|
+
}
|
|
7412
|
+
|
|
6566
7413
|
/**
|
|
6567
7414
|
Generate a structured, typed object for a given prompt and schema using a language model.
|
|
6568
7415
|
|
|
@@ -7278,6 +8125,8 @@ declare const symbol$1: unique symbol;
|
|
|
7278
8125
|
|
|
7279
8126
|
declare const symbol$1_2: unique symbol;
|
|
7280
8127
|
|
|
8128
|
+
declare const symbol$1_3: unique symbol;
|
|
8129
|
+
|
|
7281
8130
|
declare const symbol$2: unique symbol;
|
|
7282
8131
|
|
|
7283
8132
|
declare const symbol$2_2: unique symbol;
|
|
@@ -7302,6 +8151,8 @@ declare const symbol$7: unique symbol;
|
|
|
7302
8151
|
|
|
7303
8152
|
declare const symbol$7_2: unique symbol;
|
|
7304
8153
|
|
|
8154
|
+
declare const symbol$7_3: unique symbol;
|
|
8155
|
+
|
|
7305
8156
|
declare const symbol$8: unique symbol;
|
|
7306
8157
|
|
|
7307
8158
|
declare const symbol$8_2: unique symbol;
|
|
@@ -7320,10 +8171,14 @@ declare const symbol$c: unique symbol;
|
|
|
7320
8171
|
|
|
7321
8172
|
declare const symbol$c_2: unique symbol;
|
|
7322
8173
|
|
|
8174
|
+
declare const symbol$c_3: unique symbol;
|
|
8175
|
+
|
|
7323
8176
|
declare const symbol$d: unique symbol;
|
|
7324
8177
|
|
|
7325
8178
|
declare const symbol$d_2: unique symbol;
|
|
7326
8179
|
|
|
8180
|
+
declare const symbol$d_3: unique symbol;
|
|
8181
|
+
|
|
7327
8182
|
declare const symbol$e: unique symbol;
|
|
7328
8183
|
|
|
7329
8184
|
declare const symbol: unique symbol;
|
|
@@ -7523,7 +8378,7 @@ declare type TimeInput = HrTime | number | Date;
|
|
|
7523
8378
|
|
|
7524
8379
|
The tool can also contain an optional execute function for the actual execution function of the tool.
|
|
7525
8380
|
*/
|
|
7526
|
-
export declare type Tool<INPUT extends
|
|
8381
|
+
export declare type Tool<INPUT extends JSONValue_3 | unknown | never = any, OUTPUT extends JSONValue_3 | unknown | never = any> = {
|
|
7527
8382
|
/**
|
|
7528
8383
|
An optional description of what the tool does.
|
|
7529
8384
|
Will be used by the language model to decide whether to use the tool.
|
|
@@ -7567,7 +8422,7 @@ export declare type Tool<INPUT extends JSONValue_2 | unknown | never = any, OUTP
|
|
|
7567
8422
|
|
|
7568
8423
|
If not provided, the tool result will be sent as a JSON object.
|
|
7569
8424
|
*/
|
|
7570
|
-
toModelOutput?: (output: 0 extends 1 & OUTPUT ? any : [OUTPUT] extends [never] ? any : NoInfer<OUTPUT>) =>
|
|
8425
|
+
toModelOutput?: (output: 0 extends 1 & OUTPUT ? any : [OUTPUT] extends [never] ? any : NoInfer<OUTPUT>) => LanguageModelV2ToolResultPart_2['output'];
|
|
7571
8426
|
} & ({
|
|
7572
8427
|
/**
|
|
7573
8428
|
Tool with user-defined input and output schemas.
|
|
@@ -7824,7 +8679,7 @@ export declare interface ToolResultPart {
|
|
|
7824
8679
|
/**
|
|
7825
8680
|
Result of the tool call. This is a JSON-serializable object.
|
|
7826
8681
|
*/
|
|
7827
|
-
output:
|
|
8682
|
+
output: LanguageModelV2ToolResultOutput_2;
|
|
7828
8683
|
/**
|
|
7829
8684
|
Additional provider-specific metadata. They are passed through
|
|
7830
8685
|
to the provider from the AI SDK and enable provider-specific
|
|
@@ -8176,6 +9031,30 @@ export declare class TypeValidationError extends AISDKError {
|
|
|
8176
9031
|
}): TypeValidationError;
|
|
8177
9032
|
}
|
|
8178
9033
|
|
|
9034
|
+
declare class TypeValidationError_2 extends AISDKError_2 {
|
|
9035
|
+
private readonly [symbol$1_2];
|
|
9036
|
+
readonly value: unknown;
|
|
9037
|
+
constructor({ value, cause }: {
|
|
9038
|
+
value: unknown;
|
|
9039
|
+
cause: unknown;
|
|
9040
|
+
});
|
|
9041
|
+
static isInstance(error: unknown): error is TypeValidationError_2;
|
|
9042
|
+
/**
|
|
9043
|
+
* Wraps an error into a TypeValidationError.
|
|
9044
|
+
* If the cause is already a TypeValidationError with the same value, it returns the cause.
|
|
9045
|
+
* Otherwise, it creates a new TypeValidationError.
|
|
9046
|
+
*
|
|
9047
|
+
* @param {Object} params - The parameters for wrapping the error.
|
|
9048
|
+
* @param {unknown} params.value - The value that failed validation.
|
|
9049
|
+
* @param {unknown} params.cause - The original error or cause of the validation failure.
|
|
9050
|
+
* @returns {TypeValidationError} A TypeValidationError instance.
|
|
9051
|
+
*/
|
|
9052
|
+
static wrap({ value, cause, }: {
|
|
9053
|
+
value: unknown;
|
|
9054
|
+
cause: unknown;
|
|
9055
|
+
}): TypeValidationError_2;
|
|
9056
|
+
}
|
|
9057
|
+
|
|
8179
9058
|
export declare const UI_MESSAGE_STREAM_HEADERS: {
|
|
8180
9059
|
'content-type': string;
|
|
8181
9060
|
'cache-control': string;
|
|
@@ -8599,9 +9478,8 @@ export declare const userModelMessageSchema: z.ZodType<UserModelMessage>;
|
|
|
8599
9478
|
* Validates that a URL is safe to download from, blocking private/internal addresses
|
|
8600
9479
|
* to prevent SSRF attacks.
|
|
8601
9480
|
*
|
|
8602
|
-
* Note: this performs string/literal-IP checks only.
|
|
8603
|
-
*
|
|
8604
|
-
* should additionally constrain egress at the network layer when handling untrusted URLs).
|
|
9481
|
+
* Note: this function performs string/literal-IP checks only. The Node.js
|
|
9482
|
+
* download fetch additionally validates and pins DNS results at connect time.
|
|
8605
9483
|
*
|
|
8606
9484
|
* @param url - The URL string to validate.
|
|
8607
9485
|
* @throws DownloadError if the URL is unsafe.
|
|
@@ -8776,5 +9654,5 @@ export declare function zodSchema<OBJECT>(zodSchema: z4.core.$ZodType<OBJECT, an
|
|
|
8776
9654
|
}): Schema<OBJECT>;
|
|
8777
9655
|
|
|
8778
9656
|
export { }
|
|
8779
|
-
export { GatewayProviderSettings as GatewayProviderSettings, GatewayProvider as GatewayProvider, ParseResult as ParseResult, FlexibleValidator as FlexibleValidator, ValidationResult as ValidationResult,
|
|
8780
|
-
export { schemaSymbol, symbol$1, symbol$1_2, symbol$2, symbol$2_2, symbol$3, symbol$3_2, symbol$4, symbol$4_2, symbol$5, symbol$5_2, symbol$6, symbol$6_2, symbol$7, symbol$7_2, symbol$8, symbol$8_2, symbol$9, symbol$9_2, symbol$a, symbol$b, symbol$b_2, symbol$c, symbol$c_2, symbol$d, symbol$d_2, symbol$e, symbol, symbol_2, symbol_3, validatorSymbol };
|
|
9657
|
+
export { GatewayProviderSettings as GatewayProviderSettings, GatewayProvider as GatewayProvider, ParseResult as ParseResult, FlexibleValidator as FlexibleValidator, ValidationResult as ValidationResult, LanguageModelV2ToolResultOutput_2 as LanguageModelV2ToolResultOutput_2, ProviderOptions as ProviderOptions, ReasoningPart as ReasoningPart, JSONValue_3 as JSONValue_3, ToolOutputProperties as ToolOutputProperties, LanguageModelV2ToolResultPart_2 as LanguageModelV2ToolResultPart_2, FlexibleSchema as FlexibleSchema, ImageModelV2CallWarning as ImageModelV2CallWarning, SpeechModelV2CallWarning as SpeechModelV2CallWarning, TranscriptionModelV2CallWarning as TranscriptionModelV2CallWarning, AttributeValue as AttributeValue, Tracer as Tracer, EmbeddingModelV2Embedding as EmbeddingModelV2Embedding, ImageModelV2ProviderMetadata as ImageModelV2ProviderMetadata, GlobalProviderModelId as GlobalProviderModelId, LanguageModelV2FinishReason as LanguageModelV2FinishReason, LanguageModelV2CallWarning as LanguageModelV2CallWarning, LanguageModelV2Middleware as LanguageModelV2Middleware, SharedV2ProviderMetadata as SharedV2ProviderMetadata, LanguageModelV2Usage as LanguageModelV2Usage, Source as Source, ResponseMessage as ResponseMessage, DeepPartialInternal as DeepPartialInternal, LanguageModelV2ToolCall as LanguageModelV2ToolCall, StreamTextOnAbortCallback as StreamTextOnAbortCallback, ValueOf as ValueOf, asUITool as asUITool, _ai_sdk_provider_utils as _ai_sdk_provider_utils, DataUIMessageChunk as DataUIMessageChunk, ConsumeStreamOptions as ConsumeStreamOptions, Output_2 as Output_2, InferAgentTools as InferAgentTools, SingleRequestTextStreamPart as SingleRequestTextStreamPart, RetryErrorReason as RetryErrorReason, InferSchema as InferSchema, Job as Job, StreamObjectOnErrorCallback as StreamObjectOnErrorCallback, JSONValue_2 as JSONValue_2, LanguageModelV2CallOptions as LanguageModelV2CallOptions, LanguageModelV2 as LanguageModelV2, EmbeddingModelV2 as EmbeddingModelV2, ImageModelV2 as ImageModelV2, TranscriptionModelV2 as TranscriptionModelV2, SpeechModelV2 as SpeechModelV2, ExtractModelId as ExtractModelId, ExtractLiteralUnion as ExtractLiteralUnion, ProviderV2 as ProviderV2, getOriginalFetch as getOriginalFetch, UIMessageStreamResponseInit as UIMessageStreamResponseInit, InferUIMessageToolCall as InferUIMessageToolCall, Validator as Validator, StandardSchemaV1 as StandardSchemaV1, UIDataTypesToSchemas as UIDataTypesToSchemas, InferUIMessageData as InferUIMessageData, InferUIMessageMetadata as InferUIMessageMetadata, InferUIMessageTools as InferUIMessageTools, Resolvable as Resolvable, FetchFunction as FetchFunction };
|
|
9658
|
+
export { EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL, schemaSymbol, symbol$1, symbol$1_2, symbol$1_3, symbol$2, symbol$2_2, symbol$3, symbol$3_2, symbol$4, symbol$4_2, symbol$5, symbol$5_2, symbol$6, symbol$6_2, symbol$7, symbol$7_2, symbol$7_3, symbol$8, symbol$8_2, symbol$9, symbol$9_2, symbol$a, symbol$b, symbol$b_2, symbol$c, symbol$c_2, symbol$c_3, symbol$d, symbol$d_2, symbol$d_3, symbol$e, symbol, symbol_2, symbol_3, validatorSymbol };
|