ai 6.0.0-beta.118 → 6.0.0-beta.120

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
+ ## 6.0.0-beta.120
4
+
5
+ ### Patch Changes
6
+
7
+ - 457318b: chore(provider,ai): switch to SharedV3Warning and unified warnings
8
+ - Updated dependencies [457318b]
9
+ - @ai-sdk/provider@3.0.0-beta.20
10
+ - @ai-sdk/gateway@2.0.0-beta.64
11
+ - @ai-sdk/provider-utils@4.0.0-beta.37
12
+
13
+ ## 6.0.0-beta.119
14
+
15
+ ### Patch Changes
16
+
17
+ - b59d924: feat(ai): support SystemModelMessage in system and instructions properties
18
+
3
19
  ## 6.0.0-beta.118
4
20
 
5
21
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { GatewayModelId } from '@ai-sdk/gateway';
2
2
  export { GatewayModelId, createGateway, gateway } from '@ai-sdk/gateway';
3
3
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
4
- import { Tool, InferToolInput, InferToolOutput, FlexibleSchema, InferSchema, AssistantModelMessage, ToolModelMessage, ReasoningPart, ModelMessage, SystemModelMessage, UserModelMessage, ProviderOptions, IdGenerator, ToolCall, MaybePromiseLike, TextPart, FilePart, Resolvable, FetchFunction, DataContent } from '@ai-sdk/provider-utils';
4
+ import { Tool, InferToolInput, InferToolOutput, FlexibleSchema, InferSchema, AssistantModelMessage, ToolModelMessage, ReasoningPart, SystemModelMessage, ModelMessage, UserModelMessage, ProviderOptions, IdGenerator, ToolCall, MaybePromiseLike, TextPart, FilePart, Resolvable, FetchFunction, DataContent } from '@ai-sdk/provider-utils';
5
5
  export { AssistantContent, AssistantModelMessage, DataContent, FilePart, FlexibleSchema, IdGenerator, ImagePart, InferSchema, InferToolInput, InferToolOutput, ModelMessage, Schema, SystemModelMessage, TextPart, Tool, ToolApprovalRequest, ToolApprovalResponse, ToolCallOptions, ToolCallPart, ToolContent, ToolExecuteFunction, ToolModelMessage, ToolResultPart, UserContent, UserModelMessage, asSchema, createIdGenerator, dynamicTool, generateId, jsonSchema, parseJsonEventStream, tool, zodSchema } from '@ai-sdk/provider-utils';
6
6
  import * as _ai_sdk_provider from '@ai-sdk/provider';
7
- import { EmbeddingModelV3, EmbeddingModelV2, EmbeddingModelV3Embedding, ImageModelV3, ImageModelV2, ImageModelV3CallWarning, ImageModelV2CallWarning, ImageModelV3ProviderMetadata, ImageModelV2ProviderMetadata, JSONValue as JSONValue$1, LanguageModelV3, LanguageModelV2, LanguageModelV3FinishReason, LanguageModelV3CallWarning, LanguageModelV3Source, LanguageModelV3Middleware, EmbeddingModelV3Middleware, RerankingModelV3, SharedV3ProviderMetadata, SpeechModelV3, SpeechModelV2, SpeechModelV3CallWarning, TranscriptionModelV3, TranscriptionModelV2, TranscriptionModelV3CallWarning, LanguageModelV3Usage, ImageModelV3Usage, LanguageModelV3CallOptions, AISDKError, LanguageModelV3ToolCall, JSONSchema7, JSONParseError, TypeValidationError, JSONObject, SharedV3Warning, EmbeddingModelCallOptions, ProviderV3, ProviderV2, NoSuchModelError } from '@ai-sdk/provider';
7
+ import { EmbeddingModelV3, EmbeddingModelV2, EmbeddingModelV3Embedding, EmbeddingModelV3Middleware, ImageModelV3, ImageModelV2, ImageModelV3ProviderMetadata, ImageModelV2ProviderMetadata, JSONValue as JSONValue$1, LanguageModelV3, LanguageModelV2, LanguageModelV3FinishReason, SharedV3Warning, LanguageModelV3Source, LanguageModelV3Middleware, RerankingModelV3, SharedV3ProviderMetadata, SpeechModelV3, SpeechModelV2, TranscriptionModelV3, TranscriptionModelV2, LanguageModelV3Usage, ImageModelV3Usage, LanguageModelV3CallOptions, AISDKError, LanguageModelV3ToolCall, JSONSchema7, JSONParseError, TypeValidationError, JSONObject, EmbeddingModelCallOptions, ProviderV3, ProviderV2, NoSuchModelError } from '@ai-sdk/provider';
8
8
  export { AISDKError, APICallError, EmptyResponseBodyError, InvalidPromptError, InvalidResponseDataError, JSONParseError, JSONSchema7, LoadAPIKeyError, LoadSettingError, NoContentGeneratedError, NoSuchModelError, TooManyEmbeddingValuesForCallError, TypeValidationError, UnsupportedFunctionalityError } from '@ai-sdk/provider';
9
9
  import { AttributeValue, Tracer } from '@opentelemetry/api';
10
10
  import { ServerResponse } from 'node:http';
@@ -20,16 +20,13 @@ Embedding.
20
20
  */
21
21
  type Embedding = EmbeddingModelV3Embedding;
22
22
 
23
+ type EmbeddingModelMiddleware = EmbeddingModelV3Middleware;
24
+
23
25
  /**
24
26
  Image model that is used by the AI SDK Core functions.
25
27
  */
26
28
  type ImageModel = string | ImageModelV3 | ImageModelV2;
27
29
  /**
28
- Warning from the model provider for this call. The call will proceed, but e.g.
29
- some settings might not be supported, which can lead to suboptimal results.
30
- */
31
- type ImageGenerationWarning = ImageModelV3CallWarning | ImageModelV2CallWarning;
32
- /**
33
30
  Metadata from the model provider for this call
34
31
  */
35
32
  type ImageModelProviderMetadata = ImageModelV3ProviderMetadata | ImageModelV2ProviderMetadata;
@@ -111,7 +108,7 @@ type FinishReason = LanguageModelV3FinishReason;
111
108
  Warning from the model provider for this call. The call will proceed, but e.g.
112
109
  some settings might not be supported, which can lead to suboptimal results.
113
110
  */
114
- type CallWarning = LanguageModelV3CallWarning;
111
+ type CallWarning = SharedV3Warning;
115
112
  /**
116
113
  A source that has been used as input to generate the response.
117
114
  */
@@ -131,8 +128,6 @@ type ToolChoice<TOOLS extends Record<string, unknown>> = 'auto' | 'none' | 'requ
131
128
 
132
129
  type LanguageModelMiddleware = LanguageModelV3Middleware;
133
130
 
134
- type EmbeddingModelMiddleware = EmbeddingModelV3Middleware;
135
-
136
131
  type LanguageModelRequestMetadata = {
137
132
  /**
138
133
  Request HTTP body that was sent to the provider API.
@@ -224,11 +219,6 @@ type ProviderMetadata = SharedV3ProviderMetadata;
224
219
  Speech model that is used by the AI SDK Core functions.
225
220
  */
226
221
  type SpeechModel = string | SpeechModelV3 | SpeechModelV2;
227
- /**
228
- Warning from the model provider for this call. The call will proceed, but e.g.
229
- some settings might not be supported, which can lead to suboptimal results.
230
- */
231
- type SpeechWarning = SpeechModelV3CallWarning;
232
222
 
233
223
  type SpeechModelResponseMetadata = {
234
224
  /**
@@ -253,11 +243,6 @@ type SpeechModelResponseMetadata = {
253
243
  Transcription model that is used by the AI SDK Core functions.
254
244
  */
255
245
  type TranscriptionModel = string | TranscriptionModelV3 | TranscriptionModelV2;
256
- /**
257
- Warning from the model provider for this call. The call will proceed, but e.g.
258
- some settings might not be supported, which can lead to suboptimal results.
259
- */
260
- type TranscriptionWarning = TranscriptionModelV3CallWarning;
261
246
 
262
247
  type TranscriptionModelResponseMetadata = {
263
248
  /**
@@ -292,6 +277,12 @@ Usage information for an image model call.
292
277
  */
293
278
  type ImageModelUsage = ImageModelV3Usage;
294
279
 
280
+ /**
281
+ Warning from the model provider for this call. The call will proceed, but e.g.
282
+ some settings might not be supported, which can lead to suboptimal results.
283
+ */
284
+ type Warning = SharedV3Warning;
285
+
295
286
  /**
296
287
  * A generated file.
297
288
  */
@@ -911,7 +902,7 @@ type Prompt = {
911
902
  /**
912
903
  System message to include in the prompt. Can be used with `prompt` or `messages`.
913
904
  */
914
- system?: string;
905
+ system?: string | SystemModelMessage;
915
906
  } & ({
916
907
  /**
917
908
  A prompt. It can be either a text prompt or a list of messages.
@@ -1022,7 +1013,7 @@ type PrepareStepResult<TOOLS extends Record<string, Tool> = Record<string, Tool>
1022
1013
  model?: LanguageModel;
1023
1014
  toolChoice?: ToolChoice<NoInfer<TOOLS>>;
1024
1015
  activeTools?: Array<keyof NoInfer<TOOLS>>;
1025
- system?: string;
1016
+ system?: string | SystemModelMessage;
1026
1017
  messages?: Array<ModelMessage>;
1027
1018
  } | undefined;
1028
1019
 
@@ -1119,7 +1110,7 @@ declare const coreMessageSchema: z.ZodType<CoreMessage>;
1119
1110
  * @param options.error - The error that occurred while parsing the tool call.
1120
1111
  */
1121
1112
  type ToolCallRepairFunction<TOOLS extends ToolSet> = (options: {
1122
- system: string | undefined;
1113
+ system: string | SystemModelMessage | undefined;
1123
1114
  messages: ModelMessage[];
1124
1115
  toolCall: LanguageModelV3ToolCall;
1125
1116
  tools: TOOLS;
@@ -2683,8 +2674,10 @@ type ToolLoopAgentSettings<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUT
2683
2674
  id?: string;
2684
2675
  /**
2685
2676
  * The instructions for the agent.
2677
+ *
2678
+ * It can be a string, or, if you need to pass additional provider options (e.g. for caching), a `SystemModelMessage`.
2686
2679
  */
2687
- instructions?: string;
2680
+ instructions?: string | SystemModelMessage;
2688
2681
  /**
2689
2682
  The language model to use.
2690
2683
  */
@@ -3766,7 +3759,7 @@ type SingleRequestTextStreamPart<TOOLS extends ToolSet> = {
3766
3759
  file: GeneratedFile;
3767
3760
  } | {
3768
3761
  type: 'stream-start';
3769
- warnings: LanguageModelV3CallWarning[];
3762
+ warnings: SharedV3Warning[];
3770
3763
  } | {
3771
3764
  type: 'response-metadata';
3772
3765
  id?: string;
@@ -3988,7 +3981,7 @@ interface GenerateImageResult {
3988
3981
  /**
3989
3982
  Warnings for the call, e.g. unsupported settings.
3990
3983
  */
3991
- readonly warnings: Array<ImageGenerationWarning>;
3984
+ readonly warnings: Array<Warning>;
3992
3985
  /**
3993
3986
  Response metadata from the provider. There may be multiple responses if we made multiple calls to the model.
3994
3987
  */
@@ -4659,7 +4652,7 @@ interface SpeechResult {
4659
4652
  /**
4660
4653
  Warnings for the call, e.g. unsupported settings.
4661
4654
  */
4662
- readonly warnings: Array<SpeechWarning>;
4655
+ readonly warnings: Array<Warning>;
4663
4656
  /**
4664
4657
  Response metadata from the provider. There may be multiple responses if we made multiple calls to the model.
4665
4658
  */
@@ -4747,10 +4740,30 @@ declare function generateSpeech({ model, text, voice, outputFormat, instructions
4747
4740
  headers?: Record<string, string>;
4748
4741
  }): Promise<SpeechResult>;
4749
4742
 
4750
- type Warning = LanguageModelV3CallWarning | ImageModelV3CallWarning | SpeechModelV3CallWarning | TranscriptionModelV3CallWarning | SharedV3Warning;
4743
+ /**
4744
+ * A function for logging warnings.
4745
+ *
4746
+ * You can assign it to the `AI_SDK_LOG_WARNINGS` global variable to use it as the default warning logger.
4747
+ *
4748
+ * @example
4749
+ * ```ts
4750
+ * globalThis.AI_SDK_LOG_WARNINGS = (options) => {
4751
+ * console.log('WARNINGS:', options.warnings, options.provider, options.model);
4752
+ * };
4753
+ * ```
4754
+ */
4751
4755
  type LogWarningsFunction = (options: {
4756
+ /**
4757
+ * The warnings returned by the model provider.
4758
+ */
4752
4759
  warnings: Warning[];
4760
+ /**
4761
+ * The provider id used for the call.
4762
+ */
4753
4763
  provider: string;
4764
+ /**
4765
+ * The model id used for the call.
4766
+ */
4754
4767
  model: string;
4755
4768
  }) => void;
4756
4769
 
@@ -5114,7 +5127,7 @@ interface TranscriptionResult {
5114
5127
  /**
5115
5128
  Warnings for the call, e.g. unsupported settings.
5116
5129
  */
5117
- readonly warnings: Array<TranscriptionWarning>;
5130
+ readonly warnings: Array<Warning>;
5118
5131
  /**
5119
5132
  Response metadata from the provider. There may be multiple responses if we made multiple calls to the model.
5120
5133
  */
@@ -5199,4 +5212,4 @@ declare global {
5199
5212
  var AI_SDK_LOG_WARNINGS: LogWarningsFunction | undefined | false;
5200
5213
  }
5201
5214
 
5202
- 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, ImageModelUsage, 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 };
5215
+ 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, FileUIPart, FinishReason, GenerateObjectResult, GenerateTextOnFinishCallback, GenerateTextOnStepFinishCallback, GenerateTextResult, GeneratedAudioFile, GeneratedFile, HttpChatTransport, HttpChatTransportInitOptions, ImageModel, ImageModelProviderMetadata, ImageModelResponseMetadata, ImageModelUsage, InferAgentUIMessage, InferCompleteOutput as InferGenerateOutput, InferPartialOutput as InferStreamOutput, InferUIDataParts, InferUIMessageChunk, InferUITool, InferUITools, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolInputError, JSONValue, JsonToSseTransformStream, LanguageModel, LanguageModelMiddleware, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, LogWarningsFunction, 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, 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, TypedToolCall, TypedToolError, TypedToolOutputDenied, TypedToolResult, UIDataPartSchemas, UIDataTypes, UIMessage, UIMessageChunk, UIMessagePart, UIMessageStreamOnFinishCallback, UIMessageStreamOptions, UIMessageStreamWriter, UITool, UIToolInvocation, UITools, UI_MESSAGE_STREAM_HEADERS, UnsupportedModelVersionError, UseCompletionOptions, Warning, 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
@@ -1,10 +1,10 @@
1
1
  import { GatewayModelId } from '@ai-sdk/gateway';
2
2
  export { GatewayModelId, createGateway, gateway } from '@ai-sdk/gateway';
3
3
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
4
- import { Tool, InferToolInput, InferToolOutput, FlexibleSchema, InferSchema, AssistantModelMessage, ToolModelMessage, ReasoningPart, ModelMessage, SystemModelMessage, UserModelMessage, ProviderOptions, IdGenerator, ToolCall, MaybePromiseLike, TextPart, FilePart, Resolvable, FetchFunction, DataContent } from '@ai-sdk/provider-utils';
4
+ import { Tool, InferToolInput, InferToolOutput, FlexibleSchema, InferSchema, AssistantModelMessage, ToolModelMessage, ReasoningPart, SystemModelMessage, ModelMessage, UserModelMessage, ProviderOptions, IdGenerator, ToolCall, MaybePromiseLike, TextPart, FilePart, Resolvable, FetchFunction, DataContent } from '@ai-sdk/provider-utils';
5
5
  export { AssistantContent, AssistantModelMessage, DataContent, FilePart, FlexibleSchema, IdGenerator, ImagePart, InferSchema, InferToolInput, InferToolOutput, ModelMessage, Schema, SystemModelMessage, TextPart, Tool, ToolApprovalRequest, ToolApprovalResponse, ToolCallOptions, ToolCallPart, ToolContent, ToolExecuteFunction, ToolModelMessage, ToolResultPart, UserContent, UserModelMessage, asSchema, createIdGenerator, dynamicTool, generateId, jsonSchema, parseJsonEventStream, tool, zodSchema } from '@ai-sdk/provider-utils';
6
6
  import * as _ai_sdk_provider from '@ai-sdk/provider';
7
- import { EmbeddingModelV3, EmbeddingModelV2, EmbeddingModelV3Embedding, ImageModelV3, ImageModelV2, ImageModelV3CallWarning, ImageModelV2CallWarning, ImageModelV3ProviderMetadata, ImageModelV2ProviderMetadata, JSONValue as JSONValue$1, LanguageModelV3, LanguageModelV2, LanguageModelV3FinishReason, LanguageModelV3CallWarning, LanguageModelV3Source, LanguageModelV3Middleware, EmbeddingModelV3Middleware, RerankingModelV3, SharedV3ProviderMetadata, SpeechModelV3, SpeechModelV2, SpeechModelV3CallWarning, TranscriptionModelV3, TranscriptionModelV2, TranscriptionModelV3CallWarning, LanguageModelV3Usage, ImageModelV3Usage, LanguageModelV3CallOptions, AISDKError, LanguageModelV3ToolCall, JSONSchema7, JSONParseError, TypeValidationError, JSONObject, SharedV3Warning, EmbeddingModelCallOptions, ProviderV3, ProviderV2, NoSuchModelError } from '@ai-sdk/provider';
7
+ import { EmbeddingModelV3, EmbeddingModelV2, EmbeddingModelV3Embedding, EmbeddingModelV3Middleware, ImageModelV3, ImageModelV2, ImageModelV3ProviderMetadata, ImageModelV2ProviderMetadata, JSONValue as JSONValue$1, LanguageModelV3, LanguageModelV2, LanguageModelV3FinishReason, SharedV3Warning, LanguageModelV3Source, LanguageModelV3Middleware, RerankingModelV3, SharedV3ProviderMetadata, SpeechModelV3, SpeechModelV2, TranscriptionModelV3, TranscriptionModelV2, LanguageModelV3Usage, ImageModelV3Usage, LanguageModelV3CallOptions, AISDKError, LanguageModelV3ToolCall, JSONSchema7, JSONParseError, TypeValidationError, JSONObject, EmbeddingModelCallOptions, ProviderV3, ProviderV2, NoSuchModelError } from '@ai-sdk/provider';
8
8
  export { AISDKError, APICallError, EmptyResponseBodyError, InvalidPromptError, InvalidResponseDataError, JSONParseError, JSONSchema7, LoadAPIKeyError, LoadSettingError, NoContentGeneratedError, NoSuchModelError, TooManyEmbeddingValuesForCallError, TypeValidationError, UnsupportedFunctionalityError } from '@ai-sdk/provider';
9
9
  import { AttributeValue, Tracer } from '@opentelemetry/api';
10
10
  import { ServerResponse } from 'node:http';
@@ -20,16 +20,13 @@ Embedding.
20
20
  */
21
21
  type Embedding = EmbeddingModelV3Embedding;
22
22
 
23
+ type EmbeddingModelMiddleware = EmbeddingModelV3Middleware;
24
+
23
25
  /**
24
26
  Image model that is used by the AI SDK Core functions.
25
27
  */
26
28
  type ImageModel = string | ImageModelV3 | ImageModelV2;
27
29
  /**
28
- Warning from the model provider for this call. The call will proceed, but e.g.
29
- some settings might not be supported, which can lead to suboptimal results.
30
- */
31
- type ImageGenerationWarning = ImageModelV3CallWarning | ImageModelV2CallWarning;
32
- /**
33
30
  Metadata from the model provider for this call
34
31
  */
35
32
  type ImageModelProviderMetadata = ImageModelV3ProviderMetadata | ImageModelV2ProviderMetadata;
@@ -111,7 +108,7 @@ type FinishReason = LanguageModelV3FinishReason;
111
108
  Warning from the model provider for this call. The call will proceed, but e.g.
112
109
  some settings might not be supported, which can lead to suboptimal results.
113
110
  */
114
- type CallWarning = LanguageModelV3CallWarning;
111
+ type CallWarning = SharedV3Warning;
115
112
  /**
116
113
  A source that has been used as input to generate the response.
117
114
  */
@@ -131,8 +128,6 @@ type ToolChoice<TOOLS extends Record<string, unknown>> = 'auto' | 'none' | 'requ
131
128
 
132
129
  type LanguageModelMiddleware = LanguageModelV3Middleware;
133
130
 
134
- type EmbeddingModelMiddleware = EmbeddingModelV3Middleware;
135
-
136
131
  type LanguageModelRequestMetadata = {
137
132
  /**
138
133
  Request HTTP body that was sent to the provider API.
@@ -224,11 +219,6 @@ type ProviderMetadata = SharedV3ProviderMetadata;
224
219
  Speech model that is used by the AI SDK Core functions.
225
220
  */
226
221
  type SpeechModel = string | SpeechModelV3 | SpeechModelV2;
227
- /**
228
- Warning from the model provider for this call. The call will proceed, but e.g.
229
- some settings might not be supported, which can lead to suboptimal results.
230
- */
231
- type SpeechWarning = SpeechModelV3CallWarning;
232
222
 
233
223
  type SpeechModelResponseMetadata = {
234
224
  /**
@@ -253,11 +243,6 @@ type SpeechModelResponseMetadata = {
253
243
  Transcription model that is used by the AI SDK Core functions.
254
244
  */
255
245
  type TranscriptionModel = string | TranscriptionModelV3 | TranscriptionModelV2;
256
- /**
257
- Warning from the model provider for this call. The call will proceed, but e.g.
258
- some settings might not be supported, which can lead to suboptimal results.
259
- */
260
- type TranscriptionWarning = TranscriptionModelV3CallWarning;
261
246
 
262
247
  type TranscriptionModelResponseMetadata = {
263
248
  /**
@@ -292,6 +277,12 @@ Usage information for an image model call.
292
277
  */
293
278
  type ImageModelUsage = ImageModelV3Usage;
294
279
 
280
+ /**
281
+ Warning from the model provider for this call. The call will proceed, but e.g.
282
+ some settings might not be supported, which can lead to suboptimal results.
283
+ */
284
+ type Warning = SharedV3Warning;
285
+
295
286
  /**
296
287
  * A generated file.
297
288
  */
@@ -911,7 +902,7 @@ type Prompt = {
911
902
  /**
912
903
  System message to include in the prompt. Can be used with `prompt` or `messages`.
913
904
  */
914
- system?: string;
905
+ system?: string | SystemModelMessage;
915
906
  } & ({
916
907
  /**
917
908
  A prompt. It can be either a text prompt or a list of messages.
@@ -1022,7 +1013,7 @@ type PrepareStepResult<TOOLS extends Record<string, Tool> = Record<string, Tool>
1022
1013
  model?: LanguageModel;
1023
1014
  toolChoice?: ToolChoice<NoInfer<TOOLS>>;
1024
1015
  activeTools?: Array<keyof NoInfer<TOOLS>>;
1025
- system?: string;
1016
+ system?: string | SystemModelMessage;
1026
1017
  messages?: Array<ModelMessage>;
1027
1018
  } | undefined;
1028
1019
 
@@ -1119,7 +1110,7 @@ declare const coreMessageSchema: z.ZodType<CoreMessage>;
1119
1110
  * @param options.error - The error that occurred while parsing the tool call.
1120
1111
  */
1121
1112
  type ToolCallRepairFunction<TOOLS extends ToolSet> = (options: {
1122
- system: string | undefined;
1113
+ system: string | SystemModelMessage | undefined;
1123
1114
  messages: ModelMessage[];
1124
1115
  toolCall: LanguageModelV3ToolCall;
1125
1116
  tools: TOOLS;
@@ -2683,8 +2674,10 @@ type ToolLoopAgentSettings<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUT
2683
2674
  id?: string;
2684
2675
  /**
2685
2676
  * The instructions for the agent.
2677
+ *
2678
+ * It can be a string, or, if you need to pass additional provider options (e.g. for caching), a `SystemModelMessage`.
2686
2679
  */
2687
- instructions?: string;
2680
+ instructions?: string | SystemModelMessage;
2688
2681
  /**
2689
2682
  The language model to use.
2690
2683
  */
@@ -3766,7 +3759,7 @@ type SingleRequestTextStreamPart<TOOLS extends ToolSet> = {
3766
3759
  file: GeneratedFile;
3767
3760
  } | {
3768
3761
  type: 'stream-start';
3769
- warnings: LanguageModelV3CallWarning[];
3762
+ warnings: SharedV3Warning[];
3770
3763
  } | {
3771
3764
  type: 'response-metadata';
3772
3765
  id?: string;
@@ -3988,7 +3981,7 @@ interface GenerateImageResult {
3988
3981
  /**
3989
3982
  Warnings for the call, e.g. unsupported settings.
3990
3983
  */
3991
- readonly warnings: Array<ImageGenerationWarning>;
3984
+ readonly warnings: Array<Warning>;
3992
3985
  /**
3993
3986
  Response metadata from the provider. There may be multiple responses if we made multiple calls to the model.
3994
3987
  */
@@ -4659,7 +4652,7 @@ interface SpeechResult {
4659
4652
  /**
4660
4653
  Warnings for the call, e.g. unsupported settings.
4661
4654
  */
4662
- readonly warnings: Array<SpeechWarning>;
4655
+ readonly warnings: Array<Warning>;
4663
4656
  /**
4664
4657
  Response metadata from the provider. There may be multiple responses if we made multiple calls to the model.
4665
4658
  */
@@ -4747,10 +4740,30 @@ declare function generateSpeech({ model, text, voice, outputFormat, instructions
4747
4740
  headers?: Record<string, string>;
4748
4741
  }): Promise<SpeechResult>;
4749
4742
 
4750
- type Warning = LanguageModelV3CallWarning | ImageModelV3CallWarning | SpeechModelV3CallWarning | TranscriptionModelV3CallWarning | SharedV3Warning;
4743
+ /**
4744
+ * A function for logging warnings.
4745
+ *
4746
+ * You can assign it to the `AI_SDK_LOG_WARNINGS` global variable to use it as the default warning logger.
4747
+ *
4748
+ * @example
4749
+ * ```ts
4750
+ * globalThis.AI_SDK_LOG_WARNINGS = (options) => {
4751
+ * console.log('WARNINGS:', options.warnings, options.provider, options.model);
4752
+ * };
4753
+ * ```
4754
+ */
4751
4755
  type LogWarningsFunction = (options: {
4756
+ /**
4757
+ * The warnings returned by the model provider.
4758
+ */
4752
4759
  warnings: Warning[];
4760
+ /**
4761
+ * The provider id used for the call.
4762
+ */
4753
4763
  provider: string;
4764
+ /**
4765
+ * The model id used for the call.
4766
+ */
4754
4767
  model: string;
4755
4768
  }) => void;
4756
4769
 
@@ -5114,7 +5127,7 @@ interface TranscriptionResult {
5114
5127
  /**
5115
5128
  Warnings for the call, e.g. unsupported settings.
5116
5129
  */
5117
- readonly warnings: Array<TranscriptionWarning>;
5130
+ readonly warnings: Array<Warning>;
5118
5131
  /**
5119
5132
  Response metadata from the provider. There may be multiple responses if we made multiple calls to the model.
5120
5133
  */
@@ -5199,4 +5212,4 @@ declare global {
5199
5212
  var AI_SDK_LOG_WARNINGS: LogWarningsFunction | undefined | false;
5200
5213
  }
5201
5214
 
5202
- 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, ImageModelUsage, 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 };
5215
+ 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, FileUIPart, FinishReason, GenerateObjectResult, GenerateTextOnFinishCallback, GenerateTextOnStepFinishCallback, GenerateTextResult, GeneratedAudioFile, GeneratedFile, HttpChatTransport, HttpChatTransportInitOptions, ImageModel, ImageModelProviderMetadata, ImageModelResponseMetadata, ImageModelUsage, InferAgentUIMessage, InferCompleteOutput as InferGenerateOutput, InferPartialOutput as InferStreamOutput, InferUIDataParts, InferUIMessageChunk, InferUITool, InferUITools, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolInputError, JSONValue, JsonToSseTransformStream, LanguageModel, LanguageModelMiddleware, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, LogWarningsFunction, 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, 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, TypedToolCall, TypedToolError, TypedToolOutputDenied, TypedToolResult, UIDataPartSchemas, UIDataTypes, UIMessage, UIMessageChunk, UIMessagePart, UIMessageStreamOnFinishCallback, UIMessageStreamOptions, UIMessageStreamWriter, UITool, UIToolInvocation, UITools, UI_MESSAGE_STREAM_HEADERS, UnsupportedModelVersionError, UseCompletionOptions, Warning, 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.js CHANGED
@@ -152,23 +152,15 @@ function formatWarning({
152
152
  }) {
153
153
  const prefix = `AI SDK Warning (${provider} / ${model}):`;
154
154
  switch (warning.type) {
155
- case "unsupported-setting": {
156
- let message = `${prefix} The "${warning.setting}" setting is not supported.`;
155
+ case "unsupported": {
156
+ let message = `${prefix} The feature "${warning.feature}" is not supported.`;
157
157
  if (warning.details) {
158
158
  message += ` ${warning.details}`;
159
159
  }
160
160
  return message;
161
161
  }
162
162
  case "compatibility": {
163
- let message = `${prefix} The "${warning.feature}" feature is not fully supported.`;
164
- if (warning.details) {
165
- message += ` ${warning.details}`;
166
- }
167
- return message;
168
- }
169
- case "unsupported-tool": {
170
- const toolName = "name" in warning.tool ? warning.tool.name : "unknown tool";
171
- let message = `${prefix} The tool "${toolName}" is not supported.`;
163
+ let message = `${prefix} The feature "${warning.feature}" is used in a compatibility mode.`;
172
164
  if (warning.details) {
173
165
  message += ` ${warning.details}`;
174
166
  }
@@ -884,7 +876,7 @@ function detectMediaType({
884
876
  var import_provider_utils2 = require("@ai-sdk/provider-utils");
885
877
 
886
878
  // src/version.ts
887
- var VERSION = true ? "6.0.0-beta.118" : "0.0.0-test";
879
+ var VERSION = true ? "6.0.0-beta.120" : "0.0.0-test";
888
880
 
889
881
  // src/util/download/download.ts
890
882
  var download = async ({ url }) => {
@@ -1028,7 +1020,13 @@ async function convertToLanguageModelPrompt({
1028
1020
  supportedUrls
1029
1021
  );
1030
1022
  const messages = [
1031
- ...prompt.system != null ? [{ role: "system", content: prompt.system }] : [],
1023
+ ...prompt.system != null ? typeof prompt.system === "string" ? [{ role: "system", content: prompt.system }] : [
1024
+ {
1025
+ role: "system",
1026
+ content: prompt.system.content,
1027
+ providerOptions: prompt.system.providerOptions
1028
+ }
1029
+ ] : [],
1032
1030
  ...prompt.messages.map(
1033
1031
  (message) => convertToLanguageModelMessage({ message, downloadedAssets })
1034
1032
  )
@@ -1685,7 +1683,7 @@ async function standardizePrompt(prompt) {
1685
1683
  message: "prompt and messages cannot be defined at the same time"
1686
1684
  });
1687
1685
  }
1688
- if (prompt.system != null && typeof prompt.system !== "string") {
1686
+ if (prompt.system != null && typeof prompt.system !== "string" && "role" in prompt.system && prompt.system.role !== "system") {
1689
1687
  throw new import_provider19.InvalidPromptError({
1690
1688
  prompt,
1691
1689
  message: "system must be a string"