ai 6.0.0-beta.119 → 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 +10 -0
- package/dist/index.d.mts +36 -25
- package/dist/index.d.ts +36 -25
- package/dist/index.js +4 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -12
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +1 -1
- package/dist/internal/index.mjs +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
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
|
+
|
|
3
13
|
## 6.0.0-beta.119
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -4,7 +4,7 @@ import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
|
4
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,
|
|
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 =
|
|
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
|
*/
|
|
@@ -3768,7 +3759,7 @@ type SingleRequestTextStreamPart<TOOLS extends ToolSet> = {
|
|
|
3768
3759
|
file: GeneratedFile;
|
|
3769
3760
|
} | {
|
|
3770
3761
|
type: 'stream-start';
|
|
3771
|
-
warnings:
|
|
3762
|
+
warnings: SharedV3Warning[];
|
|
3772
3763
|
} | {
|
|
3773
3764
|
type: 'response-metadata';
|
|
3774
3765
|
id?: string;
|
|
@@ -3990,7 +3981,7 @@ interface GenerateImageResult {
|
|
|
3990
3981
|
/**
|
|
3991
3982
|
Warnings for the call, e.g. unsupported settings.
|
|
3992
3983
|
*/
|
|
3993
|
-
readonly warnings: Array<
|
|
3984
|
+
readonly warnings: Array<Warning>;
|
|
3994
3985
|
/**
|
|
3995
3986
|
Response metadata from the provider. There may be multiple responses if we made multiple calls to the model.
|
|
3996
3987
|
*/
|
|
@@ -4661,7 +4652,7 @@ interface SpeechResult {
|
|
|
4661
4652
|
/**
|
|
4662
4653
|
Warnings for the call, e.g. unsupported settings.
|
|
4663
4654
|
*/
|
|
4664
|
-
readonly warnings: Array<
|
|
4655
|
+
readonly warnings: Array<Warning>;
|
|
4665
4656
|
/**
|
|
4666
4657
|
Response metadata from the provider. There may be multiple responses if we made multiple calls to the model.
|
|
4667
4658
|
*/
|
|
@@ -4749,10 +4740,30 @@ declare function generateSpeech({ model, text, voice, outputFormat, instructions
|
|
|
4749
4740
|
headers?: Record<string, string>;
|
|
4750
4741
|
}): Promise<SpeechResult>;
|
|
4751
4742
|
|
|
4752
|
-
|
|
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
|
+
*/
|
|
4753
4755
|
type LogWarningsFunction = (options: {
|
|
4756
|
+
/**
|
|
4757
|
+
* The warnings returned by the model provider.
|
|
4758
|
+
*/
|
|
4754
4759
|
warnings: Warning[];
|
|
4760
|
+
/**
|
|
4761
|
+
* The provider id used for the call.
|
|
4762
|
+
*/
|
|
4755
4763
|
provider: string;
|
|
4764
|
+
/**
|
|
4765
|
+
* The model id used for the call.
|
|
4766
|
+
*/
|
|
4756
4767
|
model: string;
|
|
4757
4768
|
}) => void;
|
|
4758
4769
|
|
|
@@ -5116,7 +5127,7 @@ interface TranscriptionResult {
|
|
|
5116
5127
|
/**
|
|
5117
5128
|
Warnings for the call, e.g. unsupported settings.
|
|
5118
5129
|
*/
|
|
5119
|
-
readonly warnings: Array<
|
|
5130
|
+
readonly warnings: Array<Warning>;
|
|
5120
5131
|
/**
|
|
5121
5132
|
Response metadata from the provider. There may be multiple responses if we made multiple calls to the model.
|
|
5122
5133
|
*/
|
|
@@ -5201,4 +5212,4 @@ declare global {
|
|
|
5201
5212
|
var AI_SDK_LOG_WARNINGS: LogWarningsFunction | undefined | false;
|
|
5202
5213
|
}
|
|
5203
5214
|
|
|
5204
|
-
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,
|
|
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
|
@@ -4,7 +4,7 @@ import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
|
4
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,
|
|
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 =
|
|
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
|
*/
|
|
@@ -3768,7 +3759,7 @@ type SingleRequestTextStreamPart<TOOLS extends ToolSet> = {
|
|
|
3768
3759
|
file: GeneratedFile;
|
|
3769
3760
|
} | {
|
|
3770
3761
|
type: 'stream-start';
|
|
3771
|
-
warnings:
|
|
3762
|
+
warnings: SharedV3Warning[];
|
|
3772
3763
|
} | {
|
|
3773
3764
|
type: 'response-metadata';
|
|
3774
3765
|
id?: string;
|
|
@@ -3990,7 +3981,7 @@ interface GenerateImageResult {
|
|
|
3990
3981
|
/**
|
|
3991
3982
|
Warnings for the call, e.g. unsupported settings.
|
|
3992
3983
|
*/
|
|
3993
|
-
readonly warnings: Array<
|
|
3984
|
+
readonly warnings: Array<Warning>;
|
|
3994
3985
|
/**
|
|
3995
3986
|
Response metadata from the provider. There may be multiple responses if we made multiple calls to the model.
|
|
3996
3987
|
*/
|
|
@@ -4661,7 +4652,7 @@ interface SpeechResult {
|
|
|
4661
4652
|
/**
|
|
4662
4653
|
Warnings for the call, e.g. unsupported settings.
|
|
4663
4654
|
*/
|
|
4664
|
-
readonly warnings: Array<
|
|
4655
|
+
readonly warnings: Array<Warning>;
|
|
4665
4656
|
/**
|
|
4666
4657
|
Response metadata from the provider. There may be multiple responses if we made multiple calls to the model.
|
|
4667
4658
|
*/
|
|
@@ -4749,10 +4740,30 @@ declare function generateSpeech({ model, text, voice, outputFormat, instructions
|
|
|
4749
4740
|
headers?: Record<string, string>;
|
|
4750
4741
|
}): Promise<SpeechResult>;
|
|
4751
4742
|
|
|
4752
|
-
|
|
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
|
+
*/
|
|
4753
4755
|
type LogWarningsFunction = (options: {
|
|
4756
|
+
/**
|
|
4757
|
+
* The warnings returned by the model provider.
|
|
4758
|
+
*/
|
|
4754
4759
|
warnings: Warning[];
|
|
4760
|
+
/**
|
|
4761
|
+
* The provider id used for the call.
|
|
4762
|
+
*/
|
|
4755
4763
|
provider: string;
|
|
4764
|
+
/**
|
|
4765
|
+
* The model id used for the call.
|
|
4766
|
+
*/
|
|
4756
4767
|
model: string;
|
|
4757
4768
|
}) => void;
|
|
4758
4769
|
|
|
@@ -5116,7 +5127,7 @@ interface TranscriptionResult {
|
|
|
5116
5127
|
/**
|
|
5117
5128
|
Warnings for the call, e.g. unsupported settings.
|
|
5118
5129
|
*/
|
|
5119
|
-
readonly warnings: Array<
|
|
5130
|
+
readonly warnings: Array<Warning>;
|
|
5120
5131
|
/**
|
|
5121
5132
|
Response metadata from the provider. There may be multiple responses if we made multiple calls to the model.
|
|
5122
5133
|
*/
|
|
@@ -5201,4 +5212,4 @@ declare global {
|
|
|
5201
5212
|
var AI_SDK_LOG_WARNINGS: LogWarningsFunction | undefined | false;
|
|
5202
5213
|
}
|
|
5203
5214
|
|
|
5204
|
-
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,
|
|
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
|
|
156
|
-
let message = `${prefix} The "${warning.
|
|
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}"
|
|
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.
|
|
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 }) => {
|