ai 5.0.280 → 5.0.282

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,21 @@
1
1
  # ai
2
2
 
3
+ ## 5.0.282
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [ab8e7fe]
8
+ - @ai-sdk/gateway@2.0.173
9
+
10
+ ## 5.0.281
11
+
12
+ ### Patch Changes
13
+
14
+ - 9ec221d: Fix `toolChoice: 'none'` by forwarding it to the Hugging Face Responses API and rejecting tool calls before local execution in `generateText` and `streamText` with a new `ToolChoiceViolationError`. Streamed tool parts are withheld so client-side tools cannot act on them, and `experimental_repairToolCall` is not invoked for rejected tool calls.
15
+ - Updated dependencies [0a444c6]
16
+ - Updated dependencies [6120af2]
17
+ - @ai-sdk/gateway@2.0.172
18
+
3
19
  ## 5.0.280
4
20
 
5
21
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { LanguageModelV2CallWarning, ImageModelV2CallWarning, SpeechModelV2CallWarning, TranscriptionModelV2CallWarning, ProviderV2, EmbeddingModelV2, EmbeddingModelV2Embedding, ImageModelV2, ImageModelV2ProviderMetadata, JSONValue as JSONValue$1, LanguageModelV2, LanguageModelV2FinishReason, LanguageModelV2Source, LanguageModelV2Middleware, SharedV2ProviderMetadata, SpeechModelV2, TranscriptionModelV2, LanguageModelV2Usage, LanguageModelV2CallOptions, AISDKError, LanguageModelV2ToolCall, JSONSchema7, JSONParseError, TypeValidationError, NoSuchModelError } from '@ai-sdk/provider';
1
+ import { LanguageModelV2CallWarning, ImageModelV2CallWarning, SpeechModelV2CallWarning, TranscriptionModelV2CallWarning, ProviderV2, EmbeddingModelV2, EmbeddingModelV2Embedding, ImageModelV2, ImageModelV2ProviderMetadata, JSONValue as JSONValue$1, LanguageModelV2, LanguageModelV2FinishReason, LanguageModelV2Source, LanguageModelV2Middleware, SharedV2ProviderMetadata, SpeechModelV2, TranscriptionModelV2, LanguageModelV2Usage, LanguageModelV2CallOptions, AISDKError, LanguageModelV2ToolCall, JSONSchema7, LanguageModelV2Content, LanguageModelV2ToolChoice, JSONParseError, TypeValidationError, NoSuchModelError } from '@ai-sdk/provider';
2
2
  export { AISDKError, APICallError, EmptyResponseBodyError, InvalidPromptError, InvalidResponseDataError, JSONParseError, JSONSchema7, LoadAPIKeyError, LoadSettingError, NoContentGeneratedError, NoSuchModelError, TooManyEmbeddingValuesForCallError, TypeValidationError, UnsupportedFunctionalityError } from '@ai-sdk/provider';
3
3
  import { GatewayModelId } from '@ai-sdk/gateway';
4
4
  export { GatewayModelId, createGateway, gateway } from '@ai-sdk/gateway';
@@ -960,9 +960,9 @@ type StopCondition<TOOLS extends ToolSet> = (options: {
960
960
  declare function stepCountIs(stepCount: number): StopCondition<any>;
961
961
  declare function hasToolCall(toolName: string): StopCondition<any>;
962
962
 
963
- declare const symbol$e: unique symbol;
963
+ declare const symbol$f: unique symbol;
964
964
  declare class InvalidToolInputError extends AISDKError {
965
- private readonly [symbol$e];
965
+ private readonly [symbol$f];
966
966
  readonly toolName: string;
967
967
  readonly toolInput: string;
968
968
  constructor({ toolInput, toolName, cause, message, }: {
@@ -974,9 +974,9 @@ declare class InvalidToolInputError extends AISDKError {
974
974
  static isInstance(error: unknown): error is InvalidToolInputError;
975
975
  }
976
976
 
977
- declare const symbol$d: unique symbol;
977
+ declare const symbol$e: unique symbol;
978
978
  declare class NoSuchToolError extends AISDKError {
979
- private readonly [symbol$d];
979
+ private readonly [symbol$e];
980
980
  readonly toolName: string;
981
981
  readonly availableTools: string[] | undefined;
982
982
  constructor({ toolName, availableTools, message, }: {
@@ -2569,9 +2569,9 @@ declare function embedMany<VALUE = string>({ model: modelArg, values, maxParalle
2569
2569
  maxParallelCalls?: number;
2570
2570
  }): Promise<EmbedManyResult<VALUE>>;
2571
2571
 
2572
- declare const symbol$c: unique symbol;
2572
+ declare const symbol$d: unique symbol;
2573
2573
  declare class InvalidArgumentError extends AISDKError {
2574
- private readonly [symbol$c];
2574
+ private readonly [symbol$d];
2575
2575
  readonly parameter: string;
2576
2576
  readonly value: unknown;
2577
2577
  constructor({ parameter, value, message, }: {
@@ -2657,9 +2657,9 @@ type SingleRequestTextStreamPart<TOOLS extends ToolSet> = {
2657
2657
  rawValue: unknown;
2658
2658
  };
2659
2659
 
2660
- declare const symbol$b: unique symbol;
2660
+ declare const symbol$c: unique symbol;
2661
2661
  declare class InvalidStreamPartError extends AISDKError {
2662
- private readonly [symbol$b];
2662
+ private readonly [symbol$c];
2663
2663
  readonly chunk: SingleRequestTextStreamPart<any>;
2664
2664
  constructor({ chunk, message, }: {
2665
2665
  chunk: SingleRequestTextStreamPart<any>;
@@ -2668,7 +2668,7 @@ declare class InvalidStreamPartError extends AISDKError {
2668
2668
  static isInstance(error: unknown): error is InvalidStreamPartError;
2669
2669
  }
2670
2670
 
2671
- declare const symbol$a: unique symbol;
2671
+ declare const symbol$b: unique symbol;
2672
2672
  /**
2673
2673
  Thrown when no image could be generated. This can have multiple causes:
2674
2674
 
@@ -2676,7 +2676,7 @@ Thrown when no image could be generated. This can have multiple causes:
2676
2676
  - The model generated a response that could not be parsed.
2677
2677
  */
2678
2678
  declare class NoImageGeneratedError extends AISDKError {
2679
- private readonly [symbol$a];
2679
+ private readonly [symbol$b];
2680
2680
  /**
2681
2681
  The response metadata for each call.
2682
2682
  */
@@ -2689,7 +2689,7 @@ declare class NoImageGeneratedError extends AISDKError {
2689
2689
  static isInstance(error: unknown): error is NoImageGeneratedError;
2690
2690
  }
2691
2691
 
2692
- declare const symbol$9: unique symbol;
2692
+ declare const symbol$a: unique symbol;
2693
2693
  /**
2694
2694
  Thrown when no object could be generated. This can have several causes:
2695
2695
 
@@ -2702,7 +2702,7 @@ The error contains the following properties:
2702
2702
  - `text`: The text that was generated by the model. This can be the raw text or the tool call text, depending on the model.
2703
2703
  */
2704
2704
  declare class NoObjectGeneratedError extends AISDKError {
2705
- private readonly [symbol$9];
2705
+ private readonly [symbol$a];
2706
2706
  /**
2707
2707
  The text that was generated by the model. This can be the raw text or the tool call text, depending on the model.
2708
2708
  */
@@ -2730,12 +2730,12 @@ declare class NoObjectGeneratedError extends AISDKError {
2730
2730
  static isInstance(error: unknown): error is NoObjectGeneratedError;
2731
2731
  }
2732
2732
 
2733
- declare const symbol$8: unique symbol;
2733
+ declare const symbol$9: unique symbol;
2734
2734
  /**
2735
2735
  Thrown when no LLM output was generated, e.g. because of errors.
2736
2736
  */
2737
2737
  declare class NoOutputGeneratedError extends AISDKError {
2738
- private readonly [symbol$8];
2738
+ private readonly [symbol$9];
2739
2739
  constructor({ message, cause, }?: {
2740
2740
  message?: string;
2741
2741
  cause?: Error;
@@ -2743,12 +2743,12 @@ declare class NoOutputGeneratedError extends AISDKError {
2743
2743
  static isInstance(error: unknown): error is NoOutputGeneratedError;
2744
2744
  }
2745
2745
 
2746
- declare const symbol$7: unique symbol;
2746
+ declare const symbol$8: unique symbol;
2747
2747
  /**
2748
2748
  Thrown when no output type is specified and output-related methods are called.
2749
2749
  */
2750
2750
  declare class NoOutputSpecifiedError extends AISDKError {
2751
- private readonly [symbol$7];
2751
+ private readonly [symbol$8];
2752
2752
  constructor({ message }?: {
2753
2753
  message?: string;
2754
2754
  });
@@ -2765,9 +2765,9 @@ declare class NoSpeechGeneratedError extends AISDKError {
2765
2765
  });
2766
2766
  }
2767
2767
 
2768
- declare const symbol$6: unique symbol;
2768
+ declare const symbol$7: unique symbol;
2769
2769
  declare class ToolCallRepairError extends AISDKError {
2770
- private readonly [symbol$6];
2770
+ private readonly [symbol$7];
2771
2771
  readonly originalError: NoSuchToolError | InvalidToolInputError;
2772
2772
  constructor({ cause, originalError, message, }: {
2773
2773
  message?: string;
@@ -2777,6 +2777,46 @@ declare class ToolCallRepairError extends AISDKError {
2777
2777
  static isInstance(error: unknown): error is ToolCallRepairError;
2778
2778
  }
2779
2779
 
2780
+ declare const symbol$6: unique symbol;
2781
+ type EnforcedToolChoice = Extract<LanguageModelV2ToolChoice, {
2782
+ type: 'none';
2783
+ }>;
2784
+ /**
2785
+ * Thrown when a model response does not satisfy an enforced tool choice.
2786
+ */
2787
+ declare class ToolChoiceViolationError extends AISDKError {
2788
+ private readonly [symbol$6];
2789
+ /**
2790
+ * The tool choice that the model response did not satisfy.
2791
+ */
2792
+ readonly toolChoice: EnforcedToolChoice;
2793
+ /**
2794
+ * Reason why the model finished generating the response.
2795
+ */
2796
+ readonly finishReason: FinishReason;
2797
+ /**
2798
+ * The provider that returned the response.
2799
+ */
2800
+ readonly provider: string;
2801
+ /**
2802
+ * The model that returned the response.
2803
+ */
2804
+ readonly modelId: string;
2805
+ /**
2806
+ * The normalized content returned by the model.
2807
+ */
2808
+ readonly content: Array<LanguageModelV2Content>;
2809
+ constructor({ toolChoice, finishReason, provider, modelId, content, message, }: {
2810
+ toolChoice: EnforcedToolChoice;
2811
+ finishReason: FinishReason;
2812
+ provider: string;
2813
+ modelId: string;
2814
+ content: Array<LanguageModelV2Content>;
2815
+ message?: string;
2816
+ });
2817
+ static isInstance(error: unknown): error is ToolChoiceViolationError;
2818
+ }
2819
+
2780
2820
  /**
2781
2821
  Error that is thrown when a model with an unsupported version is used.
2782
2822
  */
@@ -4555,4 +4595,4 @@ declare function safeValidateUIMessages<UI_MESSAGE extends UIMessage>({ messages
4555
4595
  */
4556
4596
  declare function validateUIMessages<UI_MESSAGE extends UIMessage>(options: ValidateUIMessagesOptions<UI_MESSAGE>): Promise<Array<UI_MESSAGE>>;
4557
4597
 
4558
- export { AbstractChat, AsyncIterableStream, CallSettings, CallWarning, ChatInit, ChatOnDataCallback, ChatOnErrorCallback, ChatOnFinishCallback, ChatOnToolCallCallback, ChatRequestOptions, ChatState, ChatStatus, ChatTransport, ChunkDetector, CompletionRequestOptions, ContentPart, CoreAssistantMessage, CoreMessage, CoreSystemMessage, CoreToolMessage, CoreUserMessage, CreateUIMessage, DataUIPart, DeepPartial, DefaultChatTransport, DownloadError, DynamicToolCall, DynamicToolError, DynamicToolResult, DynamicToolUIPart, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingModelUsage, ErrorHandler, Agent as Experimental_Agent, AgentSettings 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, GenerateTextOnStepFinishCallback, GenerateTextResult, GeneratedAudioFile, GeneratedFile, HttpChatTransport, HttpChatTransportInitOptions, ImageModel, ImageGenerationWarning as ImageModelCallWarning, ImageModelProviderMetadata, ImageModelResponseMetadata, 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, Output as OutputInterface, PrepareReconnectToStreamRequest, PrepareSendMessagesRequest, PrepareStepFunction, PrepareStepResult, Prompt, Provider, ProviderMetadata, ProviderRegistryProvider, ReasoningOutput, ReasoningUIPart, RepairTextFunction, RetryError, SafeValidateUIMessagesResult, SerialJobExecutor, SourceDocumentUIPart, SourceUrlUIPart, SpeechModel, SpeechModelResponseMetadata, SpeechWarning, StaticToolCall, StaticToolError, StaticToolResult, StepResult, StepStartUIPart, StopCondition, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextOnFinishCallback, StreamTextOnStepFinishCallback, StreamTextResult, StreamTextTransform, TelemetrySettings, TextStreamChatTransport, TextStreamPart, TextUIPart, ToolCallRepairError, ToolCallRepairFunction, ToolChoice, ToolSet, ToolUIPart, TranscriptionModel, TranscriptionModelResponseMetadata, TranscriptionWarning, TypedToolCall, TypedToolError, TypedToolResult, UIDataPartSchemas, UIDataTypes, UIMessage, UIMessageChunk, UIMessagePart, UIMessageStreamOnFinishCallback, UIMessageStreamOptions, UIMessageStreamOutcome, UIMessageStreamWriter, UIMessageStreamWriterWithOutcome, UITool, UIToolInvocation, UITools, UI_MESSAGE_STREAM_HEADERS, UnsupportedModelVersionError, UseCompletionOptions, assistantModelMessageSchema, callCompletionApi, consumeStream, convertFileListToFileUIParts, convertToCoreMessages, convertToModelMessages, coreAssistantMessageSchema, coreMessageSchema, coreSystemMessageSchema, coreToolMessageSchema, coreUserMessageSchema, cosineSimilarity, createDownload, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, 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, isDynamicToolUIPart, isFileUIPart, isReasoningUIPart, isTextUIPart, isToolOrDynamicToolUIPart, isToolUIPart, lastAssistantMessageIsCompleteWithToolCalls, modelMessageSchema, parsePartialJson, pipeTextStreamToResponse, pipeUIMessageStreamToResponse, pruneMessages, readUIMessageStream, safeValidateUIMessages, simulateReadableStream, simulateStreamingMiddleware, smoothStream, stepCountIs, streamObject, streamText, systemModelMessageSchema, toolModelMessageSchema, uiMessageChunkSchema, userModelMessageSchema, validateUIMessages, wrapLanguageModel, wrapProvider };
4598
+ export { AbstractChat, AsyncIterableStream, CallSettings, CallWarning, ChatInit, ChatOnDataCallback, ChatOnErrorCallback, ChatOnFinishCallback, ChatOnToolCallCallback, ChatRequestOptions, ChatState, ChatStatus, ChatTransport, ChunkDetector, CompletionRequestOptions, ContentPart, CoreAssistantMessage, CoreMessage, CoreSystemMessage, CoreToolMessage, CoreUserMessage, CreateUIMessage, DataUIPart, DeepPartial, DefaultChatTransport, DownloadError, DynamicToolCall, DynamicToolError, DynamicToolResult, DynamicToolUIPart, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingModelUsage, ErrorHandler, Agent as Experimental_Agent, AgentSettings 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, GenerateTextOnStepFinishCallback, GenerateTextResult, GeneratedAudioFile, GeneratedFile, HttpChatTransport, HttpChatTransportInitOptions, ImageModel, ImageGenerationWarning as ImageModelCallWarning, ImageModelProviderMetadata, ImageModelResponseMetadata, 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, Output as OutputInterface, PrepareReconnectToStreamRequest, PrepareSendMessagesRequest, PrepareStepFunction, PrepareStepResult, Prompt, Provider, ProviderMetadata, ProviderRegistryProvider, ReasoningOutput, ReasoningUIPart, RepairTextFunction, RetryError, SafeValidateUIMessagesResult, SerialJobExecutor, SourceDocumentUIPart, SourceUrlUIPart, SpeechModel, SpeechModelResponseMetadata, SpeechWarning, StaticToolCall, StaticToolError, StaticToolResult, StepResult, StepStartUIPart, StopCondition, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextOnFinishCallback, StreamTextOnStepFinishCallback, StreamTextResult, StreamTextTransform, TelemetrySettings, TextStreamChatTransport, TextStreamPart, TextUIPart, ToolCallRepairError, ToolCallRepairFunction, ToolChoice, ToolChoiceViolationError, ToolSet, ToolUIPart, TranscriptionModel, TranscriptionModelResponseMetadata, TranscriptionWarning, TypedToolCall, TypedToolError, TypedToolResult, UIDataPartSchemas, UIDataTypes, UIMessage, UIMessageChunk, UIMessagePart, UIMessageStreamOnFinishCallback, UIMessageStreamOptions, UIMessageStreamOutcome, UIMessageStreamWriter, UIMessageStreamWriterWithOutcome, UITool, UIToolInvocation, UITools, UI_MESSAGE_STREAM_HEADERS, UnsupportedModelVersionError, UseCompletionOptions, assistantModelMessageSchema, callCompletionApi, consumeStream, convertFileListToFileUIParts, convertToCoreMessages, convertToModelMessages, coreAssistantMessageSchema, coreMessageSchema, coreSystemMessageSchema, coreToolMessageSchema, coreUserMessageSchema, cosineSimilarity, createDownload, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, 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, isDynamicToolUIPart, isFileUIPart, isReasoningUIPart, isTextUIPart, isToolOrDynamicToolUIPart, isToolUIPart, lastAssistantMessageIsCompleteWithToolCalls, modelMessageSchema, parsePartialJson, pipeTextStreamToResponse, pipeUIMessageStreamToResponse, pruneMessages, readUIMessageStream, safeValidateUIMessages, simulateReadableStream, simulateStreamingMiddleware, smoothStream, stepCountIs, streamObject, streamText, systemModelMessageSchema, toolModelMessageSchema, uiMessageChunkSchema, userModelMessageSchema, validateUIMessages, wrapLanguageModel, wrapProvider };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { LanguageModelV2CallWarning, ImageModelV2CallWarning, SpeechModelV2CallWarning, TranscriptionModelV2CallWarning, ProviderV2, EmbeddingModelV2, EmbeddingModelV2Embedding, ImageModelV2, ImageModelV2ProviderMetadata, JSONValue as JSONValue$1, LanguageModelV2, LanguageModelV2FinishReason, LanguageModelV2Source, LanguageModelV2Middleware, SharedV2ProviderMetadata, SpeechModelV2, TranscriptionModelV2, LanguageModelV2Usage, LanguageModelV2CallOptions, AISDKError, LanguageModelV2ToolCall, JSONSchema7, JSONParseError, TypeValidationError, NoSuchModelError } from '@ai-sdk/provider';
1
+ import { LanguageModelV2CallWarning, ImageModelV2CallWarning, SpeechModelV2CallWarning, TranscriptionModelV2CallWarning, ProviderV2, EmbeddingModelV2, EmbeddingModelV2Embedding, ImageModelV2, ImageModelV2ProviderMetadata, JSONValue as JSONValue$1, LanguageModelV2, LanguageModelV2FinishReason, LanguageModelV2Source, LanguageModelV2Middleware, SharedV2ProviderMetadata, SpeechModelV2, TranscriptionModelV2, LanguageModelV2Usage, LanguageModelV2CallOptions, AISDKError, LanguageModelV2ToolCall, JSONSchema7, LanguageModelV2Content, LanguageModelV2ToolChoice, JSONParseError, TypeValidationError, NoSuchModelError } from '@ai-sdk/provider';
2
2
  export { AISDKError, APICallError, EmptyResponseBodyError, InvalidPromptError, InvalidResponseDataError, JSONParseError, JSONSchema7, LoadAPIKeyError, LoadSettingError, NoContentGeneratedError, NoSuchModelError, TooManyEmbeddingValuesForCallError, TypeValidationError, UnsupportedFunctionalityError } from '@ai-sdk/provider';
3
3
  import { GatewayModelId } from '@ai-sdk/gateway';
4
4
  export { GatewayModelId, createGateway, gateway } from '@ai-sdk/gateway';
@@ -960,9 +960,9 @@ type StopCondition<TOOLS extends ToolSet> = (options: {
960
960
  declare function stepCountIs(stepCount: number): StopCondition<any>;
961
961
  declare function hasToolCall(toolName: string): StopCondition<any>;
962
962
 
963
- declare const symbol$e: unique symbol;
963
+ declare const symbol$f: unique symbol;
964
964
  declare class InvalidToolInputError extends AISDKError {
965
- private readonly [symbol$e];
965
+ private readonly [symbol$f];
966
966
  readonly toolName: string;
967
967
  readonly toolInput: string;
968
968
  constructor({ toolInput, toolName, cause, message, }: {
@@ -974,9 +974,9 @@ declare class InvalidToolInputError extends AISDKError {
974
974
  static isInstance(error: unknown): error is InvalidToolInputError;
975
975
  }
976
976
 
977
- declare const symbol$d: unique symbol;
977
+ declare const symbol$e: unique symbol;
978
978
  declare class NoSuchToolError extends AISDKError {
979
- private readonly [symbol$d];
979
+ private readonly [symbol$e];
980
980
  readonly toolName: string;
981
981
  readonly availableTools: string[] | undefined;
982
982
  constructor({ toolName, availableTools, message, }: {
@@ -2569,9 +2569,9 @@ declare function embedMany<VALUE = string>({ model: modelArg, values, maxParalle
2569
2569
  maxParallelCalls?: number;
2570
2570
  }): Promise<EmbedManyResult<VALUE>>;
2571
2571
 
2572
- declare const symbol$c: unique symbol;
2572
+ declare const symbol$d: unique symbol;
2573
2573
  declare class InvalidArgumentError extends AISDKError {
2574
- private readonly [symbol$c];
2574
+ private readonly [symbol$d];
2575
2575
  readonly parameter: string;
2576
2576
  readonly value: unknown;
2577
2577
  constructor({ parameter, value, message, }: {
@@ -2657,9 +2657,9 @@ type SingleRequestTextStreamPart<TOOLS extends ToolSet> = {
2657
2657
  rawValue: unknown;
2658
2658
  };
2659
2659
 
2660
- declare const symbol$b: unique symbol;
2660
+ declare const symbol$c: unique symbol;
2661
2661
  declare class InvalidStreamPartError extends AISDKError {
2662
- private readonly [symbol$b];
2662
+ private readonly [symbol$c];
2663
2663
  readonly chunk: SingleRequestTextStreamPart<any>;
2664
2664
  constructor({ chunk, message, }: {
2665
2665
  chunk: SingleRequestTextStreamPart<any>;
@@ -2668,7 +2668,7 @@ declare class InvalidStreamPartError extends AISDKError {
2668
2668
  static isInstance(error: unknown): error is InvalidStreamPartError;
2669
2669
  }
2670
2670
 
2671
- declare const symbol$a: unique symbol;
2671
+ declare const symbol$b: unique symbol;
2672
2672
  /**
2673
2673
  Thrown when no image could be generated. This can have multiple causes:
2674
2674
 
@@ -2676,7 +2676,7 @@ Thrown when no image could be generated. This can have multiple causes:
2676
2676
  - The model generated a response that could not be parsed.
2677
2677
  */
2678
2678
  declare class NoImageGeneratedError extends AISDKError {
2679
- private readonly [symbol$a];
2679
+ private readonly [symbol$b];
2680
2680
  /**
2681
2681
  The response metadata for each call.
2682
2682
  */
@@ -2689,7 +2689,7 @@ declare class NoImageGeneratedError extends AISDKError {
2689
2689
  static isInstance(error: unknown): error is NoImageGeneratedError;
2690
2690
  }
2691
2691
 
2692
- declare const symbol$9: unique symbol;
2692
+ declare const symbol$a: unique symbol;
2693
2693
  /**
2694
2694
  Thrown when no object could be generated. This can have several causes:
2695
2695
 
@@ -2702,7 +2702,7 @@ The error contains the following properties:
2702
2702
  - `text`: The text that was generated by the model. This can be the raw text or the tool call text, depending on the model.
2703
2703
  */
2704
2704
  declare class NoObjectGeneratedError extends AISDKError {
2705
- private readonly [symbol$9];
2705
+ private readonly [symbol$a];
2706
2706
  /**
2707
2707
  The text that was generated by the model. This can be the raw text or the tool call text, depending on the model.
2708
2708
  */
@@ -2730,12 +2730,12 @@ declare class NoObjectGeneratedError extends AISDKError {
2730
2730
  static isInstance(error: unknown): error is NoObjectGeneratedError;
2731
2731
  }
2732
2732
 
2733
- declare const symbol$8: unique symbol;
2733
+ declare const symbol$9: unique symbol;
2734
2734
  /**
2735
2735
  Thrown when no LLM output was generated, e.g. because of errors.
2736
2736
  */
2737
2737
  declare class NoOutputGeneratedError extends AISDKError {
2738
- private readonly [symbol$8];
2738
+ private readonly [symbol$9];
2739
2739
  constructor({ message, cause, }?: {
2740
2740
  message?: string;
2741
2741
  cause?: Error;
@@ -2743,12 +2743,12 @@ declare class NoOutputGeneratedError extends AISDKError {
2743
2743
  static isInstance(error: unknown): error is NoOutputGeneratedError;
2744
2744
  }
2745
2745
 
2746
- declare const symbol$7: unique symbol;
2746
+ declare const symbol$8: unique symbol;
2747
2747
  /**
2748
2748
  Thrown when no output type is specified and output-related methods are called.
2749
2749
  */
2750
2750
  declare class NoOutputSpecifiedError extends AISDKError {
2751
- private readonly [symbol$7];
2751
+ private readonly [symbol$8];
2752
2752
  constructor({ message }?: {
2753
2753
  message?: string;
2754
2754
  });
@@ -2765,9 +2765,9 @@ declare class NoSpeechGeneratedError extends AISDKError {
2765
2765
  });
2766
2766
  }
2767
2767
 
2768
- declare const symbol$6: unique symbol;
2768
+ declare const symbol$7: unique symbol;
2769
2769
  declare class ToolCallRepairError extends AISDKError {
2770
- private readonly [symbol$6];
2770
+ private readonly [symbol$7];
2771
2771
  readonly originalError: NoSuchToolError | InvalidToolInputError;
2772
2772
  constructor({ cause, originalError, message, }: {
2773
2773
  message?: string;
@@ -2777,6 +2777,46 @@ declare class ToolCallRepairError extends AISDKError {
2777
2777
  static isInstance(error: unknown): error is ToolCallRepairError;
2778
2778
  }
2779
2779
 
2780
+ declare const symbol$6: unique symbol;
2781
+ type EnforcedToolChoice = Extract<LanguageModelV2ToolChoice, {
2782
+ type: 'none';
2783
+ }>;
2784
+ /**
2785
+ * Thrown when a model response does not satisfy an enforced tool choice.
2786
+ */
2787
+ declare class ToolChoiceViolationError extends AISDKError {
2788
+ private readonly [symbol$6];
2789
+ /**
2790
+ * The tool choice that the model response did not satisfy.
2791
+ */
2792
+ readonly toolChoice: EnforcedToolChoice;
2793
+ /**
2794
+ * Reason why the model finished generating the response.
2795
+ */
2796
+ readonly finishReason: FinishReason;
2797
+ /**
2798
+ * The provider that returned the response.
2799
+ */
2800
+ readonly provider: string;
2801
+ /**
2802
+ * The model that returned the response.
2803
+ */
2804
+ readonly modelId: string;
2805
+ /**
2806
+ * The normalized content returned by the model.
2807
+ */
2808
+ readonly content: Array<LanguageModelV2Content>;
2809
+ constructor({ toolChoice, finishReason, provider, modelId, content, message, }: {
2810
+ toolChoice: EnforcedToolChoice;
2811
+ finishReason: FinishReason;
2812
+ provider: string;
2813
+ modelId: string;
2814
+ content: Array<LanguageModelV2Content>;
2815
+ message?: string;
2816
+ });
2817
+ static isInstance(error: unknown): error is ToolChoiceViolationError;
2818
+ }
2819
+
2780
2820
  /**
2781
2821
  Error that is thrown when a model with an unsupported version is used.
2782
2822
  */
@@ -4555,4 +4595,4 @@ declare function safeValidateUIMessages<UI_MESSAGE extends UIMessage>({ messages
4555
4595
  */
4556
4596
  declare function validateUIMessages<UI_MESSAGE extends UIMessage>(options: ValidateUIMessagesOptions<UI_MESSAGE>): Promise<Array<UI_MESSAGE>>;
4557
4597
 
4558
- export { AbstractChat, AsyncIterableStream, CallSettings, CallWarning, ChatInit, ChatOnDataCallback, ChatOnErrorCallback, ChatOnFinishCallback, ChatOnToolCallCallback, ChatRequestOptions, ChatState, ChatStatus, ChatTransport, ChunkDetector, CompletionRequestOptions, ContentPart, CoreAssistantMessage, CoreMessage, CoreSystemMessage, CoreToolMessage, CoreUserMessage, CreateUIMessage, DataUIPart, DeepPartial, DefaultChatTransport, DownloadError, DynamicToolCall, DynamicToolError, DynamicToolResult, DynamicToolUIPart, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingModelUsage, ErrorHandler, Agent as Experimental_Agent, AgentSettings 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, GenerateTextOnStepFinishCallback, GenerateTextResult, GeneratedAudioFile, GeneratedFile, HttpChatTransport, HttpChatTransportInitOptions, ImageModel, ImageGenerationWarning as ImageModelCallWarning, ImageModelProviderMetadata, ImageModelResponseMetadata, 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, Output as OutputInterface, PrepareReconnectToStreamRequest, PrepareSendMessagesRequest, PrepareStepFunction, PrepareStepResult, Prompt, Provider, ProviderMetadata, ProviderRegistryProvider, ReasoningOutput, ReasoningUIPart, RepairTextFunction, RetryError, SafeValidateUIMessagesResult, SerialJobExecutor, SourceDocumentUIPart, SourceUrlUIPart, SpeechModel, SpeechModelResponseMetadata, SpeechWarning, StaticToolCall, StaticToolError, StaticToolResult, StepResult, StepStartUIPart, StopCondition, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextOnFinishCallback, StreamTextOnStepFinishCallback, StreamTextResult, StreamTextTransform, TelemetrySettings, TextStreamChatTransport, TextStreamPart, TextUIPart, ToolCallRepairError, ToolCallRepairFunction, ToolChoice, ToolSet, ToolUIPart, TranscriptionModel, TranscriptionModelResponseMetadata, TranscriptionWarning, TypedToolCall, TypedToolError, TypedToolResult, UIDataPartSchemas, UIDataTypes, UIMessage, UIMessageChunk, UIMessagePart, UIMessageStreamOnFinishCallback, UIMessageStreamOptions, UIMessageStreamOutcome, UIMessageStreamWriter, UIMessageStreamWriterWithOutcome, UITool, UIToolInvocation, UITools, UI_MESSAGE_STREAM_HEADERS, UnsupportedModelVersionError, UseCompletionOptions, assistantModelMessageSchema, callCompletionApi, consumeStream, convertFileListToFileUIParts, convertToCoreMessages, convertToModelMessages, coreAssistantMessageSchema, coreMessageSchema, coreSystemMessageSchema, coreToolMessageSchema, coreUserMessageSchema, cosineSimilarity, createDownload, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, 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, isDynamicToolUIPart, isFileUIPart, isReasoningUIPart, isTextUIPart, isToolOrDynamicToolUIPart, isToolUIPart, lastAssistantMessageIsCompleteWithToolCalls, modelMessageSchema, parsePartialJson, pipeTextStreamToResponse, pipeUIMessageStreamToResponse, pruneMessages, readUIMessageStream, safeValidateUIMessages, simulateReadableStream, simulateStreamingMiddleware, smoothStream, stepCountIs, streamObject, streamText, systemModelMessageSchema, toolModelMessageSchema, uiMessageChunkSchema, userModelMessageSchema, validateUIMessages, wrapLanguageModel, wrapProvider };
4598
+ export { AbstractChat, AsyncIterableStream, CallSettings, CallWarning, ChatInit, ChatOnDataCallback, ChatOnErrorCallback, ChatOnFinishCallback, ChatOnToolCallCallback, ChatRequestOptions, ChatState, ChatStatus, ChatTransport, ChunkDetector, CompletionRequestOptions, ContentPart, CoreAssistantMessage, CoreMessage, CoreSystemMessage, CoreToolMessage, CoreUserMessage, CreateUIMessage, DataUIPart, DeepPartial, DefaultChatTransport, DownloadError, DynamicToolCall, DynamicToolError, DynamicToolResult, DynamicToolUIPart, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingModelUsage, ErrorHandler, Agent as Experimental_Agent, AgentSettings 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, GenerateTextOnStepFinishCallback, GenerateTextResult, GeneratedAudioFile, GeneratedFile, HttpChatTransport, HttpChatTransportInitOptions, ImageModel, ImageGenerationWarning as ImageModelCallWarning, ImageModelProviderMetadata, ImageModelResponseMetadata, 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, Output as OutputInterface, PrepareReconnectToStreamRequest, PrepareSendMessagesRequest, PrepareStepFunction, PrepareStepResult, Prompt, Provider, ProviderMetadata, ProviderRegistryProvider, ReasoningOutput, ReasoningUIPart, RepairTextFunction, RetryError, SafeValidateUIMessagesResult, SerialJobExecutor, SourceDocumentUIPart, SourceUrlUIPart, SpeechModel, SpeechModelResponseMetadata, SpeechWarning, StaticToolCall, StaticToolError, StaticToolResult, StepResult, StepStartUIPart, StopCondition, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextOnFinishCallback, StreamTextOnStepFinishCallback, StreamTextResult, StreamTextTransform, TelemetrySettings, TextStreamChatTransport, TextStreamPart, TextUIPart, ToolCallRepairError, ToolCallRepairFunction, ToolChoice, ToolChoiceViolationError, ToolSet, ToolUIPart, TranscriptionModel, TranscriptionModelResponseMetadata, TranscriptionWarning, TypedToolCall, TypedToolError, TypedToolResult, UIDataPartSchemas, UIDataTypes, UIMessage, UIMessageChunk, UIMessagePart, UIMessageStreamOnFinishCallback, UIMessageStreamOptions, UIMessageStreamOutcome, UIMessageStreamWriter, UIMessageStreamWriterWithOutcome, UITool, UIToolInvocation, UITools, UI_MESSAGE_STREAM_HEADERS, UnsupportedModelVersionError, UseCompletionOptions, assistantModelMessageSchema, callCompletionApi, consumeStream, convertFileListToFileUIParts, convertToCoreMessages, convertToModelMessages, coreAssistantMessageSchema, coreMessageSchema, coreSystemMessageSchema, coreToolMessageSchema, coreUserMessageSchema, cosineSimilarity, createDownload, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, 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, isDynamicToolUIPart, isFileUIPart, isReasoningUIPart, isTextUIPart, isToolOrDynamicToolUIPart, isToolUIPart, lastAssistantMessageIsCompleteWithToolCalls, modelMessageSchema, parsePartialJson, pipeTextStreamToResponse, pipeUIMessageStreamToResponse, pruneMessages, readUIMessageStream, safeValidateUIMessages, simulateReadableStream, simulateStreamingMiddleware, smoothStream, stepCountIs, streamObject, streamText, systemModelMessageSchema, toolModelMessageSchema, uiMessageChunkSchema, userModelMessageSchema, validateUIMessages, wrapLanguageModel, wrapProvider };