ai 6.0.0-beta.87 → 6.0.0-beta.89

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # ai
2
2
 
3
+ ## 6.0.0-beta.89
4
+
5
+ ### Patch Changes
6
+
7
+ - d59ce25: fix(ai): do not mutate middleware array argument when wrapping
8
+
9
+ ## 6.0.0-beta.88
10
+
11
+ ### Patch Changes
12
+
13
+ - 22ef5c6: feat(ai): Output.text() is default output mode
14
+
3
15
  ## 6.0.0-beta.87
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: <OUTPUT>({ schema: inputSchema, }: {
512
- schema: FlexibleSchema<OUTPUT>;
513
- }) => Output<OUTPUT, DeepPartial<OUTPUT>>;
511
+ declare const object: <OBJECT>({ schema: inputSchema, }: {
512
+ schema: FlexibleSchema<OBJECT>;
513
+ }) => Output<OBJECT, DeepPartial<OBJECT>>;
514
514
  /**
515
- * Array output specification for text generation.
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 element to generate.
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
- * Choice output specification for text generation.
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 options to choose from.
529
+ * @param options - The available choices.
530
+ *
529
531
  * @returns An output specification for generating a choice.
530
532
  */
531
- declare const choice: <ELEMENT extends string>({ options: choiceOptions, }: {
532
- options: Array<ELEMENT>;
533
- }) => Output<ELEMENT, ELEMENT>;
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$e: unique symbol;
986
+ declare const symbol$d: unique symbol;
985
987
  declare class InvalidToolInputError extends AISDKError {
986
- private readonly [symbol$e];
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$d: unique symbol;
1000
+ declare const symbol$c: unique symbol;
999
1001
  declare class NoSuchToolError extends AISDKError {
1000
- private readonly [symbol$d];
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 = never>({ 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 & {
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 = never>({ 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 & {
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
  */
@@ -3588,9 +3590,9 @@ declare function embedMany<VALUE = string>({ model: modelArg, values, maxParalle
3588
3590
  maxParallelCalls?: number;
3589
3591
  }): Promise<EmbedManyResult<VALUE>>;
3590
3592
 
3591
- declare const symbol$c: unique symbol;
3593
+ declare const symbol$b: unique symbol;
3592
3594
  declare class InvalidArgumentError extends AISDKError {
3593
- private readonly [symbol$c];
3595
+ private readonly [symbol$b];
3594
3596
  readonly parameter: string;
3595
3597
  readonly value: unknown;
3596
3598
  constructor({ parameter, value, message, }: {
@@ -3678,9 +3680,9 @@ type SingleRequestTextStreamPart<TOOLS extends ToolSet> = {
3678
3680
  rawValue: unknown;
3679
3681
  };
3680
3682
 
3681
- declare const symbol$b: unique symbol;
3683
+ declare const symbol$a: unique symbol;
3682
3684
  declare class InvalidStreamPartError extends AISDKError {
3683
- private readonly [symbol$b];
3685
+ private readonly [symbol$a];
3684
3686
  readonly chunk: SingleRequestTextStreamPart<any>;
3685
3687
  constructor({ chunk, message, }: {
3686
3688
  chunk: SingleRequestTextStreamPart<any>;
@@ -3689,7 +3691,7 @@ declare class InvalidStreamPartError extends AISDKError {
3689
3691
  static isInstance(error: unknown): error is InvalidStreamPartError;
3690
3692
  }
3691
3693
 
3692
- declare const symbol$a: unique symbol;
3694
+ declare const symbol$9: unique symbol;
3693
3695
  /**
3694
3696
  Thrown when no image could be generated. This can have multiple causes:
3695
3697
 
@@ -3697,7 +3699,7 @@ Thrown when no image could be generated. This can have multiple causes:
3697
3699
  - The model generated a response that could not be parsed.
3698
3700
  */
3699
3701
  declare class NoImageGeneratedError extends AISDKError {
3700
- private readonly [symbol$a];
3702
+ private readonly [symbol$9];
3701
3703
  /**
3702
3704
  The response metadata for each call.
3703
3705
  */
@@ -3710,7 +3712,7 @@ declare class NoImageGeneratedError extends AISDKError {
3710
3712
  static isInstance(error: unknown): error is NoImageGeneratedError;
3711
3713
  }
3712
3714
 
3713
- declare const symbol$9: unique symbol;
3715
+ declare const symbol$8: unique symbol;
3714
3716
  /**
3715
3717
  Thrown when no object could be generated. This can have several causes:
3716
3718
 
@@ -3723,7 +3725,7 @@ The error contains the following properties:
3723
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.
3724
3726
  */
3725
3727
  declare class NoObjectGeneratedError extends AISDKError {
3726
- private readonly [symbol$9];
3728
+ private readonly [symbol$8];
3727
3729
  /**
3728
3730
  The text that was generated by the model. This can be the raw text or the tool call text, depending on the model.
3729
3731
  */
@@ -3751,12 +3753,12 @@ declare class NoObjectGeneratedError extends AISDKError {
3751
3753
  static isInstance(error: unknown): error is NoObjectGeneratedError;
3752
3754
  }
3753
3755
 
3754
- declare const symbol$8: unique symbol;
3756
+ declare const symbol$7: unique symbol;
3755
3757
  /**
3756
3758
  Thrown when no LLM output was generated, e.g. because of errors.
3757
3759
  */
3758
3760
  declare class NoOutputGeneratedError extends AISDKError {
3759
- private readonly [symbol$8];
3761
+ private readonly [symbol$7];
3760
3762
  constructor({ message, cause, }?: {
3761
3763
  message?: string;
3762
3764
  cause?: Error;
@@ -3764,18 +3766,6 @@ declare class NoOutputGeneratedError extends AISDKError {
3764
3766
  static isInstance(error: unknown): error is NoOutputGeneratedError;
3765
3767
  }
3766
3768
 
3767
- declare const symbol$7: unique symbol;
3768
- /**
3769
- Thrown when no output type is specified and output-related methods are called.
3770
- */
3771
- declare class NoOutputSpecifiedError extends AISDKError {
3772
- private readonly [symbol$7];
3773
- constructor({ message }?: {
3774
- message?: string;
3775
- });
3776
- static isInstance(error: unknown): error is NoOutputSpecifiedError;
3777
- }
3778
-
3779
3769
  /**
3780
3770
  Error that is thrown when no speech audio was generated.
3781
3771
  */
@@ -5100,4 +5090,4 @@ declare global {
5100
5090
  var AI_SDK_LOG_WARNINGS: LogWarningsFunction | undefined | false;
5101
5091
  }
5102
5092
 
5103
- 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, NoOutputSpecifiedError, 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 };
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: <OUTPUT>({ schema: inputSchema, }: {
512
- schema: FlexibleSchema<OUTPUT>;
513
- }) => Output<OUTPUT, DeepPartial<OUTPUT>>;
511
+ declare const object: <OBJECT>({ schema: inputSchema, }: {
512
+ schema: FlexibleSchema<OBJECT>;
513
+ }) => Output<OBJECT, DeepPartial<OBJECT>>;
514
514
  /**
515
- * Array output specification for text generation.
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 element to generate.
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
- * Choice output specification for text generation.
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 options to choose from.
529
+ * @param options - The available choices.
530
+ *
529
531
  * @returns An output specification for generating a choice.
530
532
  */
531
- declare const choice: <ELEMENT extends string>({ options: choiceOptions, }: {
532
- options: Array<ELEMENT>;
533
- }) => Output<ELEMENT, ELEMENT>;
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$e: unique symbol;
986
+ declare const symbol$d: unique symbol;
985
987
  declare class InvalidToolInputError extends AISDKError {
986
- private readonly [symbol$e];
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$d: unique symbol;
1000
+ declare const symbol$c: unique symbol;
999
1001
  declare class NoSuchToolError extends AISDKError {
1000
- private readonly [symbol$d];
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 = never>({ 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 & {
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 = never>({ 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 & {
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
  */
@@ -3588,9 +3590,9 @@ declare function embedMany<VALUE = string>({ model: modelArg, values, maxParalle
3588
3590
  maxParallelCalls?: number;
3589
3591
  }): Promise<EmbedManyResult<VALUE>>;
3590
3592
 
3591
- declare const symbol$c: unique symbol;
3593
+ declare const symbol$b: unique symbol;
3592
3594
  declare class InvalidArgumentError extends AISDKError {
3593
- private readonly [symbol$c];
3595
+ private readonly [symbol$b];
3594
3596
  readonly parameter: string;
3595
3597
  readonly value: unknown;
3596
3598
  constructor({ parameter, value, message, }: {
@@ -3678,9 +3680,9 @@ type SingleRequestTextStreamPart<TOOLS extends ToolSet> = {
3678
3680
  rawValue: unknown;
3679
3681
  };
3680
3682
 
3681
- declare const symbol$b: unique symbol;
3683
+ declare const symbol$a: unique symbol;
3682
3684
  declare class InvalidStreamPartError extends AISDKError {
3683
- private readonly [symbol$b];
3685
+ private readonly [symbol$a];
3684
3686
  readonly chunk: SingleRequestTextStreamPart<any>;
3685
3687
  constructor({ chunk, message, }: {
3686
3688
  chunk: SingleRequestTextStreamPart<any>;
@@ -3689,7 +3691,7 @@ declare class InvalidStreamPartError extends AISDKError {
3689
3691
  static isInstance(error: unknown): error is InvalidStreamPartError;
3690
3692
  }
3691
3693
 
3692
- declare const symbol$a: unique symbol;
3694
+ declare const symbol$9: unique symbol;
3693
3695
  /**
3694
3696
  Thrown when no image could be generated. This can have multiple causes:
3695
3697
 
@@ -3697,7 +3699,7 @@ Thrown when no image could be generated. This can have multiple causes:
3697
3699
  - The model generated a response that could not be parsed.
3698
3700
  */
3699
3701
  declare class NoImageGeneratedError extends AISDKError {
3700
- private readonly [symbol$a];
3702
+ private readonly [symbol$9];
3701
3703
  /**
3702
3704
  The response metadata for each call.
3703
3705
  */
@@ -3710,7 +3712,7 @@ declare class NoImageGeneratedError extends AISDKError {
3710
3712
  static isInstance(error: unknown): error is NoImageGeneratedError;
3711
3713
  }
3712
3714
 
3713
- declare const symbol$9: unique symbol;
3715
+ declare const symbol$8: unique symbol;
3714
3716
  /**
3715
3717
  Thrown when no object could be generated. This can have several causes:
3716
3718
 
@@ -3723,7 +3725,7 @@ The error contains the following properties:
3723
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.
3724
3726
  */
3725
3727
  declare class NoObjectGeneratedError extends AISDKError {
3726
- private readonly [symbol$9];
3728
+ private readonly [symbol$8];
3727
3729
  /**
3728
3730
  The text that was generated by the model. This can be the raw text or the tool call text, depending on the model.
3729
3731
  */
@@ -3751,12 +3753,12 @@ declare class NoObjectGeneratedError extends AISDKError {
3751
3753
  static isInstance(error: unknown): error is NoObjectGeneratedError;
3752
3754
  }
3753
3755
 
3754
- declare const symbol$8: unique symbol;
3756
+ declare const symbol$7: unique symbol;
3755
3757
  /**
3756
3758
  Thrown when no LLM output was generated, e.g. because of errors.
3757
3759
  */
3758
3760
  declare class NoOutputGeneratedError extends AISDKError {
3759
- private readonly [symbol$8];
3761
+ private readonly [symbol$7];
3760
3762
  constructor({ message, cause, }?: {
3761
3763
  message?: string;
3762
3764
  cause?: Error;
@@ -3764,18 +3766,6 @@ declare class NoOutputGeneratedError extends AISDKError {
3764
3766
  static isInstance(error: unknown): error is NoOutputGeneratedError;
3765
3767
  }
3766
3768
 
3767
- declare const symbol$7: unique symbol;
3768
- /**
3769
- Thrown when no output type is specified and output-related methods are called.
3770
- */
3771
- declare class NoOutputSpecifiedError extends AISDKError {
3772
- private readonly [symbol$7];
3773
- constructor({ message }?: {
3774
- message?: string;
3775
- });
3776
- static isInstance(error: unknown): error is NoOutputSpecifiedError;
3777
- }
3778
-
3779
3769
  /**
3780
3770
  Error that is thrown when no speech audio was generated.
3781
3771
  */
@@ -5100,4 +5090,4 @@ declare global {
5100
5090
  var AI_SDK_LOG_WARNINGS: LogWarningsFunction | undefined | false;
5101
5091
  }
5102
5092
 
5103
- 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, NoOutputSpecifiedError, 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 };
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 };