@mastra/fastembed 1.2.0 → 1.3.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/CHANGELOG.md +30 -0
- package/README.md +22 -9
- package/dist/_types/@internal_ai-sdk-v5/dist/index.d.ts +110 -221
- package/dist/_types/@internal_ai-v6/dist/index.d.ts +499 -397
- package/dist/index.cjs +26466 -44374
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +26430 -44338
- package/dist/index.js.map +1 -1
- package/dist/model-cache.d.ts +1 -1
- package/dist/model-cache.d.ts.map +1 -1
- package/package.json +13 -13
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { JSONSchema7 } from 'json-schema';
|
|
2
|
-
import { JSONSchema7Definition } from 'json-schema';
|
|
3
2
|
import { ServerResponse } from 'node:http';
|
|
4
3
|
import { ServerResponse as ServerResponse_2 } from 'http';
|
|
5
4
|
import { z } from 'zod/v4';
|
|
@@ -225,133 +224,6 @@ export declare type AgentStreamParameters<CALL_OPTIONS, TOOLS extends ToolSet> =
|
|
|
225
224
|
experimental_transform?: StreamTextTransform<TOOLS> | Array<StreamTextTransform<TOOLS>>;
|
|
226
225
|
};
|
|
227
226
|
|
|
228
|
-
declare namespace _ai_sdk_provider {
|
|
229
|
-
export {
|
|
230
|
-
JSONSchema7,
|
|
231
|
-
JSONSchema7Definition,
|
|
232
|
-
AISDKError,
|
|
233
|
-
APICallError,
|
|
234
|
-
EmbeddingModelV2,
|
|
235
|
-
EmbeddingModelV2Embedding,
|
|
236
|
-
EmbeddingModelV3,
|
|
237
|
-
EmbeddingModelV3CallOptions,
|
|
238
|
-
EmbeddingModelV3Embedding,
|
|
239
|
-
EmbeddingModelV3Middleware,
|
|
240
|
-
EmbeddingModelV3Result,
|
|
241
|
-
EmptyResponseBodyError,
|
|
242
|
-
VideoModelV3 as Experimental_VideoModelV3,
|
|
243
|
-
VideoModelV3CallOptions as Experimental_VideoModelV3CallOptions,
|
|
244
|
-
VideoModelV3File as Experimental_VideoModelV3File,
|
|
245
|
-
VideoModelV3VideoData as Experimental_VideoModelV3VideoData,
|
|
246
|
-
ImageModelV2,
|
|
247
|
-
ImageModelV2CallOptions,
|
|
248
|
-
ImageModelV2CallWarning,
|
|
249
|
-
ImageModelV2ProviderMetadata,
|
|
250
|
-
ImageModelV3,
|
|
251
|
-
ImageModelV3CallOptions,
|
|
252
|
-
ImageModelV3File,
|
|
253
|
-
ImageModelV3Middleware,
|
|
254
|
-
ImageModelV3ProviderMetadata,
|
|
255
|
-
ImageModelV3Usage,
|
|
256
|
-
InvalidArgumentError_2 as InvalidArgumentError,
|
|
257
|
-
InvalidPromptError,
|
|
258
|
-
InvalidResponseDataError,
|
|
259
|
-
JSONArray,
|
|
260
|
-
JSONObject,
|
|
261
|
-
JSONParseError,
|
|
262
|
-
JSONValue_2 as JSONValue,
|
|
263
|
-
LanguageModelV2,
|
|
264
|
-
LanguageModelV2CallOptions,
|
|
265
|
-
LanguageModelV2CallWarning,
|
|
266
|
-
LanguageModelV2Content,
|
|
267
|
-
LanguageModelV2DataContent,
|
|
268
|
-
LanguageModelV2File,
|
|
269
|
-
LanguageModelV2FilePart,
|
|
270
|
-
LanguageModelV2FinishReason,
|
|
271
|
-
LanguageModelV2FunctionTool,
|
|
272
|
-
LanguageModelV2Message,
|
|
273
|
-
LanguageModelV2Middleware,
|
|
274
|
-
LanguageModelV2Prompt,
|
|
275
|
-
LanguageModelV2ProviderDefinedTool,
|
|
276
|
-
LanguageModelV2Reasoning,
|
|
277
|
-
LanguageModelV2ReasoningPart,
|
|
278
|
-
LanguageModelV2ResponseMetadata,
|
|
279
|
-
LanguageModelV2Source,
|
|
280
|
-
LanguageModelV2StreamPart,
|
|
281
|
-
LanguageModelV2Text,
|
|
282
|
-
LanguageModelV2TextPart,
|
|
283
|
-
LanguageModelV2ToolCall,
|
|
284
|
-
LanguageModelV2ToolCallPart,
|
|
285
|
-
LanguageModelV2ToolChoice,
|
|
286
|
-
LanguageModelV2ToolResultOutput,
|
|
287
|
-
LanguageModelV2ToolResultPart,
|
|
288
|
-
LanguageModelV2Usage,
|
|
289
|
-
LanguageModelV3,
|
|
290
|
-
LanguageModelV3CallOptions,
|
|
291
|
-
LanguageModelV3Content,
|
|
292
|
-
LanguageModelV3DataContent,
|
|
293
|
-
LanguageModelV3File,
|
|
294
|
-
LanguageModelV3FilePart,
|
|
295
|
-
LanguageModelV3FinishReason,
|
|
296
|
-
LanguageModelV3FunctionTool,
|
|
297
|
-
LanguageModelV3GenerateResult,
|
|
298
|
-
LanguageModelV3Message,
|
|
299
|
-
LanguageModelV3Middleware,
|
|
300
|
-
LanguageModelV3Prompt,
|
|
301
|
-
LanguageModelV3ProviderTool,
|
|
302
|
-
LanguageModelV3Reasoning,
|
|
303
|
-
LanguageModelV3ReasoningPart,
|
|
304
|
-
LanguageModelV3ResponseMetadata,
|
|
305
|
-
LanguageModelV3Source,
|
|
306
|
-
LanguageModelV3StreamPart,
|
|
307
|
-
LanguageModelV3StreamResult,
|
|
308
|
-
LanguageModelV3Text,
|
|
309
|
-
LanguageModelV3TextPart,
|
|
310
|
-
LanguageModelV3ToolApprovalRequest,
|
|
311
|
-
LanguageModelV3ToolApprovalResponsePart,
|
|
312
|
-
LanguageModelV3ToolCall,
|
|
313
|
-
LanguageModelV3ToolCallPart,
|
|
314
|
-
LanguageModelV3ToolChoice,
|
|
315
|
-
LanguageModelV3ToolResult,
|
|
316
|
-
LanguageModelV3ToolResultOutput,
|
|
317
|
-
LanguageModelV3ToolResultPart,
|
|
318
|
-
LanguageModelV3Usage,
|
|
319
|
-
LoadAPIKeyError,
|
|
320
|
-
LoadSettingError,
|
|
321
|
-
NoContentGeneratedError,
|
|
322
|
-
NoSuchModelError,
|
|
323
|
-
ProviderV2,
|
|
324
|
-
ProviderV3,
|
|
325
|
-
RerankingModelV3,
|
|
326
|
-
RerankingModelV3CallOptions,
|
|
327
|
-
SharedV2Headers,
|
|
328
|
-
SharedV2ProviderMetadata,
|
|
329
|
-
SharedV2ProviderOptions,
|
|
330
|
-
SharedV3Headers,
|
|
331
|
-
SharedV3ProviderMetadata,
|
|
332
|
-
SharedV3ProviderOptions,
|
|
333
|
-
SharedV3Warning,
|
|
334
|
-
SpeechModelV2,
|
|
335
|
-
SpeechModelV2CallOptions,
|
|
336
|
-
SpeechModelV2CallWarning,
|
|
337
|
-
SpeechModelV3,
|
|
338
|
-
SpeechModelV3CallOptions,
|
|
339
|
-
TooManyEmbeddingValuesForCallError,
|
|
340
|
-
TranscriptionModelV2,
|
|
341
|
-
TranscriptionModelV2CallOptions,
|
|
342
|
-
TranscriptionModelV2CallWarning,
|
|
343
|
-
TranscriptionModelV3,
|
|
344
|
-
TranscriptionModelV3CallOptions,
|
|
345
|
-
TypeValidationContext,
|
|
346
|
-
TypeValidationError,
|
|
347
|
-
UnsupportedFunctionalityError,
|
|
348
|
-
getErrorMessage_2 as getErrorMessage,
|
|
349
|
-
isJSONArray,
|
|
350
|
-
isJSONObject,
|
|
351
|
-
isJSONValue
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
|
|
355
227
|
declare namespace _ai_sdk_provider_utils {
|
|
356
228
|
export {
|
|
357
229
|
EventSourceMessage,
|
|
@@ -380,7 +252,12 @@ declare namespace _ai_sdk_provider_utils {
|
|
|
380
252
|
ReasoningPart,
|
|
381
253
|
Resolvable,
|
|
382
254
|
ResponseHandler,
|
|
255
|
+
RetryDelayProvider,
|
|
256
|
+
RetryErrorFactory,
|
|
257
|
+
RetryErrorReason,
|
|
258
|
+
RetryFunction,
|
|
383
259
|
Schema,
|
|
260
|
+
ShouldRetryFunction,
|
|
384
261
|
SystemModelMessage,
|
|
385
262
|
TextPart,
|
|
386
263
|
Tool,
|
|
@@ -403,6 +280,7 @@ declare namespace _ai_sdk_provider_utils {
|
|
|
403
280
|
VERSION,
|
|
404
281
|
ValidationResult,
|
|
405
282
|
asSchema,
|
|
283
|
+
cancelResponseBody,
|
|
406
284
|
combineHeaders,
|
|
407
285
|
convertAsyncIteratorToReadableStream,
|
|
408
286
|
convertBase64ToUint8Array,
|
|
@@ -424,14 +302,17 @@ declare namespace _ai_sdk_provider_utils {
|
|
|
424
302
|
dynamicTool,
|
|
425
303
|
executeTool,
|
|
426
304
|
extractResponseHeaders,
|
|
305
|
+
fetchWithValidatedRedirects,
|
|
427
306
|
generateId,
|
|
428
307
|
getErrorMessage,
|
|
429
308
|
getFromApi,
|
|
430
309
|
getRuntimeEnvironmentUserAgent,
|
|
431
310
|
injectJsonInstructionIntoMessages,
|
|
432
311
|
isAbortError,
|
|
312
|
+
isBrowserRuntime,
|
|
433
313
|
isNonNullable,
|
|
434
314
|
isParsableJson,
|
|
315
|
+
isSameOrigin,
|
|
435
316
|
isUrlSupported,
|
|
436
317
|
jsonSchema,
|
|
437
318
|
lazySchema,
|
|
@@ -449,8 +330,10 @@ declare namespace _ai_sdk_provider_utils {
|
|
|
449
330
|
readResponseWithSizeLimit,
|
|
450
331
|
removeUndefinedEntries,
|
|
451
332
|
resolve,
|
|
333
|
+
retryWithExponentialBackoff,
|
|
452
334
|
safeParseJSON,
|
|
453
335
|
safeValidateTypes,
|
|
336
|
+
secureJsonParse,
|
|
454
337
|
stripFileExtension,
|
|
455
338
|
tool,
|
|
456
339
|
validateDownloadUrl,
|
|
@@ -697,6 +580,20 @@ export declare type CallSettings = {
|
|
|
697
580
|
*/
|
|
698
581
|
export declare type CallWarning = SharedV3Warning;
|
|
699
582
|
|
|
583
|
+
/**
|
|
584
|
+
* Cancels a response body to release the underlying connection.
|
|
585
|
+
*
|
|
586
|
+
* When a fetch Response is rejected without consuming its body (e.g. a failed
|
|
587
|
+
* status code, an open-redirect rejection, or a Content-Length that exceeds the
|
|
588
|
+
* size limit), the underlying TCP socket is not returned to the connection pool
|
|
589
|
+
* and may stay open until the process runs out of file descriptors. Cancelling
|
|
590
|
+
* the body avoids this leak.
|
|
591
|
+
*
|
|
592
|
+
* Errors thrown while cancelling are ignored: the body may already be locked,
|
|
593
|
+
* disturbed, or absent, none of which should mask the original rejection.
|
|
594
|
+
*/
|
|
595
|
+
declare function cancelResponseBody(response: Response): Promise<void>;
|
|
596
|
+
|
|
700
597
|
/**
|
|
701
598
|
* Function that can be called to add a tool approval response to the chat.
|
|
702
599
|
*/
|
|
@@ -1289,7 +1186,7 @@ export declare type CreateUIMessage<UI_MESSAGE extends UIMessage> = Omit<UI_MESS
|
|
|
1289
1186
|
* Creates a UI message stream that can be used to send messages to the client.
|
|
1290
1187
|
*
|
|
1291
1188
|
* @param options.execute - A function that is called with a writer to write UI message chunks to the stream.
|
|
1292
|
-
* @param options.onError - A function that extracts an error message from an error. Defaults to `
|
|
1189
|
+
* @param options.onError - A function that extracts an error message from an error. Defaults to `() => 'An error occurred.'` so server-side error details are not leaked to the client; supply your own to surface richer messages.
|
|
1293
1190
|
* @param options.originalMessages - The original messages. If provided, persistence mode is assumed
|
|
1294
1191
|
* and a message ID is provided for the response message.
|
|
1295
1192
|
* @param options.onStepFinish - A callback that is called when each step finishes. Useful for persisting intermediate messages.
|
|
@@ -1298,7 +1195,8 @@ export declare type CreateUIMessage<UI_MESSAGE extends UIMessage> = Omit<UI_MESS
|
|
|
1298
1195
|
*
|
|
1299
1196
|
* @returns A `ReadableStream` of UI message chunks.
|
|
1300
1197
|
*/
|
|
1301
|
-
export declare function createUIMessageStream<UI_MESSAGE extends UIMessage>({ execute, onError,
|
|
1198
|
+
export declare function createUIMessageStream<UI_MESSAGE extends UIMessage>({ execute, onError, // prevent leaking server error details to the client by default
|
|
1199
|
+
originalMessages, onStepFinish, onFinish, generateId, }: {
|
|
1302
1200
|
execute: (options: {
|
|
1303
1201
|
writer: UIMessageStreamWriter<UI_MESSAGE>;
|
|
1304
1202
|
}) => Promise<void> | void;
|
|
@@ -1665,7 +1563,7 @@ export declare type DynamicToolUIPart = {
|
|
|
1665
1563
|
providerExecuted?: boolean;
|
|
1666
1564
|
} & ({
|
|
1667
1565
|
state: 'input-streaming';
|
|
1668
|
-
input
|
|
1566
|
+
input?: unknown;
|
|
1669
1567
|
output?: never;
|
|
1670
1568
|
errorText?: never;
|
|
1671
1569
|
callProviderMetadata?: ProviderMetadata;
|
|
@@ -1687,6 +1585,7 @@ export declare type DynamicToolUIPart = {
|
|
|
1687
1585
|
id: string;
|
|
1688
1586
|
approved?: never;
|
|
1689
1587
|
reason?: never;
|
|
1588
|
+
signature?: string;
|
|
1690
1589
|
};
|
|
1691
1590
|
} | {
|
|
1692
1591
|
state: 'approval-responded';
|
|
@@ -1698,6 +1597,7 @@ export declare type DynamicToolUIPart = {
|
|
|
1698
1597
|
id: string;
|
|
1699
1598
|
approved: boolean;
|
|
1700
1599
|
reason?: string;
|
|
1600
|
+
signature?: string;
|
|
1701
1601
|
};
|
|
1702
1602
|
} | {
|
|
1703
1603
|
state: 'output-available';
|
|
@@ -1711,6 +1611,7 @@ export declare type DynamicToolUIPart = {
|
|
|
1711
1611
|
id: string;
|
|
1712
1612
|
approved: true;
|
|
1713
1613
|
reason?: string;
|
|
1614
|
+
signature?: string;
|
|
1714
1615
|
};
|
|
1715
1616
|
} | {
|
|
1716
1617
|
state: 'output-error';
|
|
@@ -1723,6 +1624,7 @@ export declare type DynamicToolUIPart = {
|
|
|
1723
1624
|
id: string;
|
|
1724
1625
|
approved: true;
|
|
1725
1626
|
reason?: string;
|
|
1627
|
+
signature?: string;
|
|
1726
1628
|
};
|
|
1727
1629
|
} | {
|
|
1728
1630
|
state: 'output-denied';
|
|
@@ -1734,6 +1636,7 @@ export declare type DynamicToolUIPart = {
|
|
|
1734
1636
|
id: string;
|
|
1735
1637
|
approved: false;
|
|
1736
1638
|
reason?: string;
|
|
1639
|
+
signature?: string;
|
|
1737
1640
|
};
|
|
1738
1641
|
});
|
|
1739
1642
|
|
|
@@ -2299,6 +2202,146 @@ EventSourceMessage
|
|
|
2299
2202
|
constructor({ onError, onRetry, onComment }?: StreamOptions);
|
|
2300
2203
|
}
|
|
2301
2204
|
|
|
2205
|
+
declare type ExaSearchCategory = 'company' | 'people' | 'research paper' | 'news' | 'personal site' | 'financial report';
|
|
2206
|
+
|
|
2207
|
+
declare interface ExaSearchConfig {
|
|
2208
|
+
/**
|
|
2209
|
+
* Default search method. Exa defaults to auto when omitted.
|
|
2210
|
+
*/
|
|
2211
|
+
type?: ExaSearchType;
|
|
2212
|
+
/**
|
|
2213
|
+
* Default maximum number of results to return (1-100, default: 10).
|
|
2214
|
+
*/
|
|
2215
|
+
numResults?: number;
|
|
2216
|
+
/**
|
|
2217
|
+
* Default category filter for result types.
|
|
2218
|
+
*/
|
|
2219
|
+
category?: ExaSearchCategory;
|
|
2220
|
+
/**
|
|
2221
|
+
* Default two-letter ISO country code for location-aware search.
|
|
2222
|
+
*/
|
|
2223
|
+
userLocation?: string;
|
|
2224
|
+
/**
|
|
2225
|
+
* Default domains to include or exclude.
|
|
2226
|
+
*/
|
|
2227
|
+
includeDomains?: string[];
|
|
2228
|
+
excludeDomains?: string[];
|
|
2229
|
+
/**
|
|
2230
|
+
* Default published date filters in ISO 8601 format.
|
|
2231
|
+
*/
|
|
2232
|
+
startPublishedDate?: string;
|
|
2233
|
+
endPublishedDate?: string;
|
|
2234
|
+
/**
|
|
2235
|
+
* Default content extraction controls.
|
|
2236
|
+
*/
|
|
2237
|
+
contents?: ExaSearchContentsConfig;
|
|
2238
|
+
}
|
|
2239
|
+
|
|
2240
|
+
declare interface ExaSearchContentsConfig {
|
|
2241
|
+
text?: boolean | ExaSearchTextConfig;
|
|
2242
|
+
highlights?: boolean | ExaSearchHighlightsConfig;
|
|
2243
|
+
maxAgeHours?: number;
|
|
2244
|
+
livecrawlTimeout?: number;
|
|
2245
|
+
subpages?: number;
|
|
2246
|
+
subpageTarget?: string | string[];
|
|
2247
|
+
extras?: ExaSearchExtrasConfig;
|
|
2248
|
+
}
|
|
2249
|
+
|
|
2250
|
+
declare interface ExaSearchError {
|
|
2251
|
+
error: 'api_error' | 'rate_limit' | 'timeout' | 'invalid_input' | 'configuration_error' | 'execution_error' | 'unknown';
|
|
2252
|
+
statusCode?: number;
|
|
2253
|
+
message: string;
|
|
2254
|
+
}
|
|
2255
|
+
|
|
2256
|
+
declare interface ExaSearchExtrasConfig {
|
|
2257
|
+
links?: number;
|
|
2258
|
+
imageLinks?: number;
|
|
2259
|
+
}
|
|
2260
|
+
|
|
2261
|
+
declare interface ExaSearchHighlightsConfig {
|
|
2262
|
+
query?: string;
|
|
2263
|
+
maxCharacters?: number;
|
|
2264
|
+
}
|
|
2265
|
+
|
|
2266
|
+
declare interface ExaSearchInput {
|
|
2267
|
+
query: string;
|
|
2268
|
+
type?: ExaSearchType;
|
|
2269
|
+
num_results?: number;
|
|
2270
|
+
category?: ExaSearchCategory;
|
|
2271
|
+
user_location?: string;
|
|
2272
|
+
include_domains?: string[];
|
|
2273
|
+
exclude_domains?: string[];
|
|
2274
|
+
start_published_date?: string;
|
|
2275
|
+
end_published_date?: string;
|
|
2276
|
+
contents?: {
|
|
2277
|
+
text?: boolean | {
|
|
2278
|
+
max_characters?: number;
|
|
2279
|
+
include_html_tags?: boolean;
|
|
2280
|
+
verbosity?: 'compact' | 'standard' | 'full';
|
|
2281
|
+
include_sections?: ExaTextSection[];
|
|
2282
|
+
exclude_sections?: ExaTextSection[];
|
|
2283
|
+
};
|
|
2284
|
+
highlights?: boolean | {
|
|
2285
|
+
query?: string;
|
|
2286
|
+
max_characters?: number;
|
|
2287
|
+
};
|
|
2288
|
+
max_age_hours?: number;
|
|
2289
|
+
livecrawl_timeout?: number;
|
|
2290
|
+
subpages?: number;
|
|
2291
|
+
subpage_target?: string | string[];
|
|
2292
|
+
extras?: {
|
|
2293
|
+
links?: number;
|
|
2294
|
+
image_links?: number;
|
|
2295
|
+
};
|
|
2296
|
+
};
|
|
2297
|
+
}
|
|
2298
|
+
|
|
2299
|
+
declare type ExaSearchOutput = ExaSearchResponse | ExaSearchError;
|
|
2300
|
+
|
|
2301
|
+
declare interface ExaSearchResponse {
|
|
2302
|
+
requestId: string;
|
|
2303
|
+
searchType?: string;
|
|
2304
|
+
resolvedSearchType?: string;
|
|
2305
|
+
results: ExaSearchResult[];
|
|
2306
|
+
costDollars?: {
|
|
2307
|
+
total?: number;
|
|
2308
|
+
search?: Record<string, number>;
|
|
2309
|
+
};
|
|
2310
|
+
}
|
|
2311
|
+
|
|
2312
|
+
declare interface ExaSearchResult {
|
|
2313
|
+
title: string;
|
|
2314
|
+
url: string;
|
|
2315
|
+
id: string;
|
|
2316
|
+
publishedDate?: string | null;
|
|
2317
|
+
author?: string | null;
|
|
2318
|
+
image?: string | null;
|
|
2319
|
+
favicon?: string | null;
|
|
2320
|
+
text?: string;
|
|
2321
|
+
highlights?: string[];
|
|
2322
|
+
highlightScores?: number[];
|
|
2323
|
+
summary?: string;
|
|
2324
|
+
subpages?: ExaSearchResult[];
|
|
2325
|
+
extras?: {
|
|
2326
|
+
links?: string[];
|
|
2327
|
+
imageLinks?: string[];
|
|
2328
|
+
};
|
|
2329
|
+
}
|
|
2330
|
+
|
|
2331
|
+
declare interface ExaSearchTextConfig {
|
|
2332
|
+
maxCharacters?: number;
|
|
2333
|
+
includeHtmlTags?: boolean;
|
|
2334
|
+
verbosity?: 'compact' | 'standard' | 'full';
|
|
2335
|
+
includeSections?: ExaTextSection[];
|
|
2336
|
+
excludeSections?: ExaTextSection[];
|
|
2337
|
+
}
|
|
2338
|
+
|
|
2339
|
+
declare const exaSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<ExaSearchInput, ExaSearchOutput, ExaSearchConfig>;
|
|
2340
|
+
|
|
2341
|
+
declare type ExaSearchType = 'auto' | 'fast' | 'instant';
|
|
2342
|
+
|
|
2343
|
+
declare type ExaTextSection = 'header' | 'navigation' | 'banner' | 'body' | 'sidebar' | 'footer' | 'metadata';
|
|
2344
|
+
|
|
2302
2345
|
/**
|
|
2303
2346
|
* Defines Exception.
|
|
2304
2347
|
*
|
|
@@ -2464,7 +2507,7 @@ export declare function experimental_generateSpeech({ model, text, voice, output
|
|
|
2464
2507
|
headers?: Record<string, string>;
|
|
2465
2508
|
}): Promise<Experimental_SpeechResult>;
|
|
2466
2509
|
|
|
2467
|
-
export declare function experimental_generateVideo({ model: modelArg, prompt: promptArg, n, maxVideosPerCall, aspectRatio, resolution, duration, fps, seed, providerOptions, maxRetries: maxRetriesArg, abortSignal, headers, download: downloadFn, }: {
|
|
2510
|
+
export declare function experimental_generateVideo({ model: modelArg, prompt: promptArg, n, maxVideosPerCall, aspectRatio, resolution, duration, fps, seed, frameImages, inputReferences, generateAudio, providerOptions, maxRetries: maxRetriesArg, abortSignal, headers, download: downloadFn, }: {
|
|
2468
2511
|
/**
|
|
2469
2512
|
* The video model to use.
|
|
2470
2513
|
*/
|
|
@@ -2501,6 +2544,40 @@ export declare function experimental_generateVideo({ model: modelArg, prompt: pr
|
|
|
2501
2544
|
* Seed for the video generation.
|
|
2502
2545
|
*/
|
|
2503
2546
|
seed?: number;
|
|
2547
|
+
/**
|
|
2548
|
+
* Role-tagged image inputs for image-to-video and first-last-frame generation.
|
|
2549
|
+
*/
|
|
2550
|
+
frameImages?: Array<{
|
|
2551
|
+
/**
|
|
2552
|
+
* The image for this frame.
|
|
2553
|
+
*/
|
|
2554
|
+
image: DataContent;
|
|
2555
|
+
/**
|
|
2556
|
+
* Which frame this image represents.
|
|
2557
|
+
*/
|
|
2558
|
+
frameType: VideoModelV3FrameType;
|
|
2559
|
+
}>;
|
|
2560
|
+
/**
|
|
2561
|
+
* Reference inputs for reference-to-video generation.
|
|
2562
|
+
*
|
|
2563
|
+
* Each entry may be a plain image/video ({@link DataContent}), or an object
|
|
2564
|
+
* form that carries an explicit `mediaType`.
|
|
2565
|
+
*/
|
|
2566
|
+
inputReferences?: Array<DataContent | {
|
|
2567
|
+
/**
|
|
2568
|
+
* The reference image or video.
|
|
2569
|
+
*/
|
|
2570
|
+
data: DataContent;
|
|
2571
|
+
/**
|
|
2572
|
+
* The media type of the reference (e.g. 'image/png',
|
|
2573
|
+
* 'video/mp4').
|
|
2574
|
+
*/
|
|
2575
|
+
mediaType?: string;
|
|
2576
|
+
}>;
|
|
2577
|
+
/**
|
|
2578
|
+
* Whether the model should generate audio alongside the video.
|
|
2579
|
+
*/
|
|
2580
|
+
generateAudio?: boolean;
|
|
2504
2581
|
/**
|
|
2505
2582
|
* Additional provider-specific options that are passed through to the provider
|
|
2506
2583
|
* as body parameters.
|
|
@@ -2717,6 +2794,36 @@ declare function extractResponseHeaders(response: Response): {
|
|
|
2717
2794
|
*/
|
|
2718
2795
|
declare type FetchFunction = typeof globalThis.fetch;
|
|
2719
2796
|
|
|
2797
|
+
/**
|
|
2798
|
+
* Fetches a URL while enforcing the SSRF download guard on every hop.
|
|
2799
|
+
*
|
|
2800
|
+
* Redirects are followed manually (`redirect: 'manual'`) so each hop is
|
|
2801
|
+
* validated with {@link validateDownloadUrl} *before* it is requested. Relying
|
|
2802
|
+
* on the default `redirect: 'follow'` would issue the request to a redirect
|
|
2803
|
+
* target (e.g. an internal address) before we ever see its URL, defeating the
|
|
2804
|
+
* SSRF guard.
|
|
2805
|
+
*
|
|
2806
|
+
* A `redirect: 'manual'` request yields an unreadable opaque response in the
|
|
2807
|
+
* browser (and in other spec-compliant fetch implementations), so the redirect
|
|
2808
|
+
* target cannot be validated here. In a real browser this is safe to follow
|
|
2809
|
+
* natively because SSRF is not reachable (fetch is constrained by CORS and
|
|
2810
|
+
* cannot reach a server's internal network or cloud-metadata). On any other
|
|
2811
|
+
* runtime we cannot validate the hop, so we fail closed rather than follow it
|
|
2812
|
+
* blindly and bypass the SSRF guard.
|
|
2813
|
+
*
|
|
2814
|
+
* The returned response is the final (non-redirect) response. The caller is
|
|
2815
|
+
* responsible for checking `response.ok` and reading the body.
|
|
2816
|
+
*
|
|
2817
|
+
* @throws DownloadError if a hop is unsafe, the redirect limit is exceeded, or
|
|
2818
|
+
* a redirect cannot be validated on a non-browser runtime.
|
|
2819
|
+
*/
|
|
2820
|
+
declare function fetchWithValidatedRedirects({ url, headers, abortSignal, maxRedirects, }: {
|
|
2821
|
+
url: string;
|
|
2822
|
+
headers?: HeadersInit;
|
|
2823
|
+
abortSignal?: AbortSignal;
|
|
2824
|
+
maxRedirects?: number;
|
|
2825
|
+
}): Promise<Response>;
|
|
2826
|
+
|
|
2720
2827
|
/**
|
|
2721
2828
|
* File content part of a prompt. It contains a file.
|
|
2722
2829
|
*/
|
|
@@ -2847,7 +2954,7 @@ declare interface GatewayGenerationInfoParams {
|
|
|
2847
2954
|
id: string;
|
|
2848
2955
|
}
|
|
2849
2956
|
|
|
2850
|
-
declare type GatewayImageModelId = 'bfl/flux-2-flex' | 'bfl/flux-2-klein-4b' | 'bfl/flux-2-klein-9b' | 'bfl/flux-2-max' | 'bfl/flux-2-pro' | 'bfl/flux-kontext-max' | 'bfl/flux-kontext-pro' | 'bfl/flux-pro-1.0-fill' | 'bfl/flux-pro-1.1' | 'bfl/flux-pro-1.1-ultra' | 'bytedance/seedream-4.0' | 'bytedance/seedream-4.5' | 'bytedance/seedream-5.0-lite' | 'google/imagen-4.0-fast-generate-001' | 'google/imagen-4.0-generate-001' | 'google/imagen-4.0-ultra-generate-001' | 'openai/gpt-image-1' | 'openai/gpt-image-1-mini' | 'openai/gpt-image-1.5' | 'openai/gpt-image-2' | 'prodia/flux-fast-schnell' | 'recraft/recraft-v2' | 'recraft/recraft-v3' | 'recraft/recraft-v4' | 'recraft/recraft-v4-pro' | '
|
|
2957
|
+
declare type GatewayImageModelId = 'bfl/flux-2-flex' | 'bfl/flux-2-klein-4b' | 'bfl/flux-2-klein-9b' | 'bfl/flux-2-max' | 'bfl/flux-2-pro' | 'bfl/flux-kontext-max' | 'bfl/flux-kontext-pro' | 'bfl/flux-pro-1.0-fill' | 'bfl/flux-pro-1.1' | 'bfl/flux-pro-1.1-ultra' | 'bytedance/seedream-4.0' | 'bytedance/seedream-4.5' | 'bytedance/seedream-5.0-lite' | 'bytedance/seedream-5.0-pro' | 'google/imagen-4.0-fast-generate-001' | 'google/imagen-4.0-generate-001' | 'google/imagen-4.0-ultra-generate-001' | 'openai/gpt-image-1' | 'openai/gpt-image-1-mini' | 'openai/gpt-image-1.5' | 'openai/gpt-image-2' | 'prodia/flux-fast-schnell' | 'quiverai/arrow-1.1' | 'recraft/recraft-v2' | 'recraft/recraft-v3' | 'recraft/recraft-v4' | 'recraft/recraft-v4-pro' | 'recraft/recraft-v4.1' | 'recraft/recraft-v4.1-pro' | 'recraft/recraft-v4.1-utility' | 'recraft/recraft-v4.1-utility-pro' | 'xai/grok-imagine-image' | (string & {});
|
|
2851
2958
|
|
|
2852
2959
|
declare interface GatewayLanguageModelEntry {
|
|
2853
2960
|
/**
|
|
@@ -2898,7 +3005,7 @@ declare interface GatewayLanguageModelEntry {
|
|
|
2898
3005
|
|
|
2899
3006
|
declare type GatewayLanguageModelSpecification = Pick<LanguageModelV3, 'specificationVersion' | 'provider' | 'modelId'>;
|
|
2900
3007
|
|
|
2901
|
-
export declare type GatewayModelId = 'alibaba/qwen-3-14b' | 'alibaba/qwen-3-235b' | 'alibaba/qwen-3-30b' | 'alibaba/qwen-3-32b' | 'alibaba/qwen-3.6-max-preview' | 'alibaba/qwen3-235b-a22b-thinking' | 'alibaba/qwen3-coder' | 'alibaba/qwen3-coder-30b-a3b' | 'alibaba/qwen3-coder-next' | 'alibaba/qwen3-coder-plus' | 'alibaba/qwen3-max' | 'alibaba/qwen3-max-preview' | 'alibaba/qwen3-max-thinking' | 'alibaba/qwen3-next-80b-a3b-instruct' | 'alibaba/qwen3-next-80b-a3b-thinking' | 'alibaba/qwen3-vl-235b-a22b-instruct' | 'alibaba/qwen3-vl-instruct' | 'alibaba/qwen3-vl-thinking' | 'alibaba/qwen3.5-flash' | 'alibaba/qwen3.5-plus' | 'alibaba/qwen3.6-27b' | 'alibaba/qwen3.6-plus' | 'amazon/nova-2-lite' | 'amazon/nova-lite' | 'amazon/nova-micro' | 'amazon/nova-pro' | 'anthropic/claude-3-haiku' | 'anthropic/claude-
|
|
3008
|
+
export declare type GatewayModelId = 'alibaba/qwen-3-14b' | 'alibaba/qwen-3-235b' | 'alibaba/qwen-3-30b' | 'alibaba/qwen-3-32b' | 'alibaba/qwen-3.6-max-preview' | 'alibaba/qwen3-235b-a22b-thinking' | 'alibaba/qwen3-coder' | 'alibaba/qwen3-coder-30b-a3b' | 'alibaba/qwen3-coder-next' | 'alibaba/qwen3-coder-plus' | 'alibaba/qwen3-max' | 'alibaba/qwen3-max-preview' | 'alibaba/qwen3-max-thinking' | 'alibaba/qwen3-next-80b-a3b-instruct' | 'alibaba/qwen3-next-80b-a3b-thinking' | 'alibaba/qwen3-vl-235b-a22b-instruct' | 'alibaba/qwen3-vl-instruct' | 'alibaba/qwen3-vl-thinking' | 'alibaba/qwen3.5-flash' | 'alibaba/qwen3.5-plus' | 'alibaba/qwen3.6-27b' | 'alibaba/qwen3.6-plus' | 'alibaba/qwen3.7-max' | 'alibaba/qwen3.7-plus' | 'amazon/nova-2-lite' | 'amazon/nova-lite' | 'amazon/nova-micro' | 'amazon/nova-pro' | 'anthropic/claude-3-haiku' | 'anthropic/claude-fable-5' | 'anthropic/claude-haiku-4.5' | 'anthropic/claude-opus-4' | 'anthropic/claude-opus-4.1' | 'anthropic/claude-opus-4.5' | 'anthropic/claude-opus-4.6' | 'anthropic/claude-opus-4.7' | 'anthropic/claude-opus-4.8' | 'anthropic/claude-opus-4.8-fast' | 'anthropic/claude-opus-5' | 'anthropic/claude-opus-5-fast' | 'anthropic/claude-sonnet-4' | 'anthropic/claude-sonnet-4.5' | 'anthropic/claude-sonnet-4.6' | 'anthropic/claude-sonnet-5' | 'arcee-ai/trinity-large-thinking' | 'arcee-ai/trinity-mini' | 'bytedance/seed-1.6' | 'bytedance/seed-1.8' | 'cohere/command-a' | 'deepseek/deepseek-r1' | 'deepseek/deepseek-v3' | 'deepseek/deepseek-v3.1' | 'deepseek/deepseek-v3.1-terminus' | 'deepseek/deepseek-v3.2' | 'deepseek/deepseek-v3.2-thinking' | 'deepseek/deepseek-v4-flash' | 'deepseek/deepseek-v4-pro' | 'google/gemini-2.5-flash' | 'google/gemini-2.5-flash-image' | 'google/gemini-2.5-flash-lite' | 'google/gemini-2.5-pro' | 'google/gemini-3-flash' | 'google/gemini-3-pro-image' | 'google/gemini-3.1-flash-image' | 'google/gemini-3.1-flash-image-preview' | 'google/gemini-3.1-flash-lite' | 'google/gemini-3.1-flash-lite-image' | 'google/gemini-3.1-pro-preview' | 'google/gemini-3.5-flash' | 'google/gemini-3.5-flash-lite' | 'google/gemini-3.6-flash' | 'google/gemini-omni-flash-preview' | 'google/gemma-4-26b-a4b-it' | 'google/gemma-4-31b-it' | 'inception/mercury-2' | 'inception/mercury-coder-small' | 'inclusionai/ling-3.0-flash-free' | 'interfaze/interfaze-beta' | 'kwaipilot/kat-coder-air-v2.5' | 'kwaipilot/kat-coder-pro-v1' | 'kwaipilot/kat-coder-pro-v2' | 'kwaipilot/kat-coder-pro-v2.5' | 'meta/llama-3.1-70b' | 'meta/llama-3.1-8b' | 'meta/llama-3.3-70b' | 'meta/llama-4-maverick' | 'meta/llama-4-scout' | 'meta/muse-spark-1.1' | 'minimax/minimax-m2' | 'minimax/minimax-m2.1' | 'minimax/minimax-m2.1-lightning' | 'minimax/minimax-m2.5' | 'minimax/minimax-m2.5-highspeed' | 'minimax/minimax-m2.7' | 'minimax/minimax-m2.7-highspeed' | 'minimax/minimax-m3' | 'mistral/codestral' | 'mistral/devstral-2' | 'mistral/devstral-small-2' | 'mistral/magistral-medium' | 'mistral/magistral-small' | 'mistral/ministral-14b' | 'mistral/ministral-3b' | 'mistral/ministral-8b' | 'mistral/mistral-large-3' | 'mistral/mistral-medium' | 'mistral/mistral-medium-3.5' | 'mistral/mistral-nemo' | 'mistral/mistral-small' | 'mistral/pixtral-12b' | 'moonshotai/kimi-k2' | 'moonshotai/kimi-k2-thinking' | 'moonshotai/kimi-k2.5' | 'moonshotai/kimi-k2.6' | 'moonshotai/kimi-k2.7-code' | 'moonshotai/kimi-k2.7-code-highspeed' | 'moonshotai/kimi-k3' | 'moonshotai/kimi-k3-fast' | 'morph/morph-v3-fast' | 'morph/morph-v3-large' | 'nvidia/nemotron-3-nano-30b-a3b' | 'nvidia/nemotron-3-super-120b-a12b' | 'nvidia/nemotron-3-ultra-550b-a55b' | 'nvidia/nemotron-nano-12b-v2-vl' | 'nvidia/nemotron-nano-9b-v2' | 'openai/gpt-3.5-turbo' | 'openai/gpt-4-turbo' | 'openai/gpt-4.1' | 'openai/gpt-4.1-mini' | 'openai/gpt-4.1-nano' | 'openai/gpt-4o' | 'openai/gpt-4o-mini' | 'openai/gpt-4o-mini-search-preview' | 'openai/gpt-5' | 'openai/gpt-5-codex' | 'openai/gpt-5-mini' | 'openai/gpt-5-nano' | 'openai/gpt-5-pro' | 'openai/gpt-5.1-codex' | 'openai/gpt-5.1-codex-max' | 'openai/gpt-5.1-codex-mini' | 'openai/gpt-5.1-instant' | 'openai/gpt-5.1-thinking' | 'openai/gpt-5.2' | 'openai/gpt-5.2-codex' | 'openai/gpt-5.2-pro' | 'openai/gpt-5.3-chat' | 'openai/gpt-5.3-codex' | 'openai/gpt-5.4' | 'openai/gpt-5.4-mini' | 'openai/gpt-5.4-nano' | 'openai/gpt-5.4-pro' | 'openai/gpt-5.5' | 'openai/gpt-5.5-pro' | 'openai/gpt-5.6-luna' | 'openai/gpt-5.6-sol' | 'openai/gpt-5.6-terra' | 'openai/gpt-oss-120b' | 'openai/gpt-oss-20b' | 'openai/gpt-oss-safeguard-20b' | 'openai/o1' | 'openai/o3' | 'openai/o3-deep-research' | 'openai/o3-mini' | 'openai/o3-pro' | 'openai/o4-mini' | 'perplexity/sonar' | 'perplexity/sonar-pro' | 'perplexity/sonar-reasoning-pro' | 'poolside/laguna-s-2.1' | 'poolside/laguna-s-2.1-free' | 'sakana/fugu-ultra' | 'stepfun/step-3.5-flash' | 'stepfun/step-3.7-flash' | 'tencent/hy3' | 'thinkingmachines/inkling' | 'xai/grok-4.1-fast-non-reasoning' | 'xai/grok-4.1-fast-reasoning' | 'xai/grok-4.20-multi-agent' | 'xai/grok-4.20-multi-agent-beta' | 'xai/grok-4.20-non-reasoning' | 'xai/grok-4.20-non-reasoning-beta' | 'xai/grok-4.20-reasoning' | 'xai/grok-4.20-reasoning-beta' | 'xai/grok-4.3' | 'xai/grok-4.5' | 'xai/grok-build-0.1' | 'xiaomi/mimo-v2.5' | 'xiaomi/mimo-v2.5-pro' | 'zai/glm-4.5' | 'zai/glm-4.5-air' | 'zai/glm-4.5v' | 'zai/glm-4.6' | 'zai/glm-4.6v' | 'zai/glm-4.6v-flash' | 'zai/glm-4.7' | 'zai/glm-4.7-flash' | 'zai/glm-4.7-flashx' | 'zai/glm-5' | 'zai/glm-5-turbo' | 'zai/glm-5.1' | 'zai/glm-5.2' | 'zai/glm-5.2-fast' | 'zai/glm-5v-turbo' | (string & {});
|
|
2902
3009
|
|
|
2903
3010
|
declare interface GatewayProvider extends ProviderV3 {
|
|
2904
3011
|
(modelId: GatewayModelId): LanguageModelV3;
|
|
@@ -2964,6 +3071,22 @@ declare interface GatewayProvider extends ProviderV3 {
|
|
|
2964
3071
|
* Creates a model for reranking documents.
|
|
2965
3072
|
*/
|
|
2966
3073
|
rerankingModel(modelId: GatewayRerankingModelId): RerankingModelV3;
|
|
3074
|
+
/**
|
|
3075
|
+
* Creates a model for text-to-speech generation.
|
|
3076
|
+
*/
|
|
3077
|
+
speech(modelId: GatewaySpeechModelId): SpeechModelV3;
|
|
3078
|
+
/**
|
|
3079
|
+
* Creates a model for text-to-speech generation.
|
|
3080
|
+
*/
|
|
3081
|
+
speechModel(modelId: GatewaySpeechModelId): SpeechModelV3;
|
|
3082
|
+
/**
|
|
3083
|
+
* Creates a model for audio transcription.
|
|
3084
|
+
*/
|
|
3085
|
+
transcription(modelId: GatewayTranscriptionModelId): TranscriptionModelV3;
|
|
3086
|
+
/**
|
|
3087
|
+
* Creates a model for audio transcription.
|
|
3088
|
+
*/
|
|
3089
|
+
transcriptionModel(modelId: GatewayTranscriptionModelId): TranscriptionModelV3;
|
|
2967
3090
|
/**
|
|
2968
3091
|
* Gateway-specific tools executed server-side.
|
|
2969
3092
|
*/
|
|
@@ -2996,6 +3119,8 @@ declare interface GatewayProviderSettings {
|
|
|
2996
3119
|
|
|
2997
3120
|
declare type GatewayRerankingModelId = 'cohere/rerank-v3.5' | 'cohere/rerank-v4-fast' | 'cohere/rerank-v4-pro' | 'voyage/rerank-2.5' | 'voyage/rerank-2.5-lite' | (string & {});
|
|
2998
3121
|
|
|
3122
|
+
declare type GatewaySpeechModelId = 'openai/tts-1' | 'openai/tts-1-hd' | 'xai/grok-tts' | (string & {});
|
|
3123
|
+
|
|
2999
3124
|
declare interface GatewaySpendReportParams {
|
|
3000
3125
|
/** Start date in YYYY-MM-DD format (inclusive) */
|
|
3001
3126
|
startDate: string;
|
|
@@ -3058,6 +3183,14 @@ declare interface GatewaySpendReportRow {
|
|
|
3058
3183
|
* Gateway-specific provider-defined tools.
|
|
3059
3184
|
*/
|
|
3060
3185
|
declare const gatewayTools: {
|
|
3186
|
+
/**
|
|
3187
|
+
* Search the web using Exa for current information and token-efficient
|
|
3188
|
+
* excerpts optimized for agent workflows.
|
|
3189
|
+
*
|
|
3190
|
+
* Supports search type, category, domain, date, location, and content
|
|
3191
|
+
* extraction controls.
|
|
3192
|
+
*/
|
|
3193
|
+
exaSearch: (config?: ExaSearchConfig) => ReturnType<typeof exaSearchToolFactory>;
|
|
3061
3194
|
/**
|
|
3062
3195
|
* Search the web using Parallel AI's Search API for LLM-optimized excerpts.
|
|
3063
3196
|
*
|
|
@@ -3077,7 +3210,9 @@ declare const gatewayTools: {
|
|
|
3077
3210
|
perplexitySearch: (config?: PerplexitySearchConfig) => ReturnType<typeof perplexitySearchToolFactory>;
|
|
3078
3211
|
};
|
|
3079
3212
|
|
|
3080
|
-
declare type
|
|
3213
|
+
declare type GatewayTranscriptionModelId = 'openai/gpt-4o-mini-transcribe' | 'openai/gpt-4o-transcribe' | 'openai/gpt-realtime-whisper' | 'openai/whisper-1' | 'xai/grok-stt' | (string & {});
|
|
3214
|
+
|
|
3215
|
+
declare type GatewayVideoModelId = 'alibaba/wan-v2.5-t2v-preview' | 'alibaba/wan-v2.6-i2v' | 'alibaba/wan-v2.6-i2v-flash' | 'alibaba/wan-v2.6-r2v' | 'alibaba/wan-v2.6-r2v-flash' | 'alibaba/wan-v2.6-t2v' | 'alibaba/wan-v2.7-r2v' | 'alibaba/wan-v2.7-t2v' | 'bytedance/seedance-2.0' | 'bytedance/seedance-2.0-fast' | 'bytedance/seedance-v1.0-pro' | 'bytedance/seedance-v1.0-pro-fast' | 'bytedance/seedance-v1.5-pro' | 'google/veo-3.0-fast-generate-001' | 'google/veo-3.0-generate-001' | 'google/veo-3.1-fast-generate-001' | 'google/veo-3.1-generate-001' | 'klingai/kling-v2.5-turbo-i2v' | 'klingai/kling-v2.5-turbo-t2v' | 'klingai/kling-v2.6-i2v' | 'klingai/kling-v2.6-motion-control' | 'klingai/kling-v2.6-t2v' | 'klingai/kling-v3.0-i2v' | 'klingai/kling-v3.0-motion-control' | 'klingai/kling-v3.0-t2v' | 'xai/grok-imagine-video' | 'xai/grok-imagine-video-1.5' | 'xai/grok-imagine-video-1.5-preview' | (string & {});
|
|
3081
3216
|
|
|
3082
3217
|
/**
|
|
3083
3218
|
* A generated audio file.
|
|
@@ -3465,7 +3600,7 @@ export declare interface GenerateObjectResult<OBJECT> {
|
|
|
3465
3600
|
* @returns
|
|
3466
3601
|
* A result object that contains the generated text, the results of the tool calls, and additional information.
|
|
3467
3602
|
*/
|
|
3468
|
-
export declare function generateText<TOOLS extends ToolSet, OUTPUT extends Output_2 = Output_2<string, string>>({ model: modelArg, tools, toolChoice, system, prompt, messages, allowSystemInMessages, maxRetries: maxRetriesArg, abortSignal, timeout, headers, stopWhen, experimental_output, output, experimental_telemetry: telemetry, providerOptions, experimental_activeTools, activeTools, experimental_prepareStep, prepareStep, experimental_repairToolCall: repairToolCall, experimental_download: download, experimental_context, experimental_include: include, _internal: { generateId }, experimental_onStart: onStart, experimental_onStepStart: onStepStart, experimental_onToolCallStart: onToolCallStart, experimental_onToolCallFinish: onToolCallFinish, onStepFinish, onFinish, ...settings }: CallSettings & Prompt & {
|
|
3603
|
+
export declare function generateText<TOOLS extends ToolSet, OUTPUT extends Output_2 = Output_2<string, string>>({ model: modelArg, tools, toolChoice, system, prompt, messages, allowSystemInMessages, maxRetries: maxRetriesArg, abortSignal, timeout, headers, stopWhen, experimental_output, output, experimental_telemetry: telemetry, providerOptions, experimental_activeTools, activeTools, experimental_prepareStep, prepareStep, experimental_repairToolCall: repairToolCall, experimental_download: download, experimental_context, experimental_toolApprovalSecret, experimental_include: include, _internal: { generateId }, experimental_onStart: onStart, experimental_onStepStart: onStepStart, experimental_onToolCallStart: onToolCallStart, experimental_onToolCallFinish: onToolCallFinish, onStepFinish, onFinish, ...settings }: CallSettings & Prompt & {
|
|
3469
3604
|
/**
|
|
3470
3605
|
* The language model to use.
|
|
3471
3606
|
*/
|
|
@@ -3566,6 +3701,14 @@ export declare function generateText<TOOLS extends ToolSet, OUTPUT extends Outpu
|
|
|
3566
3701
|
* @default undefined
|
|
3567
3702
|
*/
|
|
3568
3703
|
experimental_context?: unknown;
|
|
3704
|
+
/**
|
|
3705
|
+
* Secret for HMAC-signing tool approval requests. When set, the server
|
|
3706
|
+
* signs each approval request at issuance and verifies the signature when
|
|
3707
|
+
* the approval is replayed, preventing client-forged approvals.
|
|
3708
|
+
*
|
|
3709
|
+
* Experimental (can break in patch releases).
|
|
3710
|
+
*/
|
|
3711
|
+
experimental_toolApprovalSecret?: string | Uint8Array;
|
|
3569
3712
|
/**
|
|
3570
3713
|
* Settings for controlling what data is included in step results.
|
|
3571
3714
|
* Disabling inclusion can help reduce memory usage when processing
|
|
@@ -3679,7 +3822,9 @@ export declare interface GenerateTextResult<TOOLS extends ToolSet, OUTPUT extend
|
|
|
3679
3822
|
*/
|
|
3680
3823
|
readonly content: Array<ContentPart<TOOLS>>;
|
|
3681
3824
|
/**
|
|
3682
|
-
* The text
|
|
3825
|
+
* The concatenation of all text parts generated in the final step.
|
|
3826
|
+
* It is an empty string if the final step contains no text parts.
|
|
3827
|
+
* Inspect `content` for a text part to distinguish that case.
|
|
3683
3828
|
*/
|
|
3684
3829
|
readonly text: string;
|
|
3685
3830
|
/**
|
|
@@ -3786,8 +3931,10 @@ export declare interface GenerateTextResult<TOOLS extends ToolSet, OUTPUT extend
|
|
|
3786
3931
|
*/
|
|
3787
3932
|
readonly experimental_output: InferGenerateOutput<OUTPUT>;
|
|
3788
3933
|
/**
|
|
3789
|
-
* The generated
|
|
3934
|
+
* The generated output according to the `output` specification.
|
|
3790
3935
|
*
|
|
3936
|
+
* @throws {NoOutputGeneratedError} When no output is available, for example
|
|
3937
|
+
* when the final step does not finish with a `stop` reason.
|
|
3791
3938
|
*/
|
|
3792
3939
|
readonly output: InferGenerateOutput<OUTPUT>;
|
|
3793
3940
|
}
|
|
@@ -3827,8 +3974,6 @@ export declare interface GenerateVideoResult {
|
|
|
3827
3974
|
|
|
3828
3975
|
declare function getErrorMessage(error: unknown | undefined): string;
|
|
3829
3976
|
|
|
3830
|
-
declare function getErrorMessage_2(error: unknown | undefined): string;
|
|
3831
|
-
|
|
3832
3977
|
declare const getFromApi: <T>({ url, headers, successfulResponseHandler, failedResponseHandler, abortSignal, fetch, }: {
|
|
3833
3978
|
url: string;
|
|
3834
3979
|
headers?: Record<string, string | undefined>;
|
|
@@ -4537,7 +4682,7 @@ declare function injectJsonInstructionIntoMessages({ messages, schema, schemaPre
|
|
|
4537
4682
|
}): LanguageModelV3Prompt;
|
|
4538
4683
|
|
|
4539
4684
|
export declare class InvalidArgumentError extends AISDKError {
|
|
4540
|
-
private readonly [symbol$
|
|
4685
|
+
private readonly [symbol$i];
|
|
4541
4686
|
readonly parameter: string;
|
|
4542
4687
|
readonly value: unknown;
|
|
4543
4688
|
constructor({ parameter, value, message, }: {
|
|
@@ -4548,20 +4693,6 @@ export declare class InvalidArgumentError extends AISDKError {
|
|
|
4548
4693
|
static isInstance(error: unknown): error is InvalidArgumentError;
|
|
4549
4694
|
}
|
|
4550
4695
|
|
|
4551
|
-
/**
|
|
4552
|
-
* A function argument is invalid.
|
|
4553
|
-
*/
|
|
4554
|
-
declare class InvalidArgumentError_2 extends AISDKError {
|
|
4555
|
-
private readonly [symbol$a_2];
|
|
4556
|
-
readonly argument: string;
|
|
4557
|
-
constructor({ message, cause, argument, }: {
|
|
4558
|
-
argument: string;
|
|
4559
|
-
message: string;
|
|
4560
|
-
cause?: unknown;
|
|
4561
|
-
});
|
|
4562
|
-
static isInstance(error: unknown): error is InvalidArgumentError_2;
|
|
4563
|
-
}
|
|
4564
|
-
|
|
4565
4696
|
export declare class InvalidDataContentError extends AISDKError {
|
|
4566
4697
|
private readonly [symbol$4_2];
|
|
4567
4698
|
readonly content: unknown;
|
|
@@ -4613,7 +4744,7 @@ export declare class InvalidResponseDataError extends AISDKError {
|
|
|
4613
4744
|
}
|
|
4614
4745
|
|
|
4615
4746
|
export declare class InvalidStreamPartError extends AISDKError {
|
|
4616
|
-
private readonly [symbol$
|
|
4747
|
+
private readonly [symbol$h];
|
|
4617
4748
|
readonly chunk: SingleRequestTextStreamPart<any>;
|
|
4618
4749
|
constructor({ chunk, message, }: {
|
|
4619
4750
|
chunk: SingleRequestTextStreamPart<any>;
|
|
@@ -4623,7 +4754,7 @@ export declare class InvalidStreamPartError extends AISDKError {
|
|
|
4623
4754
|
}
|
|
4624
4755
|
|
|
4625
4756
|
export declare class InvalidToolApprovalError extends AISDKError {
|
|
4626
|
-
private readonly [symbol$
|
|
4757
|
+
private readonly [symbol$g];
|
|
4627
4758
|
readonly approvalId: string;
|
|
4628
4759
|
constructor({ approvalId }: {
|
|
4629
4760
|
approvalId: string;
|
|
@@ -4631,8 +4762,20 @@ export declare class InvalidToolApprovalError extends AISDKError {
|
|
|
4631
4762
|
static isInstance(error: unknown): error is InvalidToolApprovalError;
|
|
4632
4763
|
}
|
|
4633
4764
|
|
|
4765
|
+
export declare class InvalidToolApprovalSignatureError extends AISDKError {
|
|
4766
|
+
private readonly [symbol$f];
|
|
4767
|
+
readonly approvalId: string;
|
|
4768
|
+
readonly toolCallId: string;
|
|
4769
|
+
constructor({ approvalId, toolCallId, reason, }: {
|
|
4770
|
+
approvalId: string;
|
|
4771
|
+
toolCallId: string;
|
|
4772
|
+
reason: string;
|
|
4773
|
+
});
|
|
4774
|
+
static isInstance(error: unknown): error is InvalidToolApprovalSignatureError;
|
|
4775
|
+
}
|
|
4776
|
+
|
|
4634
4777
|
export declare class InvalidToolInputError extends AISDKError {
|
|
4635
|
-
private readonly [symbol$
|
|
4778
|
+
private readonly [symbol$k];
|
|
4636
4779
|
readonly toolName: string;
|
|
4637
4780
|
readonly toolInput: string;
|
|
4638
4781
|
constructor({ toolInput, toolName, cause, message, }: {
|
|
@@ -4646,6 +4789,16 @@ export declare class InvalidToolInputError extends AISDKError {
|
|
|
4646
4789
|
|
|
4647
4790
|
declare function isAbortError(error: unknown): error is Error;
|
|
4648
4791
|
|
|
4792
|
+
/**
|
|
4793
|
+
* Returns `true` when running in a browser.
|
|
4794
|
+
*
|
|
4795
|
+
* Detection keys on the presence of a global `window`, matching the browser
|
|
4796
|
+
* check used elsewhere in this package (see `getRuntimeEnvironmentUserAgent`)
|
|
4797
|
+
* so the SDK has a single, consistent definition of "browser". Server runtimes
|
|
4798
|
+
* (Node.js, Deno, Bun, edge/workers) do not define `window`.
|
|
4799
|
+
*/
|
|
4800
|
+
declare function isBrowserRuntime(globalThisAny?: any): boolean;
|
|
4801
|
+
|
|
4649
4802
|
/**
|
|
4650
4803
|
* Check if a message part is a data part.
|
|
4651
4804
|
*/
|
|
@@ -4660,17 +4813,18 @@ export declare function isDataUIPart<DATA_TYPES extends UIDataTypes>(part: UIMes
|
|
|
4660
4813
|
*/
|
|
4661
4814
|
export declare function isDeepEqualData(obj1: any, obj2: any): boolean;
|
|
4662
4815
|
|
|
4816
|
+
/**
|
|
4817
|
+
* Check if a message part is a dynamic tool part.
|
|
4818
|
+
*
|
|
4819
|
+
* Dynamic tools are tools for which the input and output types are unknown.
|
|
4820
|
+
*/
|
|
4821
|
+
export declare function isDynamicToolUIPart(part: UIMessagePart<UIDataTypes, UITools>): part is DynamicToolUIPart;
|
|
4822
|
+
|
|
4663
4823
|
/**
|
|
4664
4824
|
* Type guard to check if a message part is a file part.
|
|
4665
4825
|
*/
|
|
4666
4826
|
export declare function isFileUIPart(part: UIMessagePart<UIDataTypes, UITools>): part is FileUIPart;
|
|
4667
4827
|
|
|
4668
|
-
declare function isJSONArray(value: unknown): value is JSONArray;
|
|
4669
|
-
|
|
4670
|
-
declare function isJSONObject(value: unknown): value is JSONObject;
|
|
4671
|
-
|
|
4672
|
-
declare function isJSONValue(value: unknown): value is JSONValue_2;
|
|
4673
|
-
|
|
4674
4828
|
export declare function isLoopFinished(): StopCondition<any>;
|
|
4675
4829
|
|
|
4676
4830
|
/**
|
|
@@ -4689,6 +4843,20 @@ declare function isParsableJson(input: string): boolean;
|
|
|
4689
4843
|
*/
|
|
4690
4844
|
export declare function isReasoningUIPart(part: UIMessagePart<UIDataTypes, UITools>): part is ReasoningUIPart;
|
|
4691
4845
|
|
|
4846
|
+
/**
|
|
4847
|
+
* Returns true when `url` has the same origin (scheme + host + port) as
|
|
4848
|
+
* `baseUrl`.
|
|
4849
|
+
*
|
|
4850
|
+
* Used to decide whether provider credentials may be attached to a request to a
|
|
4851
|
+
* URL taken from a provider response (e.g. a polling or media-download URL).
|
|
4852
|
+
* Credentials must only be sent to the provider's own origin; a response that
|
|
4853
|
+
* names a foreign host (a CDN, or an attacker-controlled host if the response
|
|
4854
|
+
* is tampered with) must not receive the API key.
|
|
4855
|
+
*
|
|
4856
|
+
* Returns false if either value is not a valid absolute URL (fail-closed).
|
|
4857
|
+
*/
|
|
4858
|
+
declare function isSameOrigin(url: string, baseUrl: string): boolean;
|
|
4859
|
+
|
|
4692
4860
|
/**
|
|
4693
4861
|
* Check if a message part is a static tool part.
|
|
4694
4862
|
*
|
|
@@ -4779,7 +4947,7 @@ export declare type JSONValue = JSONValue_2;
|
|
|
4779
4947
|
*/
|
|
4780
4948
|
declare type JSONValue_2 = null | string | number | boolean | JSONObject | JSONArray;
|
|
4781
4949
|
|
|
4782
|
-
declare const KNOWN_MODEL_TYPES: readonly ["embedding", "image", "language", "reranking", "video"];
|
|
4950
|
+
declare const KNOWN_MODEL_TYPES: readonly ["embedding", "image", "language", "reranking", "speech", "transcription", "video"];
|
|
4783
4951
|
|
|
4784
4952
|
declare type KnownModelType = (typeof KNOWN_MODEL_TYPES)[number];
|
|
4785
4953
|
|
|
@@ -5235,84 +5403,6 @@ declare type LanguageModelV2Message = ({
|
|
|
5235
5403
|
providerOptions?: SharedV2ProviderOptions;
|
|
5236
5404
|
};
|
|
5237
5405
|
|
|
5238
|
-
/**
|
|
5239
|
-
* Experimental middleware for LanguageModelV2.
|
|
5240
|
-
* This type defines the structure for middleware that can be used to modify
|
|
5241
|
-
* the behavior of LanguageModelV2 operations.
|
|
5242
|
-
*/
|
|
5243
|
-
declare type LanguageModelV2Middleware = {
|
|
5244
|
-
/**
|
|
5245
|
-
* Middleware specification version. Use `v2` for the current version.
|
|
5246
|
-
*/
|
|
5247
|
-
middlewareVersion?: 'v2' | undefined;
|
|
5248
|
-
/**
|
|
5249
|
-
* Override the provider name if desired.
|
|
5250
|
-
* @param options.model - The language model instance.
|
|
5251
|
-
*/
|
|
5252
|
-
overrideProvider?: (options: {
|
|
5253
|
-
model: LanguageModelV2;
|
|
5254
|
-
}) => string;
|
|
5255
|
-
/**
|
|
5256
|
-
* Override the model ID if desired.
|
|
5257
|
-
* @param options.model - The language model instance.
|
|
5258
|
-
*/
|
|
5259
|
-
overrideModelId?: (options: {
|
|
5260
|
-
model: LanguageModelV2;
|
|
5261
|
-
}) => string;
|
|
5262
|
-
/**
|
|
5263
|
-
* Override the supported URLs if desired.
|
|
5264
|
-
* @param options.model - The language model instance.
|
|
5265
|
-
*/
|
|
5266
|
-
overrideSupportedUrls?: (options: {
|
|
5267
|
-
model: LanguageModelV2;
|
|
5268
|
-
}) => PromiseLike<Record<string, RegExp[]>> | Record<string, RegExp[]>;
|
|
5269
|
-
/**
|
|
5270
|
-
* Transforms the parameters before they are passed to the language model.
|
|
5271
|
-
* @param options - Object containing the type of operation and the parameters.
|
|
5272
|
-
* @param options.type - The type of operation ('generate' or 'stream').
|
|
5273
|
-
* @param options.params - The original parameters for the language model call.
|
|
5274
|
-
* @returns A promise that resolves to the transformed parameters.
|
|
5275
|
-
*/
|
|
5276
|
-
transformParams?: (options: {
|
|
5277
|
-
type: 'generate' | 'stream';
|
|
5278
|
-
params: LanguageModelV2CallOptions;
|
|
5279
|
-
model: LanguageModelV2;
|
|
5280
|
-
}) => PromiseLike<LanguageModelV2CallOptions>;
|
|
5281
|
-
/**
|
|
5282
|
-
* Wraps the generate operation of the language model.
|
|
5283
|
-
* @param options - Object containing the generate function, parameters, and model.
|
|
5284
|
-
* @param options.doGenerate - The original generate function.
|
|
5285
|
-
* @param options.doStream - The original stream function.
|
|
5286
|
-
* @param options.params - The parameters for the generate call. If the
|
|
5287
|
-
* `transformParams` middleware is used, this will be the transformed parameters.
|
|
5288
|
-
* @param options.model - The language model instance.
|
|
5289
|
-
* @returns A promise that resolves to the result of the generate operation.
|
|
5290
|
-
*/
|
|
5291
|
-
wrapGenerate?: (options: {
|
|
5292
|
-
doGenerate: () => ReturnType<LanguageModelV2['doGenerate']>;
|
|
5293
|
-
doStream: () => ReturnType<LanguageModelV2['doStream']>;
|
|
5294
|
-
params: LanguageModelV2CallOptions;
|
|
5295
|
-
model: LanguageModelV2;
|
|
5296
|
-
}) => Promise<Awaited<ReturnType<LanguageModelV2['doGenerate']>>>;
|
|
5297
|
-
/**
|
|
5298
|
-
* Wraps the stream operation of the language model.
|
|
5299
|
-
*
|
|
5300
|
-
* @param options - Object containing the stream function, parameters, and model.
|
|
5301
|
-
* @param options.doGenerate - The original generate function.
|
|
5302
|
-
* @param options.doStream - The original stream function.
|
|
5303
|
-
* @param options.params - The parameters for the stream call. If the
|
|
5304
|
-
* `transformParams` middleware is used, this will be the transformed parameters.
|
|
5305
|
-
* @param options.model - The language model instance.
|
|
5306
|
-
* @returns A promise that resolves to the result of the stream operation.
|
|
5307
|
-
*/
|
|
5308
|
-
wrapStream?: (options: {
|
|
5309
|
-
doGenerate: () => ReturnType<LanguageModelV2['doGenerate']>;
|
|
5310
|
-
doStream: () => ReturnType<LanguageModelV2['doStream']>;
|
|
5311
|
-
params: LanguageModelV2CallOptions;
|
|
5312
|
-
model: LanguageModelV2;
|
|
5313
|
-
}) => PromiseLike<Awaited<ReturnType<LanguageModelV2['doStream']>>>;
|
|
5314
|
-
};
|
|
5315
|
-
|
|
5316
5406
|
/**
|
|
5317
5407
|
* A prompt is a list of messages.
|
|
5318
5408
|
*
|
|
@@ -7132,7 +7222,7 @@ export declare class NoSuchProviderError extends NoSuchModelError {
|
|
|
7132
7222
|
}
|
|
7133
7223
|
|
|
7134
7224
|
export declare class NoSuchToolError extends AISDKError {
|
|
7135
|
-
private readonly [symbol$
|
|
7225
|
+
private readonly [symbol$j];
|
|
7136
7226
|
readonly toolName: string;
|
|
7137
7227
|
readonly availableTools: string[] | undefined;
|
|
7138
7228
|
constructor({ toolName, availableTools, message, }: {
|
|
@@ -7854,11 +7944,12 @@ export declare function pipeAgentUIStreamToResponse<CALL_OPTIONS = never, TOOLS
|
|
|
7854
7944
|
* @param options.statusText - Optional HTTP status text.
|
|
7855
7945
|
* @param options.headers - Optional response headers.
|
|
7856
7946
|
* @param options.textStream - The text stream to pipe.
|
|
7947
|
+
* @returns A promise that resolves when the stream has been written.
|
|
7857
7948
|
*/
|
|
7858
7949
|
export declare function pipeTextStreamToResponse({ response, status, statusText, headers, textStream, }: {
|
|
7859
7950
|
response: ServerResponse;
|
|
7860
7951
|
textStream: ReadableStream<string>;
|
|
7861
|
-
} & ResponseInit): void
|
|
7952
|
+
} & ResponseInit): Promise<void>;
|
|
7862
7953
|
|
|
7863
7954
|
/**
|
|
7864
7955
|
* Pipes a UI message stream to a Node.js ServerResponse object.
|
|
@@ -7870,11 +7961,12 @@ export declare function pipeTextStreamToResponse({ response, status, statusText,
|
|
|
7870
7961
|
* @param options.headers - Additional HTTP headers to include in the response.
|
|
7871
7962
|
* @param options.stream - The UI message chunk stream to send.
|
|
7872
7963
|
* @param options.consumeSseStream - Optional callback to consume a copy of the SSE stream independently.
|
|
7964
|
+
* @returns A promise that resolves when the stream has been written.
|
|
7873
7965
|
*/
|
|
7874
7966
|
export declare function pipeUIMessageStreamToResponse({ response, status, statusText, headers, stream, consumeSseStream, }: {
|
|
7875
7967
|
response: ServerResponse;
|
|
7876
7968
|
stream: ReadableStream<UIMessageChunk>;
|
|
7877
|
-
} & UIMessageStreamResponseInit): void
|
|
7969
|
+
} & UIMessageStreamResponseInit): Promise<void>;
|
|
7878
7970
|
|
|
7879
7971
|
declare const postFormDataToApi: <T>({ url, headers, formData, failedResponseHandler, successfulResponseHandler, abortSignal, fetch, }: {
|
|
7880
7972
|
url: string;
|
|
@@ -7961,6 +8053,8 @@ export declare type PrepareSendMessagesRequest<UI_MESSAGE extends UIMessage> = (
|
|
|
7961
8053
|
api?: string;
|
|
7962
8054
|
}>;
|
|
7963
8055
|
|
|
8056
|
+
declare type PrepareStepCallSettings = Pick<CallSettings, 'maxOutputTokens' | 'temperature' | 'topP' | 'topK' | 'presencePenalty' | 'frequencyPenalty' | 'stopSequences' | 'seed'>;
|
|
8057
|
+
|
|
7964
8058
|
/**
|
|
7965
8059
|
* Function that you can use to provide different settings for a step.
|
|
7966
8060
|
*
|
|
@@ -7999,9 +8093,13 @@ export declare type PrepareStepFunction<TOOLS extends Record<string, Tool> = Rec
|
|
|
7999
8093
|
|
|
8000
8094
|
/**
|
|
8001
8095
|
* The result type returned by a {@link PrepareStepFunction},
|
|
8002
|
-
* allowing per-step overrides of model, tools, or
|
|
8096
|
+
* allowing per-step overrides of model call settings, model, tools, or
|
|
8097
|
+
* messages.
|
|
8098
|
+
*
|
|
8099
|
+
* Model call setting overrides apply only to the current step. Undefined
|
|
8100
|
+
* settings fall back to the outer call settings.
|
|
8003
8101
|
*/
|
|
8004
|
-
export declare type PrepareStepResult<TOOLS extends Record<string, Tool> = Record<string, Tool>> = {
|
|
8102
|
+
export declare type PrepareStepResult<TOOLS extends Record<string, Tool> = Record<string, Tool>> = ({
|
|
8005
8103
|
/**
|
|
8006
8104
|
* Optionally override which LanguageModel instance is used for this step.
|
|
8007
8105
|
*/
|
|
@@ -8038,7 +8136,7 @@ export declare type PrepareStepResult<TOOLS extends Record<string, Tool> = Recor
|
|
|
8038
8136
|
* container IDs for Anthropic's code execution.
|
|
8039
8137
|
*/
|
|
8040
8138
|
providerOptions?: ProviderOptions;
|
|
8041
|
-
} | undefined;
|
|
8139
|
+
} & PrepareStepCallSettings) | undefined;
|
|
8042
8140
|
|
|
8043
8141
|
/**
|
|
8044
8142
|
* Prompt part of the AI function options.
|
|
@@ -8710,20 +8808,48 @@ declare type ResponseHandler<RETURN_TYPE> = (options: {
|
|
|
8710
8808
|
*/
|
|
8711
8809
|
declare type ResponseMessage = AssistantModelMessage | ToolModelMessage;
|
|
8712
8810
|
|
|
8811
|
+
declare type RetryDelayProvider = ({ error, exponentialBackoffDelay, }: {
|
|
8812
|
+
error: unknown;
|
|
8813
|
+
exponentialBackoffDelay: number;
|
|
8814
|
+
}) => number;
|
|
8815
|
+
|
|
8713
8816
|
export declare class RetryError extends AISDKError {
|
|
8714
8817
|
private readonly [symbol$1_2];
|
|
8715
|
-
readonly reason:
|
|
8818
|
+
readonly reason: RetryErrorReason_2;
|
|
8716
8819
|
readonly lastError: unknown;
|
|
8717
8820
|
readonly errors: Array<unknown>;
|
|
8718
8821
|
constructor({ message, reason, errors, }: {
|
|
8719
8822
|
message: string;
|
|
8720
|
-
reason:
|
|
8823
|
+
reason: RetryErrorReason_2;
|
|
8721
8824
|
errors: Array<unknown>;
|
|
8722
8825
|
});
|
|
8723
8826
|
static isInstance(error: unknown): error is RetryError;
|
|
8724
8827
|
}
|
|
8725
8828
|
|
|
8726
|
-
declare type
|
|
8829
|
+
declare type RetryErrorFactory = ({ message, reason, errors, }: {
|
|
8830
|
+
message: string;
|
|
8831
|
+
reason: RetryErrorReason;
|
|
8832
|
+
errors: Array<unknown>;
|
|
8833
|
+
}) => unknown;
|
|
8834
|
+
|
|
8835
|
+
declare type RetryErrorReason = 'maxRetriesExceeded' | 'errorNotRetryable';
|
|
8836
|
+
|
|
8837
|
+
declare type RetryErrorReason_2 = 'maxRetriesExceeded' | 'errorNotRetryable' | 'abort';
|
|
8838
|
+
|
|
8839
|
+
declare type RetryFunction = <OUTPUT>(fn: () => PromiseLike<OUTPUT>) => PromiseLike<OUTPUT>;
|
|
8840
|
+
|
|
8841
|
+
/**
|
|
8842
|
+
* Retries a failed operation with exponential backoff.
|
|
8843
|
+
*/
|
|
8844
|
+
declare const retryWithExponentialBackoff: ({ maxRetries, initialDelayInMs, backoffFactor, abortSignal, shouldRetry, getDelayInMs, createRetryError, }: {
|
|
8845
|
+
maxRetries?: number;
|
|
8846
|
+
initialDelayInMs?: number;
|
|
8847
|
+
backoffFactor?: number;
|
|
8848
|
+
abortSignal?: AbortSignal;
|
|
8849
|
+
shouldRetry: ShouldRetryFunction;
|
|
8850
|
+
getDelayInMs?: RetryDelayProvider;
|
|
8851
|
+
createRetryError?: RetryErrorFactory;
|
|
8852
|
+
}) => RetryFunction;
|
|
8727
8853
|
|
|
8728
8854
|
/**
|
|
8729
8855
|
* Safely parses a JSON string and returns the result as an object of type `unknown`.
|
|
@@ -8822,6 +8948,8 @@ export declare type Schema<OBJECT = unknown> = {
|
|
|
8822
8948
|
*/
|
|
8823
8949
|
declare const schemaSymbol: unique symbol;
|
|
8824
8950
|
|
|
8951
|
+
declare function secureJsonParse(text: string): any;
|
|
8952
|
+
|
|
8825
8953
|
export declare class SerialJobExecutor {
|
|
8826
8954
|
private queue;
|
|
8827
8955
|
private isProcessing;
|
|
@@ -8968,6 +9096,8 @@ declare type SharedV3Warning = {
|
|
|
8968
9096
|
message: string;
|
|
8969
9097
|
};
|
|
8970
9098
|
|
|
9099
|
+
declare type ShouldRetryFunction = (error: unknown) => boolean | Promise<boolean>;
|
|
9100
|
+
|
|
8971
9101
|
/**
|
|
8972
9102
|
* Creates a ReadableStream that emits the provided values with an optional delay between each value.
|
|
8973
9103
|
*
|
|
@@ -9726,7 +9856,11 @@ declare namespace StandardJSONSchemaV1 {
|
|
|
9726
9856
|
type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
|
|
9727
9857
|
}
|
|
9728
9858
|
|
|
9729
|
-
declare type StandardSchema<SCHEMA = any> = StandardSchemaV1<unknown, SCHEMA> &
|
|
9859
|
+
declare type StandardSchema<SCHEMA = any> = StandardSchemaV1<unknown, SCHEMA> & {
|
|
9860
|
+
readonly '~standard': StandardSchemaV1.Props<unknown, SCHEMA> & {
|
|
9861
|
+
readonly jsonSchema?: StandardJSONSchemaV1.Converter;
|
|
9862
|
+
};
|
|
9863
|
+
};
|
|
9730
9864
|
|
|
9731
9865
|
/** The Standard Schema interface. */
|
|
9732
9866
|
declare interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
@@ -9901,7 +10035,8 @@ export declare type StepResult<TOOLS extends ToolSet> = {
|
|
|
9901
10035
|
*/
|
|
9902
10036
|
readonly content: Array<ContentPart<TOOLS>>;
|
|
9903
10037
|
/**
|
|
9904
|
-
* The generated
|
|
10038
|
+
* The concatenation of all text parts generated in this step.
|
|
10039
|
+
* It is an empty string if the step contains no text parts.
|
|
9905
10040
|
*/
|
|
9906
10041
|
readonly text: string;
|
|
9907
10042
|
/**
|
|
@@ -10239,7 +10374,7 @@ export declare interface StreamObjectResult<PARTIAL, RESULT, ELEMENT_STREAM> {
|
|
|
10239
10374
|
* @param response A Node.js response-like object (ServerResponse).
|
|
10240
10375
|
* @param init Optional headers, status code, and status text.
|
|
10241
10376
|
*/
|
|
10242
|
-
pipeTextStreamToResponse(response: ServerResponse_2, init?: ResponseInit): void
|
|
10377
|
+
pipeTextStreamToResponse(response: ServerResponse_2, init?: ResponseInit): Promise<void>;
|
|
10243
10378
|
/**
|
|
10244
10379
|
* Creates a simple text stream response.
|
|
10245
10380
|
* The response has a `Content-Type` header set to `text/plain; charset=utf-8`.
|
|
@@ -10328,7 +10463,7 @@ declare interface StreamOptions {
|
|
|
10328
10463
|
* @returns
|
|
10329
10464
|
* A result object for accessing different stream types and additional information.
|
|
10330
10465
|
*/
|
|
10331
|
-
export declare function streamText<TOOLS extends ToolSet, OUTPUT extends Output_2 = Output_2<string, string, never>>({ model, tools, toolChoice, system, prompt, messages, allowSystemInMessages, maxRetries, abortSignal, timeout, headers, stopWhen, experimental_output, output, experimental_telemetry: telemetry, prepareStep, providerOptions, experimental_activeTools, activeTools, experimental_repairToolCall: repairToolCall, experimental_transform: transform, experimental_download: download, includeRawChunks, onChunk, onError, onFinish, onAbort, onStepFinish, experimental_onStart: onStart, experimental_onStepStart: onStepStart, experimental_onToolCallStart: onToolCallStart, experimental_onToolCallFinish: onToolCallFinish, experimental_context, experimental_include: include, _internal: { now, generateId }, ...settings }: CallSettings & Prompt & {
|
|
10466
|
+
export declare function streamText<TOOLS extends ToolSet, OUTPUT extends Output_2 = Output_2<string, string, never>>({ model, tools, toolChoice, system, prompt, messages, allowSystemInMessages, maxRetries, abortSignal, timeout, headers, stopWhen, experimental_output, output, experimental_telemetry: telemetry, prepareStep, providerOptions, experimental_activeTools, activeTools, experimental_repairToolCall: repairToolCall, experimental_transform: transform, experimental_download: download, includeRawChunks, onChunk, onError, onFinish, onAbort, onStepFinish, experimental_onStart: onStart, experimental_onStepStart: onStepStart, experimental_onToolCallStart: onToolCallStart, experimental_onToolCallFinish: onToolCallFinish, experimental_context, experimental_toolApprovalSecret, experimental_include: include, _internal: { now, generateId }, ...settings }: CallSettings & Prompt & {
|
|
10332
10467
|
/**
|
|
10333
10468
|
* The language model to use.
|
|
10334
10469
|
*/
|
|
@@ -10461,6 +10596,14 @@ export declare function streamText<TOOLS extends ToolSet, OUTPUT extends Output_
|
|
|
10461
10596
|
* @default undefined
|
|
10462
10597
|
*/
|
|
10463
10598
|
experimental_context?: unknown;
|
|
10599
|
+
/**
|
|
10600
|
+
* Secret for HMAC-signing tool approval requests. When set, the server
|
|
10601
|
+
* signs each approval request at issuance and verifies the signature when
|
|
10602
|
+
* the approval is replayed, preventing client-forged approvals.
|
|
10603
|
+
*
|
|
10604
|
+
* Experimental (can break in patch releases).
|
|
10605
|
+
*/
|
|
10606
|
+
experimental_toolApprovalSecret?: string | Uint8Array;
|
|
10464
10607
|
/**
|
|
10465
10608
|
* Settings for controlling what data is included in step results.
|
|
10466
10609
|
* Disabling inclusion can help reduce memory usage when processing
|
|
@@ -10709,8 +10852,9 @@ export declare interface StreamTextResult<TOOLS extends ToolSet, OUTPUT extends
|
|
|
10709
10852
|
readonly providerMetadata: PromiseLike<ProviderMetadata | undefined>;
|
|
10710
10853
|
/**
|
|
10711
10854
|
* A text stream that returns only the generated text deltas. You can use it
|
|
10712
|
-
* as either an AsyncIterable or a ReadableStream.
|
|
10713
|
-
* stream
|
|
10855
|
+
* as either an AsyncIterable or a ReadableStream. Error parts are not
|
|
10856
|
+
* surfaced in this stream. Use the `onError` callback or `fullStream` to
|
|
10857
|
+
* observe them.
|
|
10714
10858
|
*/
|
|
10715
10859
|
readonly textStream: AsyncIterableStream<string>;
|
|
10716
10860
|
/**
|
|
@@ -10757,7 +10901,7 @@ export declare interface StreamTextResult<TOOLS extends ToolSet, OUTPUT extends
|
|
|
10757
10901
|
/**
|
|
10758
10902
|
* Writes UI message stream output to a Node.js response-like object.
|
|
10759
10903
|
*/
|
|
10760
|
-
pipeUIMessageStreamToResponse<UI_MESSAGE extends UIMessage>(response: ServerResponse, options?: UIMessageStreamResponseInit & UIMessageStreamOptions<UI_MESSAGE>): void
|
|
10904
|
+
pipeUIMessageStreamToResponse<UI_MESSAGE extends UIMessage>(response: ServerResponse, options?: UIMessageStreamResponseInit & UIMessageStreamOptions<UI_MESSAGE>): Promise<void>;
|
|
10761
10905
|
/**
|
|
10762
10906
|
* Writes text delta output to a Node.js response-like object.
|
|
10763
10907
|
* It sets a `Content-Type` header to `text/plain; charset=utf-8` and
|
|
@@ -10766,7 +10910,7 @@ export declare interface StreamTextResult<TOOLS extends ToolSet, OUTPUT extends
|
|
|
10766
10910
|
* @param response A Node.js response-like object (ServerResponse).
|
|
10767
10911
|
* @param init Optional headers, status code, and status text.
|
|
10768
10912
|
*/
|
|
10769
|
-
pipeTextStreamToResponse(response: ServerResponse, init?: ResponseInit): void
|
|
10913
|
+
pipeTextStreamToResponse(response: ServerResponse, init?: ResponseInit): Promise<void>;
|
|
10770
10914
|
/**
|
|
10771
10915
|
* Converts the result to a streamed response object with a stream data part stream.
|
|
10772
10916
|
*
|
|
@@ -10841,8 +10985,6 @@ declare const symbol$9_2: unique symbol;
|
|
|
10841
10985
|
|
|
10842
10986
|
declare const symbol$a: unique symbol;
|
|
10843
10987
|
|
|
10844
|
-
declare const symbol$a_2: unique symbol;
|
|
10845
|
-
|
|
10846
10988
|
declare const symbol$b: unique symbol;
|
|
10847
10989
|
|
|
10848
10990
|
declare const symbol$b_2: unique symbol;
|
|
@@ -10867,6 +11009,8 @@ declare const symbol$i: unique symbol;
|
|
|
10867
11009
|
|
|
10868
11010
|
declare const symbol$j: unique symbol;
|
|
10869
11011
|
|
|
11012
|
+
declare const symbol$k: unique symbol;
|
|
11013
|
+
|
|
10870
11014
|
declare const symbol: unique symbol;
|
|
10871
11015
|
|
|
10872
11016
|
declare const symbol_2: unique symbol;
|
|
@@ -11160,8 +11304,8 @@ export declare type Tool<INPUT extends JSONValue_2 | unknown | never = any, OUTP
|
|
|
11160
11304
|
*/
|
|
11161
11305
|
strict?: boolean;
|
|
11162
11306
|
/**
|
|
11163
|
-
* Optional function that is called when the
|
|
11164
|
-
*
|
|
11307
|
+
* Optional function that is called when the model starts generating the tool input.
|
|
11308
|
+
* In non-streaming contexts, it is called immediately before `onInputAvailable`.
|
|
11165
11309
|
*/
|
|
11166
11310
|
onInputStart?: (options: ToolExecutionOptions) => void | PromiseLike<void>;
|
|
11167
11311
|
/**
|
|
@@ -11183,6 +11327,8 @@ export declare type Tool<INPUT extends JSONValue_2 | unknown | never = any, OUTP
|
|
|
11183
11327
|
* Optional conversion function that maps the tool result to an output that can be used by the language model.
|
|
11184
11328
|
*
|
|
11185
11329
|
* If not provided, the tool result will be sent as a JSON object.
|
|
11330
|
+
*
|
|
11331
|
+
* This function is invoked on the server by `convertToModelMessages`, so ensure that you pass the same "tools" (ToolSet) to both "convertToModelMessages" and "streamText" (or other generation APIs).
|
|
11186
11332
|
*/
|
|
11187
11333
|
toModelOutput?: (options: {
|
|
11188
11334
|
/**
|
|
@@ -11262,6 +11408,11 @@ export declare type ToolApprovalRequest = {
|
|
|
11262
11408
|
* ID of the tool call that the approval request is for.
|
|
11263
11409
|
*/
|
|
11264
11410
|
toolCallId: string;
|
|
11411
|
+
/**
|
|
11412
|
+
* HMAC-SHA256 signature binding this approval to its tool call.
|
|
11413
|
+
* Present only when `experimental_toolApprovalSecret` is configured.
|
|
11414
|
+
*/
|
|
11415
|
+
signature?: string;
|
|
11265
11416
|
};
|
|
11266
11417
|
|
|
11267
11418
|
/**
|
|
@@ -11279,6 +11430,10 @@ export declare type ToolApprovalRequestOutput<TOOLS extends ToolSet> = {
|
|
|
11279
11430
|
* Tool call that the approval request is for.
|
|
11280
11431
|
*/
|
|
11281
11432
|
toolCall: TypedToolCall<TOOLS>;
|
|
11433
|
+
/**
|
|
11434
|
+
* HMAC-SHA256 signature binding this approval request to its tool call.
|
|
11435
|
+
*/
|
|
11436
|
+
signature?: string;
|
|
11282
11437
|
};
|
|
11283
11438
|
|
|
11284
11439
|
/**
|
|
@@ -11520,6 +11675,15 @@ declare type ToolLoopAgentSettings<CALL_OPTIONS = never, TOOLS extends ToolSet =
|
|
|
11520
11675
|
* It can be a string, or, if you need to pass additional provider options (e.g. for caching), a `SystemModelMessage`.
|
|
11521
11676
|
*/
|
|
11522
11677
|
instructions?: string | SystemModelMessage | Array<SystemModelMessage>;
|
|
11678
|
+
/**
|
|
11679
|
+
* Whether system messages are allowed in the `prompt` or `messages` fields.
|
|
11680
|
+
*
|
|
11681
|
+
* When disabled, system messages must be provided through the `instructions`
|
|
11682
|
+
* option.
|
|
11683
|
+
*
|
|
11684
|
+
* @default false
|
|
11685
|
+
*/
|
|
11686
|
+
allowSystemInMessages?: boolean;
|
|
11523
11687
|
/**
|
|
11524
11688
|
* The language model to use.
|
|
11525
11689
|
*/
|
|
@@ -11596,8 +11760,18 @@ declare type ToolLoopAgentSettings<CALL_OPTIONS = never, TOOLS extends ToolSet =
|
|
|
11596
11760
|
* Prepare the parameters for the generateText or streamText call.
|
|
11597
11761
|
*
|
|
11598
11762
|
* You can use this to have templates based on call options.
|
|
11763
|
+
*
|
|
11764
|
+
* The design requires you to pass call parameters as follows to
|
|
11765
|
+
* allow for the removal of parameters from the original settings
|
|
11766
|
+
* by setting them to `undefined`:
|
|
11767
|
+
*
|
|
11768
|
+
* ```
|
|
11769
|
+
* prepareCall: ({ options, ...rest }) => ({
|
|
11770
|
+
* ...rest,
|
|
11771
|
+
* }),
|
|
11772
|
+
* ```
|
|
11599
11773
|
*/
|
|
11600
|
-
prepareCall?: (options: Omit<AgentCallParameters<CALL_OPTIONS, NoInfer<TOOLS>>, 'onStepFinish'> & Pick<ToolLoopAgentSettings<CALL_OPTIONS, TOOLS, OUTPUT>, 'model' | 'tools' | 'maxOutputTokens' | 'temperature' | 'topP' | 'topK' | 'presencePenalty' | 'frequencyPenalty' | 'stopSequences' | 'seed' | 'headers' | 'instructions' | 'stopWhen' | 'experimental_telemetry' | 'activeTools' | 'providerOptions' | 'experimental_context' | 'experimental_download'>) => MaybePromiseLike<Pick<ToolLoopAgentSettings<CALL_OPTIONS, TOOLS, OUTPUT>, 'model' | 'tools' | 'maxOutputTokens' | 'temperature' | 'topP' | 'topK' | 'presencePenalty' | 'frequencyPenalty' | 'stopSequences' | 'seed' | 'headers' | 'instructions' | 'stopWhen' | 'experimental_telemetry' | 'activeTools' | 'providerOptions' | 'experimental_context' | 'experimental_download'> & Omit<Prompt, 'system'>>;
|
|
11774
|
+
prepareCall?: (options: Omit<AgentCallParameters<CALL_OPTIONS, NoInfer<TOOLS>>, 'onStepFinish'> & Pick<ToolLoopAgentSettings<CALL_OPTIONS, TOOLS, OUTPUT>, 'model' | 'tools' | 'maxOutputTokens' | 'temperature' | 'topP' | 'topK' | 'presencePenalty' | 'frequencyPenalty' | 'stopSequences' | 'seed' | 'headers' | 'instructions' | 'allowSystemInMessages' | 'stopWhen' | 'experimental_telemetry' | 'activeTools' | 'providerOptions' | 'experimental_context' | 'experimental_download'>) => MaybePromiseLike<Pick<ToolLoopAgentSettings<CALL_OPTIONS, TOOLS, OUTPUT>, 'model' | 'tools' | 'maxOutputTokens' | 'temperature' | 'topP' | 'topK' | 'presencePenalty' | 'frequencyPenalty' | 'stopSequences' | 'seed' | 'headers' | 'instructions' | 'allowSystemInMessages' | 'stopWhen' | 'experimental_telemetry' | 'activeTools' | 'providerOptions' | 'experimental_context' | 'experimental_download'> & Omit<Prompt, 'system'>>;
|
|
11601
11775
|
};
|
|
11602
11776
|
export { ToolLoopAgentSettings as Experimental_AgentSettings }
|
|
11603
11777
|
export { ToolLoopAgentSettings }
|
|
@@ -12507,6 +12681,7 @@ export declare type UIMessageChunk<METADATA = unknown, DATA_TYPES extends UIData
|
|
|
12507
12681
|
type: 'tool-approval-request';
|
|
12508
12682
|
approvalId: string;
|
|
12509
12683
|
toolCallId: string;
|
|
12684
|
+
signature?: string;
|
|
12510
12685
|
} | {
|
|
12511
12686
|
type: 'tool-output-available';
|
|
12512
12687
|
toolCallId: string;
|
|
@@ -12578,135 +12753,7 @@ export declare type UIMessageChunk<METADATA = unknown, DATA_TYPES extends UIData
|
|
|
12578
12753
|
messageMetadata: METADATA;
|
|
12579
12754
|
};
|
|
12580
12755
|
|
|
12581
|
-
export declare const uiMessageChunkSchema: _ai_sdk_provider_utils.LazySchema<
|
|
12582
|
-
type: "text-start";
|
|
12583
|
-
id: string;
|
|
12584
|
-
providerMetadata?: _ai_sdk_provider.SharedV3ProviderMetadata | undefined;
|
|
12585
|
-
} | {
|
|
12586
|
-
type: "text-delta";
|
|
12587
|
-
id: string;
|
|
12588
|
-
delta: string;
|
|
12589
|
-
providerMetadata?: _ai_sdk_provider.SharedV3ProviderMetadata | undefined;
|
|
12590
|
-
} | {
|
|
12591
|
-
type: "text-end";
|
|
12592
|
-
id: string;
|
|
12593
|
-
providerMetadata?: _ai_sdk_provider.SharedV3ProviderMetadata | undefined;
|
|
12594
|
-
} | {
|
|
12595
|
-
type: "error";
|
|
12596
|
-
errorText: string;
|
|
12597
|
-
} | {
|
|
12598
|
-
type: "tool-input-start";
|
|
12599
|
-
toolCallId: string;
|
|
12600
|
-
toolName: string;
|
|
12601
|
-
providerExecuted?: boolean | undefined;
|
|
12602
|
-
providerMetadata?: _ai_sdk_provider.SharedV3ProviderMetadata | undefined;
|
|
12603
|
-
toolMetadata?: JSONObject | undefined;
|
|
12604
|
-
dynamic?: boolean | undefined;
|
|
12605
|
-
title?: string | undefined;
|
|
12606
|
-
} | {
|
|
12607
|
-
type: "tool-input-delta";
|
|
12608
|
-
toolCallId: string;
|
|
12609
|
-
inputTextDelta: string;
|
|
12610
|
-
} | {
|
|
12611
|
-
type: "tool-input-available";
|
|
12612
|
-
toolCallId: string;
|
|
12613
|
-
toolName: string;
|
|
12614
|
-
input: unknown;
|
|
12615
|
-
providerExecuted?: boolean | undefined;
|
|
12616
|
-
providerMetadata?: _ai_sdk_provider.SharedV3ProviderMetadata | undefined;
|
|
12617
|
-
toolMetadata?: JSONObject | undefined;
|
|
12618
|
-
dynamic?: boolean | undefined;
|
|
12619
|
-
title?: string | undefined;
|
|
12620
|
-
} | {
|
|
12621
|
-
type: "tool-input-error";
|
|
12622
|
-
toolCallId: string;
|
|
12623
|
-
toolName: string;
|
|
12624
|
-
input: unknown;
|
|
12625
|
-
errorText: string;
|
|
12626
|
-
providerExecuted?: boolean | undefined;
|
|
12627
|
-
providerMetadata?: _ai_sdk_provider.SharedV3ProviderMetadata | undefined;
|
|
12628
|
-
toolMetadata?: JSONObject | undefined;
|
|
12629
|
-
dynamic?: boolean | undefined;
|
|
12630
|
-
title?: string | undefined;
|
|
12631
|
-
} | {
|
|
12632
|
-
type: "tool-approval-request";
|
|
12633
|
-
approvalId: string;
|
|
12634
|
-
toolCallId: string;
|
|
12635
|
-
} | {
|
|
12636
|
-
type: "tool-output-available";
|
|
12637
|
-
toolCallId: string;
|
|
12638
|
-
output: unknown;
|
|
12639
|
-
providerExecuted?: boolean | undefined;
|
|
12640
|
-
providerMetadata?: _ai_sdk_provider.SharedV3ProviderMetadata | undefined;
|
|
12641
|
-
toolMetadata?: JSONObject | undefined;
|
|
12642
|
-
dynamic?: boolean | undefined;
|
|
12643
|
-
preliminary?: boolean | undefined;
|
|
12644
|
-
} | {
|
|
12645
|
-
type: "tool-output-error";
|
|
12646
|
-
toolCallId: string;
|
|
12647
|
-
errorText: string;
|
|
12648
|
-
providerExecuted?: boolean | undefined;
|
|
12649
|
-
providerMetadata?: _ai_sdk_provider.SharedV3ProviderMetadata | undefined;
|
|
12650
|
-
toolMetadata?: JSONObject | undefined;
|
|
12651
|
-
dynamic?: boolean | undefined;
|
|
12652
|
-
} | {
|
|
12653
|
-
type: "tool-output-denied";
|
|
12654
|
-
toolCallId: string;
|
|
12655
|
-
} | {
|
|
12656
|
-
type: "reasoning-start";
|
|
12657
|
-
id: string;
|
|
12658
|
-
providerMetadata?: _ai_sdk_provider.SharedV3ProviderMetadata | undefined;
|
|
12659
|
-
} | {
|
|
12660
|
-
type: "reasoning-delta";
|
|
12661
|
-
id: string;
|
|
12662
|
-
delta: string;
|
|
12663
|
-
providerMetadata?: _ai_sdk_provider.SharedV3ProviderMetadata | undefined;
|
|
12664
|
-
} | {
|
|
12665
|
-
type: "reasoning-end";
|
|
12666
|
-
id: string;
|
|
12667
|
-
providerMetadata?: _ai_sdk_provider.SharedV3ProviderMetadata | undefined;
|
|
12668
|
-
} | {
|
|
12669
|
-
type: "source-url";
|
|
12670
|
-
sourceId: string;
|
|
12671
|
-
url: string;
|
|
12672
|
-
title?: string | undefined;
|
|
12673
|
-
providerMetadata?: _ai_sdk_provider.SharedV3ProviderMetadata | undefined;
|
|
12674
|
-
} | {
|
|
12675
|
-
type: "source-document";
|
|
12676
|
-
sourceId: string;
|
|
12677
|
-
mediaType: string;
|
|
12678
|
-
title: string;
|
|
12679
|
-
filename?: string | undefined;
|
|
12680
|
-
providerMetadata?: _ai_sdk_provider.SharedV3ProviderMetadata | undefined;
|
|
12681
|
-
} | {
|
|
12682
|
-
type: "file";
|
|
12683
|
-
url: string;
|
|
12684
|
-
mediaType: string;
|
|
12685
|
-
providerMetadata?: _ai_sdk_provider.SharedV3ProviderMetadata | undefined;
|
|
12686
|
-
} | {
|
|
12687
|
-
type: `data-${string}`;
|
|
12688
|
-
data: unknown;
|
|
12689
|
-
id?: string | undefined;
|
|
12690
|
-
transient?: boolean | undefined;
|
|
12691
|
-
} | {
|
|
12692
|
-
type: "start-step";
|
|
12693
|
-
} | {
|
|
12694
|
-
type: "finish-step";
|
|
12695
|
-
} | {
|
|
12696
|
-
type: "start";
|
|
12697
|
-
messageId?: string | undefined;
|
|
12698
|
-
messageMetadata?: unknown;
|
|
12699
|
-
} | {
|
|
12700
|
-
type: "finish";
|
|
12701
|
-
finishReason?: "length" | "error" | "stop" | "content-filter" | "tool-calls" | "other" | undefined;
|
|
12702
|
-
messageMetadata?: unknown;
|
|
12703
|
-
} | {
|
|
12704
|
-
type: "abort";
|
|
12705
|
-
reason?: string | undefined;
|
|
12706
|
-
} | {
|
|
12707
|
-
type: "message-metadata";
|
|
12708
|
-
messageMetadata: unknown;
|
|
12709
|
-
}>;
|
|
12756
|
+
export declare const uiMessageChunkSchema: _ai_sdk_provider_utils.LazySchema<UIMessageChunk<unknown, UIDataTypes>>;
|
|
12710
12757
|
|
|
12711
12758
|
export declare type UIMessagePart<DATA_TYPES extends UIDataTypes, TOOLS extends UITools> = TextUIPart | ReasoningUIPart | ToolUIPart<TOOLS> | DynamicToolUIPart | SourceUrlUIPart | SourceDocumentUIPart | FileUIPart | DataUIPart<DATA_TYPES> | StepStartUIPart;
|
|
12712
12759
|
|
|
@@ -12893,7 +12940,7 @@ export declare type UIToolInvocation<TOOL extends UITool | Tool> = {
|
|
|
12893
12940
|
providerExecuted?: boolean;
|
|
12894
12941
|
} & ({
|
|
12895
12942
|
state: 'input-streaming';
|
|
12896
|
-
input
|
|
12943
|
+
input?: DeepPartial<asUITool<TOOL>['input']> | undefined;
|
|
12897
12944
|
output?: never;
|
|
12898
12945
|
errorText?: never;
|
|
12899
12946
|
callProviderMetadata?: ProviderMetadata;
|
|
@@ -12915,6 +12962,7 @@ export declare type UIToolInvocation<TOOL extends UITool | Tool> = {
|
|
|
12915
12962
|
id: string;
|
|
12916
12963
|
approved?: never;
|
|
12917
12964
|
reason?: never;
|
|
12965
|
+
signature?: string;
|
|
12918
12966
|
};
|
|
12919
12967
|
} | {
|
|
12920
12968
|
state: 'approval-responded';
|
|
@@ -12926,6 +12974,7 @@ export declare type UIToolInvocation<TOOL extends UITool | Tool> = {
|
|
|
12926
12974
|
id: string;
|
|
12927
12975
|
approved: boolean;
|
|
12928
12976
|
reason?: string;
|
|
12977
|
+
signature?: string;
|
|
12929
12978
|
};
|
|
12930
12979
|
} | {
|
|
12931
12980
|
state: 'output-available';
|
|
@@ -12939,6 +12988,7 @@ export declare type UIToolInvocation<TOOL extends UITool | Tool> = {
|
|
|
12939
12988
|
id: string;
|
|
12940
12989
|
approved: true;
|
|
12941
12990
|
reason?: string;
|
|
12991
|
+
signature?: string;
|
|
12942
12992
|
};
|
|
12943
12993
|
} | {
|
|
12944
12994
|
state: 'output-error';
|
|
@@ -12952,6 +13002,7 @@ export declare type UIToolInvocation<TOOL extends UITool | Tool> = {
|
|
|
12952
13002
|
id: string;
|
|
12953
13003
|
approved: true;
|
|
12954
13004
|
reason?: string;
|
|
13005
|
+
signature?: string;
|
|
12955
13006
|
};
|
|
12956
13007
|
} | {
|
|
12957
13008
|
state: 'output-denied';
|
|
@@ -12963,6 +13014,7 @@ export declare type UIToolInvocation<TOOL extends UITool | Tool> = {
|
|
|
12963
13014
|
id: string;
|
|
12964
13015
|
approved: false;
|
|
12965
13016
|
reason?: string;
|
|
13017
|
+
signature?: string;
|
|
12966
13018
|
};
|
|
12967
13019
|
});
|
|
12968
13020
|
|
|
@@ -13079,6 +13131,10 @@ export declare const userModelMessageSchema: z.ZodType<UserModelMessage>;
|
|
|
13079
13131
|
* Validates that a URL is safe to download from, blocking private/internal addresses
|
|
13080
13132
|
* to prevent SSRF attacks.
|
|
13081
13133
|
*
|
|
13134
|
+
* Note: this performs string/literal-IP checks only. It does not resolve DNS, so a
|
|
13135
|
+
* hostname that resolves to a private address is not blocked here (see callers, which
|
|
13136
|
+
* should additionally constrain egress at the network layer when handling untrusted URLs).
|
|
13137
|
+
*
|
|
13082
13138
|
* @param url - The URL string to validate.
|
|
13083
13139
|
* @throws DownloadError if the URL is unsafe.
|
|
13084
13140
|
*/
|
|
@@ -13333,6 +13389,24 @@ declare type VideoModelV3CallOptions = {
|
|
|
13333
13389
|
* The image serves as the starting frame that the model will animate.
|
|
13334
13390
|
*/
|
|
13335
13391
|
image: VideoModelV3File | undefined;
|
|
13392
|
+
/**
|
|
13393
|
+
* Role-tagged image inputs for first-last-frame generation.
|
|
13394
|
+
* Each entry declares whether it is the `first_frame` or the
|
|
13395
|
+
* `last_frame` of the generated video.
|
|
13396
|
+
*/
|
|
13397
|
+
frameImages: Array<VideoModelV3FrameImage> | undefined;
|
|
13398
|
+
/**
|
|
13399
|
+
* Reference inputs for reference-to-video generation.
|
|
13400
|
+
*
|
|
13401
|
+
* Each entry is an image or video file. Providers route each reference by
|
|
13402
|
+
* its media type (image vs. video) and warn when a reference kind is
|
|
13403
|
+
* unsupported.
|
|
13404
|
+
*/
|
|
13405
|
+
inputReferences: Array<VideoModelV3File> | undefined;
|
|
13406
|
+
/**
|
|
13407
|
+
* Whether the model should generate audio alongside the video.
|
|
13408
|
+
*/
|
|
13409
|
+
generateAudio: boolean | undefined;
|
|
13336
13410
|
/**
|
|
13337
13411
|
* Additional provider-specific options that are passed through to the provider
|
|
13338
13412
|
* as body parameters.
|
|
@@ -13383,12 +13457,40 @@ declare type VideoModelV3File = {
|
|
|
13383
13457
|
* The URL of the video or image file.
|
|
13384
13458
|
*/
|
|
13385
13459
|
url: string;
|
|
13460
|
+
/**
|
|
13461
|
+
* The media type of the referenced file, when known.
|
|
13462
|
+
* Video types: 'video/mp4', 'video/webm', 'video/quicktime'
|
|
13463
|
+
* Image types: 'image/png', 'image/jpeg', 'image/webp'
|
|
13464
|
+
*/
|
|
13465
|
+
mediaType?: string;
|
|
13386
13466
|
/**
|
|
13387
13467
|
* Optional provider-specific metadata for the file part.
|
|
13388
13468
|
*/
|
|
13389
13469
|
providerOptions?: SharedV3ProviderMetadata;
|
|
13390
13470
|
};
|
|
13391
13471
|
|
|
13472
|
+
/**
|
|
13473
|
+
* A role-tagged image input for image-to-video and first-last-frame generation.
|
|
13474
|
+
*/
|
|
13475
|
+
declare type VideoModelV3FrameImage = {
|
|
13476
|
+
/**
|
|
13477
|
+
* The image file used for this frame.
|
|
13478
|
+
*/
|
|
13479
|
+
image: VideoModelV3File;
|
|
13480
|
+
/**
|
|
13481
|
+
* Which frame this image represents.
|
|
13482
|
+
*/
|
|
13483
|
+
frameType: VideoModelV3FrameType;
|
|
13484
|
+
};
|
|
13485
|
+
|
|
13486
|
+
/**
|
|
13487
|
+
* The role a frame image plays in video generation.
|
|
13488
|
+
*
|
|
13489
|
+
* - `first_frame`: the starting frame the model animates from
|
|
13490
|
+
* - `last_frame`: the ending frame the model animates towards
|
|
13491
|
+
*/
|
|
13492
|
+
declare type VideoModelV3FrameType = 'first_frame' | 'last_frame';
|
|
13493
|
+
|
|
13392
13494
|
/**
|
|
13393
13495
|
* Generated video data. Can be a URL, base64-encoded string, or binary data.
|
|
13394
13496
|
*/
|
|
@@ -13523,5 +13625,5 @@ export declare function zodSchema<OBJECT>(zodSchema: z4.core.$ZodType<OBJECT, an
|
|
|
13523
13625
|
}): Schema<OBJECT>;
|
|
13524
13626
|
|
|
13525
13627
|
export { }
|
|
13526
|
-
export { GatewayProviderSettings as GatewayProviderSettings, GatewayProvider as GatewayProvider, LazySchema as LazySchema, ZodSchema as ZodSchema, StandardSchema as StandardSchema, ValidationResult as ValidationResult, ParseResult as ParseResult, ProviderOptions as ProviderOptions, ReasoningPart as ReasoningPart, ToolOutputProperties as ToolOutputProperties, 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, ResponseMessage as ResponseMessage, LanguageModelV3ToolCall as LanguageModelV3ToolCall, GenerateTextIncludeSettings as GenerateTextIncludeSettings, ValueOf as ValueOf, asUITool as asUITool, _ai_sdk_provider_utils as _ai_sdk_provider_utils,
|
|
13527
|
-
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$
|
|
13628
|
+
export { GatewayProviderSettings as GatewayProviderSettings, GatewayProvider as GatewayProvider, LazySchema as LazySchema, ZodSchema as ZodSchema, StandardSchema as StandardSchema, ValidationResult as ValidationResult, ParseResult as ParseResult, ProviderOptions as ProviderOptions, ReasoningPart as ReasoningPart, ToolOutputProperties as ToolOutputProperties, 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 };
|
|
13629
|
+
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$f, symbol$g, symbol$h, symbol$i, symbol$j, symbol$k, symbol, symbol_2, symbol_3 };
|