@mastra/ai-sdk 1.10.6 → 1.10.7-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_ai-sdk-v5/dist/index.d.ts +536 -0
- package/dist/_types/@internal_ai-v6/dist/index.d.ts +488 -3
- package/dist/_types/@internal_ai-v7/dist/index.d.ts +1682 -253
- package/dist/index.cjs +965 -831
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +965 -831
- package/dist/index.js.map +1 -1
- package/dist/transformers.d.ts +1 -5
- package/dist/transformers.d.ts.map +1 -1
- package/package.json +12 -12
|
@@ -235,6 +235,8 @@ declare namespace _ai_sdk_provider_utils {
|
|
|
235
235
|
DelayedPromise,
|
|
236
236
|
DownloadError,
|
|
237
237
|
EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL as EXPERIMENTAL_EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL,
|
|
238
|
+
EMBEDDING_MODEL_PROVIDER_OPTIONS_TRANSFORMER as EXPERIMENTAL_EMBEDDING_MODEL_PROVIDER_OPTIONS_TRANSFORMER,
|
|
239
|
+
EmbeddingModelProviderOptionsTransformer,
|
|
238
240
|
FetchFunction,
|
|
239
241
|
FilePart,
|
|
240
242
|
FlexibleSchema,
|
|
@@ -259,6 +261,9 @@ declare namespace _ai_sdk_provider_utils {
|
|
|
259
261
|
RetryFunction,
|
|
260
262
|
Schema,
|
|
261
263
|
ShouldRetryFunction,
|
|
264
|
+
StreamingToolCallDelta,
|
|
265
|
+
StreamingToolCallTracker,
|
|
266
|
+
StreamingToolCallTrackerOptions,
|
|
262
267
|
SystemModelMessage,
|
|
263
268
|
TextPart,
|
|
264
269
|
Tool,
|
|
@@ -1764,6 +1769,15 @@ export declare type Embedding = EmbeddingModelV3Embedding;
|
|
|
1764
1769
|
*/
|
|
1765
1770
|
declare const EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL: unique symbol;
|
|
1766
1771
|
|
|
1772
|
+
/**
|
|
1773
|
+
* Symbol for transforming provider options for an automatically batched
|
|
1774
|
+
* embedding model call.
|
|
1775
|
+
*
|
|
1776
|
+
* This capability is experimental and intentionally lives outside the versioned
|
|
1777
|
+
* embedding model specification.
|
|
1778
|
+
*/
|
|
1779
|
+
declare const EMBEDDING_MODEL_PROVIDER_OPTIONS_TRANSFORMER: unique symbol;
|
|
1780
|
+
|
|
1767
1781
|
/**
|
|
1768
1782
|
* Embedding model that is used by the AI SDK.
|
|
1769
1783
|
*/
|
|
@@ -1771,6 +1785,13 @@ export declare type EmbeddingModel = string | EmbeddingModelV3 | EmbeddingModelV
|
|
|
1771
1785
|
|
|
1772
1786
|
export declare type EmbeddingModelMiddleware = EmbeddingModelV3Middleware;
|
|
1773
1787
|
|
|
1788
|
+
declare type EmbeddingModelProviderOptionsTransformer = (options: {
|
|
1789
|
+
providerOptions: SharedV3ProviderOptions_2 | undefined;
|
|
1790
|
+
values: Array<string>;
|
|
1791
|
+
startIndex: number;
|
|
1792
|
+
endIndex: number;
|
|
1793
|
+
}) => SharedV3ProviderOptions_2 | undefined | PromiseLike<SharedV3ProviderOptions_2 | undefined>;
|
|
1794
|
+
|
|
1774
1795
|
/**
|
|
1775
1796
|
* Represents the number of tokens used in an embedding.
|
|
1776
1797
|
*/
|
|
@@ -4992,9 +5013,9 @@ export declare function isToolUIPart<TOOLS extends UITools>(part: UIMessagePart<
|
|
|
4992
5013
|
/**
|
|
4993
5014
|
* Checks if the given URL is supported natively by the model.
|
|
4994
5015
|
*
|
|
4995
|
-
* @param mediaType - The media type of the URL. Case-
|
|
5016
|
+
* @param mediaType - The media type of the URL. Case-insensitive.
|
|
4996
5017
|
* @param url - The URL to check.
|
|
4997
|
-
* @param supportedUrls - A record where keys are case-
|
|
5018
|
+
* @param supportedUrls - A record where keys are case-insensitive media types (or '*')
|
|
4998
5019
|
* and values are arrays of RegExp patterns for URLs.
|
|
4999
5020
|
*
|
|
5000
5021
|
* @returns `true` if the URL matches a pattern under the specific media type
|
|
@@ -6130,6 +6151,34 @@ declare type LanguageModelV3File = {
|
|
|
6130
6151
|
providerMetadata?: SharedV3ProviderMetadata;
|
|
6131
6152
|
};
|
|
6132
6153
|
|
|
6154
|
+
/**
|
|
6155
|
+
* A file that has been generated by the model.
|
|
6156
|
+
* Generated files as base64 encoded strings or binary data.
|
|
6157
|
+
* The files should be returned without any unnecessary conversion.
|
|
6158
|
+
*/
|
|
6159
|
+
declare type LanguageModelV3File_2 = {
|
|
6160
|
+
type: 'file';
|
|
6161
|
+
/**
|
|
6162
|
+
* The IANA media type of the file, e.g. `image/png` or `audio/mp3`.
|
|
6163
|
+
*
|
|
6164
|
+
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
6165
|
+
*/
|
|
6166
|
+
mediaType: string;
|
|
6167
|
+
/**
|
|
6168
|
+
* Generated file data as base64 encoded strings or binary data.
|
|
6169
|
+
*
|
|
6170
|
+
* The file data should be returned without any unnecessary conversion.
|
|
6171
|
+
* If the API returns base64 encoded strings, the file data should be returned
|
|
6172
|
+
* as base64 encoded strings. If the API returns binary data, the file data should
|
|
6173
|
+
* be returned as binary data.
|
|
6174
|
+
*/
|
|
6175
|
+
data: string | Uint8Array;
|
|
6176
|
+
/**
|
|
6177
|
+
* Optional provider-specific metadata for the file part.
|
|
6178
|
+
*/
|
|
6179
|
+
providerMetadata?: SharedV3ProviderMetadata_2;
|
|
6180
|
+
};
|
|
6181
|
+
|
|
6133
6182
|
/**
|
|
6134
6183
|
* File content part of a prompt. It contains a file.
|
|
6135
6184
|
*/
|
|
@@ -6222,6 +6271,33 @@ declare type LanguageModelV3FinishReason = {
|
|
|
6222
6271
|
raw: string | undefined;
|
|
6223
6272
|
};
|
|
6224
6273
|
|
|
6274
|
+
/**
|
|
6275
|
+
* Reason why a language model finished generating a response.
|
|
6276
|
+
*
|
|
6277
|
+
* Contains both a unified finish reason and a raw finish reason from the provider.
|
|
6278
|
+
* The unified finish reason is used to provide a consistent finish reason across different providers.
|
|
6279
|
+
* The raw finish reason is used to provide the original finish reason from the provider.
|
|
6280
|
+
*/
|
|
6281
|
+
declare type LanguageModelV3FinishReason_2 = {
|
|
6282
|
+
/**
|
|
6283
|
+
* Unified finish reason. This enables using the same finish reason across different providers.
|
|
6284
|
+
*
|
|
6285
|
+
* Can be one of the following:
|
|
6286
|
+
* - `stop`: model generated stop sequence
|
|
6287
|
+
* - `length`: model generated maximum number of tokens
|
|
6288
|
+
* - `content-filter`: content filter violation stopped the model
|
|
6289
|
+
* - `tool-calls`: model triggered tool calls
|
|
6290
|
+
* - `error`: model stopped because of an error
|
|
6291
|
+
* - `other`: model stopped for other reasons
|
|
6292
|
+
*/
|
|
6293
|
+
unified: 'stop' | 'length' | 'content-filter' | 'tool-calls' | 'error' | 'other';
|
|
6294
|
+
/**
|
|
6295
|
+
* Raw finish reason from the provider.
|
|
6296
|
+
* This is the original finish reason from the provider.
|
|
6297
|
+
*/
|
|
6298
|
+
raw: string | undefined;
|
|
6299
|
+
};
|
|
6300
|
+
|
|
6225
6301
|
/**
|
|
6226
6302
|
* A tool has a name, a description, and a set of parameters.
|
|
6227
6303
|
*
|
|
@@ -6619,6 +6695,21 @@ declare interface LanguageModelV3ResponseMetadata {
|
|
|
6619
6695
|
modelId?: string;
|
|
6620
6696
|
}
|
|
6621
6697
|
|
|
6698
|
+
declare interface LanguageModelV3ResponseMetadata_2 {
|
|
6699
|
+
/**
|
|
6700
|
+
* ID for the generated response, if the provider sends one.
|
|
6701
|
+
*/
|
|
6702
|
+
id?: string;
|
|
6703
|
+
/**
|
|
6704
|
+
* Timestamp for the start of the generated response, if the provider sends one.
|
|
6705
|
+
*/
|
|
6706
|
+
timestamp?: Date;
|
|
6707
|
+
/**
|
|
6708
|
+
* The ID of the response model that was used to generate the response, if the provider sends one.
|
|
6709
|
+
*/
|
|
6710
|
+
modelId?: string;
|
|
6711
|
+
}
|
|
6712
|
+
|
|
6622
6713
|
/**
|
|
6623
6714
|
* A source that has been used as input to generate the response.
|
|
6624
6715
|
*/
|
|
@@ -6672,6 +6763,59 @@ declare type LanguageModelV3Source = {
|
|
|
6672
6763
|
providerMetadata?: SharedV3ProviderMetadata;
|
|
6673
6764
|
};
|
|
6674
6765
|
|
|
6766
|
+
/**
|
|
6767
|
+
* A source that has been used as input to generate the response.
|
|
6768
|
+
*/
|
|
6769
|
+
declare type LanguageModelV3Source_2 = {
|
|
6770
|
+
type: 'source';
|
|
6771
|
+
/**
|
|
6772
|
+
* The type of source - URL sources reference web content.
|
|
6773
|
+
*/
|
|
6774
|
+
sourceType: 'url';
|
|
6775
|
+
/**
|
|
6776
|
+
* The ID of the source.
|
|
6777
|
+
*/
|
|
6778
|
+
id: string;
|
|
6779
|
+
/**
|
|
6780
|
+
* The URL of the source.
|
|
6781
|
+
*/
|
|
6782
|
+
url: string;
|
|
6783
|
+
/**
|
|
6784
|
+
* The title of the source.
|
|
6785
|
+
*/
|
|
6786
|
+
title?: string;
|
|
6787
|
+
/**
|
|
6788
|
+
* Additional provider metadata for the source.
|
|
6789
|
+
*/
|
|
6790
|
+
providerMetadata?: SharedV3ProviderMetadata_2;
|
|
6791
|
+
} | {
|
|
6792
|
+
type: 'source';
|
|
6793
|
+
/**
|
|
6794
|
+
* The type of source - document sources reference files/documents.
|
|
6795
|
+
*/
|
|
6796
|
+
sourceType: 'document';
|
|
6797
|
+
/**
|
|
6798
|
+
* The ID of the source.
|
|
6799
|
+
*/
|
|
6800
|
+
id: string;
|
|
6801
|
+
/**
|
|
6802
|
+
* IANA media type of the document (e.g., 'application/pdf').
|
|
6803
|
+
*/
|
|
6804
|
+
mediaType: string;
|
|
6805
|
+
/**
|
|
6806
|
+
* The title of the document.
|
|
6807
|
+
*/
|
|
6808
|
+
title: string;
|
|
6809
|
+
/**
|
|
6810
|
+
* Optional filename of the document.
|
|
6811
|
+
*/
|
|
6812
|
+
filename?: string;
|
|
6813
|
+
/**
|
|
6814
|
+
* Additional provider metadata for the source.
|
|
6815
|
+
*/
|
|
6816
|
+
providerMetadata?: SharedV3ProviderMetadata_2;
|
|
6817
|
+
};
|
|
6818
|
+
|
|
6675
6819
|
declare type LanguageModelV3StreamPart = {
|
|
6676
6820
|
type: 'text-start';
|
|
6677
6821
|
providerMetadata?: SharedV3ProviderMetadata;
|
|
@@ -6733,6 +6877,67 @@ declare type LanguageModelV3StreamPart = {
|
|
|
6733
6877
|
error: unknown;
|
|
6734
6878
|
};
|
|
6735
6879
|
|
|
6880
|
+
declare type LanguageModelV3StreamPart_2 = {
|
|
6881
|
+
type: 'text-start';
|
|
6882
|
+
providerMetadata?: SharedV3ProviderMetadata_2;
|
|
6883
|
+
id: string;
|
|
6884
|
+
} | {
|
|
6885
|
+
type: 'text-delta';
|
|
6886
|
+
id: string;
|
|
6887
|
+
providerMetadata?: SharedV3ProviderMetadata_2;
|
|
6888
|
+
delta: string;
|
|
6889
|
+
} | {
|
|
6890
|
+
type: 'text-end';
|
|
6891
|
+
providerMetadata?: SharedV3ProviderMetadata_2;
|
|
6892
|
+
id: string;
|
|
6893
|
+
} | {
|
|
6894
|
+
type: 'reasoning-start';
|
|
6895
|
+
providerMetadata?: SharedV3ProviderMetadata_2;
|
|
6896
|
+
id: string;
|
|
6897
|
+
} | {
|
|
6898
|
+
type: 'reasoning-delta';
|
|
6899
|
+
id: string;
|
|
6900
|
+
providerMetadata?: SharedV3ProviderMetadata_2;
|
|
6901
|
+
delta: string;
|
|
6902
|
+
} | {
|
|
6903
|
+
type: 'reasoning-end';
|
|
6904
|
+
id: string;
|
|
6905
|
+
providerMetadata?: SharedV3ProviderMetadata_2;
|
|
6906
|
+
} | {
|
|
6907
|
+
type: 'tool-input-start';
|
|
6908
|
+
id: string;
|
|
6909
|
+
toolName: string;
|
|
6910
|
+
providerMetadata?: SharedV3ProviderMetadata_2;
|
|
6911
|
+
providerExecuted?: boolean;
|
|
6912
|
+
dynamic?: boolean;
|
|
6913
|
+
title?: string;
|
|
6914
|
+
} | {
|
|
6915
|
+
type: 'tool-input-delta';
|
|
6916
|
+
id: string;
|
|
6917
|
+
delta: string;
|
|
6918
|
+
providerMetadata?: SharedV3ProviderMetadata_2;
|
|
6919
|
+
} | {
|
|
6920
|
+
type: 'tool-input-end';
|
|
6921
|
+
id: string;
|
|
6922
|
+
providerMetadata?: SharedV3ProviderMetadata_2;
|
|
6923
|
+
} | LanguageModelV3ToolApprovalRequest_2 | LanguageModelV3ToolCall_2 | LanguageModelV3ToolResult_2 | LanguageModelV3File_2 | LanguageModelV3Source_2 | {
|
|
6924
|
+
type: 'stream-start';
|
|
6925
|
+
warnings: Array<SharedV3Warning_2>;
|
|
6926
|
+
} | ({
|
|
6927
|
+
type: 'response-metadata';
|
|
6928
|
+
} & LanguageModelV3ResponseMetadata_2) | {
|
|
6929
|
+
type: 'finish';
|
|
6930
|
+
usage: LanguageModelV3Usage_2;
|
|
6931
|
+
finishReason: LanguageModelV3FinishReason_2;
|
|
6932
|
+
providerMetadata?: SharedV3ProviderMetadata_2;
|
|
6933
|
+
} | {
|
|
6934
|
+
type: 'raw';
|
|
6935
|
+
rawValue: unknown;
|
|
6936
|
+
} | {
|
|
6937
|
+
type: 'error';
|
|
6938
|
+
error: unknown;
|
|
6939
|
+
};
|
|
6940
|
+
|
|
6736
6941
|
/**
|
|
6737
6942
|
* The result of a language model doStream call.
|
|
6738
6943
|
*/
|
|
@@ -6830,6 +7035,29 @@ declare type LanguageModelV3ToolApprovalRequest = {
|
|
|
6830
7035
|
providerMetadata?: SharedV3ProviderMetadata;
|
|
6831
7036
|
};
|
|
6832
7037
|
|
|
7038
|
+
/**
|
|
7039
|
+
* Tool approval request emitted by a provider for a provider-executed tool call.
|
|
7040
|
+
*
|
|
7041
|
+
* This is used for flows where the provider executes the tool (e.g. MCP tools)
|
|
7042
|
+
* but requires an explicit user approval before continuing.
|
|
7043
|
+
*/
|
|
7044
|
+
declare type LanguageModelV3ToolApprovalRequest_2 = {
|
|
7045
|
+
type: 'tool-approval-request';
|
|
7046
|
+
/**
|
|
7047
|
+
* ID of the approval request. This ID is referenced by the subsequent
|
|
7048
|
+
* tool-approval-response (tool message) to approve or deny execution.
|
|
7049
|
+
*/
|
|
7050
|
+
approvalId: string;
|
|
7051
|
+
/**
|
|
7052
|
+
* The tool call ID that this approval request is for.
|
|
7053
|
+
*/
|
|
7054
|
+
toolCallId: string;
|
|
7055
|
+
/**
|
|
7056
|
+
* Additional provider-specific metadata for the approval request.
|
|
7057
|
+
*/
|
|
7058
|
+
providerMetadata?: SharedV3ProviderMetadata_2;
|
|
7059
|
+
};
|
|
7060
|
+
|
|
6833
7061
|
/**
|
|
6834
7062
|
* Tool approval response content part of a prompt. It contains the user's
|
|
6835
7063
|
* decision to approve or deny a provider-executed tool call.
|
|
@@ -6916,6 +7144,40 @@ declare type LanguageModelV3ToolCall = {
|
|
|
6916
7144
|
providerMetadata?: SharedV3ProviderMetadata;
|
|
6917
7145
|
};
|
|
6918
7146
|
|
|
7147
|
+
/**
|
|
7148
|
+
* Tool calls that the model has generated.
|
|
7149
|
+
*/
|
|
7150
|
+
declare type LanguageModelV3ToolCall_2 = {
|
|
7151
|
+
type: 'tool-call';
|
|
7152
|
+
/**
|
|
7153
|
+
* The identifier of the tool call. It must be unique across all tool calls.
|
|
7154
|
+
*/
|
|
7155
|
+
toolCallId: string;
|
|
7156
|
+
/**
|
|
7157
|
+
* The name of the tool that should be called.
|
|
7158
|
+
*/
|
|
7159
|
+
toolName: string;
|
|
7160
|
+
/**
|
|
7161
|
+
* Stringified JSON object with the tool call arguments. Must match the
|
|
7162
|
+
* parameters schema of the tool.
|
|
7163
|
+
*/
|
|
7164
|
+
input: string;
|
|
7165
|
+
/**
|
|
7166
|
+
* Whether the tool call will be executed by the provider.
|
|
7167
|
+
* If this flag is not set or is false, the tool call will be executed by the client.
|
|
7168
|
+
*/
|
|
7169
|
+
providerExecuted?: boolean;
|
|
7170
|
+
/**
|
|
7171
|
+
* Whether the tool is dynamic, i.e. defined at runtime.
|
|
7172
|
+
* For example, MCP (Model Context Protocol) tools that are executed by the provider.
|
|
7173
|
+
*/
|
|
7174
|
+
dynamic?: boolean;
|
|
7175
|
+
/**
|
|
7176
|
+
* Additional provider-specific metadata for the tool call.
|
|
7177
|
+
*/
|
|
7178
|
+
providerMetadata?: SharedV3ProviderMetadata_2;
|
|
7179
|
+
};
|
|
7180
|
+
|
|
6919
7181
|
/**
|
|
6920
7182
|
* Tool call content part of a prompt. It contains a tool call (usually generated by the AI model).
|
|
6921
7183
|
*/
|
|
@@ -7029,6 +7291,48 @@ declare type LanguageModelV3ToolResult = {
|
|
|
7029
7291
|
providerMetadata?: SharedV3ProviderMetadata;
|
|
7030
7292
|
};
|
|
7031
7293
|
|
|
7294
|
+
/**
|
|
7295
|
+
* Result of a tool call that has been executed by the provider.
|
|
7296
|
+
*/
|
|
7297
|
+
declare type LanguageModelV3ToolResult_2 = {
|
|
7298
|
+
type: 'tool-result';
|
|
7299
|
+
/**
|
|
7300
|
+
* The ID of the tool call that this result is associated with.
|
|
7301
|
+
*/
|
|
7302
|
+
toolCallId: string;
|
|
7303
|
+
/**
|
|
7304
|
+
* Name of the tool that generated this result.
|
|
7305
|
+
*/
|
|
7306
|
+
toolName: string;
|
|
7307
|
+
/**
|
|
7308
|
+
* Result of the tool call. This is a JSON-serializable object.
|
|
7309
|
+
*/
|
|
7310
|
+
result: NonNullable<JSONValue_3>;
|
|
7311
|
+
/**
|
|
7312
|
+
* Optional flag if the result is an error or an error message.
|
|
7313
|
+
*/
|
|
7314
|
+
isError?: boolean;
|
|
7315
|
+
/**
|
|
7316
|
+
* Whether the tool result is preliminary.
|
|
7317
|
+
*
|
|
7318
|
+
* Preliminary tool results replace each other, e.g. image previews.
|
|
7319
|
+
* There always has to be a final, non-preliminary tool result.
|
|
7320
|
+
*
|
|
7321
|
+
* If this flag is set to true, the tool result is preliminary.
|
|
7322
|
+
* If this flag is not set or is false, the tool result is not preliminary.
|
|
7323
|
+
*/
|
|
7324
|
+
preliminary?: boolean;
|
|
7325
|
+
/**
|
|
7326
|
+
* Whether the tool is dynamic, i.e. defined at runtime.
|
|
7327
|
+
* For example, MCP (Model Context Protocol) tools that are executed by the provider.
|
|
7328
|
+
*/
|
|
7329
|
+
dynamic?: boolean;
|
|
7330
|
+
/**
|
|
7331
|
+
* Additional provider-specific metadata for the tool result.
|
|
7332
|
+
*/
|
|
7333
|
+
providerMetadata?: SharedV3ProviderMetadata_2;
|
|
7334
|
+
};
|
|
7335
|
+
|
|
7032
7336
|
/**
|
|
7033
7337
|
* Result of a tool call.
|
|
7034
7338
|
*/
|
|
@@ -7278,6 +7582,11 @@ declare type LanguageModelV3ToolResultOutput_2 = {
|
|
|
7278
7582
|
* URL of the file.
|
|
7279
7583
|
*/
|
|
7280
7584
|
url: string;
|
|
7585
|
+
/**
|
|
7586
|
+
* IANA media type.
|
|
7587
|
+
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
7588
|
+
*/
|
|
7589
|
+
mediaType?: string;
|
|
7281
7590
|
/**
|
|
7282
7591
|
* Provider-specific options.
|
|
7283
7592
|
*/
|
|
@@ -7460,6 +7769,57 @@ declare type LanguageModelV3Usage = {
|
|
|
7460
7769
|
raw?: JSONObject;
|
|
7461
7770
|
};
|
|
7462
7771
|
|
|
7772
|
+
/**
|
|
7773
|
+
* Usage information for a language model call.
|
|
7774
|
+
*/
|
|
7775
|
+
declare type LanguageModelV3Usage_2 = {
|
|
7776
|
+
/**
|
|
7777
|
+
* Information about the input tokens.
|
|
7778
|
+
*/
|
|
7779
|
+
inputTokens: {
|
|
7780
|
+
/**
|
|
7781
|
+
* The total number of input (prompt) tokens used.
|
|
7782
|
+
*/
|
|
7783
|
+
total: number | undefined;
|
|
7784
|
+
/**
|
|
7785
|
+
* The number of non-cached input (prompt) tokens used.
|
|
7786
|
+
*/
|
|
7787
|
+
noCache: number | undefined;
|
|
7788
|
+
/**
|
|
7789
|
+
* The number of cached input (prompt) tokens read.
|
|
7790
|
+
*/
|
|
7791
|
+
cacheRead: number | undefined;
|
|
7792
|
+
/**
|
|
7793
|
+
* The number of cached input (prompt) tokens written.
|
|
7794
|
+
*/
|
|
7795
|
+
cacheWrite: number | undefined;
|
|
7796
|
+
};
|
|
7797
|
+
/**
|
|
7798
|
+
* Information about the output tokens.
|
|
7799
|
+
*/
|
|
7800
|
+
outputTokens: {
|
|
7801
|
+
/**
|
|
7802
|
+
* The total number of output (completion) tokens used.
|
|
7803
|
+
*/
|
|
7804
|
+
total: number | undefined;
|
|
7805
|
+
/**
|
|
7806
|
+
* The number of text tokens used.
|
|
7807
|
+
*/
|
|
7808
|
+
text: number | undefined;
|
|
7809
|
+
/**
|
|
7810
|
+
* The number of reasoning tokens used.
|
|
7811
|
+
*/
|
|
7812
|
+
reasoning: number | undefined;
|
|
7813
|
+
};
|
|
7814
|
+
/**
|
|
7815
|
+
* Raw usage information from the provider.
|
|
7816
|
+
*
|
|
7817
|
+
* This is the usage information in the shape that the provider returns.
|
|
7818
|
+
* It can include additional information that is not part of the standard usage information.
|
|
7819
|
+
*/
|
|
7820
|
+
raw?: JSONObject_2;
|
|
7821
|
+
};
|
|
7822
|
+
|
|
7463
7823
|
/**
|
|
7464
7824
|
* Check if the last message is an assistant message with completed tool call approvals.
|
|
7465
7825
|
* The last step of the message must have at least one tool approval response and
|
|
@@ -9695,6 +10055,49 @@ declare type SharedV3Warning = {
|
|
|
9695
10055
|
message: string;
|
|
9696
10056
|
};
|
|
9697
10057
|
|
|
10058
|
+
/**
|
|
10059
|
+
* Warning from the model.
|
|
10060
|
+
*
|
|
10061
|
+
* For example, that certain features are unsupported or compatibility
|
|
10062
|
+
* functionality is used (which might lead to suboptimal results).
|
|
10063
|
+
*/
|
|
10064
|
+
declare type SharedV3Warning_2 = {
|
|
10065
|
+
/**
|
|
10066
|
+
* A feature is not supported by the model.
|
|
10067
|
+
*/
|
|
10068
|
+
type: 'unsupported';
|
|
10069
|
+
/**
|
|
10070
|
+
* The feature that is not supported.
|
|
10071
|
+
*/
|
|
10072
|
+
feature: string;
|
|
10073
|
+
/**
|
|
10074
|
+
* Additional details about the warning.
|
|
10075
|
+
*/
|
|
10076
|
+
details?: string;
|
|
10077
|
+
} | {
|
|
10078
|
+
/**
|
|
10079
|
+
* A compatibility feature is used that might lead to suboptimal results.
|
|
10080
|
+
*/
|
|
10081
|
+
type: 'compatibility';
|
|
10082
|
+
/**
|
|
10083
|
+
* The feature that is used in a compatibility mode.
|
|
10084
|
+
*/
|
|
10085
|
+
feature: string;
|
|
10086
|
+
/**
|
|
10087
|
+
* Additional details about the warning.
|
|
10088
|
+
*/
|
|
10089
|
+
details?: string;
|
|
10090
|
+
} | {
|
|
10091
|
+
/**
|
|
10092
|
+
* Other warning.
|
|
10093
|
+
*/
|
|
10094
|
+
type: 'other';
|
|
10095
|
+
/**
|
|
10096
|
+
* The message of the warning.
|
|
10097
|
+
*/
|
|
10098
|
+
message: string;
|
|
10099
|
+
};
|
|
10100
|
+
|
|
9698
10101
|
declare type ShouldRetryFunction = (error: unknown) => boolean | Promise<boolean>;
|
|
9699
10102
|
|
|
9700
10103
|
/**
|
|
@@ -10732,6 +11135,76 @@ export declare type StopCondition<TOOLS extends ToolSet> = (options: {
|
|
|
10732
11135
|
steps: Array<StepResult<TOOLS>>;
|
|
10733
11136
|
}) => PromiseLike<boolean> | boolean;
|
|
10734
11137
|
|
|
11138
|
+
/**
|
|
11139
|
+
* Minimal interface for a streaming tool call delta from an OpenAI-compatible API.
|
|
11140
|
+
*/
|
|
11141
|
+
declare interface StreamingToolCallDelta {
|
|
11142
|
+
index?: number | null;
|
|
11143
|
+
id?: string | null;
|
|
11144
|
+
type?: string | null;
|
|
11145
|
+
function?: {
|
|
11146
|
+
name?: string | null;
|
|
11147
|
+
arguments?: string | null;
|
|
11148
|
+
} | null;
|
|
11149
|
+
}
|
|
11150
|
+
|
|
11151
|
+
/**
|
|
11152
|
+
* Tracks streaming tool call state across multiple deltas from an
|
|
11153
|
+
* OpenAI-compatible chat completion stream.
|
|
11154
|
+
*/
|
|
11155
|
+
declare class StreamingToolCallTracker<DELTA extends StreamingToolCallDelta = StreamingToolCallDelta> {
|
|
11156
|
+
private toolCalls;
|
|
11157
|
+
private toolCallsById;
|
|
11158
|
+
private toolCallsByIndex;
|
|
11159
|
+
private usedToolCallIds;
|
|
11160
|
+
private nextGeneratedIdSuffixes;
|
|
11161
|
+
private readonly controller;
|
|
11162
|
+
private readonly _generateId;
|
|
11163
|
+
private readonly typeValidation;
|
|
11164
|
+
private readonly extractMetadata?;
|
|
11165
|
+
private readonly buildToolCallProviderMetadata?;
|
|
11166
|
+
constructor(controller: StreamingToolCallTrackerController, options?: StreamingToolCallTrackerOptions<DELTA>);
|
|
11167
|
+
processDelta(toolCallDelta: DELTA): void;
|
|
11168
|
+
flush(): void;
|
|
11169
|
+
private resolveToolCall;
|
|
11170
|
+
private filterToolCallsByName;
|
|
11171
|
+
private resolveMatchingToolCall;
|
|
11172
|
+
private processNewToolCall;
|
|
11173
|
+
private associateWireId;
|
|
11174
|
+
private associateIndex;
|
|
11175
|
+
private createToolCallId;
|
|
11176
|
+
private getNonBlankString;
|
|
11177
|
+
private processExistingToolCall;
|
|
11178
|
+
private finishToolCall;
|
|
11179
|
+
}
|
|
11180
|
+
|
|
11181
|
+
declare type StreamingToolCallTrackerController = Pick<TransformStreamDefaultController<LanguageModelV3StreamPart_2>, 'enqueue'>;
|
|
11182
|
+
|
|
11183
|
+
declare interface StreamingToolCallTrackerOptions<DELTA extends StreamingToolCallDelta = StreamingToolCallDelta> {
|
|
11184
|
+
/**
|
|
11185
|
+
* ID generator function for tool call IDs.
|
|
11186
|
+
* Blank or repeated outputs are converted to usable unique IDs.
|
|
11187
|
+
* Defaults to the standard generateId.
|
|
11188
|
+
*/
|
|
11189
|
+
generateId?: () => string;
|
|
11190
|
+
/**
|
|
11191
|
+
* How to validate the `type` field on new tool call deltas.
|
|
11192
|
+
* - `'none'`: no validation (default)
|
|
11193
|
+
* - `'if-present'`: throw if type is present and not `'function'`
|
|
11194
|
+
* - `'required'`: throw if type is not exactly `'function'`
|
|
11195
|
+
*/
|
|
11196
|
+
typeValidation?: 'none' | 'if-present' | 'required';
|
|
11197
|
+
/**
|
|
11198
|
+
* Extract provider-specific metadata from a tool call delta.
|
|
11199
|
+
* Called once when a new tool call is detected.
|
|
11200
|
+
*/
|
|
11201
|
+
extractMetadata?: (delta: DELTA) => SharedV3ProviderMetadata_2 | undefined;
|
|
11202
|
+
/**
|
|
11203
|
+
* Build the `providerMetadata` object for a `tool-call` event.
|
|
11204
|
+
*/
|
|
11205
|
+
buildToolCallProviderMetadata?: (metadata: SharedV3ProviderMetadata_2 | undefined) => SharedV3ProviderMetadata_2 | undefined;
|
|
11206
|
+
}
|
|
11207
|
+
|
|
10735
11208
|
/**
|
|
10736
11209
|
* Generate a structured, typed object for a given prompt and schema using a language model.
|
|
10737
11210
|
*
|
|
@@ -12020,6 +12493,13 @@ export declare type ToolApprovalRequest = {
|
|
|
12020
12493
|
* Present only when `experimental_toolApprovalSecret` is configured.
|
|
12021
12494
|
*/
|
|
12022
12495
|
signature?: string;
|
|
12496
|
+
/**
|
|
12497
|
+
* Tool input before input schema validation and transformation.
|
|
12498
|
+
*
|
|
12499
|
+
* This is included when it differs from the validated tool input so that
|
|
12500
|
+
* approved tool calls can be safely revalidated before execution.
|
|
12501
|
+
*/
|
|
12502
|
+
inputSchemaInput?: unknown;
|
|
12023
12503
|
};
|
|
12024
12504
|
|
|
12025
12505
|
/**
|
|
@@ -12579,6 +13059,11 @@ declare type ToolResultOutput = {
|
|
|
12579
13059
|
* URL of the file.
|
|
12580
13060
|
*/
|
|
12581
13061
|
url: string;
|
|
13062
|
+
/**
|
|
13063
|
+
* IANA media type.
|
|
13064
|
+
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
13065
|
+
*/
|
|
13066
|
+
mediaType?: string;
|
|
12582
13067
|
/**
|
|
12583
13068
|
* Provider-specific options.
|
|
12584
13069
|
*/
|
|
@@ -14275,4 +14760,4 @@ export declare function zodSchema<OBJECT>(zodSchema: z4.core.$ZodType<OBJECT, an
|
|
|
14275
14760
|
|
|
14276
14761
|
export { }
|
|
14277
14762
|
export { GatewayProviderSettings as GatewayProviderSettings, GatewayProvider as GatewayProvider, AISDKError_2 as AISDKError_2, LazySchema as LazySchema, ZodSchema as ZodSchema, StandardSchema as StandardSchema, ValidationResult as ValidationResult, ParseResult as ParseResult, ProviderOptions as ProviderOptions, ReasoningPart as ReasoningPart, JSONValue_3 as JSONValue_3, ToolOutputProperties as ToolOutputProperties, JSONObject_2 as JSONObject_2, ToolResultOutput as ToolResultOutput, ToolNeedsApprovalFunction as ToolNeedsApprovalFunction, TypeValidationContext as TypeValidationContext, EmbeddingModelV2 as EmbeddingModelV2, EmbeddingModelV3Embedding as EmbeddingModelV3Embedding, EmbeddingModelV3Middleware as EmbeddingModelV3Middleware, ImageModelV2 as ImageModelV2, ImageModelV3ProviderMetadata as ImageModelV3ProviderMetadata, ImageModelV2ProviderMetadata as ImageModelV2ProviderMetadata, ImageModelV3Middleware as ImageModelV3Middleware, GlobalProviderModelId as GlobalProviderModelId, LanguageModelV2 as LanguageModelV2, SharedV3Warning as SharedV3Warning, LanguageModelV3Middleware as LanguageModelV3Middleware, SharedV3ProviderMetadata as SharedV3ProviderMetadata, SpeechModelV2 as SpeechModelV2, TranscriptionModelV2 as TranscriptionModelV2, ImageModelV3Usage as ImageModelV3Usage, DeepPartialInternal as DeepPartialInternal, AttributeValue as AttributeValue, Tracer as Tracer, BaseToolCall as BaseToolCall, Source as Source, PrepareStepCallSettings as PrepareStepCallSettings, ResponseMessage as ResponseMessage, LanguageModelV3ToolCall as LanguageModelV3ToolCall, GenerateTextIncludeSettings as GenerateTextIncludeSettings, ValueOf as ValueOf, asUITool as asUITool, _ai_sdk_provider_utils as _ai_sdk_provider_utils, DataUIMessageChunk as DataUIMessageChunk, InferElementOutput as InferElementOutput, ConsumeStreamOptions as ConsumeStreamOptions, StreamTextIncludeSettings as StreamTextIncludeSettings, StreamTextOnAbortCallback as StreamTextOnAbortCallback, CallbackModelInfo as CallbackModelInfo, LanguageModelV3ToolChoice as LanguageModelV3ToolChoice, Listener as Listener, MaybePromiseLike as MaybePromiseLike, Output_2 as Output_2, InferAgentTools as InferAgentTools, UIMessageStreamResponseInit as UIMessageStreamResponseInit, getOriginalFetch as getOriginalFetch, InferUIMessageTools as InferUIMessageTools, InferUIMessageToolCall as InferUIMessageToolCall, UIDataTypesToSchemas as UIDataTypesToSchemas, InferUIMessageData as InferUIMessageData, InferUIMessageMetadata as InferUIMessageMetadata, Resolvable as Resolvable, FetchFunction as FetchFunction, SingleRequestTextStreamPart as SingleRequestTextStreamPart, RetryErrorReason_2 as RetryErrorReason_2, GenerateImagePrompt as GenerateImagePrompt, JSONValue_2 as JSONValue_2, Job as Job, StreamObjectOnErrorCallback as StreamObjectOnErrorCallback, VideoModelResponseMetadata as VideoModelResponseMetadata, VideoModelProviderMetadata as VideoModelProviderMetadata, VideoModel as VideoModel, VideoModelV3FrameType as VideoModelV3FrameType, EmbeddingModelV3CallOptions as EmbeddingModelV3CallOptions, LanguageModelV3CallOptions as LanguageModelV3CallOptions, JSONObject as JSONObject, LanguageModelV3 as LanguageModelV3, EmbeddingModelV3 as EmbeddingModelV3, ImageModelV3 as ImageModelV3, TranscriptionModelV3 as TranscriptionModelV3, SpeechModelV3 as SpeechModelV3, RerankingModelV3 as RerankingModelV3, VideoModelV3 as VideoModelV3, ProviderV2 as ProviderV2, ExtractModelId as ExtractModelId, ExtractLiteralUnion as ExtractLiteralUnion, ProviderV3 as ProviderV3 };
|
|
14278
|
-
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$f, symbol$g, symbol$h, symbol$i, symbol$j, symbol$k, symbol, symbol_2, symbol_3 };
|
|
14763
|
+
export { EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL, EMBEDDING_MODEL_PROVIDER_OPTIONS_TRANSFORMER, 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$f, symbol$g, symbol$h, symbol$i, symbol$j, symbol$k, symbol, symbol_2, symbol_3 };
|