@mastra/ai-sdk 1.10.6 → 1.10.7-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_types/@internal_ai-sdk-v5/dist/index.d.ts +536 -0
- package/dist/_types/@internal_ai-v6/dist/index.d.ts +488 -3
- package/dist/_types/@internal_ai-v7/dist/index.d.ts +1682 -253
- package/dist/index.cjs +965 -831
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +965 -831
- package/dist/index.js.map +1 -1
- package/dist/transformers.d.ts +1 -5
- package/dist/transformers.d.ts.map +1 -1
- package/package.json +12 -12
|
@@ -302,24 +302,131 @@ export declare type AgentStreamParameters<CALL_OPTIONS, TOOLS extends ToolSet, R
|
|
|
302
302
|
|
|
303
303
|
declare namespace _ai_sdk_provider_utils {
|
|
304
304
|
export {
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
305
|
+
asArray,
|
|
306
|
+
combineHeaders,
|
|
307
|
+
getWebSocketConstructor,
|
|
308
|
+
toWebSocketUrl,
|
|
309
|
+
readWebSocketMessageText,
|
|
310
|
+
waitForWebSocketBufferDrain,
|
|
311
|
+
connectToWebSocket,
|
|
312
|
+
convertAsyncIteratorToReadableStream,
|
|
313
|
+
convertInlineFileDataToUint8Array,
|
|
314
|
+
convertImageModelFileToDataUri,
|
|
315
|
+
convertToFormData,
|
|
316
|
+
createLanguageModelResponseMetadata,
|
|
317
|
+
createNullLanguageModelUsage,
|
|
318
|
+
createToolNameMapping,
|
|
319
|
+
createProviderStreamError,
|
|
320
|
+
isProviderStreamError,
|
|
321
|
+
delay,
|
|
322
|
+
lazySchema,
|
|
323
|
+
jsonSchema,
|
|
324
|
+
asSchema,
|
|
325
|
+
zodSchema,
|
|
326
|
+
parseJSON,
|
|
327
|
+
safeParseJSON,
|
|
328
|
+
isParsableJson,
|
|
329
|
+
detectMediaType,
|
|
330
|
+
getTopLevelMediaType,
|
|
331
|
+
isFullMediaType,
|
|
332
|
+
downloadBlob,
|
|
333
|
+
fetchWithValidatedEndpoint,
|
|
334
|
+
fetchWithValidatedRedirects,
|
|
335
|
+
extractLines,
|
|
336
|
+
extractResponseHeaders,
|
|
337
|
+
fetchUntrustedUrl,
|
|
338
|
+
filterNullable,
|
|
339
|
+
getRuntimeEnvironmentUserAgent,
|
|
340
|
+
injectJsonInstructionIntoMessages,
|
|
341
|
+
isAbortError,
|
|
342
|
+
isBrowserRuntime,
|
|
343
|
+
isBuffer,
|
|
344
|
+
isSameOrigin,
|
|
345
|
+
isNonNullable,
|
|
346
|
+
isProviderReference,
|
|
347
|
+
isRecord,
|
|
348
|
+
isUrlSupported,
|
|
349
|
+
loadApiKey,
|
|
350
|
+
loadOptionalSetting,
|
|
351
|
+
loadSetting,
|
|
352
|
+
isCustomReasoning,
|
|
353
|
+
mapReasoningToProviderEffort,
|
|
354
|
+
mapReasoningToProviderBudget,
|
|
355
|
+
mediaTypeToExtension,
|
|
356
|
+
normalizeHeaders,
|
|
357
|
+
normalizeBatchRequestCounts,
|
|
358
|
+
parseJsonEventStream,
|
|
359
|
+
parseProviderOptions,
|
|
360
|
+
isExecutableTool,
|
|
361
|
+
dynamicTool,
|
|
362
|
+
createProviderDefinedToolFactory,
|
|
363
|
+
createProviderDefinedToolFactoryWithOutputSchema,
|
|
364
|
+
createProviderExecutedToolFactory,
|
|
365
|
+
cancelResponseBody,
|
|
366
|
+
readResponseWithSizeLimit,
|
|
367
|
+
removeUndefinedEntries,
|
|
368
|
+
resolve,
|
|
369
|
+
resolveFullMediaType,
|
|
370
|
+
resolveProviderReference,
|
|
371
|
+
serializeModelOptions,
|
|
372
|
+
secureJsonParse,
|
|
373
|
+
stripFileExtension,
|
|
374
|
+
convertBase64ToUint8Array,
|
|
375
|
+
convertUint8ArrayToBase64,
|
|
376
|
+
convertToBase64,
|
|
377
|
+
validateBaseURL,
|
|
378
|
+
validateDownloadUrl,
|
|
379
|
+
validateTypes,
|
|
380
|
+
safeValidateTypes,
|
|
381
|
+
withUserAgentSuffix,
|
|
382
|
+
withoutTrailingSlash,
|
|
383
|
+
executeTool,
|
|
384
|
+
DelayedPromise,
|
|
385
|
+
FetchFunction,
|
|
386
|
+
ParseResult,
|
|
387
|
+
ResponseHandler,
|
|
388
|
+
createJsonErrorResponseHandler,
|
|
389
|
+
createEventSourceResponseHandler,
|
|
390
|
+
createJsonResponseHandler,
|
|
391
|
+
createJsonLinesResponseHandler,
|
|
392
|
+
createBinaryResponseHandler,
|
|
393
|
+
createBinaryStreamResponseHandler,
|
|
394
|
+
createStatusCodeErrorResponseHandler,
|
|
395
|
+
deleteFromApi,
|
|
396
|
+
DownloadError,
|
|
397
|
+
createIdGenerator,
|
|
398
|
+
generateId,
|
|
399
|
+
getFromApi,
|
|
400
|
+
MultipartStreamPart,
|
|
401
|
+
postMultipartStreamToApi,
|
|
402
|
+
postJsonToApi,
|
|
403
|
+
postFormDataToApi,
|
|
404
|
+
postToApi,
|
|
405
|
+
DEFAULT_MAX_DOWNLOAD_SIZE,
|
|
406
|
+
Resolvable,
|
|
407
|
+
RetryFunction,
|
|
408
|
+
RetryErrorReason,
|
|
409
|
+
RetryErrorFactory,
|
|
410
|
+
RetryDelayProvider,
|
|
411
|
+
ShouldRetryFunction,
|
|
412
|
+
retryWithExponentialBackoff,
|
|
413
|
+
SerializationError,
|
|
414
|
+
StreamingToolCallTracker,
|
|
415
|
+
VERSION,
|
|
310
416
|
Arrayable,
|
|
311
417
|
AssistantContent,
|
|
312
418
|
AssistantModelMessage,
|
|
313
419
|
Context,
|
|
314
420
|
CustomPart,
|
|
315
|
-
DEFAULT_MAX_DOWNLOAD_SIZE,
|
|
316
421
|
DataContent,
|
|
317
|
-
DelayedPromise,
|
|
318
|
-
DownloadError,
|
|
319
422
|
DynamicTool,
|
|
320
423
|
EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL as EXPERIMENTAL_EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL,
|
|
424
|
+
EMBEDDING_MODEL_PROVIDER_OPTIONS_TRANSFORMER as EXPERIMENTAL_EMBEDDING_MODEL_PROVIDER_OPTIONS_TRANSFORMER,
|
|
321
425
|
TRANSCRIPTION_STREAM_AUDIO_DONE_FRAME_TYPE as EXPERIMENTAL_TRANSCRIPTION_STREAM_AUDIO_DONE_FRAME_TYPE,
|
|
322
426
|
TRANSCRIPTION_STREAM_START_FRAME_TYPE as EXPERIMENTAL_TRANSCRIPTION_STREAM_START_FRAME_TYPE,
|
|
427
|
+
EmbeddingModelProviderOptionsTransformer,
|
|
428
|
+
EventSourceMessage,
|
|
429
|
+
EventSourceParserStream,
|
|
323
430
|
ExecutableTool,
|
|
324
431
|
Experimental_SandboxProcess,
|
|
325
432
|
Experimental_SandboxSession,
|
|
@@ -327,7 +434,6 @@ declare namespace _ai_sdk_provider_utils {
|
|
|
327
434
|
Experimental_ToolCallerTool,
|
|
328
435
|
TranscriptionStreamClientFrame as Experimental_TranscriptionStreamClientFrame,
|
|
329
436
|
TranscriptionStreamStartFrame as Experimental_TranscriptionStreamStartFrame,
|
|
330
|
-
FetchFunction,
|
|
331
437
|
FileData,
|
|
332
438
|
FileDataData,
|
|
333
439
|
FileDataReference,
|
|
@@ -347,8 +453,6 @@ declare namespace _ai_sdk_provider_utils {
|
|
|
347
453
|
LazySchema,
|
|
348
454
|
MaybePromiseLike,
|
|
349
455
|
ModelMessage,
|
|
350
|
-
MultipartStreamPart,
|
|
351
|
-
ParseResult,
|
|
352
456
|
ProviderDefinedTool,
|
|
353
457
|
ProviderDefinedToolFactory,
|
|
354
458
|
ProviderDefinedToolFactoryWithOutputSchema,
|
|
@@ -359,17 +463,8 @@ declare namespace _ai_sdk_provider_utils {
|
|
|
359
463
|
ProviderStreamError,
|
|
360
464
|
ReasoningFilePart,
|
|
361
465
|
ReasoningPart,
|
|
362
|
-
Resolvable,
|
|
363
|
-
ResponseHandler,
|
|
364
|
-
RetryDelayProvider,
|
|
365
|
-
RetryErrorFactory,
|
|
366
|
-
RetryErrorReason,
|
|
367
|
-
RetryFunction,
|
|
368
466
|
Schema,
|
|
369
|
-
SerializationError,
|
|
370
|
-
ShouldRetryFunction,
|
|
371
467
|
StreamingToolCallDelta,
|
|
372
|
-
StreamingToolCallTracker,
|
|
373
468
|
StreamingToolCallTrackerOptions,
|
|
374
469
|
SystemModelMessage,
|
|
375
470
|
TextPart,
|
|
@@ -390,111 +485,19 @@ declare namespace _ai_sdk_provider_utils {
|
|
|
390
485
|
ToolSet,
|
|
391
486
|
UserContent,
|
|
392
487
|
UserModelMessage,
|
|
393
|
-
VERSION,
|
|
394
488
|
ValidationResult,
|
|
489
|
+
WORKFLOW_DESERIALIZE,
|
|
490
|
+
WORKFLOW_SERIALIZE,
|
|
395
491
|
WebSocketConnection,
|
|
396
492
|
WebSocketConstructor,
|
|
397
493
|
WebSocketLike,
|
|
398
|
-
asArray,
|
|
399
|
-
asSchema,
|
|
400
|
-
cancelResponseBody,
|
|
401
|
-
combineHeaders,
|
|
402
|
-
connectToWebSocket,
|
|
403
|
-
convertAsyncIteratorToReadableStream,
|
|
404
|
-
convertBase64ToUint8Array,
|
|
405
|
-
convertImageModelFileToDataUri,
|
|
406
|
-
convertInlineFileDataToUint8Array,
|
|
407
|
-
convertToBase64,
|
|
408
|
-
convertToFormData,
|
|
409
|
-
convertUint8ArrayToBase64,
|
|
410
|
-
createBinaryResponseHandler,
|
|
411
|
-
createBinaryStreamResponseHandler,
|
|
412
|
-
createEventSourceResponseHandler,
|
|
413
|
-
createIdGenerator,
|
|
414
|
-
createJsonErrorResponseHandler,
|
|
415
|
-
createJsonLinesResponseHandler,
|
|
416
|
-
createJsonResponseHandler,
|
|
417
|
-
createLanguageModelResponseMetadata,
|
|
418
|
-
createNullLanguageModelUsage,
|
|
419
|
-
createProviderDefinedToolFactory,
|
|
420
|
-
createProviderDefinedToolFactoryWithOutputSchema,
|
|
421
|
-
createProviderExecutedToolFactory,
|
|
422
|
-
createProviderStreamError,
|
|
423
|
-
createStatusCodeErrorResponseHandler,
|
|
424
|
-
createToolNameMapping,
|
|
425
|
-
delay,
|
|
426
|
-
deleteFromApi,
|
|
427
|
-
detectMediaType,
|
|
428
|
-
downloadBlob,
|
|
429
|
-
dynamicTool,
|
|
430
|
-
executeTool,
|
|
431
494
|
getToolCaller as experimental_getToolCaller,
|
|
432
495
|
parseTranscriptionStreamClientFrame as experimental_parseTranscriptionStreamClientFrame,
|
|
433
496
|
parseTranscriptionStreamPart as experimental_parseTranscriptionStreamPart,
|
|
434
497
|
serializeTranscriptionStreamPart as experimental_serializeTranscriptionStreamPart,
|
|
435
498
|
experimental_toolCaller,
|
|
436
|
-
|
|
437
|
-
extractResponseHeaders,
|
|
438
|
-
fetchWithValidatedEndpoint,
|
|
439
|
-
fetchWithValidatedRedirects,
|
|
440
|
-
filterNullable,
|
|
441
|
-
generateId,
|
|
442
|
-
getFromApi,
|
|
443
|
-
getRuntimeEnvironmentUserAgent,
|
|
444
|
-
getTopLevelMediaType,
|
|
445
|
-
getWebSocketConstructor,
|
|
446
|
-
injectJsonInstructionIntoMessages,
|
|
447
|
-
isAbortError,
|
|
448
|
-
isBrowserRuntime,
|
|
449
|
-
isBuffer,
|
|
450
|
-
isCustomReasoning,
|
|
451
|
-
isExecutableTool,
|
|
452
|
-
isFullMediaType,
|
|
453
|
-
isNonNullable,
|
|
454
|
-
isParsableJson,
|
|
455
|
-
isProviderReference,
|
|
456
|
-
isProviderStreamError,
|
|
457
|
-
isRecord,
|
|
458
|
-
isSameOrigin,
|
|
459
|
-
isUrlSupported,
|
|
460
|
-
jsonSchema,
|
|
461
|
-
lazySchema,
|
|
462
|
-
loadApiKey,
|
|
463
|
-
loadOptionalSetting,
|
|
464
|
-
loadSetting,
|
|
465
|
-
mapReasoningToProviderBudget,
|
|
466
|
-
mapReasoningToProviderEffort,
|
|
467
|
-
mediaTypeToExtension,
|
|
468
|
-
normalizeBatchRequestCounts,
|
|
469
|
-
normalizeHeaders,
|
|
470
|
-
parseJSON,
|
|
471
|
-
parseJsonEventStream,
|
|
472
|
-
parseProviderOptions,
|
|
473
|
-
postFormDataToApi,
|
|
474
|
-
postJsonToApi,
|
|
475
|
-
postMultipartStreamToApi,
|
|
476
|
-
postToApi,
|
|
477
|
-
readResponseWithSizeLimit,
|
|
478
|
-
readWebSocketMessageText,
|
|
479
|
-
removeUndefinedEntries,
|
|
480
|
-
resolve,
|
|
481
|
-
resolveFullMediaType,
|
|
482
|
-
resolveProviderReference,
|
|
483
|
-
retryWithExponentialBackoff,
|
|
484
|
-
safeParseJSON,
|
|
485
|
-
safeValidateTypes,
|
|
486
|
-
secureJsonParse,
|
|
487
|
-
serializeModelOptions,
|
|
488
|
-
stripFileExtension,
|
|
489
|
-
toWebSocketUrl,
|
|
499
|
+
getErrorMessage,
|
|
490
500
|
tool,
|
|
491
|
-
validateBaseURL,
|
|
492
|
-
validateDownloadUrl,
|
|
493
|
-
validateTypes,
|
|
494
|
-
waitForWebSocketBufferDrain,
|
|
495
|
-
withUserAgentSuffix,
|
|
496
|
-
withoutTrailingSlash,
|
|
497
|
-
zodSchema,
|
|
498
501
|
StandardJSONSchemaV1,
|
|
499
502
|
StandardSchemaV1,
|
|
500
503
|
StandardTypedV1
|
|
@@ -535,6 +538,38 @@ export declare class AISDKError extends Error {
|
|
|
535
538
|
protected static hasMarker(error: unknown, marker: string): boolean;
|
|
536
539
|
}
|
|
537
540
|
|
|
541
|
+
/**
|
|
542
|
+
* Custom error class for AI SDK related errors.
|
|
543
|
+
* @extends Error
|
|
544
|
+
*/
|
|
545
|
+
declare class AISDKError_2 extends Error {
|
|
546
|
+
private readonly [symbol$15];
|
|
547
|
+
/**
|
|
548
|
+
* The underlying cause of the error, if any.
|
|
549
|
+
*/
|
|
550
|
+
readonly cause?: unknown;
|
|
551
|
+
/**
|
|
552
|
+
* Creates an AI SDK Error.
|
|
553
|
+
*
|
|
554
|
+
* @param {Object} params - The parameters for creating the error.
|
|
555
|
+
* @param {string} params.name - The name of the error.
|
|
556
|
+
* @param {string} params.message - The error message.
|
|
557
|
+
* @param {unknown} [params.cause] - The underlying cause of the error.
|
|
558
|
+
*/
|
|
559
|
+
constructor({ name, message, cause }: {
|
|
560
|
+
name: string;
|
|
561
|
+
message: string;
|
|
562
|
+
cause?: unknown;
|
|
563
|
+
});
|
|
564
|
+
/**
|
|
565
|
+
* Checks if the given error is an AI SDK Error.
|
|
566
|
+
* @param {unknown} error - The error to check.
|
|
567
|
+
* @returns {boolean} True if the error is an AI SDK Error, false otherwise.
|
|
568
|
+
*/
|
|
569
|
+
static isInstance(error: unknown): error is AISDKError_2;
|
|
570
|
+
protected static hasMarker(error: unknown, marker: string): boolean;
|
|
571
|
+
}
|
|
572
|
+
|
|
538
573
|
export declare class APICallError extends AISDKError {
|
|
539
574
|
private readonly [symbol$e];
|
|
540
575
|
readonly url: string;
|
|
@@ -559,6 +594,29 @@ export declare class APICallError extends AISDKError {
|
|
|
559
594
|
static isInstance(error: unknown): error is APICallError;
|
|
560
595
|
}
|
|
561
596
|
|
|
597
|
+
declare class APICallError_2 extends AISDKError_2 {
|
|
598
|
+
private readonly [symbol$14];
|
|
599
|
+
readonly url: string;
|
|
600
|
+
readonly requestBodyValues: unknown;
|
|
601
|
+
readonly statusCode?: number;
|
|
602
|
+
readonly responseHeaders?: Record<string, string>;
|
|
603
|
+
readonly responseBody?: string;
|
|
604
|
+
readonly isRetryable: boolean;
|
|
605
|
+
readonly data?: unknown;
|
|
606
|
+
constructor({ message, url, requestBodyValues, statusCode, responseHeaders, responseBody, cause, isRetryable, data }: {
|
|
607
|
+
message: string;
|
|
608
|
+
url: string;
|
|
609
|
+
requestBodyValues: unknown;
|
|
610
|
+
statusCode?: number;
|
|
611
|
+
responseHeaders?: Record<string, string>;
|
|
612
|
+
responseBody?: string;
|
|
613
|
+
cause?: unknown;
|
|
614
|
+
isRetryable?: boolean;
|
|
615
|
+
data?: unknown;
|
|
616
|
+
});
|
|
617
|
+
static isInstance(error: unknown): error is APICallError_2;
|
|
618
|
+
}
|
|
619
|
+
|
|
562
620
|
/**
|
|
563
621
|
* A value that can be provided either as a single item, an array of items,
|
|
564
622
|
* or be left undefined.
|
|
@@ -605,7 +663,7 @@ export declare type AsyncIterableStream<T> = AsyncIterable<T> & ReadableStream<T
|
|
|
605
663
|
/**
|
|
606
664
|
* Common properties shared by function-style tools.
|
|
607
665
|
*/
|
|
608
|
-
declare type BaseFunctionTool<INPUT extends
|
|
666
|
+
declare type BaseFunctionTool<INPUT extends JSONValue_3 | unknown | never = any, OUTPUT extends JSONValue_3 | unknown | never = any, CONTEXT extends Context | unknown | never = any> = BaseTool<INPUT, OUTPUT, CONTEXT> & {
|
|
609
667
|
/**
|
|
610
668
|
* Optional description of what the tool does.
|
|
611
669
|
*
|
|
@@ -644,7 +702,7 @@ declare type BaseFunctionTool<INPUT extends JSONValue_2 | unknown | never = any,
|
|
|
644
702
|
/**
|
|
645
703
|
* Common properties shared by provider tools.
|
|
646
704
|
*/
|
|
647
|
-
declare type BaseProviderTool<INPUT extends
|
|
705
|
+
declare type BaseProviderTool<INPUT extends JSONValue_3 | unknown | never = any, OUTPUT extends JSONValue_3 | unknown | never = any, CONTEXT extends Context | unknown | never = any> = BaseTool<INPUT, OUTPUT, CONTEXT> & {
|
|
648
706
|
type: 'provider';
|
|
649
707
|
/**
|
|
650
708
|
* The ID of the tool. Must follow the format `<provider-name>.<unique-tool-name>`.
|
|
@@ -662,7 +720,7 @@ declare type BaseProviderTool<INPUT extends JSONValue_2 | unknown | never = any,
|
|
|
662
720
|
/**
|
|
663
721
|
* Common properties shared by all tool kinds.
|
|
664
722
|
*/
|
|
665
|
-
declare type BaseTool<INPUT extends
|
|
723
|
+
declare type BaseTool<INPUT extends JSONValue_3 | unknown | never = any, OUTPUT extends JSONValue_3 | unknown | never = any, CONTEXT extends Context | unknown | never = any> = {
|
|
666
724
|
/**
|
|
667
725
|
* Defer exposing this tool until it is discovered by `toolSearch`.
|
|
668
726
|
* Supports direct calls and local callers that announce tools in conversation
|
|
@@ -691,7 +749,7 @@ declare type BaseTool<INPUT extends JSONValue_2 | unknown | never = any, OUTPUT
|
|
|
691
749
|
* and UI message parts. This is useful for sources of dynamic tools (e.g.
|
|
692
750
|
* an MCP server) to identify themselves.
|
|
693
751
|
*/
|
|
694
|
-
metadata?:
|
|
752
|
+
metadata?: JSONObject_2;
|
|
695
753
|
/**
|
|
696
754
|
* The schema of the input that the tool expects.
|
|
697
755
|
* The language model will use this to generate the input.
|
|
@@ -711,9 +769,7 @@ declare type BaseTool<INPUT extends JSONValue_2 | unknown | never = any, OUTPUT
|
|
|
711
769
|
*
|
|
712
770
|
* @deprecated Tool approval is handled on a `generateText` / `streamText` level now.
|
|
713
771
|
*/
|
|
714
|
-
needsApproval?: boolean | ToolNeedsApprovalFunction<[
|
|
715
|
-
INPUT
|
|
716
|
-
] extends [never] ? unknown : INPUT, NoInfer<CONTEXT>>;
|
|
772
|
+
needsApproval?: boolean | ToolNeedsApprovalFunction<[INPUT] extends [never] ? unknown : INPUT, NoInfer<CONTEXT>>;
|
|
717
773
|
/**
|
|
718
774
|
* Optional function that is called when the model starts generating the tool input.
|
|
719
775
|
* In non-streaming contexts, it is called immediately before `onInputAvailable`.
|
|
@@ -840,6 +896,16 @@ declare type BatchV4Error = {
|
|
|
840
896
|
readonly statusCode?: number;
|
|
841
897
|
};
|
|
842
898
|
|
|
899
|
+
/**
|
|
900
|
+
* Serializable error information for a batch or batch item.
|
|
901
|
+
*/
|
|
902
|
+
declare type BatchV4Error_2 = {
|
|
903
|
+
readonly message: string;
|
|
904
|
+
readonly type?: string;
|
|
905
|
+
readonly code?: string;
|
|
906
|
+
readonly statusCode?: number;
|
|
907
|
+
};
|
|
908
|
+
|
|
843
909
|
/**
|
|
844
910
|
* A complete terminal result for one request in a batch, discriminated by
|
|
845
911
|
* modality.
|
|
@@ -970,6 +1036,24 @@ declare type BatchV4Status = {
|
|
|
970
1036
|
readonly providerMetadata?: SharedV4ProviderMetadata;
|
|
971
1037
|
};
|
|
972
1038
|
|
|
1039
|
+
/**
|
|
1040
|
+
* Normalized lifecycle status for a batch.
|
|
1041
|
+
*/
|
|
1042
|
+
declare type BatchV4Status_2 = {
|
|
1043
|
+
readonly status: 'pending' | 'completed' | 'failed';
|
|
1044
|
+
readonly rawStatus?: string;
|
|
1045
|
+
readonly requestCounts?: {
|
|
1046
|
+
readonly total: number;
|
|
1047
|
+
readonly pending: number;
|
|
1048
|
+
readonly completed: number;
|
|
1049
|
+
readonly failed: number;
|
|
1050
|
+
};
|
|
1051
|
+
readonly error?: BatchV4Error_2;
|
|
1052
|
+
readonly createdAt?: string;
|
|
1053
|
+
readonly expiresAt?: string;
|
|
1054
|
+
readonly providerMetadata?: SharedV4ProviderMetadata_2;
|
|
1055
|
+
};
|
|
1056
|
+
|
|
973
1057
|
/**
|
|
974
1058
|
* A callback function that can be used with `notify`.
|
|
975
1059
|
*/
|
|
@@ -1264,7 +1348,7 @@ export declare type CompletionRequestOptions<BODY extends object = object> = {
|
|
|
1264
1348
|
* abort wiring, and message decoding. Callers own the URL, the auth channel
|
|
1265
1349
|
* (subprotocols vs headers), and the wire protocol.
|
|
1266
1350
|
*/
|
|
1267
|
-
declare function connectToWebSocket({ url, protocols, headers, webSocket, abortSignal, onOpen, onMessageText, onProcessingError, onSocketError, onClose, onAbort
|
|
1351
|
+
declare function connectToWebSocket({ url, protocols, headers, webSocket, abortSignal, onOpen, onMessageText, onProcessingError, onSocketError, onClose, onAbort }: {
|
|
1268
1352
|
url: string | URL;
|
|
1269
1353
|
protocols?: string | string[];
|
|
1270
1354
|
headers?: Record<string, string | undefined>;
|
|
@@ -1371,7 +1455,7 @@ export declare function convertFileListToFileUIParts(files: FileList | undefined
|
|
|
1371
1455
|
* If the file is base64 data, it returns a data URI with the base64 data.
|
|
1372
1456
|
* If the file is a Uint8Array, it converts it to base64 and returns a data URI.
|
|
1373
1457
|
*/
|
|
1374
|
-
declare function convertImageModelFileToDataUri(file:
|
|
1458
|
+
declare function convertImageModelFileToDataUri(file: ImageModelV4File_2): string;
|
|
1375
1459
|
|
|
1376
1460
|
/**
|
|
1377
1461
|
* Converts inline file data (a tagged `data` or `text` shape) into raw bytes.
|
|
@@ -1561,18 +1645,18 @@ export declare function createGateway(options?: GatewayProviderSettings): Gatewa
|
|
|
1561
1645
|
* @param separator - The separator between the prefix and the random part of the ID. Default: '-'.
|
|
1562
1646
|
* @param size - The size of the random part of the ID to generate. Default: 16.
|
|
1563
1647
|
*/
|
|
1564
|
-
export declare const createIdGenerator: ({ prefix, size, alphabet, separator
|
|
1648
|
+
export declare const createIdGenerator: ({ prefix, size, alphabet, separator }?: {
|
|
1565
1649
|
prefix?: string;
|
|
1566
1650
|
separator?: string;
|
|
1567
1651
|
size?: number;
|
|
1568
1652
|
alphabet?: string;
|
|
1569
1653
|
}) => IdGenerator;
|
|
1570
1654
|
|
|
1571
|
-
declare const createJsonErrorResponseHandler: <T>({ errorSchema, errorToMessage, isRetryable
|
|
1655
|
+
declare const createJsonErrorResponseHandler: <T>({ errorSchema, errorToMessage, isRetryable }: {
|
|
1572
1656
|
errorSchema: FlexibleSchema<T>;
|
|
1573
1657
|
errorToMessage: (error: T) => string;
|
|
1574
1658
|
isRetryable?: (response: Response, error?: T) => boolean;
|
|
1575
|
-
}) => ResponseHandler<
|
|
1659
|
+
}) => ResponseHandler<APICallError_2>;
|
|
1576
1660
|
|
|
1577
1661
|
declare const createJsonLinesResponseHandler: <T>(responseSchema: FlexibleSchema<T>) => ResponseHandler<AsyncGenerator<T>>;
|
|
1578
1662
|
|
|
@@ -1582,29 +1666,29 @@ declare const createJsonResponseHandler: <T>(responseSchema: FlexibleSchema<T>)
|
|
|
1582
1666
|
* Converts common provider response fields into language model response
|
|
1583
1667
|
* metadata.
|
|
1584
1668
|
*/
|
|
1585
|
-
declare function createLanguageModelResponseMetadata({ id, model, created
|
|
1669
|
+
declare function createLanguageModelResponseMetadata({ id, model, created }: {
|
|
1586
1670
|
id?: string | null;
|
|
1587
1671
|
model?: string | null;
|
|
1588
1672
|
created?: number | null;
|
|
1589
|
-
}):
|
|
1673
|
+
}): LanguageModelV4ResponseMetadata_2;
|
|
1590
1674
|
|
|
1591
1675
|
/**
|
|
1592
1676
|
* Creates an empty language model usage result for unavailable usage data.
|
|
1593
1677
|
*/
|
|
1594
|
-
declare function createNullLanguageModelUsage():
|
|
1678
|
+
declare function createNullLanguageModelUsage(): LanguageModelV4Usage_2;
|
|
1595
1679
|
|
|
1596
|
-
declare function createProviderDefinedToolFactory<INPUT, ARGS extends object, CONTEXT extends Context = {}>({ id, inputSchema
|
|
1680
|
+
declare function createProviderDefinedToolFactory<INPUT, ARGS extends object, CONTEXT extends Context = {}>({ id, inputSchema }: {
|
|
1597
1681
|
id: `${string}.${string}`;
|
|
1598
1682
|
inputSchema: FlexibleSchema<INPUT>;
|
|
1599
1683
|
}): ProviderDefinedToolFactory<INPUT, ARGS, CONTEXT>;
|
|
1600
1684
|
|
|
1601
|
-
declare function createProviderDefinedToolFactoryWithOutputSchema<INPUT, OUTPUT, ARGS extends object, CONTEXT extends Context = {}>({ id, inputSchema, outputSchema
|
|
1685
|
+
declare function createProviderDefinedToolFactoryWithOutputSchema<INPUT, OUTPUT, ARGS extends object, CONTEXT extends Context = {}>({ id, inputSchema, outputSchema }: {
|
|
1602
1686
|
id: `${string}.${string}`;
|
|
1603
1687
|
inputSchema: FlexibleSchema<INPUT>;
|
|
1604
1688
|
outputSchema: FlexibleSchema<OUTPUT>;
|
|
1605
1689
|
}): ProviderDefinedToolFactoryWithOutputSchema<INPUT, OUTPUT, ARGS, CONTEXT>;
|
|
1606
1690
|
|
|
1607
|
-
declare function createProviderExecutedToolFactory<INPUT, OUTPUT, ARGS extends object, CONTEXT extends Context = {}>({ id, inputSchema, outputSchema, supportsDeferredResults
|
|
1691
|
+
declare function createProviderExecutedToolFactory<INPUT, OUTPUT, ARGS extends object, CONTEXT extends Context = {}>({ id, inputSchema, outputSchema, supportsDeferredResults }: {
|
|
1608
1692
|
id: `${string}.${string}`;
|
|
1609
1693
|
inputSchema: FlexibleSchema<INPUT>;
|
|
1610
1694
|
outputSchema: FlexibleSchema<OUTPUT>;
|
|
@@ -1644,7 +1728,7 @@ export declare function createProviderRegistry<PROVIDERS extends Record<string,
|
|
|
1644
1728
|
* Adds provider-owned status and retry metadata to a stream error payload
|
|
1645
1729
|
* without requiring provider packages to depend on AI SDK Core.
|
|
1646
1730
|
*/
|
|
1647
|
-
declare function createProviderStreamError({ message, type, code, statusCode, isRetryable, data
|
|
1731
|
+
declare function createProviderStreamError({ message, type, code, statusCode, isRetryable, data }: {
|
|
1648
1732
|
message: string;
|
|
1649
1733
|
type?: string;
|
|
1650
1734
|
code?: string | number;
|
|
@@ -1653,7 +1737,7 @@ declare function createProviderStreamError({ message, type, code, statusCode, is
|
|
|
1653
1737
|
data: unknown;
|
|
1654
1738
|
}): ProviderStreamError;
|
|
1655
1739
|
|
|
1656
|
-
declare const createStatusCodeErrorResponseHandler: () => ResponseHandler<
|
|
1740
|
+
declare const createStatusCodeErrorResponseHandler: () => ResponseHandler<APICallError_2>;
|
|
1657
1741
|
|
|
1658
1742
|
/**
|
|
1659
1743
|
* Creates a Response object from a text stream.
|
|
@@ -1675,11 +1759,11 @@ export declare function createTextStreamResponse({ status, statusText, headers,
|
|
|
1675
1759
|
* @param tools - Tools that were passed to the language model.
|
|
1676
1760
|
* @param providerToolNames - Maps the provider tool ids to the provider tool names.
|
|
1677
1761
|
*/
|
|
1678
|
-
declare function createToolNameMapping({ tools, providerToolNames
|
|
1762
|
+
declare function createToolNameMapping({ tools, providerToolNames }: {
|
|
1679
1763
|
/**
|
|
1680
1764
|
* Tools that were passed to the language model.
|
|
1681
1765
|
*/
|
|
1682
|
-
tools: Array<
|
|
1766
|
+
tools: Array<LanguageModelV4FunctionTool_2 | LanguageModelV4ProviderTool_2> | undefined;
|
|
1683
1767
|
/**
|
|
1684
1768
|
* Maps the provider tool ids to the provider tool names.
|
|
1685
1769
|
*/
|
|
@@ -1984,7 +2068,7 @@ declare class DelayedPromise<T> {
|
|
|
1984
2068
|
* only — there is no untrusted-URL validation path (use `getFromApi` with
|
|
1985
2069
|
* `validateUrl` for response-supplied URLs).
|
|
1986
2070
|
*/
|
|
1987
|
-
declare const deleteFromApi: <T>({ url, headers, failedResponseHandler, successfulResponseHandler, abortSignal, fetch
|
|
2071
|
+
declare const deleteFromApi: <T>({ url, headers, failedResponseHandler, successfulResponseHandler, abortSignal, fetch }: {
|
|
1988
2072
|
url: string;
|
|
1989
2073
|
headers?: Record<string, string | undefined>;
|
|
1990
2074
|
failedResponseHandler: ResponseHandler<Error>;
|
|
@@ -2007,7 +2091,7 @@ declare const deleteFromApi: <T>({ url, headers, failedResponseHandler, successf
|
|
|
2007
2091
|
* segment are considered. Returns `undefined` for unsupported segments
|
|
2008
2092
|
* (e.g. `"text"`) or when no signature matches.
|
|
2009
2093
|
*/
|
|
2010
|
-
declare function detectMediaType({ data, topLevelType
|
|
2094
|
+
declare function detectMediaType({ data, topLevelType }: {
|
|
2011
2095
|
data: Uint8Array | string;
|
|
2012
2096
|
topLevelType?: string;
|
|
2013
2097
|
}): string | undefined;
|
|
@@ -2087,12 +2171,12 @@ declare function downloadBlob(url: string, options?: {
|
|
|
2087
2171
|
abortSignal?: AbortSignal;
|
|
2088
2172
|
}): Promise<Blob>;
|
|
2089
2173
|
|
|
2090
|
-
export declare class DownloadError extends
|
|
2091
|
-
private readonly [symbol$
|
|
2174
|
+
export declare class DownloadError extends AISDKError_2 {
|
|
2175
|
+
private readonly [symbol$1_3];
|
|
2092
2176
|
readonly url: string;
|
|
2093
2177
|
readonly statusCode?: number;
|
|
2094
2178
|
readonly statusText?: string;
|
|
2095
|
-
constructor({ url, statusCode, statusText, cause, message
|
|
2179
|
+
constructor({ url, statusCode, statusText, cause, message }: {
|
|
2096
2180
|
url: string;
|
|
2097
2181
|
statusCode?: number;
|
|
2098
2182
|
statusText?: string;
|
|
@@ -2108,7 +2192,7 @@ export declare class DownloadError extends AISDKError {
|
|
|
2108
2192
|
*
|
|
2109
2193
|
* For example, MCP tools that are not known at development time.
|
|
2110
2194
|
*/
|
|
2111
|
-
declare type DynamicTool<INPUT extends
|
|
2195
|
+
declare type DynamicTool<INPUT extends JSONValue_3 | unknown | never = any, OUTPUT extends JSONValue_3 | unknown | never = any, CONTEXT extends Context | unknown | never = any> = BaseFunctionTool<INPUT, OUTPUT, CONTEXT> & {
|
|
2112
2196
|
type: 'dynamic';
|
|
2113
2197
|
};
|
|
2114
2198
|
|
|
@@ -2399,6 +2483,15 @@ export declare type Embedding = EmbeddingModelV4Embedding;
|
|
|
2399
2483
|
*/
|
|
2400
2484
|
declare const EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL: unique symbol;
|
|
2401
2485
|
|
|
2486
|
+
/**
|
|
2487
|
+
* Symbol for transforming provider options for an automatically batched
|
|
2488
|
+
* embedding model call.
|
|
2489
|
+
*
|
|
2490
|
+
* This capability is experimental and intentionally lives outside the versioned
|
|
2491
|
+
* embedding model specification.
|
|
2492
|
+
*/
|
|
2493
|
+
declare const EMBEDDING_MODEL_PROVIDER_OPTIONS_TRANSFORMER: unique symbol;
|
|
2494
|
+
|
|
2402
2495
|
/**
|
|
2403
2496
|
* Embedding model that is used by the AI SDK.
|
|
2404
2497
|
*/
|
|
@@ -2460,6 +2553,13 @@ export declare type EmbeddingModelMiddleware = Omit<EmbeddingModelV4Middleware,
|
|
|
2460
2553
|
readonly specificationVersion?: string;
|
|
2461
2554
|
};
|
|
2462
2555
|
|
|
2556
|
+
declare type EmbeddingModelProviderOptionsTransformer = (options: {
|
|
2557
|
+
providerOptions: SharedV4ProviderOptions_2 | undefined;
|
|
2558
|
+
values: Array<string>;
|
|
2559
|
+
startIndex: number;
|
|
2560
|
+
endIndex: number;
|
|
2561
|
+
}) => SharedV4ProviderOptions_2 | undefined | PromiseLike<SharedV4ProviderOptions_2 | undefined>;
|
|
2562
|
+
|
|
2463
2563
|
/**
|
|
2464
2564
|
* Represents the number of tokens used in an embedding.
|
|
2465
2565
|
*/
|
|
@@ -3430,7 +3530,7 @@ declare type ExecutableTool<TOOL extends Tool = Tool> = TOOL & {
|
|
|
3430
3530
|
* @yields A preliminary output for each streamed value, followed by a final output, or a single final
|
|
3431
3531
|
* output for non-streaming tools.
|
|
3432
3532
|
*/
|
|
3433
|
-
declare function executeTool<TOOL extends Tool>({ tool, input, options
|
|
3533
|
+
declare function executeTool<TOOL extends Tool>({ tool, input, options }: {
|
|
3434
3534
|
tool: ExecutableTool<TOOL>;
|
|
3435
3535
|
input: InferToolInput<TOOL>;
|
|
3436
3536
|
options: ToolExecutionOptions<InferToolContext<TOOL>>;
|
|
@@ -4886,7 +4986,7 @@ export declare function extractJsonMiddleware(options?: {
|
|
|
4886
4986
|
* cleanly. When neither `startLine` nor `endLine` is provided, the input is
|
|
4887
4987
|
* returned unchanged. `endLine` past EOF clamps to the last line.
|
|
4888
4988
|
*/
|
|
4889
|
-
declare function extractLines({ text, startLine, endLine
|
|
4989
|
+
declare function extractLines({ text, startLine, endLine }: {
|
|
4890
4990
|
text: string;
|
|
4891
4991
|
startLine?: number;
|
|
4892
4992
|
endLine?: number;
|
|
@@ -4938,6 +5038,41 @@ declare function extractResponseHeaders(response: Response): {
|
|
|
4938
5038
|
*/
|
|
4939
5039
|
declare type FetchFunction = typeof globalThis.fetch;
|
|
4940
5040
|
|
|
5041
|
+
/**
|
|
5042
|
+
* Fetches an untrusted URL with first-hop credential isolation and validated
|
|
5043
|
+
* redirects. Uses the URL validation, DNS-pinned Node.js transport, redirect
|
|
5044
|
+
* limits, and cross-origin header stripping of {@link fetchWithValidatedRedirects}.
|
|
5045
|
+
* An injected fetch must provide equivalent connect-time DNS validation.
|
|
5046
|
+
*
|
|
5047
|
+
* Without a matching `credentialedOrigin` (or `trustedOrigin` when it is
|
|
5048
|
+
* omitted), only allowlisted request metadata is sent on the first hop.
|
|
5049
|
+
* Arbitrary caller headers require an explicit matching origin because vendor
|
|
5050
|
+
* credential names cannot be inferred safely. Proxy, metadata, cookie, and
|
|
5051
|
+
* hop-by-hop headers are sanitized even for a matching origin.
|
|
5052
|
+
*
|
|
5053
|
+
* `trustedOrigin` also exempts same-origin hops from URL validation, allowing
|
|
5054
|
+
* developer-configured private endpoints. Both origin options must come from
|
|
5055
|
+
* developer configuration, never from untrusted response data.
|
|
5056
|
+
*
|
|
5057
|
+
* This is an opt-in alternative to `fetchWithValidatedRedirects`, whose
|
|
5058
|
+
* existing first-hop header behavior is preserved for compatibility.
|
|
5059
|
+
*/
|
|
5060
|
+
declare function fetchUntrustedUrl({ headers, credentialedOrigin, untrustedFirstHopHeaders, ...options }: Parameters<typeof fetchWithValidatedRedirects>[0] & {
|
|
5061
|
+
/**
|
|
5062
|
+
* The developer-configured origin allowed to receive arbitrary caller
|
|
5063
|
+
* headers on the first hop. Defaults to `trustedOrigin` when omitted.
|
|
5064
|
+
* An explicit value takes precedence over `trustedOrigin` and does not
|
|
5065
|
+
* exempt the URL from validation.
|
|
5066
|
+
*/
|
|
5067
|
+
credentialedOrigin?: string;
|
|
5068
|
+
/**
|
|
5069
|
+
* Additional sanitized header names safe to disclose to an untrusted first
|
|
5070
|
+
* hop. Use only for non-credential protocol metadata. Credentials require
|
|
5071
|
+
* a matching `credentialedOrigin` instead. Names are case-insensitive.
|
|
5072
|
+
*/
|
|
5073
|
+
untrustedFirstHopHeaders?: readonly string[];
|
|
5074
|
+
}): Promise<Response>;
|
|
5075
|
+
|
|
4941
5076
|
/**
|
|
4942
5077
|
* Fetches one validated URL without following redirects.
|
|
4943
5078
|
*
|
|
@@ -4946,7 +5081,7 @@ declare type FetchFunction = typeof globalThis.fetch;
|
|
|
4946
5081
|
* Redirects are rejected by default. Callers using `redirect: 'manual'` must
|
|
4947
5082
|
* validate the Location target before issuing another request.
|
|
4948
5083
|
*/
|
|
4949
|
-
declare function fetchWithValidatedEndpoint({ url, init, fetch: customFetch, trustedOrigin, redirect
|
|
5084
|
+
declare function fetchWithValidatedEndpoint({ url, init, fetch: customFetch, trustedOrigin, redirect }: {
|
|
4950
5085
|
url: string | URL;
|
|
4951
5086
|
init?: RequestInit;
|
|
4952
5087
|
fetch?: FetchFunction;
|
|
@@ -4970,6 +5105,9 @@ declare function fetchWithValidatedEndpoint({ url, init, fetch: customFetch, tru
|
|
|
4970
5105
|
* Request headers are also protected: {@link sanitizeRequestHeaders} strips
|
|
4971
5106
|
* proxy/metadata/cookie/hop-by-hop headers before the first request, and all
|
|
4972
5107
|
* caller headers except `User-Agent` are dropped on a cross-origin redirect.
|
|
5108
|
+
* Credentials and custom headers are preserved on the first hop for backwards
|
|
5109
|
+
* compatibility. The caller must ensure that the initial URL may receive them.
|
|
5110
|
+
* Use `fetchUntrustedUrl` for URLs that require first-hop credential isolation.
|
|
4973
5111
|
* The fetch spec only strips `Authorization` on cross-origin redirects because
|
|
4974
5112
|
* in a browser, CORS preflighting protects custom headers; there is no CORS on
|
|
4975
5113
|
* the server, so provider API keys carried in custom headers (e.g. `x-key`)
|
|
@@ -5002,7 +5140,7 @@ declare function fetchWithValidatedEndpoint({ url, init, fetch: customFetch, tru
|
|
|
5002
5140
|
* @throws DownloadError if a hop is unsafe, the redirect limit is exceeded, or
|
|
5003
5141
|
* a redirect cannot be validated on a non-browser runtime.
|
|
5004
5142
|
*/
|
|
5005
|
-
declare function fetchWithValidatedRedirects({ url, headers, abortSignal, maxRedirects, fetch: customFetch, trustedOrigin
|
|
5143
|
+
declare function fetchWithValidatedRedirects({ url, headers, abortSignal, maxRedirects, fetch: customFetch, trustedOrigin }: {
|
|
5006
5144
|
url: string;
|
|
5007
5145
|
headers?: HeadersInit;
|
|
5008
5146
|
abortSignal?: AbortSignal;
|
|
@@ -5040,18 +5178,18 @@ declare interface FileDataData {
|
|
|
5040
5178
|
/**
|
|
5041
5179
|
* File data variant containing a provider reference (`{ [provider]: id }`).
|
|
5042
5180
|
*/
|
|
5043
|
-
declare type FileDataReference =
|
|
5181
|
+
declare type FileDataReference = SharedV4FileDataReference_2;
|
|
5044
5182
|
|
|
5045
5183
|
/**
|
|
5046
5184
|
* File data variant containing inline text content (e.g. an inline text
|
|
5047
5185
|
* document).
|
|
5048
5186
|
*/
|
|
5049
|
-
declare type FileDataText =
|
|
5187
|
+
declare type FileDataText = SharedV4FileDataText_2;
|
|
5050
5188
|
|
|
5051
5189
|
/**
|
|
5052
5190
|
* File data variant containing a URL that points to the file.
|
|
5053
5191
|
*/
|
|
5054
|
-
declare type FileDataUrl =
|
|
5192
|
+
declare type FileDataUrl = SharedV4FileDataUrl_2;
|
|
5055
5193
|
|
|
5056
5194
|
/**
|
|
5057
5195
|
* File content part of a prompt. It contains a file.
|
|
@@ -5467,7 +5605,7 @@ export declare type FlexibleSchema<SCHEMA = any> = Schema<SCHEMA> | LazySchema<S
|
|
|
5467
5605
|
/**
|
|
5468
5606
|
* Tool with user-defined input and output schemas that is executed by the AI SDK.
|
|
5469
5607
|
*/
|
|
5470
|
-
declare type FunctionTool<INPUT extends
|
|
5608
|
+
declare type FunctionTool<INPUT extends JSONValue_3 | unknown | never = any, OUTPUT extends JSONValue_3 | unknown | never = any, CONTEXT extends Context | unknown | never = any> = BaseFunctionTool<INPUT, OUTPUT, CONTEXT> & {
|
|
5471
5609
|
type?: undefined | 'function';
|
|
5472
5610
|
};
|
|
5473
5611
|
|
|
@@ -7380,7 +7518,7 @@ declare function getErrorMessage(error: unknown | undefined): string;
|
|
|
7380
7518
|
*/
|
|
7381
7519
|
export declare function getFirstChunkTimeoutMs(timeout: TimeoutConfiguration<any> | undefined): number | undefined;
|
|
7382
7520
|
|
|
7383
|
-
declare const getFromApi: <T>({ url, headers, successfulResponseHandler, failedResponseHandler, abortSignal, fetch, validateUrl, credentialedOrigin, trustedOrigin
|
|
7521
|
+
declare const getFromApi: <T>({ url, headers, successfulResponseHandler, failedResponseHandler, abortSignal, fetch, validateUrl, credentialedOrigin, trustedOrigin }: {
|
|
7384
7522
|
url: string;
|
|
7385
7523
|
headers?: Record<string, string | undefined>;
|
|
7386
7524
|
failedResponseHandler: ResponseHandler<Error>;
|
|
@@ -8157,6 +8295,42 @@ declare type ImageModelV4File = {
|
|
|
8157
8295
|
providerOptions?: SharedV4ProviderMetadata;
|
|
8158
8296
|
};
|
|
8159
8297
|
|
|
8298
|
+
/**
|
|
8299
|
+
* An image file that can be used for image editing or variation generation.
|
|
8300
|
+
*/
|
|
8301
|
+
declare type ImageModelV4File_2 = {
|
|
8302
|
+
type: 'file';
|
|
8303
|
+
/**
|
|
8304
|
+
* The IANA media type of the file, e.g. `image/png`. Any string is supported.
|
|
8305
|
+
*
|
|
8306
|
+
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
8307
|
+
*/
|
|
8308
|
+
mediaType: string;
|
|
8309
|
+
/**
|
|
8310
|
+
* Generated file data as base64 encoded strings or binary data.
|
|
8311
|
+
*
|
|
8312
|
+
* The file data should be returned without any unnecessary conversion.
|
|
8313
|
+
* If the API returns base64 encoded strings, the file data should be returned
|
|
8314
|
+
* as base64 encoded strings. If the API returns binary data, the file data should
|
|
8315
|
+
* be returned as binary data.
|
|
8316
|
+
*/
|
|
8317
|
+
data: string | Uint8Array;
|
|
8318
|
+
/**
|
|
8319
|
+
* Optional provider-specific metadata for the file part.
|
|
8320
|
+
*/
|
|
8321
|
+
providerOptions?: SharedV4ProviderMetadata_2;
|
|
8322
|
+
} | {
|
|
8323
|
+
type: 'url';
|
|
8324
|
+
/**
|
|
8325
|
+
* The URL of the image file.
|
|
8326
|
+
*/
|
|
8327
|
+
url: string;
|
|
8328
|
+
/**
|
|
8329
|
+
* Optional provider-specific metadata for the file part.
|
|
8330
|
+
*/
|
|
8331
|
+
providerOptions?: SharedV4ProviderMetadata_2;
|
|
8332
|
+
};
|
|
8333
|
+
|
|
8160
8334
|
/**
|
|
8161
8335
|
* Middleware for ImageModelV4.
|
|
8162
8336
|
* This type defines the structure for middleware that can be used to modify
|
|
@@ -8434,12 +8608,12 @@ export declare type InferUITools<TOOLS extends ToolSet> = {
|
|
|
8434
8608
|
[NAME in keyof TOOLS & string]: InferUITool<TOOLS[NAME]>;
|
|
8435
8609
|
};
|
|
8436
8610
|
|
|
8437
|
-
declare function injectJsonInstructionIntoMessages({ messages, schema, schemaPrefix, schemaSuffix
|
|
8438
|
-
messages:
|
|
8611
|
+
declare function injectJsonInstructionIntoMessages({ messages, schema, schemaPrefix, schemaSuffix }: {
|
|
8612
|
+
messages: LanguageModelV4Prompt_2;
|
|
8439
8613
|
schema?: JSONSchema7;
|
|
8440
8614
|
schemaPrefix?: string;
|
|
8441
8615
|
schemaSuffix?: string;
|
|
8442
|
-
}):
|
|
8616
|
+
}): LanguageModelV4Prompt_2;
|
|
8443
8617
|
|
|
8444
8618
|
declare type InlineFileData = Extract<FilePart['data'], {
|
|
8445
8619
|
type: 'data';
|
|
@@ -8589,7 +8763,7 @@ declare function isBuffer(value: unknown): value is Buffer;
|
|
|
8589
8763
|
*/
|
|
8590
8764
|
export declare function isCustomContentUIPart(part: UIMessagePart<UIDataTypes, UITools>): part is CustomContentUIPart;
|
|
8591
8765
|
|
|
8592
|
-
declare function isCustomReasoning(reasoning:
|
|
8766
|
+
declare function isCustomReasoning(reasoning: LanguageModelV4CallOptions_2['reasoning']): reasoning is Exclude<LanguageModelV4CallOptions_2['reasoning'], 'provider-default' | undefined>;
|
|
8593
8767
|
|
|
8594
8768
|
/**
|
|
8595
8769
|
* Check if a message part is a data part.
|
|
@@ -8671,7 +8845,7 @@ declare function isParsableJson(input: string): boolean;
|
|
|
8671
8845
|
* to provider-specific identifiers) as opposed to raw bytes, a URL, or a
|
|
8672
8846
|
* tagged `{ type: ... }` object.
|
|
8673
8847
|
*/
|
|
8674
|
-
declare function isProviderReference(data: unknown): data is
|
|
8848
|
+
declare function isProviderReference(data: unknown): data is SharedV4ProviderReference_2;
|
|
8675
8849
|
|
|
8676
8850
|
declare function isProviderStreamError(error: unknown): error is ProviderStreamError;
|
|
8677
8851
|
|
|
@@ -8751,17 +8925,17 @@ declare type IsUntypedContext<CONTEXT> = IsAny<CONTEXT> extends true ? true : un
|
|
|
8751
8925
|
/**
|
|
8752
8926
|
* Checks if the given URL is supported natively by the model.
|
|
8753
8927
|
*
|
|
8754
|
-
* @param mediaType - The media type of the URL. Case-
|
|
8928
|
+
* @param mediaType - The media type of the URL. Case-insensitive. May be a full
|
|
8755
8929
|
* `type/subtype`, a wildcard `type/*`, or just the
|
|
8756
8930
|
* top-level segment (e.g. `image`).
|
|
8757
8931
|
* @param url - The URL to check.
|
|
8758
|
-
* @param supportedUrls - A record where keys are case-
|
|
8932
|
+
* @param supportedUrls - A record where keys are case-insensitive media types (or '*')
|
|
8759
8933
|
* and values are arrays of RegExp patterns for URLs.
|
|
8760
8934
|
*
|
|
8761
8935
|
* @returns `true` if the URL matches a pattern under the specific media type
|
|
8762
8936
|
* or the wildcard '*', `false` otherwise.
|
|
8763
8937
|
*/
|
|
8764
|
-
declare function isUrlSupported({ mediaType, url, supportedUrls
|
|
8938
|
+
declare function isUrlSupported({ mediaType, url, supportedUrls }: {
|
|
8765
8939
|
mediaType: string;
|
|
8766
8940
|
url: string;
|
|
8767
8941
|
supportedUrls: Record<string, RegExp[]>;
|
|
@@ -8775,6 +8949,10 @@ declare type JSONObject = {
|
|
|
8775
8949
|
[key: string]: JSONValue_2 | undefined;
|
|
8776
8950
|
};
|
|
8777
8951
|
|
|
8952
|
+
declare type JSONObject_2 = {
|
|
8953
|
+
[key: string]: JSONValue_3 | undefined;
|
|
8954
|
+
};
|
|
8955
|
+
|
|
8778
8956
|
export declare class JSONParseError extends AISDKError {
|
|
8779
8957
|
private readonly [symbol$8];
|
|
8780
8958
|
readonly text: string;
|
|
@@ -8785,13 +8963,23 @@ export declare class JSONParseError extends AISDKError {
|
|
|
8785
8963
|
static isInstance(error: unknown): error is JSONParseError;
|
|
8786
8964
|
}
|
|
8787
8965
|
|
|
8966
|
+
declare class JSONParseError_2 extends AISDKError_2 {
|
|
8967
|
+
private readonly [symbol$8_2];
|
|
8968
|
+
readonly text: string;
|
|
8969
|
+
constructor({ text, cause }: {
|
|
8970
|
+
text: string;
|
|
8971
|
+
cause: unknown;
|
|
8972
|
+
});
|
|
8973
|
+
static isInstance(error: unknown): error is JSONParseError_2;
|
|
8974
|
+
}
|
|
8975
|
+
|
|
8788
8976
|
/**
|
|
8789
8977
|
* Create a schema using a JSON Schema.
|
|
8790
8978
|
*
|
|
8791
8979
|
* @param jsonSchema The JSON Schema for the schema.
|
|
8792
8980
|
* @param options.validate Optional. A validation function for the schema.
|
|
8793
8981
|
*/
|
|
8794
|
-
export declare function jsonSchema<OBJECT = unknown>(jsonSchema: JSONSchema7 | PromiseLike<JSONSchema7> | (() => JSONSchema7 | PromiseLike<JSONSchema7>), { validate
|
|
8982
|
+
export declare function jsonSchema<OBJECT = unknown>(jsonSchema: JSONSchema7 | PromiseLike<JSONSchema7> | (() => JSONSchema7 | PromiseLike<JSONSchema7>), { validate }?: {
|
|
8795
8983
|
validate?: (value: unknown) => ValidationResult<OBJECT> | PromiseLike<ValidationResult<OBJECT>>;
|
|
8796
8984
|
}): Schema<OBJECT>;
|
|
8797
8985
|
|
|
@@ -8814,6 +9002,12 @@ export declare type JSONValue = JSONValue_2;
|
|
|
8814
9002
|
*/
|
|
8815
9003
|
declare type JSONValue_2 = null | string | number | boolean | Readonly<JSONObject> | readonly JSONValue_2[];
|
|
8816
9004
|
|
|
9005
|
+
/**
|
|
9006
|
+
* A JSON value can be a string, number, boolean, object, array, or null.
|
|
9007
|
+
* JSON values can be serialized and deserialized by the JSON.stringify and JSON.parse methods.
|
|
9008
|
+
*/
|
|
9009
|
+
declare type JSONValue_3 = null | string | number | boolean | Readonly<JSONObject_2> | readonly JSONValue_3[];
|
|
9010
|
+
|
|
8817
9011
|
declare const KNOWN_MODEL_TYPES: readonly ["embedding", "evaluation", "image", "language", "realtime", "reranking", "speech", "transcription", "video"];
|
|
8818
9012
|
|
|
8819
9013
|
declare type KnownModelType = (typeof KNOWN_MODEL_TYPES)[number];
|
|
@@ -11002,25 +11196,167 @@ declare type LanguageModelV4CallOptions = {
|
|
|
11002
11196
|
*/
|
|
11003
11197
|
headers?: Record<string, string | undefined>;
|
|
11004
11198
|
/**
|
|
11005
|
-
* Reasoning effort level for the model. Controls how much reasoning
|
|
11006
|
-
* the model performs before generating a response. Defaults to 'provider-default'.
|
|
11199
|
+
* Reasoning effort level for the model. Controls how much reasoning
|
|
11200
|
+
* the model performs before generating a response. Defaults to 'provider-default'.
|
|
11201
|
+
*/
|
|
11202
|
+
reasoning?: 'provider-default' | 'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh';
|
|
11203
|
+
/**
|
|
11204
|
+
* Additional provider-specific options. They are passed through
|
|
11205
|
+
* to the provider from the AI SDK and enable provider-specific
|
|
11206
|
+
* functionality that can be fully encapsulated in the provider.
|
|
11207
|
+
*/
|
|
11208
|
+
providerOptions?: SharedV4ProviderOptions;
|
|
11209
|
+
};
|
|
11210
|
+
|
|
11211
|
+
declare type LanguageModelV4CallOptions_2 = {
|
|
11212
|
+
/**
|
|
11213
|
+
* A language mode prompt is a standardized prompt type.
|
|
11214
|
+
*
|
|
11215
|
+
* Note: This is **not** the user-facing prompt. The AI SDK methods will map the
|
|
11216
|
+
* user-facing prompt types such as chat or instruction prompts to this format.
|
|
11217
|
+
* That approach allows us to evolve the user facing prompts without breaking
|
|
11218
|
+
* the language model interface.
|
|
11219
|
+
*/
|
|
11220
|
+
prompt: LanguageModelV4Prompt_2;
|
|
11221
|
+
/**
|
|
11222
|
+
* Maximum number of tokens to generate.
|
|
11223
|
+
*/
|
|
11224
|
+
maxOutputTokens?: number;
|
|
11225
|
+
/**
|
|
11226
|
+
* Temperature setting. The range depends on the provider and model.
|
|
11227
|
+
*/
|
|
11228
|
+
temperature?: number;
|
|
11229
|
+
/**
|
|
11230
|
+
* Stop sequences.
|
|
11231
|
+
* If set, the model will stop generating text when one of the stop sequences is generated.
|
|
11232
|
+
* Providers may have limits on the number of stop sequences.
|
|
11233
|
+
*/
|
|
11234
|
+
stopSequences?: string[];
|
|
11235
|
+
/**
|
|
11236
|
+
* Nucleus sampling.
|
|
11237
|
+
*/
|
|
11238
|
+
topP?: number;
|
|
11239
|
+
/**
|
|
11240
|
+
* Only sample from the top K options for each subsequent token.
|
|
11241
|
+
*
|
|
11242
|
+
* Used to remove "long tail" low probability responses.
|
|
11243
|
+
* Recommended for advanced use cases only. You usually only need to use temperature.
|
|
11244
|
+
*/
|
|
11245
|
+
topK?: number;
|
|
11246
|
+
/**
|
|
11247
|
+
* Presence penalty setting. It affects the likelihood of the model to
|
|
11248
|
+
* repeat information that is already in the prompt.
|
|
11249
|
+
*/
|
|
11250
|
+
presencePenalty?: number;
|
|
11251
|
+
/**
|
|
11252
|
+
* Frequency penalty setting. It affects the likelihood of the model
|
|
11253
|
+
* to repeatedly use the same words or phrases.
|
|
11254
|
+
*/
|
|
11255
|
+
frequencyPenalty?: number;
|
|
11256
|
+
/**
|
|
11257
|
+
* Response format. The output can either be text or JSON. Default is text.
|
|
11258
|
+
*
|
|
11259
|
+
* If JSON is selected, a schema can optionally be provided to guide the LLM.
|
|
11260
|
+
*/
|
|
11261
|
+
responseFormat?: {
|
|
11262
|
+
type: 'text';
|
|
11263
|
+
} | {
|
|
11264
|
+
type: 'json';
|
|
11265
|
+
/**
|
|
11266
|
+
* JSON schema that the generated output should conform to.
|
|
11267
|
+
*/
|
|
11268
|
+
schema?: JSONSchema7;
|
|
11269
|
+
/**
|
|
11270
|
+
* Name of output that should be generated. Used by some providers for additional LLM guidance.
|
|
11271
|
+
*/
|
|
11272
|
+
name?: string;
|
|
11273
|
+
/**
|
|
11274
|
+
* Description of the output that should be generated. Used by some providers for additional LLM guidance.
|
|
11275
|
+
*/
|
|
11276
|
+
description?: string;
|
|
11277
|
+
};
|
|
11278
|
+
/**
|
|
11279
|
+
* The seed (integer) to use for random sampling. If set and supported
|
|
11280
|
+
* by the model, calls will generate deterministic results.
|
|
11281
|
+
*/
|
|
11282
|
+
seed?: number;
|
|
11283
|
+
/**
|
|
11284
|
+
* The tools that are available for the model.
|
|
11285
|
+
*/
|
|
11286
|
+
tools?: Array<LanguageModelV4FunctionTool_2 | LanguageModelV4ProviderTool_2>;
|
|
11287
|
+
/**
|
|
11288
|
+
* Specifies how the tool should be selected. Defaults to 'auto'.
|
|
11289
|
+
*/
|
|
11290
|
+
toolChoice?: LanguageModelV4ToolChoice_2;
|
|
11291
|
+
/**
|
|
11292
|
+
* Include raw chunks in the stream. Only applicable for streaming calls.
|
|
11293
|
+
*/
|
|
11294
|
+
includeRawChunks?: boolean;
|
|
11295
|
+
/**
|
|
11296
|
+
* Abort signal for cancelling the operation.
|
|
11297
|
+
*/
|
|
11298
|
+
abortSignal?: AbortSignal;
|
|
11299
|
+
/**
|
|
11300
|
+
* Additional HTTP headers to be sent with the request.
|
|
11301
|
+
* Only applicable for HTTP-based providers.
|
|
11302
|
+
*/
|
|
11303
|
+
headers?: Record<string, string | undefined>;
|
|
11304
|
+
/**
|
|
11305
|
+
* Reasoning effort level for the model. Controls how much reasoning
|
|
11306
|
+
* the model performs before generating a response. Defaults to 'provider-default'.
|
|
11307
|
+
*/
|
|
11308
|
+
reasoning?: 'provider-default' | 'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh';
|
|
11309
|
+
/**
|
|
11310
|
+
* Additional provider-specific options. They are passed through
|
|
11311
|
+
* to the provider from the AI SDK and enable provider-specific
|
|
11312
|
+
* functionality that can be fully encapsulated in the provider.
|
|
11313
|
+
*/
|
|
11314
|
+
providerOptions?: SharedV4ProviderOptions_2;
|
|
11315
|
+
};
|
|
11316
|
+
|
|
11317
|
+
declare type LanguageModelV4Content = LanguageModelV4Text | LanguageModelV4Reasoning | LanguageModelV4CustomContent | LanguageModelV4ReasoningFile | LanguageModelV4File | LanguageModelV4ToolApprovalRequest | LanguageModelV4Source | LanguageModelV4ToolCall | LanguageModelV4ToolResult;
|
|
11318
|
+
|
|
11319
|
+
/**
|
|
11320
|
+
* A provider-specific content block that does not map to another standardized
|
|
11321
|
+
* content part type.
|
|
11322
|
+
*/
|
|
11323
|
+
declare type LanguageModelV4CustomContent = {
|
|
11324
|
+
type: 'custom';
|
|
11325
|
+
/**
|
|
11326
|
+
* The kind of custom content, in the format `{provider}.{provider-type}`.
|
|
11327
|
+
*/
|
|
11328
|
+
kind: `${string}.${string}`;
|
|
11329
|
+
/**
|
|
11330
|
+
* Additional provider-specific options. They are passed through
|
|
11331
|
+
* to the provider from the AI SDK and enable provider-specific
|
|
11332
|
+
* functionality that can be fully encapsulated in the provider.
|
|
11333
|
+
*/
|
|
11334
|
+
providerMetadata?: SharedV4ProviderMetadata;
|
|
11335
|
+
};
|
|
11336
|
+
|
|
11337
|
+
/**
|
|
11338
|
+
* A provider-specific content block that does not map to another standardized
|
|
11339
|
+
* content part type.
|
|
11340
|
+
*/
|
|
11341
|
+
declare type LanguageModelV4CustomContent_2 = {
|
|
11342
|
+
type: 'custom';
|
|
11343
|
+
/**
|
|
11344
|
+
* The kind of custom content, in the format `{provider}.{provider-type}`.
|
|
11007
11345
|
*/
|
|
11008
|
-
|
|
11346
|
+
kind: `${string}.${string}`;
|
|
11009
11347
|
/**
|
|
11010
11348
|
* Additional provider-specific options. They are passed through
|
|
11011
11349
|
* to the provider from the AI SDK and enable provider-specific
|
|
11012
11350
|
* functionality that can be fully encapsulated in the provider.
|
|
11013
11351
|
*/
|
|
11014
|
-
|
|
11352
|
+
providerMetadata?: SharedV4ProviderMetadata_2;
|
|
11015
11353
|
};
|
|
11016
11354
|
|
|
11017
|
-
declare type LanguageModelV4Content = LanguageModelV4Text | LanguageModelV4Reasoning | LanguageModelV4CustomContent | LanguageModelV4ReasoningFile | LanguageModelV4File | LanguageModelV4ToolApprovalRequest | LanguageModelV4Source | LanguageModelV4ToolCall | LanguageModelV4ToolResult;
|
|
11018
|
-
|
|
11019
11355
|
/**
|
|
11020
|
-
*
|
|
11021
|
-
*
|
|
11356
|
+
* Provider-specific content part of a prompt. It contains no standardized
|
|
11357
|
+
* payload beyond provider-specific options.
|
|
11022
11358
|
*/
|
|
11023
|
-
declare
|
|
11359
|
+
declare interface LanguageModelV4CustomPart {
|
|
11024
11360
|
type: 'custom';
|
|
11025
11361
|
/**
|
|
11026
11362
|
* The kind of custom content, in the format `{provider}.{provider-type}`.
|
|
@@ -11031,14 +11367,14 @@ declare type LanguageModelV4CustomContent = {
|
|
|
11031
11367
|
* to the provider from the AI SDK and enable provider-specific
|
|
11032
11368
|
* functionality that can be fully encapsulated in the provider.
|
|
11033
11369
|
*/
|
|
11034
|
-
|
|
11035
|
-
}
|
|
11370
|
+
providerOptions?: SharedV4ProviderOptions;
|
|
11371
|
+
}
|
|
11036
11372
|
|
|
11037
11373
|
/**
|
|
11038
11374
|
* Provider-specific content part of a prompt. It contains no standardized
|
|
11039
11375
|
* payload beyond provider-specific options.
|
|
11040
11376
|
*/
|
|
11041
|
-
declare interface
|
|
11377
|
+
declare interface LanguageModelV4CustomPart_2 {
|
|
11042
11378
|
type: 'custom';
|
|
11043
11379
|
/**
|
|
11044
11380
|
* The kind of custom content, in the format `{provider}.{provider-type}`.
|
|
@@ -11049,7 +11385,7 @@ declare interface LanguageModelV4CustomPart {
|
|
|
11049
11385
|
* to the provider from the AI SDK and enable provider-specific
|
|
11050
11386
|
* functionality that can be fully encapsulated in the provider.
|
|
11051
11387
|
*/
|
|
11052
|
-
providerOptions?:
|
|
11388
|
+
providerOptions?: SharedV4ProviderOptions_2;
|
|
11053
11389
|
}
|
|
11054
11390
|
|
|
11055
11391
|
/**
|
|
@@ -11083,6 +11419,37 @@ declare type LanguageModelV4File = {
|
|
|
11083
11419
|
providerMetadata?: SharedV4ProviderMetadata;
|
|
11084
11420
|
};
|
|
11085
11421
|
|
|
11422
|
+
/**
|
|
11423
|
+
* A file that has been generated by the model.
|
|
11424
|
+
* Generated files as base64 encoded strings or binary data.
|
|
11425
|
+
* The files should be returned without any unnecessary conversion.
|
|
11426
|
+
*/
|
|
11427
|
+
declare type LanguageModelV4File_2 = {
|
|
11428
|
+
type: 'file';
|
|
11429
|
+
/**
|
|
11430
|
+
* The IANA media type of the file, e.g. `image/png` or `audio/mp3`.
|
|
11431
|
+
*
|
|
11432
|
+
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
11433
|
+
*/
|
|
11434
|
+
mediaType: string;
|
|
11435
|
+
/**
|
|
11436
|
+
* Generated file data as a tagged discriminated union:
|
|
11437
|
+
*
|
|
11438
|
+
* - `{ type: 'data', data }`: raw bytes (Uint8Array) or base64-encoded string.
|
|
11439
|
+
* - `{ type: 'url', url }`: a URL that points to the file.
|
|
11440
|
+
*
|
|
11441
|
+
* The file data should be returned without any unnecessary conversion.
|
|
11442
|
+
* If the API returns base64 encoded strings, the file data should be returned
|
|
11443
|
+
* as base64 encoded strings. If the API returns binary data, the file data should
|
|
11444
|
+
* be returned as binary data.
|
|
11445
|
+
*/
|
|
11446
|
+
data: SharedV4FileDataData_2 | SharedV4FileDataUrl_2;
|
|
11447
|
+
/**
|
|
11448
|
+
* Optional provider-specific metadata for the file part.
|
|
11449
|
+
*/
|
|
11450
|
+
providerMetadata?: SharedV4ProviderMetadata_2;
|
|
11451
|
+
};
|
|
11452
|
+
|
|
11086
11453
|
/**
|
|
11087
11454
|
* File content part of a prompt. It contains a file.
|
|
11088
11455
|
*/
|
|
@@ -11122,6 +11489,45 @@ declare interface LanguageModelV4FilePart {
|
|
|
11122
11489
|
providerOptions?: SharedV4ProviderOptions;
|
|
11123
11490
|
}
|
|
11124
11491
|
|
|
11492
|
+
/**
|
|
11493
|
+
* File content part of a prompt. It contains a file.
|
|
11494
|
+
*/
|
|
11495
|
+
declare interface LanguageModelV4FilePart_2 {
|
|
11496
|
+
type: 'file';
|
|
11497
|
+
/**
|
|
11498
|
+
* Optional filename of the file.
|
|
11499
|
+
*/
|
|
11500
|
+
filename?: string;
|
|
11501
|
+
/**
|
|
11502
|
+
* File data as a tagged discriminated union:
|
|
11503
|
+
*
|
|
11504
|
+
* - `{ type: 'data', data }`: raw bytes (Uint8Array) or base64-encoded string.
|
|
11505
|
+
* - `{ type: 'url', url }`: a URL that points to the file.
|
|
11506
|
+
* - `{ type: 'reference', reference }`: a provider reference (`{ [provider]: id }`).
|
|
11507
|
+
* - `{ type: 'text', text }`: inline text content (e.g. an inline text document).
|
|
11508
|
+
*/
|
|
11509
|
+
data: SharedV4FileData_2;
|
|
11510
|
+
/**
|
|
11511
|
+
* Either a full IANA media type (`type/subtype`, e.g. `image/png`) or just
|
|
11512
|
+
* the top-level IANA segment (e.g. `image`, `audio`, `video`, `text`).
|
|
11513
|
+
*
|
|
11514
|
+
* `*`-subtype wildcards (e.g. `image/*`) are normalized as equivalent to the
|
|
11515
|
+
* top-level segment alone (e.g. `image`). Providers can use the helpers in
|
|
11516
|
+
* `@ai-sdk/provider-utils` (`isFullMediaType`, `getTopLevelMediaType`,
|
|
11517
|
+
* `detectMediaType`) to resolve the field according to their API
|
|
11518
|
+
* requirements.
|
|
11519
|
+
*
|
|
11520
|
+
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
11521
|
+
*/
|
|
11522
|
+
mediaType: string;
|
|
11523
|
+
/**
|
|
11524
|
+
* Additional provider-specific options. They are passed through
|
|
11525
|
+
* to the provider from the AI SDK and enable provider-specific
|
|
11526
|
+
* functionality that can be fully encapsulated in the provider.
|
|
11527
|
+
*/
|
|
11528
|
+
providerOptions?: SharedV4ProviderOptions_2;
|
|
11529
|
+
}
|
|
11530
|
+
|
|
11125
11531
|
/**
|
|
11126
11532
|
* Reason why a language model finished generating a response.
|
|
11127
11533
|
*
|
|
@@ -11149,6 +11555,33 @@ declare type LanguageModelV4FinishReason = {
|
|
|
11149
11555
|
raw: string | undefined;
|
|
11150
11556
|
};
|
|
11151
11557
|
|
|
11558
|
+
/**
|
|
11559
|
+
* Reason why a language model finished generating a response.
|
|
11560
|
+
*
|
|
11561
|
+
* Contains both a unified finish reason and a raw finish reason from the provider.
|
|
11562
|
+
* The unified finish reason is used to provide a consistent finish reason across different providers.
|
|
11563
|
+
* The raw finish reason is used to provide the original finish reason from the provider.
|
|
11564
|
+
*/
|
|
11565
|
+
declare type LanguageModelV4FinishReason_2 = {
|
|
11566
|
+
/**
|
|
11567
|
+
* Unified finish reason. This enables using the same finish reason across different providers.
|
|
11568
|
+
*
|
|
11569
|
+
* Can be one of the following:
|
|
11570
|
+
* - `stop`: model generated stop sequence
|
|
11571
|
+
* - `length`: model generated maximum number of tokens
|
|
11572
|
+
* - `content-filter`: content filter violation stopped the model
|
|
11573
|
+
* - `tool-calls`: model triggered tool calls
|
|
11574
|
+
* - `error`: model stopped because of an error
|
|
11575
|
+
* - `other`: model stopped for other reasons
|
|
11576
|
+
*/
|
|
11577
|
+
unified: 'stop' | 'length' | 'content-filter' | 'tool-calls' | 'error' | 'other';
|
|
11578
|
+
/**
|
|
11579
|
+
* Raw finish reason from the provider.
|
|
11580
|
+
* This is the original finish reason from the provider.
|
|
11581
|
+
*/
|
|
11582
|
+
raw: string | undefined;
|
|
11583
|
+
};
|
|
11584
|
+
|
|
11152
11585
|
/**
|
|
11153
11586
|
* A tool has a name, a description, and a set of parameters.
|
|
11154
11587
|
*
|
|
@@ -11195,6 +11628,52 @@ declare type LanguageModelV4FunctionTool = {
|
|
|
11195
11628
|
providerOptions?: SharedV4ProviderOptions;
|
|
11196
11629
|
};
|
|
11197
11630
|
|
|
11631
|
+
/**
|
|
11632
|
+
* A tool has a name, a description, and a set of parameters.
|
|
11633
|
+
*
|
|
11634
|
+
* Note: this is **not** the user-facing tool definition. The AI SDK methods will
|
|
11635
|
+
* map the user-facing tool definitions to this format.
|
|
11636
|
+
*/
|
|
11637
|
+
declare type LanguageModelV4FunctionTool_2 = {
|
|
11638
|
+
/**
|
|
11639
|
+
* The type of the tool (always 'function').
|
|
11640
|
+
*/
|
|
11641
|
+
type: 'function';
|
|
11642
|
+
/**
|
|
11643
|
+
* The name of the tool. Unique within this model call.
|
|
11644
|
+
*/
|
|
11645
|
+
name: string;
|
|
11646
|
+
/**
|
|
11647
|
+
* A description of the tool. The language model uses this to understand the
|
|
11648
|
+
* tool's purpose and to provide better completion suggestions.
|
|
11649
|
+
*/
|
|
11650
|
+
description?: string;
|
|
11651
|
+
/**
|
|
11652
|
+
* The parameters that the tool expects. The language model uses this to
|
|
11653
|
+
* understand the tool's input requirements and to provide matching suggestions.
|
|
11654
|
+
*/
|
|
11655
|
+
inputSchema: JSONSchema7;
|
|
11656
|
+
/**
|
|
11657
|
+
* An optional list of input examples that show the language
|
|
11658
|
+
* model what the input should look like.
|
|
11659
|
+
*/
|
|
11660
|
+
inputExamples?: Array<{
|
|
11661
|
+
input: JSONObject_2;
|
|
11662
|
+
}>;
|
|
11663
|
+
/**
|
|
11664
|
+
* Strict mode setting for the tool.
|
|
11665
|
+
*
|
|
11666
|
+
* Providers that support strict mode will use this setting to determine
|
|
11667
|
+
* how the input should be generated. Strict mode will always produce
|
|
11668
|
+
* valid inputs, but it might limit what input schemas are supported.
|
|
11669
|
+
*/
|
|
11670
|
+
strict?: boolean;
|
|
11671
|
+
/**
|
|
11672
|
+
* The provider-specific options for the tool.
|
|
11673
|
+
*/
|
|
11674
|
+
providerOptions?: SharedV4ProviderOptions_2;
|
|
11675
|
+
};
|
|
11676
|
+
|
|
11198
11677
|
/**
|
|
11199
11678
|
* The result of a language model doGenerate call.
|
|
11200
11679
|
*/
|
|
@@ -11266,6 +11745,27 @@ declare type LanguageModelV4Message = ({
|
|
|
11266
11745
|
providerOptions?: SharedV4ProviderOptions;
|
|
11267
11746
|
};
|
|
11268
11747
|
|
|
11748
|
+
declare type LanguageModelV4Message_2 = ({
|
|
11749
|
+
role: 'system';
|
|
11750
|
+
content: string;
|
|
11751
|
+
} | {
|
|
11752
|
+
role: 'user';
|
|
11753
|
+
content: Array<LanguageModelV4TextPart_2 | LanguageModelV4FilePart_2>;
|
|
11754
|
+
} | {
|
|
11755
|
+
role: 'assistant';
|
|
11756
|
+
content: Array<LanguageModelV4TextPart_2 | LanguageModelV4FilePart_2 | LanguageModelV4CustomPart_2 | LanguageModelV4ReasoningPart_2 | LanguageModelV4ReasoningFilePart_2 | LanguageModelV4ToolCallPart_2 | LanguageModelV4ToolResultPart_2>;
|
|
11757
|
+
} | {
|
|
11758
|
+
role: 'tool';
|
|
11759
|
+
content: Array<LanguageModelV4ToolResultPart_2 | LanguageModelV4ToolApprovalResponsePart_2>;
|
|
11760
|
+
}) & {
|
|
11761
|
+
/**
|
|
11762
|
+
* Additional provider-specific options. They are passed through
|
|
11763
|
+
* to the provider from the AI SDK and enable provider-specific
|
|
11764
|
+
* functionality that can be fully encapsulated in the provider.
|
|
11765
|
+
*/
|
|
11766
|
+
providerOptions?: SharedV4ProviderOptions_2;
|
|
11767
|
+
};
|
|
11768
|
+
|
|
11269
11769
|
/**
|
|
11270
11770
|
* Experimental middleware for LanguageModelV4.
|
|
11271
11771
|
* This type defines the structure for middleware that can be used to modify
|
|
@@ -11355,6 +11855,17 @@ declare type LanguageModelV4Middleware = {
|
|
|
11355
11855
|
*/
|
|
11356
11856
|
declare type LanguageModelV4Prompt = Array<LanguageModelV4Message>;
|
|
11357
11857
|
|
|
11858
|
+
/**
|
|
11859
|
+
* A prompt is a list of messages.
|
|
11860
|
+
*
|
|
11861
|
+
* Note: Not all models and prompt formats support multi-modal inputs and
|
|
11862
|
+
* tool calls. The validation happens at runtime.
|
|
11863
|
+
*
|
|
11864
|
+
* Note: This is not a user-facing prompt. The AI SDK methods will map the
|
|
11865
|
+
* user-facing prompt types such as chat or instruction prompts to this format.
|
|
11866
|
+
*/
|
|
11867
|
+
declare type LanguageModelV4Prompt_2 = Array<LanguageModelV4Message_2>;
|
|
11868
|
+
|
|
11358
11869
|
/**
|
|
11359
11870
|
* The configuration of a provider tool.
|
|
11360
11871
|
*
|
|
@@ -11381,6 +11892,32 @@ declare type LanguageModelV4ProviderTool = {
|
|
|
11381
11892
|
args: Record<string, unknown>;
|
|
11382
11893
|
};
|
|
11383
11894
|
|
|
11895
|
+
/**
|
|
11896
|
+
* The configuration of a provider tool.
|
|
11897
|
+
*
|
|
11898
|
+
* Provider tools are tools that are specific to a certain provider.
|
|
11899
|
+
* The input and output schemas are defined be the provider, and
|
|
11900
|
+
* some of the tools are also executed on the provider systems.
|
|
11901
|
+
*/
|
|
11902
|
+
declare type LanguageModelV4ProviderTool_2 = {
|
|
11903
|
+
/**
|
|
11904
|
+
* The type of the tool (always 'provider').
|
|
11905
|
+
*/
|
|
11906
|
+
type: 'provider';
|
|
11907
|
+
/**
|
|
11908
|
+
* The ID of the tool. Should follow the format `<provider-id>.<unique-tool-name>`.
|
|
11909
|
+
*/
|
|
11910
|
+
id: `${string}.${string}`;
|
|
11911
|
+
/**
|
|
11912
|
+
* The name of the tool. Unique within this model call.
|
|
11913
|
+
*/
|
|
11914
|
+
name: string;
|
|
11915
|
+
/**
|
|
11916
|
+
* The arguments for configuring the tool. Must match the expected arguments defined by the provider for this tool.
|
|
11917
|
+
*/
|
|
11918
|
+
args: Record<string, unknown>;
|
|
11919
|
+
};
|
|
11920
|
+
|
|
11384
11921
|
/**
|
|
11385
11922
|
* Reasoning that the model has generated.
|
|
11386
11923
|
*/
|
|
@@ -11417,17 +11954,74 @@ declare type LanguageModelV4ReasoningFile = {
|
|
|
11417
11954
|
* as base64 encoded strings. If the API returns binary data, the file data should
|
|
11418
11955
|
* be returned as binary data.
|
|
11419
11956
|
*/
|
|
11420
|
-
data: SharedV4FileDataData | SharedV4FileDataUrl;
|
|
11957
|
+
data: SharedV4FileDataData | SharedV4FileDataUrl;
|
|
11958
|
+
/**
|
|
11959
|
+
* Optional provider-specific metadata for the reasoning file part.
|
|
11960
|
+
*/
|
|
11961
|
+
providerMetadata?: SharedV4ProviderMetadata;
|
|
11962
|
+
};
|
|
11963
|
+
|
|
11964
|
+
/**
|
|
11965
|
+
* A file that has been generated by the model as part of reasoning.
|
|
11966
|
+
* Generated files as base64 encoded strings or binary data.
|
|
11967
|
+
* The files should be returned without any unnecessary conversion.
|
|
11968
|
+
*/
|
|
11969
|
+
declare type LanguageModelV4ReasoningFile_2 = {
|
|
11970
|
+
type: 'reasoning-file';
|
|
11971
|
+
/**
|
|
11972
|
+
* The IANA media type of the file, e.g. `image/png` or `audio/mp3`.
|
|
11973
|
+
*
|
|
11974
|
+
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
11975
|
+
*/
|
|
11976
|
+
mediaType: string;
|
|
11977
|
+
/**
|
|
11978
|
+
* Generated file data as a tagged discriminated union:
|
|
11979
|
+
*
|
|
11980
|
+
* - `{ type: 'data', data }`: raw bytes (Uint8Array) or base64-encoded string.
|
|
11981
|
+
* - `{ type: 'url', url }`: a URL that points to the file.
|
|
11982
|
+
*
|
|
11983
|
+
* The file data should be returned without any unnecessary conversion.
|
|
11984
|
+
* If the API returns base64 encoded strings, the file data should be returned
|
|
11985
|
+
* as base64 encoded strings. If the API returns binary data, the file data should
|
|
11986
|
+
* be returned as binary data.
|
|
11987
|
+
*/
|
|
11988
|
+
data: SharedV4FileDataData_2 | SharedV4FileDataUrl_2;
|
|
11989
|
+
/**
|
|
11990
|
+
* Optional provider-specific metadata for the reasoning file part.
|
|
11991
|
+
*/
|
|
11992
|
+
providerMetadata?: SharedV4ProviderMetadata_2;
|
|
11993
|
+
};
|
|
11994
|
+
|
|
11995
|
+
/**
|
|
11996
|
+
* Reasoning file content part of a prompt. It contains a file generated as part of reasoning.
|
|
11997
|
+
*/
|
|
11998
|
+
declare interface LanguageModelV4ReasoningFilePart {
|
|
11999
|
+
type: 'reasoning-file';
|
|
12000
|
+
/**
|
|
12001
|
+
* File data as a tagged discriminated union:
|
|
12002
|
+
*
|
|
12003
|
+
* - `{ type: 'data', data }`: raw bytes (Uint8Array) or base64-encoded string.
|
|
12004
|
+
* - `{ type: 'url', url }`: a URL that points to the file.
|
|
12005
|
+
*/
|
|
12006
|
+
data: SharedV4FileDataData | SharedV4FileDataUrl;
|
|
12007
|
+
/**
|
|
12008
|
+
* IANA media type of the file.
|
|
12009
|
+
*
|
|
12010
|
+
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
12011
|
+
*/
|
|
12012
|
+
mediaType: string;
|
|
11421
12013
|
/**
|
|
11422
|
-
*
|
|
12014
|
+
* Additional provider-specific options. They are passed through
|
|
12015
|
+
* to the provider from the AI SDK and enable provider-specific
|
|
12016
|
+
* functionality that can be fully encapsulated in the provider.
|
|
11423
12017
|
*/
|
|
11424
|
-
|
|
11425
|
-
}
|
|
12018
|
+
providerOptions?: SharedV4ProviderOptions;
|
|
12019
|
+
}
|
|
11426
12020
|
|
|
11427
12021
|
/**
|
|
11428
12022
|
* Reasoning file content part of a prompt. It contains a file generated as part of reasoning.
|
|
11429
12023
|
*/
|
|
11430
|
-
declare interface
|
|
12024
|
+
declare interface LanguageModelV4ReasoningFilePart_2 {
|
|
11431
12025
|
type: 'reasoning-file';
|
|
11432
12026
|
/**
|
|
11433
12027
|
* File data as a tagged discriminated union:
|
|
@@ -11435,7 +12029,7 @@ declare interface LanguageModelV4ReasoningFilePart {
|
|
|
11435
12029
|
* - `{ type: 'data', data }`: raw bytes (Uint8Array) or base64-encoded string.
|
|
11436
12030
|
* - `{ type: 'url', url }`: a URL that points to the file.
|
|
11437
12031
|
*/
|
|
11438
|
-
data:
|
|
12032
|
+
data: SharedV4FileDataData_2 | SharedV4FileDataUrl_2;
|
|
11439
12033
|
/**
|
|
11440
12034
|
* IANA media type of the file.
|
|
11441
12035
|
*
|
|
@@ -11447,7 +12041,7 @@ declare interface LanguageModelV4ReasoningFilePart {
|
|
|
11447
12041
|
* to the provider from the AI SDK and enable provider-specific
|
|
11448
12042
|
* functionality that can be fully encapsulated in the provider.
|
|
11449
12043
|
*/
|
|
11450
|
-
providerOptions?:
|
|
12044
|
+
providerOptions?: SharedV4ProviderOptions_2;
|
|
11451
12045
|
}
|
|
11452
12046
|
|
|
11453
12047
|
/**
|
|
@@ -11467,6 +12061,23 @@ declare interface LanguageModelV4ReasoningPart {
|
|
|
11467
12061
|
providerOptions?: SharedV4ProviderOptions;
|
|
11468
12062
|
}
|
|
11469
12063
|
|
|
12064
|
+
/**
|
|
12065
|
+
* Reasoning content part of a prompt. It contains a string of reasoning text.
|
|
12066
|
+
*/
|
|
12067
|
+
declare interface LanguageModelV4ReasoningPart_2 {
|
|
12068
|
+
type: 'reasoning';
|
|
12069
|
+
/**
|
|
12070
|
+
* The reasoning text.
|
|
12071
|
+
*/
|
|
12072
|
+
text: string;
|
|
12073
|
+
/**
|
|
12074
|
+
* Additional provider-specific options. They are passed through
|
|
12075
|
+
* to the provider from the AI SDK and enable provider-specific
|
|
12076
|
+
* functionality that can be fully encapsulated in the provider.
|
|
12077
|
+
*/
|
|
12078
|
+
providerOptions?: SharedV4ProviderOptions_2;
|
|
12079
|
+
}
|
|
12080
|
+
|
|
11470
12081
|
declare interface LanguageModelV4ResponseMetadata {
|
|
11471
12082
|
/**
|
|
11472
12083
|
* ID for the generated response, if the provider sends one.
|
|
@@ -11482,6 +12093,21 @@ declare interface LanguageModelV4ResponseMetadata {
|
|
|
11482
12093
|
modelId?: string;
|
|
11483
12094
|
}
|
|
11484
12095
|
|
|
12096
|
+
declare interface LanguageModelV4ResponseMetadata_2 {
|
|
12097
|
+
/**
|
|
12098
|
+
* ID for the generated response, if the provider sends one.
|
|
12099
|
+
*/
|
|
12100
|
+
id?: string;
|
|
12101
|
+
/**
|
|
12102
|
+
* Timestamp for the start of the generated response, if the provider sends one.
|
|
12103
|
+
*/
|
|
12104
|
+
timestamp?: Date;
|
|
12105
|
+
/**
|
|
12106
|
+
* The ID of the response model that was used to generate the response, if the provider sends one.
|
|
12107
|
+
*/
|
|
12108
|
+
modelId?: string;
|
|
12109
|
+
}
|
|
12110
|
+
|
|
11485
12111
|
/**
|
|
11486
12112
|
* A source that has been used as input to generate the response.
|
|
11487
12113
|
*/
|
|
@@ -11535,6 +12161,59 @@ declare type LanguageModelV4Source = {
|
|
|
11535
12161
|
providerMetadata?: SharedV4ProviderMetadata;
|
|
11536
12162
|
};
|
|
11537
12163
|
|
|
12164
|
+
/**
|
|
12165
|
+
* A source that has been used as input to generate the response.
|
|
12166
|
+
*/
|
|
12167
|
+
declare type LanguageModelV4Source_2 = {
|
|
12168
|
+
type: 'source';
|
|
12169
|
+
/**
|
|
12170
|
+
* The type of source - URL sources reference web content.
|
|
12171
|
+
*/
|
|
12172
|
+
sourceType: 'url';
|
|
12173
|
+
/**
|
|
12174
|
+
* The ID of the source.
|
|
12175
|
+
*/
|
|
12176
|
+
id: string;
|
|
12177
|
+
/**
|
|
12178
|
+
* The URL of the source.
|
|
12179
|
+
*/
|
|
12180
|
+
url: string;
|
|
12181
|
+
/**
|
|
12182
|
+
* The title of the source.
|
|
12183
|
+
*/
|
|
12184
|
+
title?: string;
|
|
12185
|
+
/**
|
|
12186
|
+
* Additional provider metadata for the source.
|
|
12187
|
+
*/
|
|
12188
|
+
providerMetadata?: SharedV4ProviderMetadata_2;
|
|
12189
|
+
} | {
|
|
12190
|
+
type: 'source';
|
|
12191
|
+
/**
|
|
12192
|
+
* The type of source - document sources reference files/documents.
|
|
12193
|
+
*/
|
|
12194
|
+
sourceType: 'document';
|
|
12195
|
+
/**
|
|
12196
|
+
* The ID of the source.
|
|
12197
|
+
*/
|
|
12198
|
+
id: string;
|
|
12199
|
+
/**
|
|
12200
|
+
* IANA media type of the document (e.g., 'application/pdf').
|
|
12201
|
+
*/
|
|
12202
|
+
mediaType: string;
|
|
12203
|
+
/**
|
|
12204
|
+
* The title of the document.
|
|
12205
|
+
*/
|
|
12206
|
+
title: string;
|
|
12207
|
+
/**
|
|
12208
|
+
* Optional filename of the document.
|
|
12209
|
+
*/
|
|
12210
|
+
filename?: string;
|
|
12211
|
+
/**
|
|
12212
|
+
* Additional provider metadata for the source.
|
|
12213
|
+
*/
|
|
12214
|
+
providerMetadata?: SharedV4ProviderMetadata_2;
|
|
12215
|
+
};
|
|
12216
|
+
|
|
11538
12217
|
declare type LanguageModelV4StreamPart = {
|
|
11539
12218
|
type: 'text-start';
|
|
11540
12219
|
providerMetadata?: SharedV4ProviderMetadata;
|
|
@@ -11596,6 +12275,67 @@ declare type LanguageModelV4StreamPart = {
|
|
|
11596
12275
|
error: unknown;
|
|
11597
12276
|
};
|
|
11598
12277
|
|
|
12278
|
+
declare type LanguageModelV4StreamPart_2 = {
|
|
12279
|
+
type: 'text-start';
|
|
12280
|
+
providerMetadata?: SharedV4ProviderMetadata_2;
|
|
12281
|
+
id: string;
|
|
12282
|
+
} | {
|
|
12283
|
+
type: 'text-delta';
|
|
12284
|
+
id: string;
|
|
12285
|
+
providerMetadata?: SharedV4ProviderMetadata_2;
|
|
12286
|
+
delta: string;
|
|
12287
|
+
} | {
|
|
12288
|
+
type: 'text-end';
|
|
12289
|
+
providerMetadata?: SharedV4ProviderMetadata_2;
|
|
12290
|
+
id: string;
|
|
12291
|
+
} | {
|
|
12292
|
+
type: 'reasoning-start';
|
|
12293
|
+
providerMetadata?: SharedV4ProviderMetadata_2;
|
|
12294
|
+
id: string;
|
|
12295
|
+
} | {
|
|
12296
|
+
type: 'reasoning-delta';
|
|
12297
|
+
id: string;
|
|
12298
|
+
providerMetadata?: SharedV4ProviderMetadata_2;
|
|
12299
|
+
delta: string;
|
|
12300
|
+
} | {
|
|
12301
|
+
type: 'reasoning-end';
|
|
12302
|
+
id: string;
|
|
12303
|
+
providerMetadata?: SharedV4ProviderMetadata_2;
|
|
12304
|
+
} | {
|
|
12305
|
+
type: 'tool-input-start';
|
|
12306
|
+
id: string;
|
|
12307
|
+
toolName: string;
|
|
12308
|
+
providerMetadata?: SharedV4ProviderMetadata_2;
|
|
12309
|
+
providerExecuted?: boolean;
|
|
12310
|
+
dynamic?: boolean;
|
|
12311
|
+
title?: string;
|
|
12312
|
+
} | {
|
|
12313
|
+
type: 'tool-input-delta';
|
|
12314
|
+
id: string;
|
|
12315
|
+
delta: string;
|
|
12316
|
+
providerMetadata?: SharedV4ProviderMetadata_2;
|
|
12317
|
+
} | {
|
|
12318
|
+
type: 'tool-input-end';
|
|
12319
|
+
id: string;
|
|
12320
|
+
providerMetadata?: SharedV4ProviderMetadata_2;
|
|
12321
|
+
} | LanguageModelV4ToolApprovalRequest_2 | LanguageModelV4ToolCall_2 | LanguageModelV4ToolResult_2 | LanguageModelV4CustomContent_2 | LanguageModelV4File_2 | LanguageModelV4ReasoningFile_2 | LanguageModelV4Source_2 | {
|
|
12322
|
+
type: 'stream-start';
|
|
12323
|
+
warnings: Array<SharedV4Warning_2>;
|
|
12324
|
+
} | ({
|
|
12325
|
+
type: 'response-metadata';
|
|
12326
|
+
} & LanguageModelV4ResponseMetadata_2) | {
|
|
12327
|
+
type: 'finish';
|
|
12328
|
+
usage: LanguageModelV4Usage_2;
|
|
12329
|
+
finishReason: LanguageModelV4FinishReason_2;
|
|
12330
|
+
providerMetadata?: SharedV4ProviderMetadata_2;
|
|
12331
|
+
} | {
|
|
12332
|
+
type: 'raw';
|
|
12333
|
+
rawValue: unknown;
|
|
12334
|
+
} | {
|
|
12335
|
+
type: 'error';
|
|
12336
|
+
error: unknown;
|
|
12337
|
+
};
|
|
12338
|
+
|
|
11599
12339
|
/**
|
|
11600
12340
|
* The result of a language model doStream call.
|
|
11601
12341
|
*/
|
|
@@ -11653,6 +12393,23 @@ declare interface LanguageModelV4TextPart {
|
|
|
11653
12393
|
providerOptions?: SharedV4ProviderOptions;
|
|
11654
12394
|
}
|
|
11655
12395
|
|
|
12396
|
+
/**
|
|
12397
|
+
* Text content part of a prompt. It contains a string of text.
|
|
12398
|
+
*/
|
|
12399
|
+
declare interface LanguageModelV4TextPart_2 {
|
|
12400
|
+
type: 'text';
|
|
12401
|
+
/**
|
|
12402
|
+
* The text content.
|
|
12403
|
+
*/
|
|
12404
|
+
text: string;
|
|
12405
|
+
/**
|
|
12406
|
+
* Additional provider-specific options. They are passed through
|
|
12407
|
+
* to the provider from the AI SDK and enable provider-specific
|
|
12408
|
+
* functionality that can be fully encapsulated in the provider.
|
|
12409
|
+
*/
|
|
12410
|
+
providerOptions?: SharedV4ProviderOptions_2;
|
|
12411
|
+
}
|
|
12412
|
+
|
|
11656
12413
|
/**
|
|
11657
12414
|
* Tool approval request emitted by a provider for a provider-executed tool call.
|
|
11658
12415
|
*
|
|
@@ -11676,6 +12433,29 @@ declare type LanguageModelV4ToolApprovalRequest = {
|
|
|
11676
12433
|
providerMetadata?: SharedV4ProviderMetadata;
|
|
11677
12434
|
};
|
|
11678
12435
|
|
|
12436
|
+
/**
|
|
12437
|
+
* Tool approval request emitted by a provider for a provider-executed tool call.
|
|
12438
|
+
*
|
|
12439
|
+
* This is used for flows where the provider executes the tool (e.g. MCP tools)
|
|
12440
|
+
* but requires an explicit user approval before continuing.
|
|
12441
|
+
*/
|
|
12442
|
+
declare type LanguageModelV4ToolApprovalRequest_2 = {
|
|
12443
|
+
type: 'tool-approval-request';
|
|
12444
|
+
/**
|
|
12445
|
+
* ID of the approval request. This ID is referenced by the subsequent
|
|
12446
|
+
* tool-approval-response (tool message) to approve or deny execution.
|
|
12447
|
+
*/
|
|
12448
|
+
approvalId: string;
|
|
12449
|
+
/**
|
|
12450
|
+
* The tool call ID that this approval request is for.
|
|
12451
|
+
*/
|
|
12452
|
+
toolCallId: string;
|
|
12453
|
+
/**
|
|
12454
|
+
* Additional provider-specific metadata for the approval request.
|
|
12455
|
+
*/
|
|
12456
|
+
providerMetadata?: SharedV4ProviderMetadata_2;
|
|
12457
|
+
};
|
|
12458
|
+
|
|
11679
12459
|
/**
|
|
11680
12460
|
* Tool approval response content part of a prompt. It contains the user's
|
|
11681
12461
|
* decision to approve or deny a provider-executed tool call.
|
|
@@ -11702,6 +12482,32 @@ declare interface LanguageModelV4ToolApprovalResponsePart {
|
|
|
11702
12482
|
providerOptions?: SharedV4ProviderOptions;
|
|
11703
12483
|
}
|
|
11704
12484
|
|
|
12485
|
+
/**
|
|
12486
|
+
* Tool approval response content part of a prompt. It contains the user's
|
|
12487
|
+
* decision to approve or deny a provider-executed tool call.
|
|
12488
|
+
*/
|
|
12489
|
+
declare interface LanguageModelV4ToolApprovalResponsePart_2 {
|
|
12490
|
+
type: 'tool-approval-response';
|
|
12491
|
+
/**
|
|
12492
|
+
* ID of the approval request that this response refers to.
|
|
12493
|
+
*/
|
|
12494
|
+
approvalId: string;
|
|
12495
|
+
/**
|
|
12496
|
+
* Whether the approval was granted (true) or denied (false).
|
|
12497
|
+
*/
|
|
12498
|
+
approved: boolean;
|
|
12499
|
+
/**
|
|
12500
|
+
* Optional reason for approval or denial.
|
|
12501
|
+
*/
|
|
12502
|
+
reason?: string;
|
|
12503
|
+
/**
|
|
12504
|
+
* Additional provider-specific options. They are passed through
|
|
12505
|
+
* to the provider from the AI SDK and enable provider-specific
|
|
12506
|
+
* functionality that can be fully encapsulated in the provider.
|
|
12507
|
+
*/
|
|
12508
|
+
providerOptions?: SharedV4ProviderOptions_2;
|
|
12509
|
+
}
|
|
12510
|
+
|
|
11705
12511
|
/**
|
|
11706
12512
|
* Tool calls that the model has generated.
|
|
11707
12513
|
*/
|
|
@@ -11731,15 +12537,79 @@ declare type LanguageModelV4ToolCall = {
|
|
|
11731
12537
|
*/
|
|
11732
12538
|
dynamic?: boolean;
|
|
11733
12539
|
/**
|
|
11734
|
-
* Additional provider-specific metadata for the tool call.
|
|
12540
|
+
* Additional provider-specific metadata for the tool call.
|
|
12541
|
+
*/
|
|
12542
|
+
providerMetadata?: SharedV4ProviderMetadata;
|
|
12543
|
+
};
|
|
12544
|
+
|
|
12545
|
+
/**
|
|
12546
|
+
* Tool calls that the model has generated.
|
|
12547
|
+
*/
|
|
12548
|
+
declare type LanguageModelV4ToolCall_2 = {
|
|
12549
|
+
type: 'tool-call';
|
|
12550
|
+
/**
|
|
12551
|
+
* The identifier of the tool call. It must be unique across all tool calls.
|
|
12552
|
+
*/
|
|
12553
|
+
toolCallId: string;
|
|
12554
|
+
/**
|
|
12555
|
+
* The name of the tool that should be called.
|
|
12556
|
+
*/
|
|
12557
|
+
toolName: string;
|
|
12558
|
+
/**
|
|
12559
|
+
* Stringified JSON object with the tool call arguments. Must match the
|
|
12560
|
+
* parameters schema of the tool.
|
|
12561
|
+
*/
|
|
12562
|
+
input: string;
|
|
12563
|
+
/**
|
|
12564
|
+
* Whether the tool call will be executed by the provider.
|
|
12565
|
+
* If this flag is not set or is false, the tool call will be executed by the client.
|
|
12566
|
+
*/
|
|
12567
|
+
providerExecuted?: boolean;
|
|
12568
|
+
/**
|
|
12569
|
+
* Whether the tool is dynamic, i.e. defined at runtime.
|
|
12570
|
+
* For example, MCP (Model Context Protocol) tools that are executed by the provider.
|
|
12571
|
+
*/
|
|
12572
|
+
dynamic?: boolean;
|
|
12573
|
+
/**
|
|
12574
|
+
* Additional provider-specific metadata for the tool call.
|
|
12575
|
+
*/
|
|
12576
|
+
providerMetadata?: SharedV4ProviderMetadata_2;
|
|
12577
|
+
};
|
|
12578
|
+
|
|
12579
|
+
/**
|
|
12580
|
+
* Tool call content part of a prompt. It contains a tool call (usually generated by the AI model).
|
|
12581
|
+
*/
|
|
12582
|
+
declare interface LanguageModelV4ToolCallPart {
|
|
12583
|
+
type: 'tool-call';
|
|
12584
|
+
/**
|
|
12585
|
+
* ID of the tool call. This ID is used to match the tool call with the tool result.
|
|
12586
|
+
*/
|
|
12587
|
+
toolCallId: string;
|
|
12588
|
+
/**
|
|
12589
|
+
* Name of the tool that is being called.
|
|
12590
|
+
*/
|
|
12591
|
+
toolName: string;
|
|
12592
|
+
/**
|
|
12593
|
+
* Arguments of the tool call. This is a JSON-serializable object that matches the tool's input schema.
|
|
12594
|
+
*/
|
|
12595
|
+
input: unknown;
|
|
12596
|
+
/**
|
|
12597
|
+
* Whether the tool call will be executed by the provider.
|
|
12598
|
+
* If this flag is not set or is false, the tool call will be executed by the client.
|
|
12599
|
+
*/
|
|
12600
|
+
providerExecuted?: boolean;
|
|
12601
|
+
/**
|
|
12602
|
+
* Additional provider-specific options. They are passed through
|
|
12603
|
+
* to the provider from the AI SDK and enable provider-specific
|
|
12604
|
+
* functionality that can be fully encapsulated in the provider.
|
|
11735
12605
|
*/
|
|
11736
|
-
|
|
11737
|
-
}
|
|
12606
|
+
providerOptions?: SharedV4ProviderOptions;
|
|
12607
|
+
}
|
|
11738
12608
|
|
|
11739
12609
|
/**
|
|
11740
12610
|
* Tool call content part of a prompt. It contains a tool call (usually generated by the AI model).
|
|
11741
12611
|
*/
|
|
11742
|
-
declare interface
|
|
12612
|
+
declare interface LanguageModelV4ToolCallPart_2 {
|
|
11743
12613
|
type: 'tool-call';
|
|
11744
12614
|
/**
|
|
11745
12615
|
* ID of the tool call. This ID is used to match the tool call with the tool result.
|
|
@@ -11763,7 +12633,7 @@ declare interface LanguageModelV4ToolCallPart {
|
|
|
11763
12633
|
* to the provider from the AI SDK and enable provider-specific
|
|
11764
12634
|
* functionality that can be fully encapsulated in the provider.
|
|
11765
12635
|
*/
|
|
11766
|
-
providerOptions?:
|
|
12636
|
+
providerOptions?: SharedV4ProviderOptions_2;
|
|
11767
12637
|
}
|
|
11768
12638
|
|
|
11769
12639
|
declare type LanguageModelV4ToolChoice = {
|
|
@@ -11777,6 +12647,17 @@ declare type LanguageModelV4ToolChoice = {
|
|
|
11777
12647
|
toolName: string;
|
|
11778
12648
|
};
|
|
11779
12649
|
|
|
12650
|
+
declare type LanguageModelV4ToolChoice_2 = {
|
|
12651
|
+
type: 'auto';
|
|
12652
|
+
} | {
|
|
12653
|
+
type: 'none';
|
|
12654
|
+
} | {
|
|
12655
|
+
type: 'required';
|
|
12656
|
+
} | {
|
|
12657
|
+
type: 'tool';
|
|
12658
|
+
toolName: string;
|
|
12659
|
+
};
|
|
12660
|
+
|
|
11780
12661
|
/**
|
|
11781
12662
|
* Result of a tool call that has been executed by the provider.
|
|
11782
12663
|
*/
|
|
@@ -11819,6 +12700,48 @@ declare type LanguageModelV4ToolResult = {
|
|
|
11819
12700
|
providerMetadata?: SharedV4ProviderMetadata;
|
|
11820
12701
|
};
|
|
11821
12702
|
|
|
12703
|
+
/**
|
|
12704
|
+
* Result of a tool call that has been executed by the provider.
|
|
12705
|
+
*/
|
|
12706
|
+
declare type LanguageModelV4ToolResult_2 = {
|
|
12707
|
+
type: 'tool-result';
|
|
12708
|
+
/**
|
|
12709
|
+
* The ID of the tool call that this result is associated with.
|
|
12710
|
+
*/
|
|
12711
|
+
toolCallId: string;
|
|
12712
|
+
/**
|
|
12713
|
+
* Name of the tool that generated this result.
|
|
12714
|
+
*/
|
|
12715
|
+
toolName: string;
|
|
12716
|
+
/**
|
|
12717
|
+
* Result of the tool call. This is a JSON-serializable object.
|
|
12718
|
+
*/
|
|
12719
|
+
result: NonNullable<JSONValue_3>;
|
|
12720
|
+
/**
|
|
12721
|
+
* Optional flag if the result is an error or an error message.
|
|
12722
|
+
*/
|
|
12723
|
+
isError?: boolean;
|
|
12724
|
+
/**
|
|
12725
|
+
* Whether the tool result is preliminary.
|
|
12726
|
+
*
|
|
12727
|
+
* Preliminary tool results replace each other, e.g. image previews.
|
|
12728
|
+
* There always has to be a final, non-preliminary tool result.
|
|
12729
|
+
*
|
|
12730
|
+
* If this flag is set to true, the tool result is preliminary.
|
|
12731
|
+
* If this flag is not set or is false, the tool result is not preliminary.
|
|
12732
|
+
*/
|
|
12733
|
+
preliminary?: boolean;
|
|
12734
|
+
/**
|
|
12735
|
+
* Whether the tool is dynamic, i.e. defined at runtime.
|
|
12736
|
+
* For example, MCP (Model Context Protocol) tools that are executed by the provider.
|
|
12737
|
+
*/
|
|
12738
|
+
dynamic?: boolean;
|
|
12739
|
+
/**
|
|
12740
|
+
* Additional provider-specific metadata for the tool result.
|
|
12741
|
+
*/
|
|
12742
|
+
providerMetadata?: SharedV4ProviderMetadata_2;
|
|
12743
|
+
};
|
|
12744
|
+
|
|
11822
12745
|
/**
|
|
11823
12746
|
* Result of a tool call.
|
|
11824
12747
|
*/
|
|
@@ -11923,6 +12846,110 @@ declare type LanguageModelV4ToolResultOutput = {
|
|
|
11923
12846
|
}>;
|
|
11924
12847
|
};
|
|
11925
12848
|
|
|
12849
|
+
/**
|
|
12850
|
+
* Result of a tool call.
|
|
12851
|
+
*/
|
|
12852
|
+
declare type LanguageModelV4ToolResultOutput_2 = {
|
|
12853
|
+
/**
|
|
12854
|
+
* Text tool output that should be directly sent to the API.
|
|
12855
|
+
*/
|
|
12856
|
+
type: 'text';
|
|
12857
|
+
value: string;
|
|
12858
|
+
/**
|
|
12859
|
+
* Provider-specific options.
|
|
12860
|
+
*/
|
|
12861
|
+
providerOptions?: SharedV4ProviderOptions_2;
|
|
12862
|
+
} | {
|
|
12863
|
+
type: 'json';
|
|
12864
|
+
value: JSONValue_3;
|
|
12865
|
+
/**
|
|
12866
|
+
* Provider-specific options.
|
|
12867
|
+
*/
|
|
12868
|
+
providerOptions?: SharedV4ProviderOptions_2;
|
|
12869
|
+
} | {
|
|
12870
|
+
/**
|
|
12871
|
+
* Type when the user has denied the execution of the tool call.
|
|
12872
|
+
*/
|
|
12873
|
+
type: 'execution-denied';
|
|
12874
|
+
/**
|
|
12875
|
+
* Optional reason for the execution denial.
|
|
12876
|
+
*/
|
|
12877
|
+
reason?: string;
|
|
12878
|
+
/**
|
|
12879
|
+
* Provider-specific options.
|
|
12880
|
+
*/
|
|
12881
|
+
providerOptions?: SharedV4ProviderOptions_2;
|
|
12882
|
+
} | {
|
|
12883
|
+
type: 'error-text';
|
|
12884
|
+
value: string;
|
|
12885
|
+
/**
|
|
12886
|
+
* Provider-specific options.
|
|
12887
|
+
*/
|
|
12888
|
+
providerOptions?: SharedV4ProviderOptions_2;
|
|
12889
|
+
} | {
|
|
12890
|
+
type: 'error-json';
|
|
12891
|
+
value: JSONValue_3;
|
|
12892
|
+
/**
|
|
12893
|
+
* Provider-specific options.
|
|
12894
|
+
*/
|
|
12895
|
+
providerOptions?: SharedV4ProviderOptions_2;
|
|
12896
|
+
} | {
|
|
12897
|
+
type: 'content';
|
|
12898
|
+
value: Array<{
|
|
12899
|
+
type: 'text';
|
|
12900
|
+
/**
|
|
12901
|
+
* Text content.
|
|
12902
|
+
*/
|
|
12903
|
+
text: string;
|
|
12904
|
+
/**
|
|
12905
|
+
* Provider-specific options.
|
|
12906
|
+
*/
|
|
12907
|
+
providerOptions?: SharedV4ProviderOptions_2;
|
|
12908
|
+
} | {
|
|
12909
|
+
type: 'file';
|
|
12910
|
+
/**
|
|
12911
|
+
* File data as a tagged discriminated union:
|
|
12912
|
+
*
|
|
12913
|
+
* - `{ type: 'data', data }`: raw bytes (Uint8Array) or base64-encoded string.
|
|
12914
|
+
* - `{ type: 'url', url }`: a URL that points to the file.
|
|
12915
|
+
* - `{ type: 'reference', reference }`: a provider reference (`{ [provider]: id }`).
|
|
12916
|
+
* - `{ type: 'text', text }`: inline text content (e.g. an inline text document).
|
|
12917
|
+
*/
|
|
12918
|
+
data: SharedV4FileData_2;
|
|
12919
|
+
/**
|
|
12920
|
+
* Either a full IANA media type (`type/subtype`, e.g. `image/png`) or just
|
|
12921
|
+
* the top-level IANA segment (e.g. `image`, `audio`, `video`, `text`).
|
|
12922
|
+
*
|
|
12923
|
+
* `*`-subtype wildcards (e.g. `image/*`) are normalized as equivalent to the
|
|
12924
|
+
* top-level segment alone (e.g. `image`). Providers can use the helpers in
|
|
12925
|
+
* `@ai-sdk/provider-utils` (`isFullMediaType`, `getTopLevelMediaType`,
|
|
12926
|
+
* `detectMediaType`) to resolve the field according to their API
|
|
12927
|
+
* requirements.
|
|
12928
|
+
*
|
|
12929
|
+
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
12930
|
+
*/
|
|
12931
|
+
mediaType: string;
|
|
12932
|
+
/**
|
|
12933
|
+
* Optional filename of the file.
|
|
12934
|
+
*/
|
|
12935
|
+
filename?: string;
|
|
12936
|
+
/**
|
|
12937
|
+
* Provider-specific options.
|
|
12938
|
+
*/
|
|
12939
|
+
providerOptions?: SharedV4ProviderOptions_2;
|
|
12940
|
+
} | {
|
|
12941
|
+
/**
|
|
12942
|
+
* Custom content part. This can be used to implement
|
|
12943
|
+
* provider-specific content parts.
|
|
12944
|
+
*/
|
|
12945
|
+
type: 'custom';
|
|
12946
|
+
/**
|
|
12947
|
+
* Provider-specific options.
|
|
12948
|
+
*/
|
|
12949
|
+
providerOptions?: SharedV4ProviderOptions_2;
|
|
12950
|
+
}>;
|
|
12951
|
+
};
|
|
12952
|
+
|
|
11926
12953
|
/**
|
|
11927
12954
|
* Tool result content part of a prompt. It contains the result of the tool call with the matching ID.
|
|
11928
12955
|
*/
|
|
@@ -11948,6 +12975,31 @@ declare interface LanguageModelV4ToolResultPart {
|
|
|
11948
12975
|
providerOptions?: SharedV4ProviderOptions;
|
|
11949
12976
|
}
|
|
11950
12977
|
|
|
12978
|
+
/**
|
|
12979
|
+
* Tool result content part of a prompt. It contains the result of the tool call with the matching ID.
|
|
12980
|
+
*/
|
|
12981
|
+
declare interface LanguageModelV4ToolResultPart_2 {
|
|
12982
|
+
type: 'tool-result';
|
|
12983
|
+
/**
|
|
12984
|
+
* ID of the tool call that this result is associated with.
|
|
12985
|
+
*/
|
|
12986
|
+
toolCallId: string;
|
|
12987
|
+
/**
|
|
12988
|
+
* Name of the tool that generated this result.
|
|
12989
|
+
*/
|
|
12990
|
+
toolName: string;
|
|
12991
|
+
/**
|
|
12992
|
+
* Result of the tool call.
|
|
12993
|
+
*/
|
|
12994
|
+
output: LanguageModelV4ToolResultOutput_2;
|
|
12995
|
+
/**
|
|
12996
|
+
* Additional provider-specific options. They are passed through
|
|
12997
|
+
* to the provider from the AI SDK and enable provider-specific
|
|
12998
|
+
* functionality that can be fully encapsulated in the provider.
|
|
12999
|
+
*/
|
|
13000
|
+
providerOptions?: SharedV4ProviderOptions_2;
|
|
13001
|
+
}
|
|
13002
|
+
|
|
11951
13003
|
/**
|
|
11952
13004
|
* Usage information for a language model call.
|
|
11953
13005
|
*/
|
|
@@ -11999,6 +13051,57 @@ declare type LanguageModelV4Usage = {
|
|
|
11999
13051
|
raw?: JSONObject;
|
|
12000
13052
|
};
|
|
12001
13053
|
|
|
13054
|
+
/**
|
|
13055
|
+
* Usage information for a language model call.
|
|
13056
|
+
*/
|
|
13057
|
+
declare type LanguageModelV4Usage_2 = {
|
|
13058
|
+
/**
|
|
13059
|
+
* Information about the input tokens.
|
|
13060
|
+
*/
|
|
13061
|
+
inputTokens: {
|
|
13062
|
+
/**
|
|
13063
|
+
* The total number of input (prompt) tokens used.
|
|
13064
|
+
*/
|
|
13065
|
+
total: number | undefined;
|
|
13066
|
+
/**
|
|
13067
|
+
* The number of non-cached input (prompt) tokens used.
|
|
13068
|
+
*/
|
|
13069
|
+
noCache: number | undefined;
|
|
13070
|
+
/**
|
|
13071
|
+
* The number of cached input (prompt) tokens read.
|
|
13072
|
+
*/
|
|
13073
|
+
cacheRead: number | undefined;
|
|
13074
|
+
/**
|
|
13075
|
+
* The number of cached input (prompt) tokens written.
|
|
13076
|
+
*/
|
|
13077
|
+
cacheWrite: number | undefined;
|
|
13078
|
+
};
|
|
13079
|
+
/**
|
|
13080
|
+
* Information about the output tokens.
|
|
13081
|
+
*/
|
|
13082
|
+
outputTokens: {
|
|
13083
|
+
/**
|
|
13084
|
+
* The total number of output (completion) tokens used.
|
|
13085
|
+
*/
|
|
13086
|
+
total: number | undefined;
|
|
13087
|
+
/**
|
|
13088
|
+
* The number of text tokens used.
|
|
13089
|
+
*/
|
|
13090
|
+
text: number | undefined;
|
|
13091
|
+
/**
|
|
13092
|
+
* The number of reasoning tokens used.
|
|
13093
|
+
*/
|
|
13094
|
+
reasoning: number | undefined;
|
|
13095
|
+
};
|
|
13096
|
+
/**
|
|
13097
|
+
* Raw usage information from the provider.
|
|
13098
|
+
*
|
|
13099
|
+
* This is the usage information in the shape that the provider returns.
|
|
13100
|
+
* It can include additional information that is not part of the standard usage information.
|
|
13101
|
+
*/
|
|
13102
|
+
raw?: JSONObject_2;
|
|
13103
|
+
};
|
|
13104
|
+
|
|
12002
13105
|
/**
|
|
12003
13106
|
* Check if the last message is an assistant message with completed tool call approvals.
|
|
12004
13107
|
* The last step of the message must have at least one tool approval response and
|
|
@@ -12029,7 +13132,7 @@ declare type LazySchema<SCHEMA> = () => Schema<SCHEMA>;
|
|
|
12029
13132
|
*/
|
|
12030
13133
|
declare function lazySchema<SCHEMA>(createSchema: () => Schema<SCHEMA>): LazySchema<SCHEMA>;
|
|
12031
13134
|
|
|
12032
|
-
declare function loadApiKey({ apiKey, environmentVariableName, apiKeyParameterName, description
|
|
13135
|
+
declare function loadApiKey({ apiKey, environmentVariableName, apiKeyParameterName, description }: {
|
|
12033
13136
|
apiKey: string | undefined;
|
|
12034
13137
|
environmentVariableName: string;
|
|
12035
13138
|
apiKeyParameterName?: string;
|
|
@@ -12051,7 +13154,7 @@ export declare class LoadAPIKeyError extends AISDKError {
|
|
|
12051
13154
|
* @param environmentVariableName - The environment variable name.
|
|
12052
13155
|
* @returns The setting value.
|
|
12053
13156
|
*/
|
|
12054
|
-
declare function loadOptionalSetting({ settingValue, environmentVariableName
|
|
13157
|
+
declare function loadOptionalSetting({ settingValue, environmentVariableName }: {
|
|
12055
13158
|
settingValue: string | undefined;
|
|
12056
13159
|
environmentVariableName: string;
|
|
12057
13160
|
}): string | undefined;
|
|
@@ -12065,7 +13168,7 @@ declare function loadOptionalSetting({ settingValue, environmentVariableName, }:
|
|
|
12065
13168
|
* @param description - The description of the setting.
|
|
12066
13169
|
* @returns The setting value.
|
|
12067
13170
|
*/
|
|
12068
|
-
declare function loadSetting({ settingValue, environmentVariableName, settingName, description
|
|
13171
|
+
declare function loadSetting({ settingValue, environmentVariableName, settingName, description }: {
|
|
12069
13172
|
settingValue: string | undefined;
|
|
12070
13173
|
environmentVariableName: string;
|
|
12071
13174
|
settingName: string;
|
|
@@ -12119,13 +13222,13 @@ export { LogWarningsFunction }
|
|
|
12119
13222
|
* @returns The computed token budget, or `undefined` if the level is not
|
|
12120
13223
|
* supported.
|
|
12121
13224
|
*/
|
|
12122
|
-
declare function mapReasoningToProviderBudget({ reasoning, maxOutputTokens, maxReasoningBudget, minReasoningBudget, budgetPercentages, warnings
|
|
13225
|
+
declare function mapReasoningToProviderBudget({ reasoning, maxOutputTokens, maxReasoningBudget, minReasoningBudget, budgetPercentages, warnings }: {
|
|
12123
13226
|
reasoning: ReasoningLevel;
|
|
12124
13227
|
maxOutputTokens: number;
|
|
12125
13228
|
maxReasoningBudget: number;
|
|
12126
13229
|
minReasoningBudget?: number;
|
|
12127
13230
|
budgetPercentages?: Partial<Record<ReasoningLevel, number>>;
|
|
12128
|
-
warnings:
|
|
13231
|
+
warnings: SharedV4Warning_2[];
|
|
12129
13232
|
}): number | undefined;
|
|
12130
13233
|
|
|
12131
13234
|
/**
|
|
@@ -12137,10 +13240,10 @@ declare function mapReasoningToProviderBudget({ reasoning, maxOutputTokens, maxR
|
|
|
12137
13240
|
* @returns The mapped effort string, or `undefined` if the level is not
|
|
12138
13241
|
* supported.
|
|
12139
13242
|
*/
|
|
12140
|
-
declare function mapReasoningToProviderEffort<T extends string>({ reasoning, effortMap, warnings
|
|
13243
|
+
declare function mapReasoningToProviderEffort<T extends string>({ reasoning, effortMap, warnings }: {
|
|
12141
13244
|
reasoning: ReasoningLevel;
|
|
12142
13245
|
effortMap: Partial<Record<ReasoningLevel, T>>;
|
|
12143
|
-
warnings:
|
|
13246
|
+
warnings: SharedV4Warning_2[];
|
|
12144
13247
|
}): T | undefined;
|
|
12145
13248
|
|
|
12146
13249
|
/**
|
|
@@ -12308,9 +13411,7 @@ export declare class NoOutputGeneratedError extends AISDKError {
|
|
|
12308
13411
|
* Flattens intersected mapped types so type equality assertions and editor
|
|
12309
13412
|
* hovers show the resulting object shape.
|
|
12310
13413
|
*/
|
|
12311
|
-
declare type Normalize<OBJECT> = {
|
|
12312
|
-
[KEY in keyof OBJECT]: OBJECT[KEY];
|
|
12313
|
-
};
|
|
13414
|
+
declare type Normalize<OBJECT> = { [KEY in keyof OBJECT]: OBJECT[KEY]; };
|
|
12314
13415
|
|
|
12315
13416
|
/**
|
|
12316
13417
|
* Normalizes complete batch request counts.
|
|
@@ -12318,12 +13419,12 @@ declare type Normalize<OBJECT> = {
|
|
|
12318
13419
|
* Returns `undefined` when any count is missing, is not a non-negative safe
|
|
12319
13420
|
* integer, or when the item counts do not add up to the total.
|
|
12320
13421
|
*/
|
|
12321
|
-
declare function normalizeBatchRequestCounts({ total, pending, completed, failed
|
|
13422
|
+
declare function normalizeBatchRequestCounts({ total, pending, completed, failed }: {
|
|
12322
13423
|
total: number | null | undefined;
|
|
12323
13424
|
pending: number | null | undefined;
|
|
12324
13425
|
completed: number | null | undefined;
|
|
12325
13426
|
failed: number | null | undefined;
|
|
12326
|
-
}):
|
|
13427
|
+
}): BatchV4Status_2['requestCounts'] | undefined;
|
|
12327
13428
|
|
|
12328
13429
|
/**
|
|
12329
13430
|
* Normalizes different header inputs into a plain record with lower-case keys.
|
|
@@ -12538,9 +13639,7 @@ declare type OperationStartEvent = GenerateTextStartEvent | GenerateObjectStartE
|
|
|
12538
13639
|
* Builds the optional portion of the tool context map for tools whose context
|
|
12539
13640
|
* object itself may be `undefined`.
|
|
12540
13641
|
*/
|
|
12541
|
-
declare type OptionalToolSetContext<TOOLS extends ToolSet> = {
|
|
12542
|
-
[K in keyof TOOLS as InferToolContext<NoInfer<TOOLS[K]>> extends never ? never : undefined extends InferToolContext<NoInfer<TOOLS[K]>> ? K : never]?: InferToolContext<NoInfer<TOOLS[K]>>;
|
|
12543
|
-
};
|
|
13642
|
+
declare type OptionalToolSetContext<TOOLS extends ToolSet> = { [K in keyof TOOLS as InferToolContext<NoInfer<TOOLS[K]>> extends never ? never : undefined extends InferToolContext<NoInfer<TOOLS[K]>> ? K : never]?: InferToolContext<NoInfer<TOOLS[K]>>; };
|
|
12544
13643
|
|
|
12545
13644
|
export declare namespace Output {
|
|
12546
13645
|
export { output_Output as Output, output_array as array, output_choice as choice, output_json as json, output_object as object, output_text as text };
|
|
@@ -12748,7 +13847,7 @@ declare const parallelSearchToolFactory: _ai_sdk_provider_utils.ProviderExecuted
|
|
|
12748
13847
|
declare function parseJSON(options: {
|
|
12749
13848
|
text: string;
|
|
12750
13849
|
schema?: undefined;
|
|
12751
|
-
}): Promise<
|
|
13850
|
+
}): Promise<JSONValue_3>;
|
|
12752
13851
|
|
|
12753
13852
|
/**
|
|
12754
13853
|
* Parses a JSON string into a strongly-typed object using the provided schema.
|
|
@@ -12766,7 +13865,7 @@ declare function parseJSON<T>(options: {
|
|
|
12766
13865
|
/**
|
|
12767
13866
|
* Parses a JSON event stream into a stream of parsed JSON objects.
|
|
12768
13867
|
*/
|
|
12769
|
-
export declare function parseJsonEventStream<T>({ stream, schema
|
|
13868
|
+
export declare function parseJsonEventStream<T>({ stream, schema }: {
|
|
12770
13869
|
stream: ReadableStream<Uint8Array>;
|
|
12771
13870
|
schema: FlexibleSchema<T>;
|
|
12772
13871
|
}): ReadableStream<ParseResult<T>>;
|
|
@@ -12776,7 +13875,7 @@ export declare function parsePartialJson(jsonText: string | undefined): Promise<
|
|
|
12776
13875
|
state: 'undefined-input' | 'successful-parse' | 'repaired-parse' | 'failed-parse';
|
|
12777
13876
|
}>;
|
|
12778
13877
|
|
|
12779
|
-
declare function parseProviderOptions<OPTIONS>({ provider, providerOptions, schema
|
|
13878
|
+
declare function parseProviderOptions<OPTIONS>({ provider, providerOptions, schema }: {
|
|
12780
13879
|
provider: string;
|
|
12781
13880
|
providerOptions: Record<string, unknown> | undefined;
|
|
12782
13881
|
schema: FlexibleSchema<OPTIONS>;
|
|
@@ -12788,7 +13887,7 @@ declare type ParseResult<T> = {
|
|
|
12788
13887
|
rawValue: unknown;
|
|
12789
13888
|
} | {
|
|
12790
13889
|
success: false;
|
|
12791
|
-
error:
|
|
13890
|
+
error: JSONParseError_2 | TypeValidationError_2;
|
|
12792
13891
|
rawValue: unknown;
|
|
12793
13892
|
};
|
|
12794
13893
|
|
|
@@ -12808,7 +13907,7 @@ declare function parseTranscriptionStreamClientFrame(text: string): Transcriptio
|
|
|
12808
13907
|
* fields, so a drifted server must not crash or pollute the stream.
|
|
12809
13908
|
* Revives `response-metadata.timestamp` to a `Date`.
|
|
12810
13909
|
*/
|
|
12811
|
-
declare function parseTranscriptionStreamPart(text: string):
|
|
13910
|
+
declare function parseTranscriptionStreamPart(text: string): TranscriptionModelV4StreamPart_2 | undefined;
|
|
12812
13911
|
|
|
12813
13912
|
declare type PartialMap<KeyType, ValueType> = {} & Map<DeepPartialInternal<KeyType>, DeepPartialInternal<ValueType>>;
|
|
12814
13913
|
|
|
@@ -13023,11 +14122,11 @@ export declare function pipeUIMessageStreamToResponse({ response, status, status
|
|
|
13023
14122
|
stream: ReadableStream<UIMessageChunk>;
|
|
13024
14123
|
} & UIMessageStreamResponseInit): Promise<void>;
|
|
13025
14124
|
|
|
13026
|
-
declare const postFormDataToApi: <T>({ url, headers, formData, failedResponseHandler, successfulResponseHandler, abortSignal, fetch
|
|
14125
|
+
declare const postFormDataToApi: <T>({ url, headers, formData, failedResponseHandler, successfulResponseHandler, abortSignal, fetch }: {
|
|
13027
14126
|
url: string;
|
|
13028
14127
|
headers?: Record<string, string | undefined>;
|
|
13029
14128
|
formData: FormData;
|
|
13030
|
-
failedResponseHandler: ResponseHandler<
|
|
14129
|
+
failedResponseHandler: ResponseHandler<APICallError_2>;
|
|
13031
14130
|
successfulResponseHandler: ResponseHandler<T>;
|
|
13032
14131
|
abortSignal?: AbortSignal;
|
|
13033
14132
|
fetch?: FetchFunction;
|
|
@@ -13037,11 +14136,11 @@ declare const postFormDataToApi: <T>({ url, headers, formData, failedResponseHan
|
|
|
13037
14136
|
responseHeaders?: Record<string, string>;
|
|
13038
14137
|
}>;
|
|
13039
14138
|
|
|
13040
|
-
declare const postJsonToApi: <T>({ url, headers, body, failedResponseHandler, successfulResponseHandler, abortSignal, fetch
|
|
14139
|
+
declare const postJsonToApi: <T>({ url, headers, body, failedResponseHandler, successfulResponseHandler, abortSignal, fetch }: {
|
|
13041
14140
|
url: string;
|
|
13042
14141
|
headers?: Record<string, string | undefined>;
|
|
13043
14142
|
body: unknown;
|
|
13044
|
-
failedResponseHandler: ResponseHandler<
|
|
14143
|
+
failedResponseHandler: ResponseHandler<APICallError_2>;
|
|
13045
14144
|
successfulResponseHandler: ResponseHandler<T>;
|
|
13046
14145
|
abortSignal?: AbortSignal;
|
|
13047
14146
|
fetch?: FetchFunction;
|
|
@@ -13059,7 +14158,7 @@ declare const postJsonToApi: <T>({ url, headers, body, failedResponseHandler, su
|
|
|
13059
14158
|
* (`duplex: 'half'`). Callers with fully buffered payloads can keep using
|
|
13060
14159
|
* `postFormDataToApi`.
|
|
13061
14160
|
*/
|
|
13062
|
-
declare const postMultipartStreamToApi: <T>({ url, headers, parts, failedResponseHandler, successfulResponseHandler, abortSignal, fetch
|
|
14161
|
+
declare const postMultipartStreamToApi: <T>({ url, headers, parts, failedResponseHandler, successfulResponseHandler, abortSignal, fetch }: {
|
|
13063
14162
|
url: string;
|
|
13064
14163
|
headers?: Record<string, string | undefined>;
|
|
13065
14164
|
parts: Array<MultipartStreamPart>;
|
|
@@ -13073,7 +14172,7 @@ declare const postMultipartStreamToApi: <T>({ url, headers, parts, failedRespons
|
|
|
13073
14172
|
responseHeaders?: Record<string, string>;
|
|
13074
14173
|
}>;
|
|
13075
14174
|
|
|
13076
|
-
declare const postToApi: <T>({ url, headers, body, successfulResponseHandler, failedResponseHandler, abortSignal, fetch
|
|
14175
|
+
declare const postToApi: <T>({ url, headers, body, successfulResponseHandler, failedResponseHandler, abortSignal, fetch }: {
|
|
13077
14176
|
url: string;
|
|
13078
14177
|
headers?: Record<string, string | undefined>;
|
|
13079
14178
|
body: {
|
|
@@ -13375,7 +14474,7 @@ export declare type Provider = {
|
|
|
13375
14474
|
*
|
|
13376
14475
|
* For example, shell tools that are executed in a local shell, but have provider-defined input and output schemas.
|
|
13377
14476
|
*/
|
|
13378
|
-
declare type ProviderDefinedTool<INPUT extends
|
|
14477
|
+
declare type ProviderDefinedTool<INPUT extends JSONValue_3 | unknown | never = any, OUTPUT extends JSONValue_3 | unknown | never = any, CONTEXT extends Context | unknown | never = any> = BaseProviderTool<INPUT, OUTPUT, CONTEXT> & {
|
|
13379
14478
|
/**
|
|
13380
14479
|
* Flag that indicates whether the tool is executed by the provider.
|
|
13381
14480
|
*/
|
|
@@ -13415,7 +14514,7 @@ declare type ProviderEvaluationModelIdentifier<PROVIDER> = PROVIDER extends {
|
|
|
13415
14514
|
*
|
|
13416
14515
|
* For example, web search tools and code execution tools that are executed by the provider itself.
|
|
13417
14516
|
*/
|
|
13418
|
-
declare type ProviderExecutedTool<INPUT extends
|
|
14517
|
+
declare type ProviderExecutedTool<INPUT extends JSONValue_3 | unknown | never = any, OUTPUT extends JSONValue_3 | unknown | never = any, CONTEXT extends Context | unknown | never = any> = BaseProviderTool<INPUT, OUTPUT, CONTEXT> & {
|
|
13419
14518
|
/**
|
|
13420
14519
|
* Flag that indicates whether the tool is executed by the provider.
|
|
13421
14520
|
*/
|
|
@@ -13459,7 +14558,7 @@ export declare type ProviderMetadata = SharedV4ProviderMetadata;
|
|
|
13459
14558
|
* They are passed through to the provider from the AI SDK and enable
|
|
13460
14559
|
* provider-specific functionality that can be fully encapsulated in the provider.
|
|
13461
14560
|
*/
|
|
13462
|
-
declare type ProviderOptions =
|
|
14561
|
+
declare type ProviderOptions = SharedV4ProviderOptions_2;
|
|
13463
14562
|
|
|
13464
14563
|
export declare type ProviderReference = SharedV4ProviderReference;
|
|
13465
14564
|
|
|
@@ -13470,7 +14569,7 @@ export declare type ProviderReference = SharedV4ProviderReference;
|
|
|
13470
14569
|
* providers without re-uploading, by storing each provider's own
|
|
13471
14570
|
* identifier for the same logical file.
|
|
13472
14571
|
*/
|
|
13473
|
-
declare type ProviderReference_2 =
|
|
14572
|
+
declare type ProviderReference_2 = SharedV4ProviderReference_2;
|
|
13474
14573
|
|
|
13475
14574
|
export declare interface ProviderRegistryProvider<PROVIDERS extends Record<string, ProviderV4 | ProviderV3> = Record<string, ProviderV4 | ProviderV3>, SEPARATOR extends string = ':'> {
|
|
13476
14575
|
languageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['languageModel']>>[0]>}` : never): LanguageModelV4;
|
|
@@ -13765,7 +14864,7 @@ declare type ReadFileOptions = {
|
|
|
13765
14864
|
* @returns A Uint8Array containing the response body.
|
|
13766
14865
|
* @throws DownloadError if the response exceeds maxBytes.
|
|
13767
14866
|
*/
|
|
13768
|
-
declare function readResponseWithSizeLimit({ response, url, maxBytes
|
|
14867
|
+
declare function readResponseWithSizeLimit({ response, url, maxBytes }: {
|
|
13769
14868
|
response: Response;
|
|
13770
14869
|
url: string;
|
|
13771
14870
|
maxBytes?: number;
|
|
@@ -14465,7 +15564,7 @@ export declare type ReasoningFileUIPart = {
|
|
|
14465
15564
|
providerMetadata?: ProviderMetadata;
|
|
14466
15565
|
};
|
|
14467
15566
|
|
|
14468
|
-
declare type ReasoningLevel = Exclude<
|
|
15567
|
+
declare type ReasoningLevel = Exclude<LanguageModelV4CallOptions_2['reasoning'], 'none' | 'provider-default' | undefined>;
|
|
14469
15568
|
|
|
14470
15569
|
/**
|
|
14471
15570
|
* Reasoning output of a text generation. It contains a reasoning.
|
|
@@ -14577,9 +15676,7 @@ export declare type RequestOptions<TOOLS extends ToolSet = ToolSet> = {
|
|
|
14577
15676
|
* Builds the required portion of the tool context map for tools whose context
|
|
14578
15677
|
* type does not include `undefined`.
|
|
14579
15678
|
*/
|
|
14580
|
-
declare type RequiredToolSetContext<TOOLS extends ToolSet> = {
|
|
14581
|
-
[K in keyof TOOLS as InferToolContext<NoInfer<TOOLS[K]>> extends never ? never : undefined extends InferToolContext<NoInfer<TOOLS[K]>> ? never : K]: InferToolContext<NoInfer<TOOLS[K]>>;
|
|
14582
|
-
};
|
|
15679
|
+
declare type RequiredToolSetContext<TOOLS extends ToolSet> = { [K in keyof TOOLS as InferToolContext<NoInfer<TOOLS[K]>> extends never ? never : undefined extends InferToolContext<NoInfer<TOOLS[K]>> ? never : K]: InferToolContext<NoInfer<TOOLS[K]>>; };
|
|
14583
15680
|
|
|
14584
15681
|
/**
|
|
14585
15682
|
* Rerank documents using a reranking model. The type of the value is defined by the reranking model.
|
|
@@ -15119,8 +16216,8 @@ declare function resolve<T>(value: Resolvable<T>): Promise<T>;
|
|
|
15119
16216
|
* - When neither applies (e.g. top-level-only with a URL source, or bytes that
|
|
15120
16217
|
* cannot be detected), an `UnsupportedFunctionalityError` is thrown.
|
|
15121
16218
|
*/
|
|
15122
|
-
declare function resolveFullMediaType({ part
|
|
15123
|
-
part:
|
|
16219
|
+
declare function resolveFullMediaType({ part }: {
|
|
16220
|
+
part: LanguageModelV4FilePart_2;
|
|
15124
16221
|
}): string;
|
|
15125
16222
|
|
|
15126
16223
|
/**
|
|
@@ -15128,8 +16225,8 @@ declare function resolveFullMediaType({ part, }: {
|
|
|
15128
16225
|
* given provider. Throws `NoSuchProviderReferenceError` if the provider is not
|
|
15129
16226
|
* found in the reference mapping.
|
|
15130
16227
|
*/
|
|
15131
|
-
declare function resolveProviderReference({ reference, provider
|
|
15132
|
-
reference:
|
|
16228
|
+
declare function resolveProviderReference({ reference, provider }: {
|
|
16229
|
+
reference: SharedV4ProviderReference_2;
|
|
15133
16230
|
provider: string;
|
|
15134
16231
|
}): string;
|
|
15135
16232
|
|
|
@@ -15149,13 +16246,13 @@ declare type ResponseHandler<RETURN_TYPE> = (options: {
|
|
|
15149
16246
|
*/
|
|
15150
16247
|
declare type ResponseMessage = AssistantModelMessage | ToolModelMessage;
|
|
15151
16248
|
|
|
15152
|
-
declare type RetryDelayProvider = ({ error, exponentialBackoffDelay
|
|
16249
|
+
declare type RetryDelayProvider = ({ error, exponentialBackoffDelay }: {
|
|
15153
16250
|
error: unknown;
|
|
15154
16251
|
exponentialBackoffDelay: number;
|
|
15155
16252
|
}) => number;
|
|
15156
16253
|
|
|
15157
16254
|
export declare class RetryError extends AISDKError {
|
|
15158
|
-
private readonly [symbol$
|
|
16255
|
+
private readonly [symbol$1_4];
|
|
15159
16256
|
readonly reason: RetryErrorReason_2;
|
|
15160
16257
|
readonly lastError: unknown;
|
|
15161
16258
|
readonly errors: Array<unknown>;
|
|
@@ -15167,7 +16264,7 @@ export declare class RetryError extends AISDKError {
|
|
|
15167
16264
|
static isInstance(error: unknown): error is RetryError;
|
|
15168
16265
|
}
|
|
15169
16266
|
|
|
15170
|
-
declare type RetryErrorFactory = ({ message, reason, errors
|
|
16267
|
+
declare type RetryErrorFactory = ({ message, reason, errors }: {
|
|
15171
16268
|
message: string;
|
|
15172
16269
|
reason: RetryErrorReason;
|
|
15173
16270
|
errors: Array<unknown>;
|
|
@@ -15182,7 +16279,7 @@ declare type RetryFunction = <OUTPUT>(fn: () => PromiseLike<OUTPUT>) => PromiseL
|
|
|
15182
16279
|
/**
|
|
15183
16280
|
* Retries a failed operation with exponential backoff.
|
|
15184
16281
|
*/
|
|
15185
|
-
declare const retryWithExponentialBackoff: ({ maxRetries, initialDelayInMs, backoffFactor, abortSignal, shouldRetry, getDelayInMs, createRetryError
|
|
16282
|
+
declare const retryWithExponentialBackoff: ({ maxRetries, initialDelayInMs, backoffFactor, abortSignal, shouldRetry, getDelayInMs, createRetryError }: {
|
|
15186
16283
|
maxRetries?: number;
|
|
15187
16284
|
initialDelayInMs?: number;
|
|
15188
16285
|
backoffFactor?: number;
|
|
@@ -15201,7 +16298,7 @@ declare const retryWithExponentialBackoff: ({ maxRetries, initialDelayInMs, back
|
|
|
15201
16298
|
declare function safeParseJSON(options: {
|
|
15202
16299
|
text: string;
|
|
15203
16300
|
schema?: undefined;
|
|
15204
|
-
}): Promise<ParseResult<
|
|
16301
|
+
}): Promise<ParseResult<JSONValue_3>>;
|
|
15205
16302
|
|
|
15206
16303
|
/**
|
|
15207
16304
|
* Safely parses a JSON string into a strongly-typed object, using a provided schema to validate the object.
|
|
@@ -15226,17 +16323,17 @@ declare function safeParseJSON<T>(options: {
|
|
|
15226
16323
|
* @param {TypeValidationContext} options.context - Optional context about what is being validated.
|
|
15227
16324
|
* @returns An object with either a `success` flag and the parsed and typed data, or a `success` flag and an error object.
|
|
15228
16325
|
*/
|
|
15229
|
-
declare function safeValidateTypes<OBJECT>({ value, schema, context
|
|
16326
|
+
declare function safeValidateTypes<OBJECT>({ value, schema, context }: {
|
|
15230
16327
|
value: unknown;
|
|
15231
16328
|
schema: FlexibleSchema<OBJECT>;
|
|
15232
|
-
context?:
|
|
16329
|
+
context?: TypeValidationContext_2;
|
|
15233
16330
|
}): Promise<{
|
|
15234
16331
|
success: true;
|
|
15235
16332
|
value: OBJECT;
|
|
15236
16333
|
rawValue: unknown;
|
|
15237
16334
|
} | {
|
|
15238
16335
|
success: false;
|
|
15239
|
-
error:
|
|
16336
|
+
error: TypeValidationError_2;
|
|
15240
16337
|
rawValue: unknown;
|
|
15241
16338
|
}>;
|
|
15242
16339
|
|
|
@@ -15308,9 +16405,9 @@ declare const schemaSymbol: unique symbol;
|
|
|
15308
16405
|
|
|
15309
16406
|
declare function secureJsonParse(text: string): any;
|
|
15310
16407
|
|
|
15311
|
-
declare class SerializationError extends
|
|
16408
|
+
declare class SerializationError extends AISDKError_2 {
|
|
15312
16409
|
private readonly [symbol_2];
|
|
15313
|
-
constructor({ message, cause
|
|
16410
|
+
constructor({ message, cause }?: {
|
|
15314
16411
|
message?: string;
|
|
15315
16412
|
cause?: unknown;
|
|
15316
16413
|
});
|
|
@@ -15344,7 +16441,7 @@ declare function serializeModelOptions<CONFIG extends {
|
|
|
15344
16441
|
config: CONFIG;
|
|
15345
16442
|
}): {
|
|
15346
16443
|
modelId: string;
|
|
15347
|
-
config:
|
|
16444
|
+
config: JSONObject_2;
|
|
15348
16445
|
};
|
|
15349
16446
|
|
|
15350
16447
|
/**
|
|
@@ -15355,7 +16452,7 @@ declare function serializeModelOptions<CONFIG extends {
|
|
|
15355
16452
|
* `undefined` for payloads that are not JSON-serializable (envelope rule 4,
|
|
15356
16453
|
* e.g. bigint or cyclic values); callers drop the frame.
|
|
15357
16454
|
*/
|
|
15358
|
-
declare function serializeTranscriptionStreamPart(part:
|
|
16455
|
+
declare function serializeTranscriptionStreamPart(part: TranscriptionModelV4StreamPart_2): string | undefined;
|
|
15359
16456
|
|
|
15360
16457
|
export declare class SerialJobExecutor {
|
|
15361
16458
|
private queue;
|
|
@@ -15527,6 +16624,16 @@ declare type SharedV4AudioFormat = {
|
|
|
15527
16624
|
*/
|
|
15528
16625
|
declare type SharedV4FileData = SharedV4FileDataData | SharedV4FileDataUrl | SharedV4FileDataReference | SharedV4FileDataText;
|
|
15529
16626
|
|
|
16627
|
+
/**
|
|
16628
|
+
* File data as a tagged discriminated union:
|
|
16629
|
+
*
|
|
16630
|
+
* - `{ type: 'data', data }`: raw bytes (`Uint8Array`) or base64-encoded string.
|
|
16631
|
+
* - `{ type: 'url', url }`: a URL that points to the file.
|
|
16632
|
+
* - `{ type: 'reference', reference }`: a provider reference (`{ [provider]: id }`).
|
|
16633
|
+
* - `{ type: 'text', text }`: inline text content (e.g. an inline text document).
|
|
16634
|
+
*/
|
|
16635
|
+
declare type SharedV4FileData_2 = SharedV4FileDataData_2 | SharedV4FileDataUrl_2 | SharedV4FileDataReference_2 | SharedV4FileDataText_2;
|
|
16636
|
+
|
|
15530
16637
|
/**
|
|
15531
16638
|
* File data variant containing raw bytes (`Uint8Array`) or a base64-encoded
|
|
15532
16639
|
* string.
|
|
@@ -15536,12 +16643,29 @@ declare interface SharedV4FileDataData {
|
|
|
15536
16643
|
data: Uint8Array | string;
|
|
15537
16644
|
}
|
|
15538
16645
|
|
|
16646
|
+
/**
|
|
16647
|
+
* File data variant containing raw bytes (`Uint8Array`) or a base64-encoded
|
|
16648
|
+
* string.
|
|
16649
|
+
*/
|
|
16650
|
+
declare interface SharedV4FileDataData_2 {
|
|
16651
|
+
type: 'data';
|
|
16652
|
+
data: Uint8Array | string;
|
|
16653
|
+
}
|
|
16654
|
+
|
|
15539
16655
|
/**
|
|
15540
16656
|
* File data variant containing a provider reference (`{ [provider]: id }`).
|
|
15541
16657
|
*/
|
|
15542
16658
|
declare interface SharedV4FileDataReference {
|
|
15543
16659
|
type: 'reference';
|
|
15544
|
-
reference: SharedV4ProviderReference;
|
|
16660
|
+
reference: SharedV4ProviderReference;
|
|
16661
|
+
}
|
|
16662
|
+
|
|
16663
|
+
/**
|
|
16664
|
+
* File data variant containing a provider reference (`{ [provider]: id }`).
|
|
16665
|
+
*/
|
|
16666
|
+
declare interface SharedV4FileDataReference_2 {
|
|
16667
|
+
type: 'reference';
|
|
16668
|
+
reference: SharedV4ProviderReference_2;
|
|
15545
16669
|
}
|
|
15546
16670
|
|
|
15547
16671
|
/**
|
|
@@ -15553,6 +16677,15 @@ declare interface SharedV4FileDataText {
|
|
|
15553
16677
|
text: string;
|
|
15554
16678
|
}
|
|
15555
16679
|
|
|
16680
|
+
/**
|
|
16681
|
+
* File data variant containing inline text content (e.g. an inline text
|
|
16682
|
+
* document).
|
|
16683
|
+
*/
|
|
16684
|
+
declare interface SharedV4FileDataText_2 {
|
|
16685
|
+
type: 'text';
|
|
16686
|
+
text: string;
|
|
16687
|
+
}
|
|
16688
|
+
|
|
15556
16689
|
/**
|
|
15557
16690
|
* File data variant containing a URL that points to the file.
|
|
15558
16691
|
*/
|
|
@@ -15568,8 +16701,25 @@ declare interface SharedV4FileDataUrl {
|
|
|
15568
16701
|
originalUrl?: string;
|
|
15569
16702
|
}
|
|
15570
16703
|
|
|
16704
|
+
/**
|
|
16705
|
+
* File data variant containing a URL that points to the file.
|
|
16706
|
+
*/
|
|
16707
|
+
declare interface SharedV4FileDataUrl_2 {
|
|
16708
|
+
type: 'url';
|
|
16709
|
+
url: URL;
|
|
16710
|
+
/**
|
|
16711
|
+
* The original URL string before it was parsed into a `URL`.
|
|
16712
|
+
*
|
|
16713
|
+
* This is available when parsing would change the string and a provider
|
|
16714
|
+
* needs to preserve an opaque non-HTTP URI exactly.
|
|
16715
|
+
*/
|
|
16716
|
+
originalUrl?: string;
|
|
16717
|
+
}
|
|
16718
|
+
|
|
15571
16719
|
declare type SharedV4Headers = Record<string, string>;
|
|
15572
16720
|
|
|
16721
|
+
declare type SharedV4Headers_2 = Record<string, string>;
|
|
16722
|
+
|
|
15573
16723
|
/**
|
|
15574
16724
|
* Additional provider-specific metadata.
|
|
15575
16725
|
* Metadata are additional outputs from the provider.
|
|
@@ -15593,6 +16743,29 @@ declare type SharedV4Headers = Record<string, string>;
|
|
|
15593
16743
|
*/
|
|
15594
16744
|
declare type SharedV4ProviderMetadata = Record<string, JSONObject>;
|
|
15595
16745
|
|
|
16746
|
+
/**
|
|
16747
|
+
* Additional provider-specific metadata.
|
|
16748
|
+
* Metadata are additional outputs from the provider.
|
|
16749
|
+
* They are passed through to the provider from the AI SDK
|
|
16750
|
+
* and enable provider-specific functionality
|
|
16751
|
+
* that can be fully encapsulated in the provider.
|
|
16752
|
+
*
|
|
16753
|
+
* This enables us to quickly ship provider-specific functionality
|
|
16754
|
+
* without affecting the core AI SDK.
|
|
16755
|
+
*
|
|
16756
|
+
* The outer record is keyed by the provider name, and the inner
|
|
16757
|
+
* record is keyed by the provider-specific metadata key.
|
|
16758
|
+
*
|
|
16759
|
+
* ```ts
|
|
16760
|
+
* {
|
|
16761
|
+
* "anthropic": {
|
|
16762
|
+
* "cacheControl": { "type": "ephemeral" }
|
|
16763
|
+
* }
|
|
16764
|
+
* }
|
|
16765
|
+
* ```
|
|
16766
|
+
*/
|
|
16767
|
+
declare type SharedV4ProviderMetadata_2 = Record<string, JSONObject_2>;
|
|
16768
|
+
|
|
15596
16769
|
/**
|
|
15597
16770
|
* Additional provider-specific options.
|
|
15598
16771
|
* Options are additional input to the provider.
|
|
@@ -15616,6 +16789,29 @@ declare type SharedV4ProviderMetadata = Record<string, JSONObject>;
|
|
|
15616
16789
|
*/
|
|
15617
16790
|
declare type SharedV4ProviderOptions = Record<string, JSONObject>;
|
|
15618
16791
|
|
|
16792
|
+
/**
|
|
16793
|
+
* Additional provider-specific options.
|
|
16794
|
+
* Options are additional input to the provider.
|
|
16795
|
+
* They are passed through to the provider from the AI SDK
|
|
16796
|
+
* and enable provider-specific functionality
|
|
16797
|
+
* that can be fully encapsulated in the provider.
|
|
16798
|
+
*
|
|
16799
|
+
* This enables us to quickly ship provider-specific functionality
|
|
16800
|
+
* without affecting the core AI SDK.
|
|
16801
|
+
*
|
|
16802
|
+
* The outer record is keyed by the provider name, and the inner
|
|
16803
|
+
* record is keyed by the provider-specific metadata key.
|
|
16804
|
+
*
|
|
16805
|
+
* ```ts
|
|
16806
|
+
* {
|
|
16807
|
+
* "anthropic": {
|
|
16808
|
+
* "cacheControl": { "type": "ephemeral" }
|
|
16809
|
+
* }
|
|
16810
|
+
* }
|
|
16811
|
+
* ```
|
|
16812
|
+
*/
|
|
16813
|
+
declare type SharedV4ProviderOptions_2 = Record<string, JSONObject_2>;
|
|
16814
|
+
|
|
15619
16815
|
/**
|
|
15620
16816
|
* A mapping of provider names to provider-specific file identifiers.
|
|
15621
16817
|
*
|
|
@@ -15639,6 +16835,29 @@ declare type SharedV4ProviderReference = Record<string, string> & {
|
|
|
15639
16835
|
type?: never;
|
|
15640
16836
|
};
|
|
15641
16837
|
|
|
16838
|
+
/**
|
|
16839
|
+
* A mapping of provider names to provider-specific file identifiers.
|
|
16840
|
+
*
|
|
16841
|
+
* Provider references allow files to be identified across different
|
|
16842
|
+
* providers without re-uploading, by storing each provider's own
|
|
16843
|
+
* identifier for the same logical file.
|
|
16844
|
+
*
|
|
16845
|
+
* ```ts
|
|
16846
|
+
* {
|
|
16847
|
+
* "openai": "file-abc123",
|
|
16848
|
+
* "anthropic": "file-xyz789"
|
|
16849
|
+
* }
|
|
16850
|
+
* ```
|
|
16851
|
+
*
|
|
16852
|
+
* The `type?: never` constraint excludes any object that has a `type`
|
|
16853
|
+
* property, so a `SharedV4ProviderReference` cannot be confused with a
|
|
16854
|
+
* tagged file-data shape (e.g. `{ type: 'data', data }` or
|
|
16855
|
+
* `{ type: 'reference', reference }`) when both appear in the same union.
|
|
16856
|
+
*/
|
|
16857
|
+
declare type SharedV4ProviderReference_2 = Record<string, string> & {
|
|
16858
|
+
type?: never;
|
|
16859
|
+
};
|
|
16860
|
+
|
|
15642
16861
|
/**
|
|
15643
16862
|
* Warning from the model.
|
|
15644
16863
|
*
|
|
@@ -15695,6 +16914,62 @@ declare type SharedV4Warning = {
|
|
|
15695
16914
|
message: string;
|
|
15696
16915
|
};
|
|
15697
16916
|
|
|
16917
|
+
/**
|
|
16918
|
+
* Warning from the model.
|
|
16919
|
+
*
|
|
16920
|
+
* For example, that certain features are unsupported or compatibility
|
|
16921
|
+
* functionality is used (which might lead to suboptimal results).
|
|
16922
|
+
*/
|
|
16923
|
+
declare type SharedV4Warning_2 = {
|
|
16924
|
+
/**
|
|
16925
|
+
* A feature is not supported by the model.
|
|
16926
|
+
*/
|
|
16927
|
+
type: 'unsupported';
|
|
16928
|
+
/**
|
|
16929
|
+
* The feature that is not supported.
|
|
16930
|
+
*/
|
|
16931
|
+
feature: string;
|
|
16932
|
+
/**
|
|
16933
|
+
* Additional details about the warning.
|
|
16934
|
+
*/
|
|
16935
|
+
details?: string;
|
|
16936
|
+
} | {
|
|
16937
|
+
/**
|
|
16938
|
+
* A compatibility feature is used that might lead to suboptimal results.
|
|
16939
|
+
*/
|
|
16940
|
+
type: 'compatibility';
|
|
16941
|
+
/**
|
|
16942
|
+
* The feature that is used in a compatibility mode.
|
|
16943
|
+
*/
|
|
16944
|
+
feature: string;
|
|
16945
|
+
/**
|
|
16946
|
+
* Additional details about the warning.
|
|
16947
|
+
*/
|
|
16948
|
+
details?: string;
|
|
16949
|
+
} | {
|
|
16950
|
+
/**
|
|
16951
|
+
* A deprecated feature or option is being used.
|
|
16952
|
+
*/
|
|
16953
|
+
type: 'deprecated';
|
|
16954
|
+
/**
|
|
16955
|
+
* The deprecated setting or feature name.
|
|
16956
|
+
*/
|
|
16957
|
+
setting: string;
|
|
16958
|
+
/**
|
|
16959
|
+
* A human-readable message explaining what to use instead.
|
|
16960
|
+
*/
|
|
16961
|
+
message: string;
|
|
16962
|
+
} | {
|
|
16963
|
+
/**
|
|
16964
|
+
* Other warning.
|
|
16965
|
+
*/
|
|
16966
|
+
type: 'other';
|
|
16967
|
+
/**
|
|
16968
|
+
* The message of the warning.
|
|
16969
|
+
*/
|
|
16970
|
+
message: string;
|
|
16971
|
+
};
|
|
16972
|
+
|
|
15698
16973
|
declare type ShouldRetryFunction = (error: unknown) => boolean | Promise<boolean>;
|
|
15699
16974
|
|
|
15700
16975
|
/**
|
|
@@ -17098,13 +18373,15 @@ declare interface StreamingToolCallDelta {
|
|
|
17098
18373
|
* emits tool-input-start/delta/end and tool-call events, and finalizes
|
|
17099
18374
|
* unfinished tool calls on flush.
|
|
17100
18375
|
*
|
|
17101
|
-
* Used by openai, openai-compatible, groq, deepseek,
|
|
18376
|
+
* Used by openai, openai-compatible, groq, deepseek, alibaba, mistral, and
|
|
18377
|
+
* moonshotai providers.
|
|
17102
18378
|
*/
|
|
17103
18379
|
declare class StreamingToolCallTracker<DELTA extends StreamingToolCallDelta = StreamingToolCallDelta> {
|
|
17104
18380
|
private toolCalls;
|
|
17105
18381
|
private toolCallsById;
|
|
17106
18382
|
private toolCallsByIndex;
|
|
17107
|
-
private
|
|
18383
|
+
private usedToolCallIds;
|
|
18384
|
+
private nextGeneratedIdSuffixes;
|
|
17108
18385
|
private readonly controller;
|
|
17109
18386
|
private readonly _generateId;
|
|
17110
18387
|
private readonly typeValidation;
|
|
@@ -17122,16 +18399,37 @@ declare class StreamingToolCallTracker<DELTA extends StreamingToolCallDelta = St
|
|
|
17122
18399
|
* flush handler to ensure all tool calls are properly completed.
|
|
17123
18400
|
*/
|
|
17124
18401
|
flush(): void;
|
|
18402
|
+
/**
|
|
18403
|
+
* Correlation precedence for streamed deltas:
|
|
18404
|
+
*
|
|
18405
|
+
* | ID evidence | index/name evidence | start evidence | resolution |
|
|
18406
|
+
* | --- | --- | --- | --- |
|
|
18407
|
+
* | known | matching | any | matching call, new call, or ambiguity |
|
|
18408
|
+
* | known | conflicting | named | new call |
|
|
18409
|
+
* | unseen | matching | structured start | new call |
|
|
18410
|
+
* | unseen | matching | continuation | matching call or ambiguity |
|
|
18411
|
+
* | absent | matching | any | matching call, new call, or ambiguity |
|
|
18412
|
+
* | absent | absent | named | new call |
|
|
18413
|
+
* | absent | absent | unnamed | sole unfinished call, new call, or ambiguity |
|
|
18414
|
+
*/
|
|
18415
|
+
private resolveToolCall;
|
|
18416
|
+
private filterToolCallsByName;
|
|
18417
|
+
private resolveMatchingToolCall;
|
|
17125
18418
|
private processNewToolCall;
|
|
18419
|
+
private associateWireId;
|
|
18420
|
+
private associateIndex;
|
|
18421
|
+
private createToolCallId;
|
|
18422
|
+
private getNonBlankString;
|
|
17126
18423
|
private processExistingToolCall;
|
|
17127
18424
|
private finishToolCall;
|
|
17128
18425
|
}
|
|
17129
18426
|
|
|
17130
|
-
declare type StreamingToolCallTrackerController = Pick<TransformStreamDefaultController<
|
|
18427
|
+
declare type StreamingToolCallTrackerController = Pick<TransformStreamDefaultController<LanguageModelV4StreamPart_2>, 'enqueue'>;
|
|
17131
18428
|
|
|
17132
18429
|
declare interface StreamingToolCallTrackerOptions<DELTA extends StreamingToolCallDelta = StreamingToolCallDelta> {
|
|
17133
18430
|
/**
|
|
17134
18431
|
* ID generator function for tool call IDs.
|
|
18432
|
+
* Blank or repeated outputs are converted to usable unique IDs.
|
|
17135
18433
|
* Defaults to the standard generateId.
|
|
17136
18434
|
*/
|
|
17137
18435
|
generateId?: () => string;
|
|
@@ -17148,13 +18446,13 @@ declare interface StreamingToolCallTrackerOptions<DELTA extends StreamingToolCal
|
|
|
17148
18446
|
* The returned metadata is stored on the tool call and passed to
|
|
17149
18447
|
* `buildToolCallProviderMetadata` when the tool call is finalized.
|
|
17150
18448
|
*/
|
|
17151
|
-
extractMetadata?: (delta: DELTA) =>
|
|
18449
|
+
extractMetadata?: (delta: DELTA) => SharedV4ProviderMetadata_2 | undefined;
|
|
17152
18450
|
/**
|
|
17153
18451
|
* Build the `providerMetadata` object for a `tool-call` event.
|
|
17154
18452
|
* Receives the metadata previously extracted via `extractMetadata`.
|
|
17155
18453
|
* If `undefined` is returned, no `providerMetadata` is included in the event.
|
|
17156
18454
|
*/
|
|
17157
|
-
buildToolCallProviderMetadata?: (metadata:
|
|
18455
|
+
buildToolCallProviderMetadata?: (metadata: SharedV4ProviderMetadata_2 | undefined) => SharedV4ProviderMetadata_2 | undefined;
|
|
17158
18456
|
}
|
|
17159
18457
|
|
|
17160
18458
|
/**
|
|
@@ -17497,7 +18795,7 @@ declare interface StreamOptions {
|
|
|
17497
18795
|
* Error reported by a provider after a model response stream has started.
|
|
17498
18796
|
*/
|
|
17499
18797
|
export declare class StreamProviderError extends AISDKError {
|
|
17500
|
-
private readonly [symbol$
|
|
18798
|
+
private readonly [symbol$8_3];
|
|
17501
18799
|
/**
|
|
17502
18800
|
* Provider-defined error type, when supplied by the provider.
|
|
17503
18801
|
*/
|
|
@@ -18284,10 +19582,16 @@ declare function stripFileExtension(filename: string): string;
|
|
|
18284
19582
|
|
|
18285
19583
|
declare const symbol$1: unique symbol;
|
|
18286
19584
|
|
|
19585
|
+
declare const symbol$14: unique symbol;
|
|
19586
|
+
|
|
19587
|
+
declare const symbol$15: unique symbol;
|
|
19588
|
+
|
|
18287
19589
|
declare const symbol$1_2: unique symbol;
|
|
18288
19590
|
|
|
18289
19591
|
declare const symbol$1_3: unique symbol;
|
|
18290
19592
|
|
|
19593
|
+
declare const symbol$1_4: unique symbol;
|
|
19594
|
+
|
|
18291
19595
|
declare const symbol$2: unique symbol;
|
|
18292
19596
|
|
|
18293
19597
|
declare const symbol$2_2: unique symbol;
|
|
@@ -18316,6 +19620,8 @@ declare const symbol$8: unique symbol;
|
|
|
18316
19620
|
|
|
18317
19621
|
declare const symbol$8_2: unique symbol;
|
|
18318
19622
|
|
|
19623
|
+
declare const symbol$8_3: unique symbol;
|
|
19624
|
+
|
|
18319
19625
|
declare const symbol$9: unique symbol;
|
|
18320
19626
|
|
|
18321
19627
|
declare const symbol$9_2: unique symbol;
|
|
@@ -19075,7 +20381,7 @@ export declare type TimeoutConfiguration<TOOLS extends ToolSet> = number | {
|
|
|
19075
20381
|
* the tool and can include an execute function for tools that are executed by
|
|
19076
20382
|
* the AI SDK.
|
|
19077
20383
|
*/
|
|
19078
|
-
export declare type Tool<INPUT extends
|
|
20384
|
+
export declare type Tool<INPUT extends JSONValue_3 | unknown | never = any, OUTPUT extends JSONValue_3 | unknown | never = any, CONTEXT extends Context | unknown | never = any> = FunctionTool<INPUT, OUTPUT, CONTEXT> | DynamicTool<INPUT, OUTPUT, CONTEXT> | ProviderDefinedTool<INPUT, OUTPUT, CONTEXT> | ProviderExecutedTool<INPUT, OUTPUT, CONTEXT>;
|
|
19079
20385
|
|
|
19080
20386
|
/**
|
|
19081
20387
|
* Infer the tool type from a tool object.
|
|
@@ -19149,6 +20455,13 @@ export declare type ToolApprovalRequest = {
|
|
|
19149
20455
|
* Present only when `experimental_toolApprovalSecret` is configured.
|
|
19150
20456
|
*/
|
|
19151
20457
|
signature?: string;
|
|
20458
|
+
/**
|
|
20459
|
+
* Tool input before input schema validation and transformation.
|
|
20460
|
+
*
|
|
20461
|
+
* This is included when it differs from the validated tool input so that
|
|
20462
|
+
* approved tool calls can be safely revalidated before execution.
|
|
20463
|
+
*/
|
|
20464
|
+
inputSchemaInput?: unknown;
|
|
19152
20465
|
};
|
|
19153
20466
|
|
|
19154
20467
|
/**
|
|
@@ -19951,7 +21264,7 @@ declare type ToolResultOutput = {
|
|
|
19951
21264
|
providerOptions?: ProviderOptions;
|
|
19952
21265
|
} | {
|
|
19953
21266
|
type: 'json';
|
|
19954
|
-
value:
|
|
21267
|
+
value: JSONValue_3;
|
|
19955
21268
|
/**
|
|
19956
21269
|
* Provider-specific options.
|
|
19957
21270
|
*/
|
|
@@ -19978,7 +21291,7 @@ declare type ToolResultOutput = {
|
|
|
19978
21291
|
providerOptions?: ProviderOptions;
|
|
19979
21292
|
} | {
|
|
19980
21293
|
type: 'error-json';
|
|
19981
|
-
value:
|
|
21294
|
+
value: JSONValue_3;
|
|
19982
21295
|
/**
|
|
19983
21296
|
* Provider-specific options.
|
|
19984
21297
|
*/
|
|
@@ -20960,6 +22273,79 @@ declare type TranscriptionModelV4StreamPart = {
|
|
|
20960
22273
|
error: unknown;
|
|
20961
22274
|
};
|
|
20962
22275
|
|
|
22276
|
+
declare type TranscriptionModelV4StreamPart_2 = {
|
|
22277
|
+
/**
|
|
22278
|
+
* Stream start event with warnings for the call, e.g. unsupported settings.
|
|
22279
|
+
*/
|
|
22280
|
+
type: 'stream-start';
|
|
22281
|
+
warnings: Array<SharedV4Warning_2>;
|
|
22282
|
+
} | {
|
|
22283
|
+
/**
|
|
22284
|
+
* Append-only transcript delta.
|
|
22285
|
+
*/
|
|
22286
|
+
type: 'transcript-delta';
|
|
22287
|
+
id?: string;
|
|
22288
|
+
delta: string;
|
|
22289
|
+
providerMetadata?: SharedV4ProviderMetadata_2;
|
|
22290
|
+
} | {
|
|
22291
|
+
/**
|
|
22292
|
+
* Non-final transcript text. The text may be revised by later parts.
|
|
22293
|
+
*/
|
|
22294
|
+
type: 'transcript-partial';
|
|
22295
|
+
id?: string;
|
|
22296
|
+
text: string;
|
|
22297
|
+
startSecond?: number;
|
|
22298
|
+
durationInSeconds?: number;
|
|
22299
|
+
channelIndex?: number;
|
|
22300
|
+
providerMetadata?: SharedV4ProviderMetadata_2;
|
|
22301
|
+
} | {
|
|
22302
|
+
/**
|
|
22303
|
+
* Final transcript text for a provider-defined segment or utterance.
|
|
22304
|
+
*/
|
|
22305
|
+
type: 'transcript-final';
|
|
22306
|
+
id?: string;
|
|
22307
|
+
text: string;
|
|
22308
|
+
startSecond?: number;
|
|
22309
|
+
endSecond?: number;
|
|
22310
|
+
channelIndex?: number;
|
|
22311
|
+
providerMetadata?: SharedV4ProviderMetadata_2;
|
|
22312
|
+
} | {
|
|
22313
|
+
/**
|
|
22314
|
+
* Metadata for the response, emitted once available.
|
|
22315
|
+
*/
|
|
22316
|
+
type: 'response-metadata';
|
|
22317
|
+
timestamp?: Date;
|
|
22318
|
+
modelId?: string;
|
|
22319
|
+
headers?: SharedV4Headers_2;
|
|
22320
|
+
body?: unknown;
|
|
22321
|
+
} | {
|
|
22322
|
+
/**
|
|
22323
|
+
* Metadata that is available after the stream is finished.
|
|
22324
|
+
*/
|
|
22325
|
+
type: 'finish';
|
|
22326
|
+
text: string;
|
|
22327
|
+
segments: Array<{
|
|
22328
|
+
text: string;
|
|
22329
|
+
startSecond: number;
|
|
22330
|
+
endSecond: number;
|
|
22331
|
+
}>;
|
|
22332
|
+
language?: string;
|
|
22333
|
+
durationInSeconds?: number;
|
|
22334
|
+
providerMetadata?: Record<string, JSONObject_2>;
|
|
22335
|
+
} | {
|
|
22336
|
+
/**
|
|
22337
|
+
* Raw provider chunks if enabled.
|
|
22338
|
+
*/
|
|
22339
|
+
type: 'raw';
|
|
22340
|
+
rawValue: unknown;
|
|
22341
|
+
} | {
|
|
22342
|
+
/**
|
|
22343
|
+
* Error parts are streamed, allowing for multiple errors.
|
|
22344
|
+
*/
|
|
22345
|
+
type: 'error';
|
|
22346
|
+
error: unknown;
|
|
22347
|
+
};
|
|
22348
|
+
|
|
20963
22349
|
/**
|
|
20964
22350
|
* The result of a transcription model doStream call.
|
|
20965
22351
|
*/
|
|
@@ -21106,7 +22492,7 @@ declare type TranscriptionStreamStartFrame = {
|
|
|
21106
22492
|
rate?: number;
|
|
21107
22493
|
};
|
|
21108
22494
|
/** Provider-specific options, passed through verbatim. */
|
|
21109
|
-
providerOptions?: Record<string,
|
|
22495
|
+
providerOptions?: Record<string, JSONObject_2>;
|
|
21110
22496
|
/** When true, the server should include `raw` parts in the stream. */
|
|
21111
22497
|
includeRawChunks?: boolean;
|
|
21112
22498
|
};
|
|
@@ -21141,6 +22527,21 @@ declare interface TypeValidationContext {
|
|
|
21141
22527
|
entityId?: string;
|
|
21142
22528
|
}
|
|
21143
22529
|
|
|
22530
|
+
declare interface TypeValidationContext_2 {
|
|
22531
|
+
/**
|
|
22532
|
+
* Field path in dot notation (e.g., "message.metadata", "message.parts[3].data")
|
|
22533
|
+
*/
|
|
22534
|
+
field?: string;
|
|
22535
|
+
/**
|
|
22536
|
+
* Entity name (e.g., tool name, data type name)
|
|
22537
|
+
*/
|
|
22538
|
+
entityName?: string;
|
|
22539
|
+
/**
|
|
22540
|
+
* Entity identifier (e.g., message ID, tool call ID)
|
|
22541
|
+
*/
|
|
22542
|
+
entityId?: string;
|
|
22543
|
+
}
|
|
22544
|
+
|
|
21144
22545
|
export declare class TypeValidationError extends AISDKError {
|
|
21145
22546
|
private readonly [symbol$1];
|
|
21146
22547
|
readonly value: unknown;
|
|
@@ -21169,6 +22570,34 @@ export declare class TypeValidationError extends AISDKError {
|
|
|
21169
22570
|
}): TypeValidationError;
|
|
21170
22571
|
}
|
|
21171
22572
|
|
|
22573
|
+
declare class TypeValidationError_2 extends AISDKError_2 {
|
|
22574
|
+
private readonly [symbol$1_2];
|
|
22575
|
+
readonly value: unknown;
|
|
22576
|
+
readonly context?: TypeValidationContext_2;
|
|
22577
|
+
constructor({ value, cause, context }: {
|
|
22578
|
+
value: unknown;
|
|
22579
|
+
cause: unknown;
|
|
22580
|
+
context?: TypeValidationContext_2;
|
|
22581
|
+
});
|
|
22582
|
+
static isInstance(error: unknown): error is TypeValidationError_2;
|
|
22583
|
+
/**
|
|
22584
|
+
* Wraps an error into a TypeValidationError.
|
|
22585
|
+
* If the cause is already a TypeValidationError with the same value and context, it returns the cause.
|
|
22586
|
+
* Otherwise, it creates a new TypeValidationError.
|
|
22587
|
+
*
|
|
22588
|
+
* @param {Object} params - The parameters for wrapping the error.
|
|
22589
|
+
* @param {unknown} params.value - The value that failed validation.
|
|
22590
|
+
* @param {unknown} params.cause - The original error or cause of the validation failure.
|
|
22591
|
+
* @param {TypeValidationContext} params.context - Optional context about what is being validated.
|
|
22592
|
+
* @returns {TypeValidationError} A TypeValidationError instance.
|
|
22593
|
+
*/
|
|
22594
|
+
static wrap({ value, cause, context }: {
|
|
22595
|
+
value: unknown;
|
|
22596
|
+
cause: unknown;
|
|
22597
|
+
context?: TypeValidationContext_2;
|
|
22598
|
+
}): TypeValidationError_2;
|
|
22599
|
+
}
|
|
22600
|
+
|
|
21172
22601
|
export declare const UI_MESSAGE_STREAM_HEADERS: {
|
|
21173
22602
|
'content-type': string;
|
|
21174
22603
|
'cache-control': string;
|
|
@@ -21930,10 +23359,10 @@ declare function validateDownloadUrl(url: string): void;
|
|
|
21930
23359
|
* @param {TypeValidationContext} options.context - Optional context about what is being validated.
|
|
21931
23360
|
* @returns {Promise<T>} - The typed object.
|
|
21932
23361
|
*/
|
|
21933
|
-
declare function validateTypes<OBJECT>({ value, schema, context
|
|
23362
|
+
declare function validateTypes<OBJECT>({ value, schema, context }: {
|
|
21934
23363
|
value: unknown;
|
|
21935
23364
|
schema: FlexibleSchema<OBJECT>;
|
|
21936
|
-
context?:
|
|
23365
|
+
context?: TypeValidationContext_2;
|
|
21937
23366
|
}): Promise<OBJECT>;
|
|
21938
23367
|
|
|
21939
23368
|
/**
|
|
@@ -22761,7 +24190,7 @@ declare type VideoModelV4VideoData = {
|
|
|
22761
24190
|
* longer open or the signal aborts — `bufferedAmount` never drains on a
|
|
22762
24191
|
* closed socket, so waiting on would poll forever.
|
|
22763
24192
|
*/
|
|
22764
|
-
declare function waitForWebSocketBufferDrain(socket: WebSocketLike, { highWaterMark, pollIntervalMs, abortSignal
|
|
24193
|
+
declare function waitForWebSocketBufferDrain(socket: WebSocketLike, { highWaterMark, pollIntervalMs, abortSignal }?: {
|
|
22765
24194
|
highWaterMark?: number;
|
|
22766
24195
|
pollIntervalMs?: number;
|
|
22767
24196
|
abortSignal?: AbortSignal;
|
|
@@ -22945,5 +24374,5 @@ export declare function zodSchema<OBJECT>(zodSchema: $ZodType<OBJECT, any> | z3.
|
|
|
22945
24374
|
}): Schema<OBJECT>;
|
|
22946
24375
|
|
|
22947
24376
|
export { }
|
|
22948
|
-
export { GatewayProviderSettings as GatewayProviderSettings, GatewayProvider as GatewayProvider,
|
|
22949
|
-
export { EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL, schemaSymbol, symbol$1, symbol$1_2, symbol$1_3, symbol$2, symbol$2_2, symbol$3, symbol$3_2, symbol$4, symbol$4_2, symbol$5, symbol$5_2, symbol$6, symbol$6_2, symbol$7, symbol$7_2, symbol$8, symbol$8_2, symbol$9, symbol$9_2, symbol$a, symbol$a_2, symbol$b, symbol$c, symbol$c_2, symbol$d, symbol$d_2, symbol$e, symbol$e_2, symbol$f, symbol$f_2, symbol$g, symbol$h, symbol$i, symbol$j, symbol$k, symbol$l, symbol$m, symbol$n, symbol, symbol_2, symbol_3 };
|
|
24377
|
+
export { GatewayProviderSettings as GatewayProviderSettings, GatewayProvider as GatewayProvider, AISDKError_2 as AISDKError_2, ParseResult as ParseResult, LazySchema as LazySchema, ZodSchema as ZodSchema, StandardSchema as StandardSchema, ValidationResult as ValidationResult, ProviderOptions as ProviderOptions, CustomPart as CustomPart, ReasoningPart as ReasoningPart, ReasoningFilePart as ReasoningFilePart, FileData as FileData, ProviderReference_2 as ProviderReference_2, ToolResultOutput as ToolResultOutput, ReadFileOptions as ReadFileOptions, WriteFileOptions as WriteFileOptions, SandboxProcessOptions as SandboxProcessOptions, ToolCallerDefinition as ToolCallerDefinition, JSONValue_3 as JSONValue_3, FunctionTool as FunctionTool, ProviderDefinedTool as ProviderDefinedTool, ProviderExecutedTool as ProviderExecutedTool, ExecutableTool as ExecutableTool, DynamicTool as DynamicTool, SharedV4ProviderReference as SharedV4ProviderReference, TypeValidationContext as TypeValidationContext, EmbeddingModelV3 as EmbeddingModelV3, EmbeddingModelV2 as EmbeddingModelV2, EmbeddingModelV4Embedding as EmbeddingModelV4Embedding, EmbeddingModelV4Middleware as EmbeddingModelV4Middleware, ImageModelV3 as ImageModelV3, ImageModelV2 as ImageModelV2, ImageModelV2ProviderMetadata as ImageModelV2ProviderMetadata, ImageModelV4Middleware as ImageModelV4Middleware, GlobalProviderModelId as GlobalProviderModelId, LanguageModelV3 as LanguageModelV3, LanguageModelV2 as LanguageModelV2, SharedV4Warning as SharedV4Warning, LanguageModelV4Middleware as LanguageModelV4Middleware, RerankingModelV3 as RerankingModelV3, SpeechModelV3 as SpeechModelV3, SpeechModelV2 as SpeechModelV2, TranscriptionModelV3 as TranscriptionModelV3, TranscriptionModelV2 as TranscriptionModelV2, ImageModelV4Usage as ImageModelV4Usage, EvaluationModelV4Question as EvaluationModelV4Question, EvaluationModelV4Result as EvaluationModelV4Result, DeepPartialInternal as DeepPartialInternal, IncludedContext as IncludedContext, IncludedToolsContext as IncludedToolsContext, BaseToolCall as BaseToolCall, Source as Source, ValueOf as ValueOf, asUITool as asUITool, _ai_sdk_provider_utils as _ai_sdk_provider_utils, DataUIMessageChunk as DataUIMessageChunk, InferElementOutput as InferElementOutput, ConsumeStreamOptions as ConsumeStreamOptions, TextStreamTextStartPart as TextStreamTextStartPart, TextStreamTextEndPart as TextStreamTextEndPart, TextStreamReasoningStartPart as TextStreamReasoningStartPart, TextStreamReasoningEndPart as TextStreamReasoningEndPart, TextStreamCustomPart as TextStreamCustomPart, TextStreamToolInputStartPart as TextStreamToolInputStartPart, TextStreamToolInputEndPart as TextStreamToolInputEndPart, TextStreamToolInputDeltaPart as TextStreamToolInputDeltaPart, TextStreamSourcePart as TextStreamSourcePart, TextStreamToolOutputDeniedPart as TextStreamToolOutputDeniedPart, TextStreamStartStepPart as TextStreamStartStepPart, TextStreamFinishStepPart as TextStreamFinishStepPart, TextStreamStartPart as TextStreamStartPart, TextStreamFinishPart as TextStreamFinishPart, TextStreamAbortPart as TextStreamAbortPart, TextStreamErrorPart as TextStreamErrorPart, TextStreamRawPart as TextStreamRawPart, MaybePromiseLike as MaybePromiseLike, InferToolContext as InferToolContext, ToolCallerName as ToolCallerName, LanguageModelV4ToolCall as LanguageModelV4ToolCall, WidenedToolExecutionStartEvent as WidenedToolExecutionStartEvent, StaticToolExecutionStartEvent as StaticToolExecutionStartEvent, DynamicToolExecutionStartEvent as DynamicToolExecutionStartEvent, WidenedToolExecutionEndEvent as WidenedToolExecutionEndEvent, StaticToolExecutionEndEvent as StaticToolExecutionEndEvent, DynamicToolExecutionEndEvent as DynamicToolExecutionEndEvent, StreamTextOnErrorHandler as StreamTextOnErrorHandler, StreamTextOnAbortCallback as StreamTextOnAbortCallback, EnrichedStreamPart as EnrichedStreamPart, StandardizedPrompt as StandardizedPrompt, ResponseMessage as ResponseMessage, OperationStartEvent as OperationStartEvent, OperationEndEvent as OperationEndEvent, Arrayable as Arrayable, Context as Context, ToolsContextParameter as ToolsContextParameter, 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, ValidateUIMessagesOptions as ValidateUIMessagesOptions, ActiveToolSubset as ActiveToolSubset, TextStreamTextDeltaPart as TextStreamTextDeltaPart, TextStreamReasoningDeltaPart as TextStreamReasoningDeltaPart, TextStreamFilePart as TextStreamFilePart, TextStreamReasoningFilePart as TextStreamReasoningFilePart, TextStreamToolApprovalRequestPart as TextStreamToolApprovalRequestPart, TextStreamToolApprovalResponsePart as TextStreamToolApprovalResponsePart, TextStreamToolCallPart as TextStreamToolCallPart, TextStreamToolResultPart as TextStreamToolResultPart, TextStreamToolErrorPart as TextStreamToolErrorPart, LanguageModelV4Prompt as LanguageModelV4Prompt, SharedV4Headers as SharedV4Headers, BatchV4 as BatchV4, BatchV4Error as BatchV4Error, BatchV4Status as BatchV4Status, GenerateImagePrompt as GenerateImagePrompt, BatchV4ModelIds as BatchV4ModelIds, InferBatchModelIds as InferBatchModelIds, BatchV4StartResult as BatchV4StartResult, BatchCallOptions as BatchCallOptions, ImageModelV4ProviderMetadata as ImageModelV4ProviderMetadata, Callback as Callback, EnforcedToolChoice as EnforcedToolChoice, LanguageModelV4Content as LanguageModelV4Content, RetryErrorReason_2 as RetryErrorReason_2, EvaluationModelV4CallOptions as EvaluationModelV4CallOptions, Job as Job, StreamObjectOnErrorCallback as StreamObjectOnErrorCallback, VideoModelResponseMetadata as VideoModelResponseMetadata, VideoModelProviderMetadata as VideoModelProviderMetadata, VideoModelV4FrameType as VideoModelV4FrameType, GenerateVideoPollOptions as GenerateVideoPollOptions, GenerateVideoWebhookFactory as GenerateVideoWebhookFactory, VideoModelV4OperationStatusResult as VideoModelV4OperationStatusResult, JSONValue_2 as JSONValue_2, EmbeddingModelV4CallOptions as EmbeddingModelV4CallOptions, LanguageModelV4CallOptions as LanguageModelV4CallOptions, JSONObject as JSONObject, RealtimeFactoryV4 as RealtimeFactoryV4, RealtimeFactoryV4GetTokenOptions as RealtimeFactoryV4GetTokenOptions, RealtimeFactoryV4GetTokenResult as RealtimeFactoryV4GetTokenResult, RealtimeModelV4 as RealtimeModelV4, RealtimeModelV4ClientEvent as RealtimeModelV4ClientEvent, RealtimeModelV4ServerEvent as RealtimeModelV4ServerEvent, RealtimeModelV4SessionConfig as RealtimeModelV4SessionConfig, RealtimeModelV4ToolDefinition as RealtimeModelV4ToolDefinition, InferToolSetContext as InferToolSetContext, VideoModel as VideoModel, FilesV4 as FilesV4, SkillsV4 as SkillsV4, ProviderV2 as ProviderV2, ExtractModelId as ExtractModelId, LanguageModelV4 as LanguageModelV4, EmbeddingModelV4 as EmbeddingModelV4, ImageModelV4 as ImageModelV4, TranscriptionModelV4 as TranscriptionModelV4, RerankingModelV4 as RerankingModelV4, SpeechModelV4 as SpeechModelV4, VideoModelV4 as VideoModelV4, EvaluationModelV4 as EvaluationModelV4, ProviderEvaluationModelIdentifier as ProviderEvaluationModelIdentifier, ExtractLiteralUnion as ExtractLiteralUnion, ProviderVideoModelIdentifier as ProviderVideoModelIdentifier, ProviderV4 as ProviderV4, ProviderV3 as ProviderV3, ToolSearchInput as ToolSearchInput, ToolSearchOutput as ToolSearchOutput, SharedV4AudioFormat as SharedV4AudioFormat, SharedV4ProviderMetadata as SharedV4ProviderMetadata, SpeechTranslationModelV4Usage as SpeechTranslationModelV4Usage, SpeechTranslationModelResponseMetadata as SpeechTranslationModelResponseMetadata, SpeechTranslationModel as SpeechTranslationModel, FilesV4UploadFileCallOptions as FilesV4UploadFileCallOptions, SkillsV4UploadSkillResult as SkillsV4UploadSkillResult, SkillsV4UploadSkillCallOptions as SkillsV4UploadSkillCallOptions, UploadSkillFile as UploadSkillFile };
|
|
24378
|
+
export { EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL, EMBEDDING_MODEL_PROVIDER_OPTIONS_TRANSFORMER, schemaSymbol, symbol$1, symbol$14, symbol$15, symbol$1_2, symbol$1_3, symbol$1_4, 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$8_3, symbol$9, symbol$9_2, symbol$a, symbol$a_2, symbol$b, symbol$c, symbol$c_2, symbol$d, symbol$d_2, symbol$e, symbol$e_2, symbol$f, symbol$f_2, symbol$g, symbol$h, symbol$i, symbol$j, symbol$k, symbol$l, symbol$m, symbol$n, symbol, symbol_2, symbol_3 };
|