ai 6.0.0-beta.86 → 6.0.0-beta.88
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/index.d.mts +34 -40
- package/dist/index.d.ts +34 -40
- package/dist/index.js +2363 -2372
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2312 -2320
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +1 -1
- package/dist/internal/index.mjs +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# ai
|
|
2
2
|
|
|
3
|
+
## 6.0.0-beta.88
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 22ef5c6: feat(ai): Output.text() is default output mode
|
|
8
|
+
|
|
9
|
+
## 6.0.0-beta.87
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- ca13d26: feat(ai): add output to StreamTextResult
|
|
14
|
+
|
|
3
15
|
## 6.0.0-beta.86
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -508,29 +508,31 @@ declare const text: () => Output<string, string>;
|
|
|
508
508
|
*
|
|
509
509
|
* @returns An output specification for generating objects with the specified schema.
|
|
510
510
|
*/
|
|
511
|
-
declare const object: <
|
|
512
|
-
schema: FlexibleSchema<
|
|
513
|
-
}) => Output<
|
|
511
|
+
declare const object: <OBJECT>({ schema: inputSchema, }: {
|
|
512
|
+
schema: FlexibleSchema<OBJECT>;
|
|
513
|
+
}) => Output<OBJECT, DeepPartial<OBJECT>>;
|
|
514
514
|
/**
|
|
515
|
-
*
|
|
515
|
+
* Output specification for array generation.
|
|
516
516
|
* When the model generates a text response, it will return an array of elements.
|
|
517
517
|
*
|
|
518
|
-
* @param element - The schema of the
|
|
518
|
+
* @param element - The schema of the array elements to generate.
|
|
519
|
+
*
|
|
519
520
|
* @returns An output specification for generating an array of elements.
|
|
520
521
|
*/
|
|
521
522
|
declare const array: <ELEMENT>({ element: inputElementSchema, }: {
|
|
522
523
|
element: FlexibleSchema<ELEMENT>;
|
|
523
524
|
}) => Output<Array<ELEMENT>, Array<ELEMENT>>;
|
|
524
525
|
/**
|
|
525
|
-
*
|
|
526
|
+
* Output specification for choice generation.
|
|
526
527
|
* When the model generates a text response, it will return a one of the choice options.
|
|
527
528
|
*
|
|
528
|
-
* @param options - The
|
|
529
|
+
* @param options - The available choices.
|
|
530
|
+
*
|
|
529
531
|
* @returns An output specification for generating a choice.
|
|
530
532
|
*/
|
|
531
|
-
declare const choice: <
|
|
532
|
-
options: Array<
|
|
533
|
-
}) => Output<
|
|
533
|
+
declare const choice: <CHOICE extends string>({ options: choiceOptions, }: {
|
|
534
|
+
options: Array<CHOICE>;
|
|
535
|
+
}) => Output<CHOICE, CHOICE>;
|
|
534
536
|
/**
|
|
535
537
|
* Output specification for unstructured JSON generation.
|
|
536
538
|
* When the model generates a text response, it will return a JSON object.
|
|
@@ -981,9 +983,9 @@ type StopCondition<TOOLS extends ToolSet> = (options: {
|
|
|
981
983
|
declare function stepCountIs(stepCount: number): StopCondition<any>;
|
|
982
984
|
declare function hasToolCall(toolName: string): StopCondition<any>;
|
|
983
985
|
|
|
984
|
-
declare const symbol$
|
|
986
|
+
declare const symbol$d: unique symbol;
|
|
985
987
|
declare class InvalidToolInputError extends AISDKError {
|
|
986
|
-
private readonly [symbol$
|
|
988
|
+
private readonly [symbol$d];
|
|
987
989
|
readonly toolName: string;
|
|
988
990
|
readonly toolInput: string;
|
|
989
991
|
constructor({ toolInput, toolName, cause, message, }: {
|
|
@@ -995,9 +997,9 @@ declare class InvalidToolInputError extends AISDKError {
|
|
|
995
997
|
static isInstance(error: unknown): error is InvalidToolInputError;
|
|
996
998
|
}
|
|
997
999
|
|
|
998
|
-
declare const symbol$
|
|
1000
|
+
declare const symbol$c: unique symbol;
|
|
999
1001
|
declare class NoSuchToolError extends AISDKError {
|
|
1000
|
-
private readonly [symbol$
|
|
1002
|
+
private readonly [symbol$c];
|
|
1001
1003
|
readonly toolName: string;
|
|
1002
1004
|
readonly availableTools: string[] | undefined;
|
|
1003
1005
|
constructor({ toolName, availableTools, message, }: {
|
|
@@ -1146,7 +1148,7 @@ If set and supported by the model, calls will generate deterministic results.
|
|
|
1146
1148
|
@returns
|
|
1147
1149
|
A result object that contains the generated text, the results of the tool calls, and additional information.
|
|
1148
1150
|
*/
|
|
1149
|
-
declare function generateText<TOOLS extends ToolSet, OUTPUT extends Output =
|
|
1151
|
+
declare function generateText<TOOLS extends ToolSet, OUTPUT extends Output = Output<string, string>>({ model: modelArg, tools, toolChoice, system, prompt, messages, maxRetries: maxRetriesArg, abortSignal, headers, stopWhen, experimental_output, output, experimental_telemetry: telemetry, providerOptions, experimental_activeTools, activeTools, experimental_prepareStep, prepareStep, experimental_repairToolCall: repairToolCall, experimental_download: download, experimental_context, _internal: { generateId, currentDate, }, onStepFinish, onFinish, ...settings }: CallSettings & Prompt & {
|
|
1150
1152
|
/**
|
|
1151
1153
|
The language model to use.
|
|
1152
1154
|
*/
|
|
@@ -1392,7 +1394,7 @@ If set and supported by the model, calls will generate deterministic results.
|
|
|
1392
1394
|
@return
|
|
1393
1395
|
A result object for accessing different stream types and additional information.
|
|
1394
1396
|
*/
|
|
1395
|
-
declare function streamText<TOOLS extends ToolSet, OUTPUT extends Output =
|
|
1397
|
+
declare function streamText<TOOLS extends ToolSet, OUTPUT extends Output = Output<string, string>>({ model, tools, toolChoice, system, prompt, messages, maxRetries, abortSignal, headers, stopWhen, experimental_output, output, experimental_telemetry: telemetry, prepareStep, providerOptions, experimental_activeTools, activeTools, experimental_repairToolCall: repairToolCall, experimental_transform: transform, experimental_download: download, includeRawChunks, onChunk, onError, onFinish, onAbort, onStepFinish, experimental_context, _internal: { now, generateId, currentDate, }, ...settings }: CallSettings & Prompt & {
|
|
1396
1398
|
/**
|
|
1397
1399
|
The language model to use.
|
|
1398
1400
|
*/
|
|
@@ -2381,10 +2383,14 @@ interface StreamTextResult<TOOLS extends ToolSet, OUTPUT extends Output> {
|
|
|
2381
2383
|
*/
|
|
2382
2384
|
readonly experimental_partialOutputStream: AsyncIterableStream<InferPartialOutput<OUTPUT>>;
|
|
2383
2385
|
/**
|
|
2384
|
-
* A stream of partial outputs. It uses the `output` specification.
|
|
2386
|
+
* A stream of partial parsed outputs. It uses the `output` specification.
|
|
2385
2387
|
*/
|
|
2386
2388
|
readonly partialOutputStream: AsyncIterableStream<InferPartialOutput<OUTPUT>>;
|
|
2387
2389
|
/**
|
|
2390
|
+
* The complete parsed output. It uses the `output` specification.
|
|
2391
|
+
*/
|
|
2392
|
+
readonly output: Promise<InferCompleteOutput<OUTPUT>>;
|
|
2393
|
+
/**
|
|
2388
2394
|
Consumes the stream without processing the parts.
|
|
2389
2395
|
This is useful to force the stream to finish.
|
|
2390
2396
|
It effectively removes the backpressure and allows the stream to finish,
|
|
@@ -3584,9 +3590,9 @@ declare function embedMany<VALUE = string>({ model: modelArg, values, maxParalle
|
|
|
3584
3590
|
maxParallelCalls?: number;
|
|
3585
3591
|
}): Promise<EmbedManyResult<VALUE>>;
|
|
3586
3592
|
|
|
3587
|
-
declare const symbol$
|
|
3593
|
+
declare const symbol$b: unique symbol;
|
|
3588
3594
|
declare class InvalidArgumentError extends AISDKError {
|
|
3589
|
-
private readonly [symbol$
|
|
3595
|
+
private readonly [symbol$b];
|
|
3590
3596
|
readonly parameter: string;
|
|
3591
3597
|
readonly value: unknown;
|
|
3592
3598
|
constructor({ parameter, value, message, }: {
|
|
@@ -3674,9 +3680,9 @@ type SingleRequestTextStreamPart<TOOLS extends ToolSet> = {
|
|
|
3674
3680
|
rawValue: unknown;
|
|
3675
3681
|
};
|
|
3676
3682
|
|
|
3677
|
-
declare const symbol$
|
|
3683
|
+
declare const symbol$a: unique symbol;
|
|
3678
3684
|
declare class InvalidStreamPartError extends AISDKError {
|
|
3679
|
-
private readonly [symbol$
|
|
3685
|
+
private readonly [symbol$a];
|
|
3680
3686
|
readonly chunk: SingleRequestTextStreamPart<any>;
|
|
3681
3687
|
constructor({ chunk, message, }: {
|
|
3682
3688
|
chunk: SingleRequestTextStreamPart<any>;
|
|
@@ -3685,7 +3691,7 @@ declare class InvalidStreamPartError extends AISDKError {
|
|
|
3685
3691
|
static isInstance(error: unknown): error is InvalidStreamPartError;
|
|
3686
3692
|
}
|
|
3687
3693
|
|
|
3688
|
-
declare const symbol$
|
|
3694
|
+
declare const symbol$9: unique symbol;
|
|
3689
3695
|
/**
|
|
3690
3696
|
Thrown when no image could be generated. This can have multiple causes:
|
|
3691
3697
|
|
|
@@ -3693,7 +3699,7 @@ Thrown when no image could be generated. This can have multiple causes:
|
|
|
3693
3699
|
- The model generated a response that could not be parsed.
|
|
3694
3700
|
*/
|
|
3695
3701
|
declare class NoImageGeneratedError extends AISDKError {
|
|
3696
|
-
private readonly [symbol$
|
|
3702
|
+
private readonly [symbol$9];
|
|
3697
3703
|
/**
|
|
3698
3704
|
The response metadata for each call.
|
|
3699
3705
|
*/
|
|
@@ -3706,7 +3712,7 @@ declare class NoImageGeneratedError extends AISDKError {
|
|
|
3706
3712
|
static isInstance(error: unknown): error is NoImageGeneratedError;
|
|
3707
3713
|
}
|
|
3708
3714
|
|
|
3709
|
-
declare const symbol$
|
|
3715
|
+
declare const symbol$8: unique symbol;
|
|
3710
3716
|
/**
|
|
3711
3717
|
Thrown when no object could be generated. This can have several causes:
|
|
3712
3718
|
|
|
@@ -3719,7 +3725,7 @@ The error contains the following properties:
|
|
|
3719
3725
|
- `text`: The text that was generated by the model. This can be the raw text or the tool call text, depending on the model.
|
|
3720
3726
|
*/
|
|
3721
3727
|
declare class NoObjectGeneratedError extends AISDKError {
|
|
3722
|
-
private readonly [symbol$
|
|
3728
|
+
private readonly [symbol$8];
|
|
3723
3729
|
/**
|
|
3724
3730
|
The text that was generated by the model. This can be the raw text or the tool call text, depending on the model.
|
|
3725
3731
|
*/
|
|
@@ -3747,12 +3753,12 @@ declare class NoObjectGeneratedError extends AISDKError {
|
|
|
3747
3753
|
static isInstance(error: unknown): error is NoObjectGeneratedError;
|
|
3748
3754
|
}
|
|
3749
3755
|
|
|
3750
|
-
declare const symbol$
|
|
3756
|
+
declare const symbol$7: unique symbol;
|
|
3751
3757
|
/**
|
|
3752
3758
|
Thrown when no LLM output was generated, e.g. because of errors.
|
|
3753
3759
|
*/
|
|
3754
3760
|
declare class NoOutputGeneratedError extends AISDKError {
|
|
3755
|
-
private readonly [symbol$
|
|
3761
|
+
private readonly [symbol$7];
|
|
3756
3762
|
constructor({ message, cause, }?: {
|
|
3757
3763
|
message?: string;
|
|
3758
3764
|
cause?: Error;
|
|
@@ -3760,18 +3766,6 @@ declare class NoOutputGeneratedError extends AISDKError {
|
|
|
3760
3766
|
static isInstance(error: unknown): error is NoOutputGeneratedError;
|
|
3761
3767
|
}
|
|
3762
3768
|
|
|
3763
|
-
declare const symbol$7: unique symbol;
|
|
3764
|
-
/**
|
|
3765
|
-
Thrown when no output type is specified and output-related methods are called.
|
|
3766
|
-
*/
|
|
3767
|
-
declare class NoOutputSpecifiedError extends AISDKError {
|
|
3768
|
-
private readonly [symbol$7];
|
|
3769
|
-
constructor({ message }?: {
|
|
3770
|
-
message?: string;
|
|
3771
|
-
});
|
|
3772
|
-
static isInstance(error: unknown): error is NoOutputSpecifiedError;
|
|
3773
|
-
}
|
|
3774
|
-
|
|
3775
3769
|
/**
|
|
3776
3770
|
Error that is thrown when no speech audio was generated.
|
|
3777
3771
|
*/
|
|
@@ -5096,4 +5090,4 @@ declare global {
|
|
|
5096
5090
|
var AI_SDK_LOG_WARNINGS: LogWarningsFunction | undefined | false;
|
|
5097
5091
|
}
|
|
5098
5092
|
|
|
5099
|
-
export { AbstractChat, Agent, AsyncIterableStream, CallSettings, CallWarning, ChatAddToolApproveResponseFunction, ChatInit, ChatOnDataCallback, ChatOnErrorCallback, ChatOnFinishCallback, ChatOnToolCallCallback, ChatRequestOptions, ChatState, ChatStatus, ChatTransport, ChunkDetector, CompletionRequestOptions, CoreAssistantMessage, CoreMessage, CoreSystemMessage, CoreToolMessage, CoreUserMessage, CreateUIMessage, DataUIPart, DeepPartial, DefaultChatTransport, DownloadError, DynamicToolCall, DynamicToolError, DynamicToolResult, DynamicToolUIPart, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingModelMiddleware, EmbeddingModelUsage, ErrorHandler, ToolLoopAgent as Experimental_Agent, ToolLoopAgentSettings as Experimental_AgentSettings, DownloadFunction as Experimental_DownloadFunction, GenerateImageResult as Experimental_GenerateImageResult, GeneratedFile as Experimental_GeneratedImage, InferAgentUIMessage as Experimental_InferAgentUIMessage, LogWarningsFunction as Experimental_LogWarningsFunction, SpeechResult as Experimental_SpeechResult, TranscriptionResult as Experimental_TranscriptionResult, Warning as Experimental_Warning, FileUIPart, FinishReason, GenerateObjectResult, GenerateTextOnFinishCallback, GenerateTextOnStepFinishCallback, GenerateTextResult, GeneratedAudioFile, GeneratedFile, HttpChatTransport, HttpChatTransportInitOptions, ImageModel, ImageGenerationWarning as ImageModelCallWarning, ImageModelProviderMetadata, ImageModelResponseMetadata, InferAgentUIMessage, InferCompleteOutput as InferGenerateOutput, InferPartialOutput as InferStreamOutput, InferUIDataParts, InferUIMessageChunk, InferUITool, InferUITools, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolInputError, JSONValue, JsonToSseTransformStream, LanguageModel, LanguageModelMiddleware, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, MessageConversionError, NoImageGeneratedError, NoObjectGeneratedError, NoOutputGeneratedError,
|
|
5093
|
+
export { AbstractChat, Agent, AsyncIterableStream, CallSettings, CallWarning, ChatAddToolApproveResponseFunction, ChatInit, ChatOnDataCallback, ChatOnErrorCallback, ChatOnFinishCallback, ChatOnToolCallCallback, ChatRequestOptions, ChatState, ChatStatus, ChatTransport, ChunkDetector, CompletionRequestOptions, CoreAssistantMessage, CoreMessage, CoreSystemMessage, CoreToolMessage, CoreUserMessage, CreateUIMessage, DataUIPart, DeepPartial, DefaultChatTransport, DownloadError, DynamicToolCall, DynamicToolError, DynamicToolResult, DynamicToolUIPart, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingModelMiddleware, EmbeddingModelUsage, ErrorHandler, ToolLoopAgent as Experimental_Agent, ToolLoopAgentSettings as Experimental_AgentSettings, DownloadFunction as Experimental_DownloadFunction, GenerateImageResult as Experimental_GenerateImageResult, GeneratedFile as Experimental_GeneratedImage, InferAgentUIMessage as Experimental_InferAgentUIMessage, LogWarningsFunction as Experimental_LogWarningsFunction, SpeechResult as Experimental_SpeechResult, TranscriptionResult as Experimental_TranscriptionResult, Warning as Experimental_Warning, FileUIPart, FinishReason, GenerateObjectResult, GenerateTextOnFinishCallback, GenerateTextOnStepFinishCallback, GenerateTextResult, GeneratedAudioFile, GeneratedFile, HttpChatTransport, HttpChatTransportInitOptions, ImageModel, ImageGenerationWarning as ImageModelCallWarning, ImageModelProviderMetadata, ImageModelResponseMetadata, InferAgentUIMessage, InferCompleteOutput as InferGenerateOutput, InferPartialOutput as InferStreamOutput, InferUIDataParts, InferUIMessageChunk, InferUITool, InferUITools, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolInputError, JSONValue, JsonToSseTransformStream, LanguageModel, LanguageModelMiddleware, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, MessageConversionError, NoImageGeneratedError, NoObjectGeneratedError, NoOutputGeneratedError, NoSpeechGeneratedError, NoSuchProviderError, NoSuchToolError, ObjectStreamPart, output as Output, PrepareReconnectToStreamRequest, PrepareSendMessagesRequest, PrepareStepFunction, PrepareStepResult, Prompt, Provider, ProviderMetadata, ProviderRegistryProvider, ReasoningOutput, ReasoningUIPart, RepairTextFunction, RerankResult, RerankingModel, RetryError, SafeValidateUIMessagesResult, SerialJobExecutor, SourceDocumentUIPart, SourceUrlUIPart, SpeechModel, SpeechModelResponseMetadata, SpeechWarning, StaticToolCall, StaticToolError, StaticToolOutputDenied, StaticToolResult, StepResult, StepStartUIPart, StopCondition, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextOnFinishCallback, StreamTextOnStepFinishCallback, StreamTextResult, StreamTextTransform, TelemetrySettings, TextStreamChatTransport, TextStreamPart, TextUIPart, ToolApprovalRequestOutput, ToolCallRepairError, ToolCallRepairFunction, ToolChoice, ToolLoopAgent, ToolLoopAgentOnFinishCallback, ToolLoopAgentOnStepFinishCallback, ToolLoopAgentSettings, ToolSet, ToolUIPart, TranscriptionModel, TranscriptionModelResponseMetadata, TranscriptionWarning, TypedToolCall, TypedToolError, TypedToolOutputDenied, TypedToolResult, UIDataPartSchemas, UIDataTypes, UIMessage, UIMessageChunk, UIMessagePart, UIMessageStreamOnFinishCallback, UIMessageStreamOptions, UIMessageStreamWriter, UITool, UIToolInvocation, UITools, UI_MESSAGE_STREAM_HEADERS, UnsupportedModelVersionError, UseCompletionOptions, assistantModelMessageSchema, callCompletionApi, consumeStream, convertFileListToFileUIParts, convertToCoreMessages, convertToModelMessages, coreAssistantMessageSchema, coreMessageSchema, coreSystemMessageSchema, coreToolMessageSchema, coreUserMessageSchema, cosineSimilarity, createAgentUIStream, createAgentUIStreamResponse, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, defaultEmbeddingSettingsMiddleware, defaultSettingsMiddleware, embed, embedMany, experimental_createProviderRegistry, experimental_customProvider, generateImage as experimental_generateImage, generateSpeech as experimental_generateSpeech, transcribe as experimental_transcribe, extractReasoningMiddleware, generateObject, generateText, getTextFromDataUrl, getToolName, getToolOrDynamicToolName, hasToolCall, isDataUIPart, isDeepEqualData, isFileUIPart, isReasoningUIPart, isTextUIPart, isToolOrDynamicToolUIPart, isToolUIPart, lastAssistantMessageIsCompleteWithApprovalResponses, lastAssistantMessageIsCompleteWithToolCalls, modelMessageSchema, parsePartialJson, pipeAgentUIStreamToResponse, pipeTextStreamToResponse, pipeUIMessageStreamToResponse, pruneMessages, readUIMessageStream, rerank, safeValidateUIMessages, simulateReadableStream, simulateStreamingMiddleware, smoothStream, stepCountIs, streamObject, streamText, systemModelMessageSchema, toolModelMessageSchema, uiMessageChunkSchema, userModelMessageSchema, validateUIMessages, wrapEmbeddingModel, wrapLanguageModel, wrapProvider };
|
package/dist/index.d.ts
CHANGED
|
@@ -508,29 +508,31 @@ declare const text: () => Output<string, string>;
|
|
|
508
508
|
*
|
|
509
509
|
* @returns An output specification for generating objects with the specified schema.
|
|
510
510
|
*/
|
|
511
|
-
declare const object: <
|
|
512
|
-
schema: FlexibleSchema<
|
|
513
|
-
}) => Output<
|
|
511
|
+
declare const object: <OBJECT>({ schema: inputSchema, }: {
|
|
512
|
+
schema: FlexibleSchema<OBJECT>;
|
|
513
|
+
}) => Output<OBJECT, DeepPartial<OBJECT>>;
|
|
514
514
|
/**
|
|
515
|
-
*
|
|
515
|
+
* Output specification for array generation.
|
|
516
516
|
* When the model generates a text response, it will return an array of elements.
|
|
517
517
|
*
|
|
518
|
-
* @param element - The schema of the
|
|
518
|
+
* @param element - The schema of the array elements to generate.
|
|
519
|
+
*
|
|
519
520
|
* @returns An output specification for generating an array of elements.
|
|
520
521
|
*/
|
|
521
522
|
declare const array: <ELEMENT>({ element: inputElementSchema, }: {
|
|
522
523
|
element: FlexibleSchema<ELEMENT>;
|
|
523
524
|
}) => Output<Array<ELEMENT>, Array<ELEMENT>>;
|
|
524
525
|
/**
|
|
525
|
-
*
|
|
526
|
+
* Output specification for choice generation.
|
|
526
527
|
* When the model generates a text response, it will return a one of the choice options.
|
|
527
528
|
*
|
|
528
|
-
* @param options - The
|
|
529
|
+
* @param options - The available choices.
|
|
530
|
+
*
|
|
529
531
|
* @returns An output specification for generating a choice.
|
|
530
532
|
*/
|
|
531
|
-
declare const choice: <
|
|
532
|
-
options: Array<
|
|
533
|
-
}) => Output<
|
|
533
|
+
declare const choice: <CHOICE extends string>({ options: choiceOptions, }: {
|
|
534
|
+
options: Array<CHOICE>;
|
|
535
|
+
}) => Output<CHOICE, CHOICE>;
|
|
534
536
|
/**
|
|
535
537
|
* Output specification for unstructured JSON generation.
|
|
536
538
|
* When the model generates a text response, it will return a JSON object.
|
|
@@ -981,9 +983,9 @@ type StopCondition<TOOLS extends ToolSet> = (options: {
|
|
|
981
983
|
declare function stepCountIs(stepCount: number): StopCondition<any>;
|
|
982
984
|
declare function hasToolCall(toolName: string): StopCondition<any>;
|
|
983
985
|
|
|
984
|
-
declare const symbol$
|
|
986
|
+
declare const symbol$d: unique symbol;
|
|
985
987
|
declare class InvalidToolInputError extends AISDKError {
|
|
986
|
-
private readonly [symbol$
|
|
988
|
+
private readonly [symbol$d];
|
|
987
989
|
readonly toolName: string;
|
|
988
990
|
readonly toolInput: string;
|
|
989
991
|
constructor({ toolInput, toolName, cause, message, }: {
|
|
@@ -995,9 +997,9 @@ declare class InvalidToolInputError extends AISDKError {
|
|
|
995
997
|
static isInstance(error: unknown): error is InvalidToolInputError;
|
|
996
998
|
}
|
|
997
999
|
|
|
998
|
-
declare const symbol$
|
|
1000
|
+
declare const symbol$c: unique symbol;
|
|
999
1001
|
declare class NoSuchToolError extends AISDKError {
|
|
1000
|
-
private readonly [symbol$
|
|
1002
|
+
private readonly [symbol$c];
|
|
1001
1003
|
readonly toolName: string;
|
|
1002
1004
|
readonly availableTools: string[] | undefined;
|
|
1003
1005
|
constructor({ toolName, availableTools, message, }: {
|
|
@@ -1146,7 +1148,7 @@ If set and supported by the model, calls will generate deterministic results.
|
|
|
1146
1148
|
@returns
|
|
1147
1149
|
A result object that contains the generated text, the results of the tool calls, and additional information.
|
|
1148
1150
|
*/
|
|
1149
|
-
declare function generateText<TOOLS extends ToolSet, OUTPUT extends Output =
|
|
1151
|
+
declare function generateText<TOOLS extends ToolSet, OUTPUT extends Output = Output<string, string>>({ model: modelArg, tools, toolChoice, system, prompt, messages, maxRetries: maxRetriesArg, abortSignal, headers, stopWhen, experimental_output, output, experimental_telemetry: telemetry, providerOptions, experimental_activeTools, activeTools, experimental_prepareStep, prepareStep, experimental_repairToolCall: repairToolCall, experimental_download: download, experimental_context, _internal: { generateId, currentDate, }, onStepFinish, onFinish, ...settings }: CallSettings & Prompt & {
|
|
1150
1152
|
/**
|
|
1151
1153
|
The language model to use.
|
|
1152
1154
|
*/
|
|
@@ -1392,7 +1394,7 @@ If set and supported by the model, calls will generate deterministic results.
|
|
|
1392
1394
|
@return
|
|
1393
1395
|
A result object for accessing different stream types and additional information.
|
|
1394
1396
|
*/
|
|
1395
|
-
declare function streamText<TOOLS extends ToolSet, OUTPUT extends Output =
|
|
1397
|
+
declare function streamText<TOOLS extends ToolSet, OUTPUT extends Output = Output<string, string>>({ model, tools, toolChoice, system, prompt, messages, maxRetries, abortSignal, headers, stopWhen, experimental_output, output, experimental_telemetry: telemetry, prepareStep, providerOptions, experimental_activeTools, activeTools, experimental_repairToolCall: repairToolCall, experimental_transform: transform, experimental_download: download, includeRawChunks, onChunk, onError, onFinish, onAbort, onStepFinish, experimental_context, _internal: { now, generateId, currentDate, }, ...settings }: CallSettings & Prompt & {
|
|
1396
1398
|
/**
|
|
1397
1399
|
The language model to use.
|
|
1398
1400
|
*/
|
|
@@ -2381,10 +2383,14 @@ interface StreamTextResult<TOOLS extends ToolSet, OUTPUT extends Output> {
|
|
|
2381
2383
|
*/
|
|
2382
2384
|
readonly experimental_partialOutputStream: AsyncIterableStream<InferPartialOutput<OUTPUT>>;
|
|
2383
2385
|
/**
|
|
2384
|
-
* A stream of partial outputs. It uses the `output` specification.
|
|
2386
|
+
* A stream of partial parsed outputs. It uses the `output` specification.
|
|
2385
2387
|
*/
|
|
2386
2388
|
readonly partialOutputStream: AsyncIterableStream<InferPartialOutput<OUTPUT>>;
|
|
2387
2389
|
/**
|
|
2390
|
+
* The complete parsed output. It uses the `output` specification.
|
|
2391
|
+
*/
|
|
2392
|
+
readonly output: Promise<InferCompleteOutput<OUTPUT>>;
|
|
2393
|
+
/**
|
|
2388
2394
|
Consumes the stream without processing the parts.
|
|
2389
2395
|
This is useful to force the stream to finish.
|
|
2390
2396
|
It effectively removes the backpressure and allows the stream to finish,
|
|
@@ -3584,9 +3590,9 @@ declare function embedMany<VALUE = string>({ model: modelArg, values, maxParalle
|
|
|
3584
3590
|
maxParallelCalls?: number;
|
|
3585
3591
|
}): Promise<EmbedManyResult<VALUE>>;
|
|
3586
3592
|
|
|
3587
|
-
declare const symbol$
|
|
3593
|
+
declare const symbol$b: unique symbol;
|
|
3588
3594
|
declare class InvalidArgumentError extends AISDKError {
|
|
3589
|
-
private readonly [symbol$
|
|
3595
|
+
private readonly [symbol$b];
|
|
3590
3596
|
readonly parameter: string;
|
|
3591
3597
|
readonly value: unknown;
|
|
3592
3598
|
constructor({ parameter, value, message, }: {
|
|
@@ -3674,9 +3680,9 @@ type SingleRequestTextStreamPart<TOOLS extends ToolSet> = {
|
|
|
3674
3680
|
rawValue: unknown;
|
|
3675
3681
|
};
|
|
3676
3682
|
|
|
3677
|
-
declare const symbol$
|
|
3683
|
+
declare const symbol$a: unique symbol;
|
|
3678
3684
|
declare class InvalidStreamPartError extends AISDKError {
|
|
3679
|
-
private readonly [symbol$
|
|
3685
|
+
private readonly [symbol$a];
|
|
3680
3686
|
readonly chunk: SingleRequestTextStreamPart<any>;
|
|
3681
3687
|
constructor({ chunk, message, }: {
|
|
3682
3688
|
chunk: SingleRequestTextStreamPart<any>;
|
|
@@ -3685,7 +3691,7 @@ declare class InvalidStreamPartError extends AISDKError {
|
|
|
3685
3691
|
static isInstance(error: unknown): error is InvalidStreamPartError;
|
|
3686
3692
|
}
|
|
3687
3693
|
|
|
3688
|
-
declare const symbol$
|
|
3694
|
+
declare const symbol$9: unique symbol;
|
|
3689
3695
|
/**
|
|
3690
3696
|
Thrown when no image could be generated. This can have multiple causes:
|
|
3691
3697
|
|
|
@@ -3693,7 +3699,7 @@ Thrown when no image could be generated. This can have multiple causes:
|
|
|
3693
3699
|
- The model generated a response that could not be parsed.
|
|
3694
3700
|
*/
|
|
3695
3701
|
declare class NoImageGeneratedError extends AISDKError {
|
|
3696
|
-
private readonly [symbol$
|
|
3702
|
+
private readonly [symbol$9];
|
|
3697
3703
|
/**
|
|
3698
3704
|
The response metadata for each call.
|
|
3699
3705
|
*/
|
|
@@ -3706,7 +3712,7 @@ declare class NoImageGeneratedError extends AISDKError {
|
|
|
3706
3712
|
static isInstance(error: unknown): error is NoImageGeneratedError;
|
|
3707
3713
|
}
|
|
3708
3714
|
|
|
3709
|
-
declare const symbol$
|
|
3715
|
+
declare const symbol$8: unique symbol;
|
|
3710
3716
|
/**
|
|
3711
3717
|
Thrown when no object could be generated. This can have several causes:
|
|
3712
3718
|
|
|
@@ -3719,7 +3725,7 @@ The error contains the following properties:
|
|
|
3719
3725
|
- `text`: The text that was generated by the model. This can be the raw text or the tool call text, depending on the model.
|
|
3720
3726
|
*/
|
|
3721
3727
|
declare class NoObjectGeneratedError extends AISDKError {
|
|
3722
|
-
private readonly [symbol$
|
|
3728
|
+
private readonly [symbol$8];
|
|
3723
3729
|
/**
|
|
3724
3730
|
The text that was generated by the model. This can be the raw text or the tool call text, depending on the model.
|
|
3725
3731
|
*/
|
|
@@ -3747,12 +3753,12 @@ declare class NoObjectGeneratedError extends AISDKError {
|
|
|
3747
3753
|
static isInstance(error: unknown): error is NoObjectGeneratedError;
|
|
3748
3754
|
}
|
|
3749
3755
|
|
|
3750
|
-
declare const symbol$
|
|
3756
|
+
declare const symbol$7: unique symbol;
|
|
3751
3757
|
/**
|
|
3752
3758
|
Thrown when no LLM output was generated, e.g. because of errors.
|
|
3753
3759
|
*/
|
|
3754
3760
|
declare class NoOutputGeneratedError extends AISDKError {
|
|
3755
|
-
private readonly [symbol$
|
|
3761
|
+
private readonly [symbol$7];
|
|
3756
3762
|
constructor({ message, cause, }?: {
|
|
3757
3763
|
message?: string;
|
|
3758
3764
|
cause?: Error;
|
|
@@ -3760,18 +3766,6 @@ declare class NoOutputGeneratedError extends AISDKError {
|
|
|
3760
3766
|
static isInstance(error: unknown): error is NoOutputGeneratedError;
|
|
3761
3767
|
}
|
|
3762
3768
|
|
|
3763
|
-
declare const symbol$7: unique symbol;
|
|
3764
|
-
/**
|
|
3765
|
-
Thrown when no output type is specified and output-related methods are called.
|
|
3766
|
-
*/
|
|
3767
|
-
declare class NoOutputSpecifiedError extends AISDKError {
|
|
3768
|
-
private readonly [symbol$7];
|
|
3769
|
-
constructor({ message }?: {
|
|
3770
|
-
message?: string;
|
|
3771
|
-
});
|
|
3772
|
-
static isInstance(error: unknown): error is NoOutputSpecifiedError;
|
|
3773
|
-
}
|
|
3774
|
-
|
|
3775
3769
|
/**
|
|
3776
3770
|
Error that is thrown when no speech audio was generated.
|
|
3777
3771
|
*/
|
|
@@ -5096,4 +5090,4 @@ declare global {
|
|
|
5096
5090
|
var AI_SDK_LOG_WARNINGS: LogWarningsFunction | undefined | false;
|
|
5097
5091
|
}
|
|
5098
5092
|
|
|
5099
|
-
export { AbstractChat, Agent, AsyncIterableStream, CallSettings, CallWarning, ChatAddToolApproveResponseFunction, ChatInit, ChatOnDataCallback, ChatOnErrorCallback, ChatOnFinishCallback, ChatOnToolCallCallback, ChatRequestOptions, ChatState, ChatStatus, ChatTransport, ChunkDetector, CompletionRequestOptions, CoreAssistantMessage, CoreMessage, CoreSystemMessage, CoreToolMessage, CoreUserMessage, CreateUIMessage, DataUIPart, DeepPartial, DefaultChatTransport, DownloadError, DynamicToolCall, DynamicToolError, DynamicToolResult, DynamicToolUIPart, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingModelMiddleware, EmbeddingModelUsage, ErrorHandler, ToolLoopAgent as Experimental_Agent, ToolLoopAgentSettings as Experimental_AgentSettings, DownloadFunction as Experimental_DownloadFunction, GenerateImageResult as Experimental_GenerateImageResult, GeneratedFile as Experimental_GeneratedImage, InferAgentUIMessage as Experimental_InferAgentUIMessage, LogWarningsFunction as Experimental_LogWarningsFunction, SpeechResult as Experimental_SpeechResult, TranscriptionResult as Experimental_TranscriptionResult, Warning as Experimental_Warning, FileUIPart, FinishReason, GenerateObjectResult, GenerateTextOnFinishCallback, GenerateTextOnStepFinishCallback, GenerateTextResult, GeneratedAudioFile, GeneratedFile, HttpChatTransport, HttpChatTransportInitOptions, ImageModel, ImageGenerationWarning as ImageModelCallWarning, ImageModelProviderMetadata, ImageModelResponseMetadata, InferAgentUIMessage, InferCompleteOutput as InferGenerateOutput, InferPartialOutput as InferStreamOutput, InferUIDataParts, InferUIMessageChunk, InferUITool, InferUITools, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolInputError, JSONValue, JsonToSseTransformStream, LanguageModel, LanguageModelMiddleware, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, MessageConversionError, NoImageGeneratedError, NoObjectGeneratedError, NoOutputGeneratedError,
|
|
5093
|
+
export { AbstractChat, Agent, AsyncIterableStream, CallSettings, CallWarning, ChatAddToolApproveResponseFunction, ChatInit, ChatOnDataCallback, ChatOnErrorCallback, ChatOnFinishCallback, ChatOnToolCallCallback, ChatRequestOptions, ChatState, ChatStatus, ChatTransport, ChunkDetector, CompletionRequestOptions, CoreAssistantMessage, CoreMessage, CoreSystemMessage, CoreToolMessage, CoreUserMessage, CreateUIMessage, DataUIPart, DeepPartial, DefaultChatTransport, DownloadError, DynamicToolCall, DynamicToolError, DynamicToolResult, DynamicToolUIPart, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingModelMiddleware, EmbeddingModelUsage, ErrorHandler, ToolLoopAgent as Experimental_Agent, ToolLoopAgentSettings as Experimental_AgentSettings, DownloadFunction as Experimental_DownloadFunction, GenerateImageResult as Experimental_GenerateImageResult, GeneratedFile as Experimental_GeneratedImage, InferAgentUIMessage as Experimental_InferAgentUIMessage, LogWarningsFunction as Experimental_LogWarningsFunction, SpeechResult as Experimental_SpeechResult, TranscriptionResult as Experimental_TranscriptionResult, Warning as Experimental_Warning, FileUIPart, FinishReason, GenerateObjectResult, GenerateTextOnFinishCallback, GenerateTextOnStepFinishCallback, GenerateTextResult, GeneratedAudioFile, GeneratedFile, HttpChatTransport, HttpChatTransportInitOptions, ImageModel, ImageGenerationWarning as ImageModelCallWarning, ImageModelProviderMetadata, ImageModelResponseMetadata, InferAgentUIMessage, InferCompleteOutput as InferGenerateOutput, InferPartialOutput as InferStreamOutput, InferUIDataParts, InferUIMessageChunk, InferUITool, InferUITools, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolInputError, JSONValue, JsonToSseTransformStream, LanguageModel, LanguageModelMiddleware, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, MessageConversionError, NoImageGeneratedError, NoObjectGeneratedError, NoOutputGeneratedError, NoSpeechGeneratedError, NoSuchProviderError, NoSuchToolError, ObjectStreamPart, output as Output, PrepareReconnectToStreamRequest, PrepareSendMessagesRequest, PrepareStepFunction, PrepareStepResult, Prompt, Provider, ProviderMetadata, ProviderRegistryProvider, ReasoningOutput, ReasoningUIPart, RepairTextFunction, RerankResult, RerankingModel, RetryError, SafeValidateUIMessagesResult, SerialJobExecutor, SourceDocumentUIPart, SourceUrlUIPart, SpeechModel, SpeechModelResponseMetadata, SpeechWarning, StaticToolCall, StaticToolError, StaticToolOutputDenied, StaticToolResult, StepResult, StepStartUIPart, StopCondition, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextOnFinishCallback, StreamTextOnStepFinishCallback, StreamTextResult, StreamTextTransform, TelemetrySettings, TextStreamChatTransport, TextStreamPart, TextUIPart, ToolApprovalRequestOutput, ToolCallRepairError, ToolCallRepairFunction, ToolChoice, ToolLoopAgent, ToolLoopAgentOnFinishCallback, ToolLoopAgentOnStepFinishCallback, ToolLoopAgentSettings, ToolSet, ToolUIPart, TranscriptionModel, TranscriptionModelResponseMetadata, TranscriptionWarning, TypedToolCall, TypedToolError, TypedToolOutputDenied, TypedToolResult, UIDataPartSchemas, UIDataTypes, UIMessage, UIMessageChunk, UIMessagePart, UIMessageStreamOnFinishCallback, UIMessageStreamOptions, UIMessageStreamWriter, UITool, UIToolInvocation, UITools, UI_MESSAGE_STREAM_HEADERS, UnsupportedModelVersionError, UseCompletionOptions, assistantModelMessageSchema, callCompletionApi, consumeStream, convertFileListToFileUIParts, convertToCoreMessages, convertToModelMessages, coreAssistantMessageSchema, coreMessageSchema, coreSystemMessageSchema, coreToolMessageSchema, coreUserMessageSchema, cosineSimilarity, createAgentUIStream, createAgentUIStreamResponse, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, defaultEmbeddingSettingsMiddleware, defaultSettingsMiddleware, embed, embedMany, experimental_createProviderRegistry, experimental_customProvider, generateImage as experimental_generateImage, generateSpeech as experimental_generateSpeech, transcribe as experimental_transcribe, extractReasoningMiddleware, generateObject, generateText, getTextFromDataUrl, getToolName, getToolOrDynamicToolName, hasToolCall, isDataUIPart, isDeepEqualData, isFileUIPart, isReasoningUIPart, isTextUIPart, isToolOrDynamicToolUIPart, isToolUIPart, lastAssistantMessageIsCompleteWithApprovalResponses, lastAssistantMessageIsCompleteWithToolCalls, modelMessageSchema, parsePartialJson, pipeAgentUIStreamToResponse, pipeTextStreamToResponse, pipeUIMessageStreamToResponse, pruneMessages, readUIMessageStream, rerank, safeValidateUIMessages, simulateReadableStream, simulateStreamingMiddleware, smoothStream, stepCountIs, streamObject, streamText, systemModelMessageSchema, toolModelMessageSchema, uiMessageChunkSchema, userModelMessageSchema, validateUIMessages, wrapEmbeddingModel, wrapLanguageModel, wrapProvider };
|