@ai-sdk/provider 4.0.8 → 4.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/index.d.ts +225 -3
- package/package.json +1 -1
- package/src/files/v4/files-v4-delete-file-call-options.ts +30 -0
- package/src/files/v4/files-v4-delete-file-result.ts +32 -0
- package/src/files/v4/files-v4-download-file-call-options.ts +30 -0
- package/src/files/v4/files-v4-download-file-result.ts +30 -0
- package/src/files/v4/files-v4-get-file-metadata-call-options.ts +30 -0
- package/src/files/v4/files-v4-get-file-metadata-result.ts +53 -0
- package/src/files/v4/files-v4-upload-file-call-options.ts +26 -1
- package/src/files/v4/files-v4-upload-file-result.ts +18 -0
- package/src/files/v4/files-v4.ts +34 -0
- package/src/files/v4/index.ts +10 -1
- package/src/language-model/v4/language-model-v4-batch.ts +3 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @ai-sdk/provider
|
|
2
2
|
|
|
3
|
+
## 4.0.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 5190b67: feat(provider): extend the FilesV4 interface with optional `getFileMetadata`, `downloadFile` (streaming), and `deleteFile` operations, plus `abortSignal`/`headers` call options and a `{ type: 'stream' }` upload data variant; upload results now expose `byteSize`, `createdAt`, and `expiresAt` (also surfaced by the core `uploadFile()` helper, which now forwards `abortSignal`/`headers`); add `postMultipartStreamToApi` (streaming multipart uploads with deterministic part ordering and failure-path stream teardown), `deleteFromApi`, and `createBinaryStreamResponseHandler` to provider-utils
|
|
8
|
+
|
|
9
|
+
## 4.0.9
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- aa45741: fix(provider/anthropic): preserve native message batch request counts in provider metadata and support the full language-model option surface in batch requests
|
|
14
|
+
|
|
3
15
|
## 4.0.8
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -994,6 +994,183 @@ declare class UnsupportedFunctionalityError extends AISDKError {
|
|
|
994
994
|
static isInstance(error: unknown): error is UnsupportedFunctionalityError;
|
|
995
995
|
}
|
|
996
996
|
|
|
997
|
+
/**
|
|
998
|
+
* Options for deleting a file via the files interface.
|
|
999
|
+
*/
|
|
1000
|
+
type FilesV4DeleteFileCallOptions = {
|
|
1001
|
+
/**
|
|
1002
|
+
* The provider reference of the file, as returned by `uploadFile`.
|
|
1003
|
+
*/
|
|
1004
|
+
file: SharedV4ProviderReference;
|
|
1005
|
+
/**
|
|
1006
|
+
* Abort signal for cancelling the operation.
|
|
1007
|
+
*/
|
|
1008
|
+
abortSignal?: AbortSignal;
|
|
1009
|
+
/**
|
|
1010
|
+
* Additional HTTP headers to be sent with the request.
|
|
1011
|
+
* Only applicable for HTTP-based providers.
|
|
1012
|
+
*/
|
|
1013
|
+
headers?: Record<string, string | undefined>;
|
|
1014
|
+
/**
|
|
1015
|
+
* Additional provider-specific options. They are passed through
|
|
1016
|
+
* to the provider from the AI SDK and enable provider-specific
|
|
1017
|
+
* functionality that can be fully encapsulated in the provider.
|
|
1018
|
+
*/
|
|
1019
|
+
providerOptions?: SharedV4ProviderOptions;
|
|
1020
|
+
};
|
|
1021
|
+
|
|
1022
|
+
/**
|
|
1023
|
+
* Result of deleting a file via the files interface.
|
|
1024
|
+
*/
|
|
1025
|
+
type FilesV4DeleteFileResult = {
|
|
1026
|
+
/**
|
|
1027
|
+
* A provider reference mapping provider names to provider-specific file identifiers.
|
|
1028
|
+
* Contains only the operated provider's entry — when working with a merged
|
|
1029
|
+
* multi-provider reference, do not reassign it with this result.
|
|
1030
|
+
*/
|
|
1031
|
+
providerReference: SharedV4ProviderReference;
|
|
1032
|
+
/**
|
|
1033
|
+
* Whether the provider confirmed the deletion.
|
|
1034
|
+
*/
|
|
1035
|
+
deleted: boolean;
|
|
1036
|
+
/**
|
|
1037
|
+
* Additional provider-specific metadata. They are passed through
|
|
1038
|
+
* to the provider from the AI SDK and enable provider-specific
|
|
1039
|
+
* functionality that can be fully encapsulated in the provider.
|
|
1040
|
+
*/
|
|
1041
|
+
providerMetadata?: SharedV4ProviderMetadata;
|
|
1042
|
+
/**
|
|
1043
|
+
* Warnings from the provider.
|
|
1044
|
+
*/
|
|
1045
|
+
warnings: Array<SharedV4Warning>;
|
|
1046
|
+
};
|
|
1047
|
+
|
|
1048
|
+
/**
|
|
1049
|
+
* Options for downloading file content via the files interface.
|
|
1050
|
+
*/
|
|
1051
|
+
type FilesV4DownloadFileCallOptions = {
|
|
1052
|
+
/**
|
|
1053
|
+
* The provider reference of the file, as returned by `uploadFile`.
|
|
1054
|
+
*/
|
|
1055
|
+
file: SharedV4ProviderReference;
|
|
1056
|
+
/**
|
|
1057
|
+
* Abort signal for cancelling the operation.
|
|
1058
|
+
*/
|
|
1059
|
+
abortSignal?: AbortSignal;
|
|
1060
|
+
/**
|
|
1061
|
+
* Additional HTTP headers to be sent with the request.
|
|
1062
|
+
* Only applicable for HTTP-based providers.
|
|
1063
|
+
*/
|
|
1064
|
+
headers?: Record<string, string | undefined>;
|
|
1065
|
+
/**
|
|
1066
|
+
* Additional provider-specific options. They are passed through
|
|
1067
|
+
* to the provider from the AI SDK and enable provider-specific
|
|
1068
|
+
* functionality that can be fully encapsulated in the provider.
|
|
1069
|
+
*/
|
|
1070
|
+
providerOptions?: SharedV4ProviderOptions;
|
|
1071
|
+
};
|
|
1072
|
+
|
|
1073
|
+
/**
|
|
1074
|
+
* Result of downloading file content via the files interface.
|
|
1075
|
+
*/
|
|
1076
|
+
type FilesV4DownloadFileResult = {
|
|
1077
|
+
/**
|
|
1078
|
+
* The file content as a byte stream.
|
|
1079
|
+
* The consumer is responsible for draining or cancelling the stream.
|
|
1080
|
+
*/
|
|
1081
|
+
content: ReadableStream<Uint8Array>;
|
|
1082
|
+
/**
|
|
1083
|
+
* The IANA media type of the file, if available from the provider.
|
|
1084
|
+
*/
|
|
1085
|
+
mediaType?: string;
|
|
1086
|
+
/**
|
|
1087
|
+
* Additional provider-specific metadata. They are passed through
|
|
1088
|
+
* to the provider from the AI SDK and enable provider-specific
|
|
1089
|
+
* functionality that can be fully encapsulated in the provider.
|
|
1090
|
+
*/
|
|
1091
|
+
providerMetadata?: SharedV4ProviderMetadata;
|
|
1092
|
+
/**
|
|
1093
|
+
* Warnings from the provider.
|
|
1094
|
+
*/
|
|
1095
|
+
warnings: Array<SharedV4Warning>;
|
|
1096
|
+
};
|
|
1097
|
+
|
|
1098
|
+
/**
|
|
1099
|
+
* Options for retrieving file metadata via the files interface.
|
|
1100
|
+
*/
|
|
1101
|
+
type FilesV4GetFileMetadataCallOptions = {
|
|
1102
|
+
/**
|
|
1103
|
+
* The provider reference of the file, as returned by `uploadFile`.
|
|
1104
|
+
*/
|
|
1105
|
+
file: SharedV4ProviderReference;
|
|
1106
|
+
/**
|
|
1107
|
+
* Abort signal for cancelling the operation.
|
|
1108
|
+
*/
|
|
1109
|
+
abortSignal?: AbortSignal;
|
|
1110
|
+
/**
|
|
1111
|
+
* Additional HTTP headers to be sent with the request.
|
|
1112
|
+
* Only applicable for HTTP-based providers.
|
|
1113
|
+
*/
|
|
1114
|
+
headers?: Record<string, string | undefined>;
|
|
1115
|
+
/**
|
|
1116
|
+
* Additional provider-specific options. They are passed through
|
|
1117
|
+
* to the provider from the AI SDK and enable provider-specific
|
|
1118
|
+
* functionality that can be fully encapsulated in the provider.
|
|
1119
|
+
*/
|
|
1120
|
+
providerOptions?: SharedV4ProviderOptions;
|
|
1121
|
+
};
|
|
1122
|
+
|
|
1123
|
+
/**
|
|
1124
|
+
* Result of retrieving file metadata via the files interface.
|
|
1125
|
+
*/
|
|
1126
|
+
type FilesV4GetFileMetadataResult = {
|
|
1127
|
+
/**
|
|
1128
|
+
* A provider reference mapping provider names to provider-specific file identifiers.
|
|
1129
|
+
* Contains only the operated provider's entry — when working with a merged
|
|
1130
|
+
* multi-provider reference, do not reassign it with this result.
|
|
1131
|
+
*/
|
|
1132
|
+
providerReference: SharedV4ProviderReference;
|
|
1133
|
+
/**
|
|
1134
|
+
* The filename of the file, if available from the provider.
|
|
1135
|
+
*/
|
|
1136
|
+
filename?: string;
|
|
1137
|
+
/**
|
|
1138
|
+
* The IANA media type of the file, if available from the provider.
|
|
1139
|
+
*/
|
|
1140
|
+
mediaType?: string;
|
|
1141
|
+
/**
|
|
1142
|
+
* The size of the file in bytes, if available from the provider.
|
|
1143
|
+
*/
|
|
1144
|
+
byteSize?: number;
|
|
1145
|
+
/**
|
|
1146
|
+
* When the file was created, if available from the provider.
|
|
1147
|
+
*/
|
|
1148
|
+
createdAt?: Date;
|
|
1149
|
+
/**
|
|
1150
|
+
* When the provider will delete the file (retention expiry),
|
|
1151
|
+
* if available from the provider.
|
|
1152
|
+
*/
|
|
1153
|
+
expiresAt?: Date;
|
|
1154
|
+
/**
|
|
1155
|
+
* Additional provider-specific metadata. They are passed through
|
|
1156
|
+
* to the provider from the AI SDK and enable provider-specific
|
|
1157
|
+
* functionality that can be fully encapsulated in the provider.
|
|
1158
|
+
*/
|
|
1159
|
+
providerMetadata?: SharedV4ProviderMetadata;
|
|
1160
|
+
/**
|
|
1161
|
+
* Warnings from the provider.
|
|
1162
|
+
*/
|
|
1163
|
+
warnings: Array<SharedV4Warning>;
|
|
1164
|
+
};
|
|
1165
|
+
|
|
1166
|
+
/**
|
|
1167
|
+
* File data variant containing a byte stream. Providers that support
|
|
1168
|
+
* streaming uploads send it without buffering the full file in memory.
|
|
1169
|
+
*/
|
|
1170
|
+
interface FilesV4UploadFileStreamData {
|
|
1171
|
+
type: 'stream';
|
|
1172
|
+
stream: ReadableStream<Uint8Array>;
|
|
1173
|
+
}
|
|
997
1174
|
/**
|
|
998
1175
|
* Options for uploading a file via the files interface.
|
|
999
1176
|
*/
|
|
@@ -1003,8 +1180,10 @@ type FilesV4UploadFileCallOptions = {
|
|
|
1003
1180
|
*
|
|
1004
1181
|
* - `{ type: 'data', data }`: raw bytes (`Uint8Array`) or a base64-encoded string.
|
|
1005
1182
|
* - `{ type: 'text', text }`: inline text (UTF-8).
|
|
1183
|
+
* - `{ type: 'stream', stream }`: a byte stream (not buffered by providers
|
|
1184
|
+
* that support streaming uploads).
|
|
1006
1185
|
*/
|
|
1007
|
-
data: SharedV4FileDataData | SharedV4FileDataText;
|
|
1186
|
+
data: SharedV4FileDataData | SharedV4FileDataText | FilesV4UploadFileStreamData;
|
|
1008
1187
|
/**
|
|
1009
1188
|
* The IANA media type of the file (e.g. `'application/pdf'`).
|
|
1010
1189
|
*/
|
|
@@ -1013,6 +1192,15 @@ type FilesV4UploadFileCallOptions = {
|
|
|
1013
1192
|
* The filename of the file.
|
|
1014
1193
|
*/
|
|
1015
1194
|
filename?: string;
|
|
1195
|
+
/**
|
|
1196
|
+
* Abort signal for cancelling the operation.
|
|
1197
|
+
*/
|
|
1198
|
+
abortSignal?: AbortSignal;
|
|
1199
|
+
/**
|
|
1200
|
+
* Additional HTTP headers to be sent with the request.
|
|
1201
|
+
* Only applicable for HTTP-based providers.
|
|
1202
|
+
*/
|
|
1203
|
+
headers?: Record<string, string | undefined>;
|
|
1016
1204
|
/**
|
|
1017
1205
|
* Additional provider-specific options. They are passed through
|
|
1018
1206
|
* to the provider from the AI SDK and enable provider-specific
|
|
@@ -1027,6 +1215,8 @@ type FilesV4UploadFileCallOptions = {
|
|
|
1027
1215
|
type FilesV4UploadFileResult = {
|
|
1028
1216
|
/**
|
|
1029
1217
|
* A provider reference mapping provider names to provider-specific file identifiers.
|
|
1218
|
+
* The key is the canonical provider name (e.g. `openai`) and may differ from
|
|
1219
|
+
* the interface's `provider` id (e.g. `openai.files`).
|
|
1030
1220
|
*/
|
|
1031
1221
|
providerReference: SharedV4ProviderReference;
|
|
1032
1222
|
/**
|
|
@@ -1037,6 +1227,19 @@ type FilesV4UploadFileResult = {
|
|
|
1037
1227
|
* The filename of the uploaded file, if available from the provider.
|
|
1038
1228
|
*/
|
|
1039
1229
|
filename?: string;
|
|
1230
|
+
/**
|
|
1231
|
+
* The size of the uploaded file in bytes, if available from the provider.
|
|
1232
|
+
*/
|
|
1233
|
+
byteSize?: number;
|
|
1234
|
+
/**
|
|
1235
|
+
* When the file was created, if available from the provider.
|
|
1236
|
+
*/
|
|
1237
|
+
createdAt?: Date;
|
|
1238
|
+
/**
|
|
1239
|
+
* When the provider will delete the file (retention expiry, e.g. from a
|
|
1240
|
+
* requested upload TTL), if available from the provider.
|
|
1241
|
+
*/
|
|
1242
|
+
expiresAt?: Date;
|
|
1040
1243
|
/**
|
|
1041
1244
|
* Additional provider-specific metadata. They are passed through
|
|
1042
1245
|
* to the provider from the AI SDK and enable provider-specific
|
|
@@ -1051,6 +1254,10 @@ type FilesV4UploadFileResult = {
|
|
|
1051
1254
|
|
|
1052
1255
|
/**
|
|
1053
1256
|
* Specification for a file management interface that implements the files interface version 4.
|
|
1257
|
+
*
|
|
1258
|
+
* Only `uploadFile` is required. The other operations are optional
|
|
1259
|
+
* capabilities: their presence signals that the provider supports them
|
|
1260
|
+
* (mirroring the optional-method pattern of `VideoModelV4`).
|
|
1054
1261
|
*/
|
|
1055
1262
|
type FilesV4 = {
|
|
1056
1263
|
/**
|
|
@@ -1066,6 +1273,21 @@ type FilesV4 = {
|
|
|
1066
1273
|
* that can be used in subsequent API calls.
|
|
1067
1274
|
*/
|
|
1068
1275
|
uploadFile(options: FilesV4UploadFileCallOptions): PromiseLike<FilesV4UploadFileResult>;
|
|
1276
|
+
/**
|
|
1277
|
+
* Retrieves metadata for a previously uploaded file.
|
|
1278
|
+
* Optional: presence signals that the provider supports metadata reads.
|
|
1279
|
+
*/
|
|
1280
|
+
getFileMetadata?(options: FilesV4GetFileMetadataCallOptions): PromiseLike<FilesV4GetFileMetadataResult>;
|
|
1281
|
+
/**
|
|
1282
|
+
* Downloads the content of a previously uploaded file as a byte stream.
|
|
1283
|
+
* Optional: presence signals that the provider supports content download.
|
|
1284
|
+
*/
|
|
1285
|
+
downloadFile?(options: FilesV4DownloadFileCallOptions): PromiseLike<FilesV4DownloadFileResult>;
|
|
1286
|
+
/**
|
|
1287
|
+
* Deletes a previously uploaded file.
|
|
1288
|
+
* Optional: presence signals that the provider supports deletion.
|
|
1289
|
+
*/
|
|
1290
|
+
deleteFile?(options: FilesV4DeleteFileCallOptions): PromiseLike<FilesV4DeleteFileResult>;
|
|
1069
1291
|
};
|
|
1070
1292
|
|
|
1071
1293
|
/**
|
|
@@ -4954,7 +5176,7 @@ type LanguageModelV4BatchRequest = {
|
|
|
4954
5176
|
/**
|
|
4955
5177
|
* Normalized text-generation options for the request.
|
|
4956
5178
|
*/
|
|
4957
|
-
readonly options: Pick<LanguageModelV4CallOptions, 'prompt' | 'maxOutputTokens' | 'temperature' | 'stopSequences' | 'topP' | 'topK' | 'presencePenalty' | 'frequencyPenalty' | 'seed' | 'reasoning' | 'providerOptions'>;
|
|
5179
|
+
readonly options: Pick<LanguageModelV4CallOptions, 'prompt' | 'maxOutputTokens' | 'temperature' | 'stopSequences' | 'topP' | 'topK' | 'presencePenalty' | 'frequencyPenalty' | 'seed' | 'reasoning' | 'responseFormat' | 'toolChoice' | 'tools' | 'providerOptions'>;
|
|
4958
5180
|
};
|
|
4959
5181
|
/**
|
|
4960
5182
|
* Language model V4 with durable batch-processing support.
|
|
@@ -7948,4 +8170,4 @@ type VideoModelV3 = {
|
|
|
7948
8170
|
}>;
|
|
7949
8171
|
};
|
|
7950
8172
|
|
|
7951
|
-
export { AISDKError, APICallError, type EmbeddingModelV2, type EmbeddingModelV2Embedding, type EmbeddingModelV3, type EmbeddingModelV3CallOptions, type EmbeddingModelV3Embedding, type EmbeddingModelV3Middleware, type EmbeddingModelV3Result, type EmbeddingModelV4, type EmbeddingModelV4CallOptions, type EmbeddingModelV4Embedding, type EmbeddingModelV4Middleware, type EmbeddingModelV4Result, EmptyResponseBodyError, type BatchLanguageModelV4 as Experimental_BatchLanguageModelV4, type BatchModelV4 as Experimental_BatchModelV4, type BatchV4Error as Experimental_BatchV4Error, type BatchV4ItemResult as Experimental_BatchV4ItemResult, type BatchV4OperationOptions as Experimental_BatchV4OperationOptions, type BatchV4StartOptions as Experimental_BatchV4StartOptions, type BatchV4StartResult as Experimental_BatchV4StartResult, type BatchV4Status as Experimental_BatchV4Status, type LanguageModelV4BatchRequest as Experimental_LanguageModelV4BatchRequest, type RealtimeFactoryV4 as Experimental_RealtimeFactoryV4, type RealtimeFactoryV4GetTokenOptions as Experimental_RealtimeFactoryV4GetTokenOptions, type RealtimeFactoryV4GetTokenResult as Experimental_RealtimeFactoryV4GetTokenResult, type RealtimeModelV4 as Experimental_RealtimeModelV4, type RealtimeModelV4AudioMessage as Experimental_RealtimeModelV4AudioMessage, type RealtimeModelV4ClientEvent as Experimental_RealtimeModelV4ClientEvent, type RealtimeModelV4ClientSecretOptions as Experimental_RealtimeModelV4ClientSecretOptions, type RealtimeModelV4ClientSecretResult as Experimental_RealtimeModelV4ClientSecretResult, type RealtimeModelV4ConversationItem as Experimental_RealtimeModelV4ConversationItem, type RealtimeModelV4FunctionCallOutput as Experimental_RealtimeModelV4FunctionCallOutput, type RealtimeModelV4ServerEvent as Experimental_RealtimeModelV4ServerEvent, type RealtimeModelV4SessionConfig as Experimental_RealtimeModelV4SessionConfig, type RealtimeModelV4TextMessage as Experimental_RealtimeModelV4TextMessage, type RealtimeModelV4ToolDefinition as Experimental_RealtimeModelV4ToolDefinition, type SpeechTranslationModelV4 as Experimental_SpeechTranslationModelV4, type SpeechTranslationModelV4StreamOptions as Experimental_SpeechTranslationModelV4StreamOptions, type SpeechTranslationModelV4StreamPart as Experimental_SpeechTranslationModelV4StreamPart, type SpeechTranslationModelV4StreamResult as Experimental_SpeechTranslationModelV4StreamResult, type SpeechTranslationModelV4Usage as Experimental_SpeechTranslationModelV4Usage, type TranscriptionModelV4StreamOptions as Experimental_TranscriptionModelV4StreamOptions, type TranscriptionModelV4StreamPart as Experimental_TranscriptionModelV4StreamPart, type TranscriptionModelV4StreamResult as Experimental_TranscriptionModelV4StreamResult, type VideoModelV3 as Experimental_VideoModelV3, type VideoModelV3CallOptions as Experimental_VideoModelV3CallOptions, type VideoModelV3File as Experimental_VideoModelV3File, type VideoModelV3FrameImage as Experimental_VideoModelV3FrameImage, type VideoModelV3FrameType as Experimental_VideoModelV3FrameType, type VideoModelV3VideoData as Experimental_VideoModelV3VideoData, type VideoModelV4 as Experimental_VideoModelV4, type VideoModelV4CallOptions as Experimental_VideoModelV4CallOptions, type VideoModelV4File as Experimental_VideoModelV4File, type VideoModelV4FrameImage as Experimental_VideoModelV4FrameImage, type VideoModelV4FrameType as Experimental_VideoModelV4FrameType, type VideoModelV4OperationStartResult as Experimental_VideoModelV4OperationStartResult, type VideoModelV4OperationStatusResult as Experimental_VideoModelV4OperationStatusResult, type VideoModelV4OperationWebhook as Experimental_VideoModelV4OperationWebhook, type VideoModelV4Result as Experimental_VideoModelV4Result, type VideoModelV4VideoData as Experimental_VideoModelV4VideoData, type FilesV4, type FilesV4UploadFileCallOptions, type FilesV4UploadFileResult, type ImageModelV2, type ImageModelV2CallOptions, type ImageModelV2CallWarning, type ImageModelV2ProviderMetadata, type ImageModelV3, type ImageModelV3CallOptions, type ImageModelV3File, type ImageModelV3Middleware, type ImageModelV3ProviderMetadata, type ImageModelV3Usage, type ImageModelV4, type ImageModelV4CallOptions, type ImageModelV4File, type ImageModelV4Middleware, type ImageModelV4ProviderMetadata, type ImageModelV4Result, type ImageModelV4Usage, InvalidArgumentError, InvalidPromptError, InvalidResponseDataError, type JSONArray, type JSONObject, JSONParseError, type JSONValue, type LanguageModelV2, type LanguageModelV2CallOptions, type LanguageModelV2CallWarning, type LanguageModelV2Content, type LanguageModelV2DataContent, type LanguageModelV2File, type LanguageModelV2FilePart, type LanguageModelV2FinishReason, type LanguageModelV2FunctionTool, type LanguageModelV2Message, type LanguageModelV2Middleware, type LanguageModelV2Prompt, type LanguageModelV2ProviderDefinedTool, type LanguageModelV2Reasoning, type LanguageModelV2ReasoningPart, type LanguageModelV2ResponseMetadata, type LanguageModelV2Source, type LanguageModelV2StreamPart, type LanguageModelV2Text, type LanguageModelV2TextPart, type LanguageModelV2ToolCall, type LanguageModelV2ToolCallPart, type LanguageModelV2ToolChoice, type LanguageModelV2ToolResultOutput, type LanguageModelV2ToolResultPart, type LanguageModelV2Usage, type LanguageModelV3, type LanguageModelV3CallOptions, type LanguageModelV3Content, type LanguageModelV3DataContent, type LanguageModelV3File, type LanguageModelV3FilePart, type LanguageModelV3FinishReason, type LanguageModelV3FunctionTool, type LanguageModelV3GenerateResult, type LanguageModelV3Message, type LanguageModelV3Middleware, type LanguageModelV3Prompt, type LanguageModelV3ProviderTool, type LanguageModelV3Reasoning, type LanguageModelV3ReasoningPart, type LanguageModelV3ResponseMetadata, type LanguageModelV3Source, type LanguageModelV3StreamPart, type LanguageModelV3StreamResult, type LanguageModelV3Text, type LanguageModelV3TextPart, type LanguageModelV3ToolApprovalRequest, type LanguageModelV3ToolApprovalResponsePart, type LanguageModelV3ToolCall, type LanguageModelV3ToolCallPart, type LanguageModelV3ToolChoice, type LanguageModelV3ToolResult, type LanguageModelV3ToolResultOutput, type LanguageModelV3ToolResultPart, type LanguageModelV3Usage, type LanguageModelV4, type LanguageModelV4CallOptions, type LanguageModelV4Content, type LanguageModelV4CustomContent, type LanguageModelV4CustomPart, type LanguageModelV4File, type LanguageModelV4FilePart, type LanguageModelV4FinishReason, type LanguageModelV4FunctionTool, type LanguageModelV4GenerateResult, type LanguageModelV4Message, type LanguageModelV4Middleware, type LanguageModelV4Prompt, type LanguageModelV4ProviderTool, type LanguageModelV4Reasoning, type LanguageModelV4ReasoningFile, type LanguageModelV4ReasoningFilePart, type LanguageModelV4ReasoningPart, type LanguageModelV4ResponseMetadata, type LanguageModelV4Source, type LanguageModelV4StreamPart, type LanguageModelV4StreamResult, type LanguageModelV4Text, type LanguageModelV4TextPart, type LanguageModelV4ToolApprovalRequest, type LanguageModelV4ToolApprovalResponsePart, type LanguageModelV4ToolCall, type LanguageModelV4ToolCallPart, type LanguageModelV4ToolChoice, type LanguageModelV4ToolResult, type LanguageModelV4ToolResultOutput, type LanguageModelV4ToolResultPart, type LanguageModelV4Usage, LoadAPIKeyError, LoadSettingError, NoContentGeneratedError, NoSuchModelError, NoSuchProviderReferenceError, type ProviderV2, type ProviderV3, type ProviderV4, type RerankingModelV3, type RerankingModelV3CallOptions, type RerankingModelV4, type RerankingModelV4CallOptions, type RerankingModelV4Result, type SharedV2Headers, type SharedV2ProviderMetadata, type SharedV2ProviderOptions, type SharedV3Headers, type SharedV3ProviderMetadata, type SharedV3ProviderOptions, type SharedV3Warning, type SharedV4AudioFormat, type SharedV4FileData, type SharedV4FileDataData, type SharedV4FileDataReference, type SharedV4FileDataText, type SharedV4FileDataUrl, type SharedV4Headers, type SharedV4ProviderMetadata, type SharedV4ProviderOptions, type SharedV4ProviderReference, type SharedV4Warning, type SkillsV4, type SkillsV4File, type SkillsV4UploadSkillCallOptions, type SkillsV4UploadSkillResult, type SpeechModelV2, type SpeechModelV2CallOptions, type SpeechModelV2CallWarning, type SpeechModelV3, type SpeechModelV3CallOptions, type SpeechModelV4, type SpeechModelV4CallOptions, type SpeechModelV4Result, TooManyEmbeddingValuesForCallError, type TranscriptionModelV2, type TranscriptionModelV2CallOptions, type TranscriptionModelV2CallWarning, type TranscriptionModelV3, type TranscriptionModelV3CallOptions, type TranscriptionModelV4, type TranscriptionModelV4CallOptions, type TranscriptionModelV4Result, type TypeValidationContext, TypeValidationError, UnsupportedFunctionalityError, getErrorMessage, isJSONArray, isJSONObject, isJSONValue };
|
|
8173
|
+
export { AISDKError, APICallError, type EmbeddingModelV2, type EmbeddingModelV2Embedding, type EmbeddingModelV3, type EmbeddingModelV3CallOptions, type EmbeddingModelV3Embedding, type EmbeddingModelV3Middleware, type EmbeddingModelV3Result, type EmbeddingModelV4, type EmbeddingModelV4CallOptions, type EmbeddingModelV4Embedding, type EmbeddingModelV4Middleware, type EmbeddingModelV4Result, EmptyResponseBodyError, type BatchLanguageModelV4 as Experimental_BatchLanguageModelV4, type BatchModelV4 as Experimental_BatchModelV4, type BatchV4Error as Experimental_BatchV4Error, type BatchV4ItemResult as Experimental_BatchV4ItemResult, type BatchV4OperationOptions as Experimental_BatchV4OperationOptions, type BatchV4StartOptions as Experimental_BatchV4StartOptions, type BatchV4StartResult as Experimental_BatchV4StartResult, type BatchV4Status as Experimental_BatchV4Status, type LanguageModelV4BatchRequest as Experimental_LanguageModelV4BatchRequest, type RealtimeFactoryV4 as Experimental_RealtimeFactoryV4, type RealtimeFactoryV4GetTokenOptions as Experimental_RealtimeFactoryV4GetTokenOptions, type RealtimeFactoryV4GetTokenResult as Experimental_RealtimeFactoryV4GetTokenResult, type RealtimeModelV4 as Experimental_RealtimeModelV4, type RealtimeModelV4AudioMessage as Experimental_RealtimeModelV4AudioMessage, type RealtimeModelV4ClientEvent as Experimental_RealtimeModelV4ClientEvent, type RealtimeModelV4ClientSecretOptions as Experimental_RealtimeModelV4ClientSecretOptions, type RealtimeModelV4ClientSecretResult as Experimental_RealtimeModelV4ClientSecretResult, type RealtimeModelV4ConversationItem as Experimental_RealtimeModelV4ConversationItem, type RealtimeModelV4FunctionCallOutput as Experimental_RealtimeModelV4FunctionCallOutput, type RealtimeModelV4ServerEvent as Experimental_RealtimeModelV4ServerEvent, type RealtimeModelV4SessionConfig as Experimental_RealtimeModelV4SessionConfig, type RealtimeModelV4TextMessage as Experimental_RealtimeModelV4TextMessage, type RealtimeModelV4ToolDefinition as Experimental_RealtimeModelV4ToolDefinition, type SpeechTranslationModelV4 as Experimental_SpeechTranslationModelV4, type SpeechTranslationModelV4StreamOptions as Experimental_SpeechTranslationModelV4StreamOptions, type SpeechTranslationModelV4StreamPart as Experimental_SpeechTranslationModelV4StreamPart, type SpeechTranslationModelV4StreamResult as Experimental_SpeechTranslationModelV4StreamResult, type SpeechTranslationModelV4Usage as Experimental_SpeechTranslationModelV4Usage, type TranscriptionModelV4StreamOptions as Experimental_TranscriptionModelV4StreamOptions, type TranscriptionModelV4StreamPart as Experimental_TranscriptionModelV4StreamPart, type TranscriptionModelV4StreamResult as Experimental_TranscriptionModelV4StreamResult, type VideoModelV3 as Experimental_VideoModelV3, type VideoModelV3CallOptions as Experimental_VideoModelV3CallOptions, type VideoModelV3File as Experimental_VideoModelV3File, type VideoModelV3FrameImage as Experimental_VideoModelV3FrameImage, type VideoModelV3FrameType as Experimental_VideoModelV3FrameType, type VideoModelV3VideoData as Experimental_VideoModelV3VideoData, type VideoModelV4 as Experimental_VideoModelV4, type VideoModelV4CallOptions as Experimental_VideoModelV4CallOptions, type VideoModelV4File as Experimental_VideoModelV4File, type VideoModelV4FrameImage as Experimental_VideoModelV4FrameImage, type VideoModelV4FrameType as Experimental_VideoModelV4FrameType, type VideoModelV4OperationStartResult as Experimental_VideoModelV4OperationStartResult, type VideoModelV4OperationStatusResult as Experimental_VideoModelV4OperationStatusResult, type VideoModelV4OperationWebhook as Experimental_VideoModelV4OperationWebhook, type VideoModelV4Result as Experimental_VideoModelV4Result, type VideoModelV4VideoData as Experimental_VideoModelV4VideoData, type FilesV4, type FilesV4DeleteFileCallOptions, type FilesV4DeleteFileResult, type FilesV4DownloadFileCallOptions, type FilesV4DownloadFileResult, type FilesV4GetFileMetadataCallOptions, type FilesV4GetFileMetadataResult, type FilesV4UploadFileCallOptions, type FilesV4UploadFileResult, type FilesV4UploadFileStreamData, type ImageModelV2, type ImageModelV2CallOptions, type ImageModelV2CallWarning, type ImageModelV2ProviderMetadata, type ImageModelV3, type ImageModelV3CallOptions, type ImageModelV3File, type ImageModelV3Middleware, type ImageModelV3ProviderMetadata, type ImageModelV3Usage, type ImageModelV4, type ImageModelV4CallOptions, type ImageModelV4File, type ImageModelV4Middleware, type ImageModelV4ProviderMetadata, type ImageModelV4Result, type ImageModelV4Usage, InvalidArgumentError, InvalidPromptError, InvalidResponseDataError, type JSONArray, type JSONObject, JSONParseError, type JSONValue, type LanguageModelV2, type LanguageModelV2CallOptions, type LanguageModelV2CallWarning, type LanguageModelV2Content, type LanguageModelV2DataContent, type LanguageModelV2File, type LanguageModelV2FilePart, type LanguageModelV2FinishReason, type LanguageModelV2FunctionTool, type LanguageModelV2Message, type LanguageModelV2Middleware, type LanguageModelV2Prompt, type LanguageModelV2ProviderDefinedTool, type LanguageModelV2Reasoning, type LanguageModelV2ReasoningPart, type LanguageModelV2ResponseMetadata, type LanguageModelV2Source, type LanguageModelV2StreamPart, type LanguageModelV2Text, type LanguageModelV2TextPart, type LanguageModelV2ToolCall, type LanguageModelV2ToolCallPart, type LanguageModelV2ToolChoice, type LanguageModelV2ToolResultOutput, type LanguageModelV2ToolResultPart, type LanguageModelV2Usage, type LanguageModelV3, type LanguageModelV3CallOptions, type LanguageModelV3Content, type LanguageModelV3DataContent, type LanguageModelV3File, type LanguageModelV3FilePart, type LanguageModelV3FinishReason, type LanguageModelV3FunctionTool, type LanguageModelV3GenerateResult, type LanguageModelV3Message, type LanguageModelV3Middleware, type LanguageModelV3Prompt, type LanguageModelV3ProviderTool, type LanguageModelV3Reasoning, type LanguageModelV3ReasoningPart, type LanguageModelV3ResponseMetadata, type LanguageModelV3Source, type LanguageModelV3StreamPart, type LanguageModelV3StreamResult, type LanguageModelV3Text, type LanguageModelV3TextPart, type LanguageModelV3ToolApprovalRequest, type LanguageModelV3ToolApprovalResponsePart, type LanguageModelV3ToolCall, type LanguageModelV3ToolCallPart, type LanguageModelV3ToolChoice, type LanguageModelV3ToolResult, type LanguageModelV3ToolResultOutput, type LanguageModelV3ToolResultPart, type LanguageModelV3Usage, type LanguageModelV4, type LanguageModelV4CallOptions, type LanguageModelV4Content, type LanguageModelV4CustomContent, type LanguageModelV4CustomPart, type LanguageModelV4File, type LanguageModelV4FilePart, type LanguageModelV4FinishReason, type LanguageModelV4FunctionTool, type LanguageModelV4GenerateResult, type LanguageModelV4Message, type LanguageModelV4Middleware, type LanguageModelV4Prompt, type LanguageModelV4ProviderTool, type LanguageModelV4Reasoning, type LanguageModelV4ReasoningFile, type LanguageModelV4ReasoningFilePart, type LanguageModelV4ReasoningPart, type LanguageModelV4ResponseMetadata, type LanguageModelV4Source, type LanguageModelV4StreamPart, type LanguageModelV4StreamResult, type LanguageModelV4Text, type LanguageModelV4TextPart, type LanguageModelV4ToolApprovalRequest, type LanguageModelV4ToolApprovalResponsePart, type LanguageModelV4ToolCall, type LanguageModelV4ToolCallPart, type LanguageModelV4ToolChoice, type LanguageModelV4ToolResult, type LanguageModelV4ToolResultOutput, type LanguageModelV4ToolResultPart, type LanguageModelV4Usage, LoadAPIKeyError, LoadSettingError, NoContentGeneratedError, NoSuchModelError, NoSuchProviderReferenceError, type ProviderV2, type ProviderV3, type ProviderV4, type RerankingModelV3, type RerankingModelV3CallOptions, type RerankingModelV4, type RerankingModelV4CallOptions, type RerankingModelV4Result, type SharedV2Headers, type SharedV2ProviderMetadata, type SharedV2ProviderOptions, type SharedV3Headers, type SharedV3ProviderMetadata, type SharedV3ProviderOptions, type SharedV3Warning, type SharedV4AudioFormat, type SharedV4FileData, type SharedV4FileDataData, type SharedV4FileDataReference, type SharedV4FileDataText, type SharedV4FileDataUrl, type SharedV4Headers, type SharedV4ProviderMetadata, type SharedV4ProviderOptions, type SharedV4ProviderReference, type SharedV4Warning, type SkillsV4, type SkillsV4File, type SkillsV4UploadSkillCallOptions, type SkillsV4UploadSkillResult, type SpeechModelV2, type SpeechModelV2CallOptions, type SpeechModelV2CallWarning, type SpeechModelV3, type SpeechModelV3CallOptions, type SpeechModelV4, type SpeechModelV4CallOptions, type SpeechModelV4Result, TooManyEmbeddingValuesForCallError, type TranscriptionModelV2, type TranscriptionModelV2CallOptions, type TranscriptionModelV2CallWarning, type TranscriptionModelV3, type TranscriptionModelV3CallOptions, type TranscriptionModelV4, type TranscriptionModelV4CallOptions, type TranscriptionModelV4Result, type TypeValidationContext, TypeValidationError, UnsupportedFunctionalityError, getErrorMessage, isJSONArray, isJSONObject, isJSONValue };
|
package/package.json
CHANGED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { SharedV4ProviderOptions } from '../../shared/v4/shared-v4-provider-options';
|
|
2
|
+
import type { SharedV4ProviderReference } from '../../shared/v4/shared-v4-provider-reference';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Options for deleting a file via the files interface.
|
|
6
|
+
*/
|
|
7
|
+
export type FilesV4DeleteFileCallOptions = {
|
|
8
|
+
/**
|
|
9
|
+
* The provider reference of the file, as returned by `uploadFile`.
|
|
10
|
+
*/
|
|
11
|
+
file: SharedV4ProviderReference;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Abort signal for cancelling the operation.
|
|
15
|
+
*/
|
|
16
|
+
abortSignal?: AbortSignal;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Additional HTTP headers to be sent with the request.
|
|
20
|
+
* Only applicable for HTTP-based providers.
|
|
21
|
+
*/
|
|
22
|
+
headers?: Record<string, string | undefined>;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Additional provider-specific options. They are passed through
|
|
26
|
+
* to the provider from the AI SDK and enable provider-specific
|
|
27
|
+
* functionality that can be fully encapsulated in the provider.
|
|
28
|
+
*/
|
|
29
|
+
providerOptions?: SharedV4ProviderOptions;
|
|
30
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { SharedV4ProviderMetadata } from '../../shared/v4/shared-v4-provider-metadata';
|
|
2
|
+
import type { SharedV4ProviderReference } from '../../shared/v4/shared-v4-provider-reference';
|
|
3
|
+
import type { SharedV4Warning } from '../../shared/v4/shared-v4-warning';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Result of deleting a file via the files interface.
|
|
7
|
+
*/
|
|
8
|
+
export type FilesV4DeleteFileResult = {
|
|
9
|
+
/**
|
|
10
|
+
* A provider reference mapping provider names to provider-specific file identifiers.
|
|
11
|
+
* Contains only the operated provider's entry — when working with a merged
|
|
12
|
+
* multi-provider reference, do not reassign it with this result.
|
|
13
|
+
*/
|
|
14
|
+
providerReference: SharedV4ProviderReference;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Whether the provider confirmed the deletion.
|
|
18
|
+
*/
|
|
19
|
+
deleted: boolean;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Additional provider-specific metadata. They are passed through
|
|
23
|
+
* to the provider from the AI SDK and enable provider-specific
|
|
24
|
+
* functionality that can be fully encapsulated in the provider.
|
|
25
|
+
*/
|
|
26
|
+
providerMetadata?: SharedV4ProviderMetadata;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Warnings from the provider.
|
|
30
|
+
*/
|
|
31
|
+
warnings: Array<SharedV4Warning>;
|
|
32
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { SharedV4ProviderOptions } from '../../shared/v4/shared-v4-provider-options';
|
|
2
|
+
import type { SharedV4ProviderReference } from '../../shared/v4/shared-v4-provider-reference';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Options for downloading file content via the files interface.
|
|
6
|
+
*/
|
|
7
|
+
export type FilesV4DownloadFileCallOptions = {
|
|
8
|
+
/**
|
|
9
|
+
* The provider reference of the file, as returned by `uploadFile`.
|
|
10
|
+
*/
|
|
11
|
+
file: SharedV4ProviderReference;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Abort signal for cancelling the operation.
|
|
15
|
+
*/
|
|
16
|
+
abortSignal?: AbortSignal;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Additional HTTP headers to be sent with the request.
|
|
20
|
+
* Only applicable for HTTP-based providers.
|
|
21
|
+
*/
|
|
22
|
+
headers?: Record<string, string | undefined>;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Additional provider-specific options. They are passed through
|
|
26
|
+
* to the provider from the AI SDK and enable provider-specific
|
|
27
|
+
* functionality that can be fully encapsulated in the provider.
|
|
28
|
+
*/
|
|
29
|
+
providerOptions?: SharedV4ProviderOptions;
|
|
30
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { SharedV4ProviderMetadata } from '../../shared/v4/shared-v4-provider-metadata';
|
|
2
|
+
import type { SharedV4Warning } from '../../shared/v4/shared-v4-warning';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Result of downloading file content via the files interface.
|
|
6
|
+
*/
|
|
7
|
+
export type FilesV4DownloadFileResult = {
|
|
8
|
+
/**
|
|
9
|
+
* The file content as a byte stream.
|
|
10
|
+
* The consumer is responsible for draining or cancelling the stream.
|
|
11
|
+
*/
|
|
12
|
+
content: ReadableStream<Uint8Array>;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The IANA media type of the file, if available from the provider.
|
|
16
|
+
*/
|
|
17
|
+
mediaType?: string;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Additional provider-specific metadata. They are passed through
|
|
21
|
+
* to the provider from the AI SDK and enable provider-specific
|
|
22
|
+
* functionality that can be fully encapsulated in the provider.
|
|
23
|
+
*/
|
|
24
|
+
providerMetadata?: SharedV4ProviderMetadata;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Warnings from the provider.
|
|
28
|
+
*/
|
|
29
|
+
warnings: Array<SharedV4Warning>;
|
|
30
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { SharedV4ProviderOptions } from '../../shared/v4/shared-v4-provider-options';
|
|
2
|
+
import type { SharedV4ProviderReference } from '../../shared/v4/shared-v4-provider-reference';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Options for retrieving file metadata via the files interface.
|
|
6
|
+
*/
|
|
7
|
+
export type FilesV4GetFileMetadataCallOptions = {
|
|
8
|
+
/**
|
|
9
|
+
* The provider reference of the file, as returned by `uploadFile`.
|
|
10
|
+
*/
|
|
11
|
+
file: SharedV4ProviderReference;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Abort signal for cancelling the operation.
|
|
15
|
+
*/
|
|
16
|
+
abortSignal?: AbortSignal;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Additional HTTP headers to be sent with the request.
|
|
20
|
+
* Only applicable for HTTP-based providers.
|
|
21
|
+
*/
|
|
22
|
+
headers?: Record<string, string | undefined>;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Additional provider-specific options. They are passed through
|
|
26
|
+
* to the provider from the AI SDK and enable provider-specific
|
|
27
|
+
* functionality that can be fully encapsulated in the provider.
|
|
28
|
+
*/
|
|
29
|
+
providerOptions?: SharedV4ProviderOptions;
|
|
30
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { SharedV4ProviderMetadata } from '../../shared/v4/shared-v4-provider-metadata';
|
|
2
|
+
import type { SharedV4ProviderReference } from '../../shared/v4/shared-v4-provider-reference';
|
|
3
|
+
import type { SharedV4Warning } from '../../shared/v4/shared-v4-warning';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Result of retrieving file metadata via the files interface.
|
|
7
|
+
*/
|
|
8
|
+
export type FilesV4GetFileMetadataResult = {
|
|
9
|
+
/**
|
|
10
|
+
* A provider reference mapping provider names to provider-specific file identifiers.
|
|
11
|
+
* Contains only the operated provider's entry — when working with a merged
|
|
12
|
+
* multi-provider reference, do not reassign it with this result.
|
|
13
|
+
*/
|
|
14
|
+
providerReference: SharedV4ProviderReference;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The filename of the file, if available from the provider.
|
|
18
|
+
*/
|
|
19
|
+
filename?: string;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The IANA media type of the file, if available from the provider.
|
|
23
|
+
*/
|
|
24
|
+
mediaType?: string;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* The size of the file in bytes, if available from the provider.
|
|
28
|
+
*/
|
|
29
|
+
byteSize?: number;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* When the file was created, if available from the provider.
|
|
33
|
+
*/
|
|
34
|
+
createdAt?: Date;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* When the provider will delete the file (retention expiry),
|
|
38
|
+
* if available from the provider.
|
|
39
|
+
*/
|
|
40
|
+
expiresAt?: Date;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Additional provider-specific metadata. They are passed through
|
|
44
|
+
* to the provider from the AI SDK and enable provider-specific
|
|
45
|
+
* functionality that can be fully encapsulated in the provider.
|
|
46
|
+
*/
|
|
47
|
+
providerMetadata?: SharedV4ProviderMetadata;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Warnings from the provider.
|
|
51
|
+
*/
|
|
52
|
+
warnings: Array<SharedV4Warning>;
|
|
53
|
+
};
|
|
@@ -4,6 +4,15 @@ import type {
|
|
|
4
4
|
} from '../../shared/v4/shared-v4-file-data';
|
|
5
5
|
import type { SharedV4ProviderOptions } from '../../shared/v4/shared-v4-provider-options';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* File data variant containing a byte stream. Providers that support
|
|
9
|
+
* streaming uploads send it without buffering the full file in memory.
|
|
10
|
+
*/
|
|
11
|
+
export interface FilesV4UploadFileStreamData {
|
|
12
|
+
type: 'stream';
|
|
13
|
+
stream: ReadableStream<Uint8Array>;
|
|
14
|
+
}
|
|
15
|
+
|
|
7
16
|
/**
|
|
8
17
|
* Options for uploading a file via the files interface.
|
|
9
18
|
*/
|
|
@@ -13,8 +22,13 @@ export type FilesV4UploadFileCallOptions = {
|
|
|
13
22
|
*
|
|
14
23
|
* - `{ type: 'data', data }`: raw bytes (`Uint8Array`) or a base64-encoded string.
|
|
15
24
|
* - `{ type: 'text', text }`: inline text (UTF-8).
|
|
25
|
+
* - `{ type: 'stream', stream }`: a byte stream (not buffered by providers
|
|
26
|
+
* that support streaming uploads).
|
|
16
27
|
*/
|
|
17
|
-
data:
|
|
28
|
+
data:
|
|
29
|
+
| SharedV4FileDataData
|
|
30
|
+
| SharedV4FileDataText
|
|
31
|
+
| FilesV4UploadFileStreamData;
|
|
18
32
|
|
|
19
33
|
/**
|
|
20
34
|
* The IANA media type of the file (e.g. `'application/pdf'`).
|
|
@@ -26,6 +40,17 @@ export type FilesV4UploadFileCallOptions = {
|
|
|
26
40
|
*/
|
|
27
41
|
filename?: string;
|
|
28
42
|
|
|
43
|
+
/**
|
|
44
|
+
* Abort signal for cancelling the operation.
|
|
45
|
+
*/
|
|
46
|
+
abortSignal?: AbortSignal;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Additional HTTP headers to be sent with the request.
|
|
50
|
+
* Only applicable for HTTP-based providers.
|
|
51
|
+
*/
|
|
52
|
+
headers?: Record<string, string | undefined>;
|
|
53
|
+
|
|
29
54
|
/**
|
|
30
55
|
* Additional provider-specific options. They are passed through
|
|
31
56
|
* to the provider from the AI SDK and enable provider-specific
|
|
@@ -8,6 +8,8 @@ import type { SharedV4Warning } from '../../shared/v4/shared-v4-warning';
|
|
|
8
8
|
export type FilesV4UploadFileResult = {
|
|
9
9
|
/**
|
|
10
10
|
* A provider reference mapping provider names to provider-specific file identifiers.
|
|
11
|
+
* The key is the canonical provider name (e.g. `openai`) and may differ from
|
|
12
|
+
* the interface's `provider` id (e.g. `openai.files`).
|
|
11
13
|
*/
|
|
12
14
|
providerReference: SharedV4ProviderReference;
|
|
13
15
|
|
|
@@ -21,6 +23,22 @@ export type FilesV4UploadFileResult = {
|
|
|
21
23
|
*/
|
|
22
24
|
filename?: string;
|
|
23
25
|
|
|
26
|
+
/**
|
|
27
|
+
* The size of the uploaded file in bytes, if available from the provider.
|
|
28
|
+
*/
|
|
29
|
+
byteSize?: number;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* When the file was created, if available from the provider.
|
|
33
|
+
*/
|
|
34
|
+
createdAt?: Date;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* When the provider will delete the file (retention expiry, e.g. from a
|
|
38
|
+
* requested upload TTL), if available from the provider.
|
|
39
|
+
*/
|
|
40
|
+
expiresAt?: Date;
|
|
41
|
+
|
|
24
42
|
/**
|
|
25
43
|
* Additional provider-specific metadata. They are passed through
|
|
26
44
|
* to the provider from the AI SDK and enable provider-specific
|
package/src/files/v4/files-v4.ts
CHANGED
|
@@ -1,8 +1,18 @@
|
|
|
1
|
+
import type { FilesV4DeleteFileCallOptions } from './files-v4-delete-file-call-options';
|
|
2
|
+
import type { FilesV4DeleteFileResult } from './files-v4-delete-file-result';
|
|
3
|
+
import type { FilesV4DownloadFileCallOptions } from './files-v4-download-file-call-options';
|
|
4
|
+
import type { FilesV4DownloadFileResult } from './files-v4-download-file-result';
|
|
5
|
+
import type { FilesV4GetFileMetadataCallOptions } from './files-v4-get-file-metadata-call-options';
|
|
6
|
+
import type { FilesV4GetFileMetadataResult } from './files-v4-get-file-metadata-result';
|
|
1
7
|
import type { FilesV4UploadFileCallOptions } from './files-v4-upload-file-call-options';
|
|
2
8
|
import type { FilesV4UploadFileResult } from './files-v4-upload-file-result';
|
|
3
9
|
|
|
4
10
|
/**
|
|
5
11
|
* Specification for a file management interface that implements the files interface version 4.
|
|
12
|
+
*
|
|
13
|
+
* Only `uploadFile` is required. The other operations are optional
|
|
14
|
+
* capabilities: their presence signals that the provider supports them
|
|
15
|
+
* (mirroring the optional-method pattern of `VideoModelV4`).
|
|
6
16
|
*/
|
|
7
17
|
export type FilesV4 = {
|
|
8
18
|
/**
|
|
@@ -22,4 +32,28 @@ export type FilesV4 = {
|
|
|
22
32
|
uploadFile(
|
|
23
33
|
options: FilesV4UploadFileCallOptions,
|
|
24
34
|
): PromiseLike<FilesV4UploadFileResult>;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Retrieves metadata for a previously uploaded file.
|
|
38
|
+
* Optional: presence signals that the provider supports metadata reads.
|
|
39
|
+
*/
|
|
40
|
+
getFileMetadata?(
|
|
41
|
+
options: FilesV4GetFileMetadataCallOptions,
|
|
42
|
+
): PromiseLike<FilesV4GetFileMetadataResult>;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Downloads the content of a previously uploaded file as a byte stream.
|
|
46
|
+
* Optional: presence signals that the provider supports content download.
|
|
47
|
+
*/
|
|
48
|
+
downloadFile?(
|
|
49
|
+
options: FilesV4DownloadFileCallOptions,
|
|
50
|
+
): PromiseLike<FilesV4DownloadFileResult>;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Deletes a previously uploaded file.
|
|
54
|
+
* Optional: presence signals that the provider supports deletion.
|
|
55
|
+
*/
|
|
56
|
+
deleteFile?(
|
|
57
|
+
options: FilesV4DeleteFileCallOptions,
|
|
58
|
+
): PromiseLike<FilesV4DeleteFileResult>;
|
|
25
59
|
};
|
package/src/files/v4/index.ts
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
1
|
export type { FilesV4 } from './files-v4';
|
|
2
|
-
export type {
|
|
2
|
+
export type { FilesV4DeleteFileCallOptions } from './files-v4-delete-file-call-options';
|
|
3
|
+
export type { FilesV4DeleteFileResult } from './files-v4-delete-file-result';
|
|
4
|
+
export type { FilesV4DownloadFileCallOptions } from './files-v4-download-file-call-options';
|
|
5
|
+
export type { FilesV4DownloadFileResult } from './files-v4-download-file-result';
|
|
6
|
+
export type { FilesV4GetFileMetadataCallOptions } from './files-v4-get-file-metadata-call-options';
|
|
7
|
+
export type { FilesV4GetFileMetadataResult } from './files-v4-get-file-metadata-result';
|
|
8
|
+
export type {
|
|
9
|
+
FilesV4UploadFileCallOptions,
|
|
10
|
+
FilesV4UploadFileStreamData,
|
|
11
|
+
} from './files-v4-upload-file-call-options';
|
|
3
12
|
export type { FilesV4UploadFileResult } from './files-v4-upload-file-result';
|