ai 6.0.0-beta.159 → 6.0.0-beta.160
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 +41 -42
- package/dist/index.d.ts +41 -42
- package/dist/index.js +457 -430
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +249 -220
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +75 -100
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +46 -71
- package/dist/internal/index.mjs.map +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.160
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 9061dc0: feat: image editing
|
|
8
|
+
- Updated dependencies [9061dc0]
|
|
9
|
+
- @ai-sdk/provider-utils@4.0.0-beta.54
|
|
10
|
+
- @ai-sdk/provider@3.0.0-beta.28
|
|
11
|
+
- @ai-sdk/gateway@2.0.0-beta.86
|
|
12
|
+
|
|
3
13
|
## 6.0.0-beta.159
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -2,7 +2,7 @@ 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
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
|
-
export { AssistantContent, AssistantModelMessage, DataContent, FilePart, FlexibleSchema, IdGenerator, ImagePart, InferSchema, InferToolInput, InferToolOutput, ModelMessage, Schema, SystemModelMessage, TextPart, Tool, ToolApprovalRequest, ToolApprovalResponse, ToolCallOptions, ToolCallPart, ToolContent, ToolExecuteFunction, ToolExecutionOptions, ToolModelMessage, ToolResultPart, UserContent, UserModelMessage, asSchema, createIdGenerator, dynamicTool, generateId, jsonSchema, parseJsonEventStream, tool, zodSchema } from '@ai-sdk/provider-utils';
|
|
5
|
+
export { AssistantContent, AssistantModelMessage, DataContent, DownloadError, FilePart, FlexibleSchema, IdGenerator, ImagePart, InferSchema, InferToolInput, InferToolOutput, ModelMessage, Schema, SystemModelMessage, TextPart, Tool, ToolApprovalRequest, ToolApprovalResponse, ToolCallOptions, ToolCallPart, ToolContent, ToolExecuteFunction, ToolExecutionOptions, 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
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, JSONObject, ImageModelV3Usage, LanguageModelV3CallOptions, AISDKError, LanguageModelV3ToolCall, JSONSchema7, JSONParseError, TypeValidationError, 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';
|
|
@@ -1177,9 +1177,9 @@ type StopCondition<TOOLS extends ToolSet> = (options: {
|
|
|
1177
1177
|
declare function stepCountIs(stepCount: number): StopCondition<any>;
|
|
1178
1178
|
declare function hasToolCall(toolName: string): StopCondition<any>;
|
|
1179
1179
|
|
|
1180
|
-
declare const symbol$
|
|
1180
|
+
declare const symbol$c: unique symbol;
|
|
1181
1181
|
declare class InvalidToolInputError extends AISDKError {
|
|
1182
|
-
private readonly [symbol$
|
|
1182
|
+
private readonly [symbol$c];
|
|
1183
1183
|
readonly toolName: string;
|
|
1184
1184
|
readonly toolInput: string;
|
|
1185
1185
|
constructor({ toolInput, toolName, cause, message, }: {
|
|
@@ -1191,9 +1191,9 @@ declare class InvalidToolInputError extends AISDKError {
|
|
|
1191
1191
|
static isInstance(error: unknown): error is InvalidToolInputError;
|
|
1192
1192
|
}
|
|
1193
1193
|
|
|
1194
|
-
declare const symbol$
|
|
1194
|
+
declare const symbol$b: unique symbol;
|
|
1195
1195
|
declare class NoSuchToolError extends AISDKError {
|
|
1196
|
-
private readonly [symbol$
|
|
1196
|
+
private readonly [symbol$b];
|
|
1197
1197
|
readonly toolName: string;
|
|
1198
1198
|
readonly availableTools: string[] | undefined;
|
|
1199
1199
|
constructor({ toolName, availableTools, message, }: {
|
|
@@ -3861,9 +3861,9 @@ declare function embedMany({ model: modelArg, values, maxParallelCalls, maxRetri
|
|
|
3861
3861
|
maxParallelCalls?: number;
|
|
3862
3862
|
}): Promise<EmbedManyResult>;
|
|
3863
3863
|
|
|
3864
|
-
declare const symbol$
|
|
3864
|
+
declare const symbol$a: unique symbol;
|
|
3865
3865
|
declare class InvalidArgumentError extends AISDKError {
|
|
3866
|
-
private readonly [symbol$
|
|
3866
|
+
private readonly [symbol$a];
|
|
3867
3867
|
readonly parameter: string;
|
|
3868
3868
|
readonly value: unknown;
|
|
3869
3869
|
constructor({ parameter, value, message, }: {
|
|
@@ -3951,9 +3951,9 @@ type SingleRequestTextStreamPart<TOOLS extends ToolSet> = {
|
|
|
3951
3951
|
rawValue: unknown;
|
|
3952
3952
|
};
|
|
3953
3953
|
|
|
3954
|
-
declare const symbol$
|
|
3954
|
+
declare const symbol$9: unique symbol;
|
|
3955
3955
|
declare class InvalidStreamPartError extends AISDKError {
|
|
3956
|
-
private readonly [symbol$
|
|
3956
|
+
private readonly [symbol$9];
|
|
3957
3957
|
readonly chunk: SingleRequestTextStreamPart<any>;
|
|
3958
3958
|
constructor({ chunk, message, }: {
|
|
3959
3959
|
chunk: SingleRequestTextStreamPart<any>;
|
|
@@ -3962,7 +3962,7 @@ declare class InvalidStreamPartError extends AISDKError {
|
|
|
3962
3962
|
static isInstance(error: unknown): error is InvalidStreamPartError;
|
|
3963
3963
|
}
|
|
3964
3964
|
|
|
3965
|
-
declare const symbol$
|
|
3965
|
+
declare const symbol$8: unique symbol;
|
|
3966
3966
|
/**
|
|
3967
3967
|
Thrown when no image could be generated. This can have multiple causes:
|
|
3968
3968
|
|
|
@@ -3970,7 +3970,7 @@ Thrown when no image could be generated. This can have multiple causes:
|
|
|
3970
3970
|
- The model generated a response that could not be parsed.
|
|
3971
3971
|
*/
|
|
3972
3972
|
declare class NoImageGeneratedError extends AISDKError {
|
|
3973
|
-
private readonly [symbol$
|
|
3973
|
+
private readonly [symbol$8];
|
|
3974
3974
|
/**
|
|
3975
3975
|
The response metadata for each call.
|
|
3976
3976
|
*/
|
|
@@ -3983,7 +3983,7 @@ declare class NoImageGeneratedError extends AISDKError {
|
|
|
3983
3983
|
static isInstance(error: unknown): error is NoImageGeneratedError;
|
|
3984
3984
|
}
|
|
3985
3985
|
|
|
3986
|
-
declare const symbol$
|
|
3986
|
+
declare const symbol$7: unique symbol;
|
|
3987
3987
|
/**
|
|
3988
3988
|
Thrown when no object could be generated. This can have several causes:
|
|
3989
3989
|
|
|
@@ -3996,7 +3996,7 @@ The error contains the following properties:
|
|
|
3996
3996
|
- `text`: The text that was generated by the model. This can be the raw text or the tool call text, depending on the model.
|
|
3997
3997
|
*/
|
|
3998
3998
|
declare class NoObjectGeneratedError extends AISDKError {
|
|
3999
|
-
private readonly [symbol$
|
|
3999
|
+
private readonly [symbol$7];
|
|
4000
4000
|
/**
|
|
4001
4001
|
The text that was generated by the model. This can be the raw text or the tool call text, depending on the model.
|
|
4002
4002
|
*/
|
|
@@ -4024,12 +4024,12 @@ declare class NoObjectGeneratedError extends AISDKError {
|
|
|
4024
4024
|
static isInstance(error: unknown): error is NoObjectGeneratedError;
|
|
4025
4025
|
}
|
|
4026
4026
|
|
|
4027
|
-
declare const symbol$
|
|
4027
|
+
declare const symbol$6: unique symbol;
|
|
4028
4028
|
/**
|
|
4029
4029
|
Thrown when no LLM output was generated, e.g. because of errors.
|
|
4030
4030
|
*/
|
|
4031
4031
|
declare class NoOutputGeneratedError extends AISDKError {
|
|
4032
|
-
private readonly [symbol$
|
|
4032
|
+
private readonly [symbol$6];
|
|
4033
4033
|
constructor({ message, cause, }?: {
|
|
4034
4034
|
message?: string;
|
|
4035
4035
|
cause?: Error;
|
|
@@ -4047,9 +4047,9 @@ declare class NoSpeechGeneratedError extends AISDKError {
|
|
|
4047
4047
|
});
|
|
4048
4048
|
}
|
|
4049
4049
|
|
|
4050
|
-
declare const symbol$
|
|
4050
|
+
declare const symbol$5: unique symbol;
|
|
4051
4051
|
declare class ToolCallRepairError extends AISDKError {
|
|
4052
|
-
private readonly [symbol$
|
|
4052
|
+
private readonly [symbol$5];
|
|
4053
4053
|
readonly originalError: NoSuchToolError | InvalidToolInputError;
|
|
4054
4054
|
constructor({ cause, originalError, message, }: {
|
|
4055
4055
|
message?: string;
|
|
@@ -4073,9 +4073,9 @@ declare class UnsupportedModelVersionError extends AISDKError {
|
|
|
4073
4073
|
});
|
|
4074
4074
|
}
|
|
4075
4075
|
|
|
4076
|
-
declare const symbol$
|
|
4076
|
+
declare const symbol$4: unique symbol;
|
|
4077
4077
|
declare class InvalidDataContentError extends AISDKError {
|
|
4078
|
-
private readonly [symbol$
|
|
4078
|
+
private readonly [symbol$4];
|
|
4079
4079
|
readonly content: unknown;
|
|
4080
4080
|
constructor({ content, cause, message, }: {
|
|
4081
4081
|
content: unknown;
|
|
@@ -4085,9 +4085,9 @@ declare class InvalidDataContentError extends AISDKError {
|
|
|
4085
4085
|
static isInstance(error: unknown): error is InvalidDataContentError;
|
|
4086
4086
|
}
|
|
4087
4087
|
|
|
4088
|
-
declare const symbol$
|
|
4088
|
+
declare const symbol$3: unique symbol;
|
|
4089
4089
|
declare class InvalidMessageRoleError extends AISDKError {
|
|
4090
|
-
private readonly [symbol$
|
|
4090
|
+
private readonly [symbol$3];
|
|
4091
4091
|
readonly role: string;
|
|
4092
4092
|
constructor({ role, message, }: {
|
|
4093
4093
|
role: string;
|
|
@@ -4096,9 +4096,9 @@ declare class InvalidMessageRoleError extends AISDKError {
|
|
|
4096
4096
|
static isInstance(error: unknown): error is InvalidMessageRoleError;
|
|
4097
4097
|
}
|
|
4098
4098
|
|
|
4099
|
-
declare const symbol$
|
|
4099
|
+
declare const symbol$2: unique symbol;
|
|
4100
4100
|
declare class MessageConversionError extends AISDKError {
|
|
4101
|
-
private readonly [symbol$
|
|
4101
|
+
private readonly [symbol$2];
|
|
4102
4102
|
readonly originalMessage: Omit<UIMessage, 'id'>;
|
|
4103
4103
|
constructor({ originalMessage, message, }: {
|
|
4104
4104
|
originalMessage: Omit<UIMessage, 'id'>;
|
|
@@ -4107,22 +4107,6 @@ declare class MessageConversionError extends AISDKError {
|
|
|
4107
4107
|
static isInstance(error: unknown): error is MessageConversionError;
|
|
4108
4108
|
}
|
|
4109
4109
|
|
|
4110
|
-
declare const symbol$2: unique symbol;
|
|
4111
|
-
declare class DownloadError extends AISDKError {
|
|
4112
|
-
private readonly [symbol$2];
|
|
4113
|
-
readonly url: string;
|
|
4114
|
-
readonly statusCode?: number;
|
|
4115
|
-
readonly statusText?: string;
|
|
4116
|
-
constructor({ url, statusCode, statusText, cause, message, }: {
|
|
4117
|
-
url: string;
|
|
4118
|
-
statusCode?: number;
|
|
4119
|
-
statusText?: string;
|
|
4120
|
-
message?: string;
|
|
4121
|
-
cause?: unknown;
|
|
4122
|
-
});
|
|
4123
|
-
static isInstance(error: unknown): error is DownloadError;
|
|
4124
|
-
}
|
|
4125
|
-
|
|
4126
4110
|
declare const symbol$1: unique symbol;
|
|
4127
4111
|
type RetryErrorReason = 'maxRetriesExceeded' | 'errorNotRetryable' | 'abort';
|
|
4128
4112
|
declare class RetryError extends AISDKError {
|
|
@@ -4170,6 +4154,11 @@ interface GenerateImageResult {
|
|
|
4170
4154
|
readonly usage: ImageModelUsage;
|
|
4171
4155
|
}
|
|
4172
4156
|
|
|
4157
|
+
type GenerateImagePrompt = string | {
|
|
4158
|
+
images: Array<DataContent>;
|
|
4159
|
+
text?: string;
|
|
4160
|
+
mask?: DataContent;
|
|
4161
|
+
};
|
|
4173
4162
|
/**
|
|
4174
4163
|
Generates images using an image model.
|
|
4175
4164
|
|
|
@@ -4187,7 +4176,7 @@ as body parameters.
|
|
|
4187
4176
|
|
|
4188
4177
|
@returns A result object that contains the generated images.
|
|
4189
4178
|
*/
|
|
4190
|
-
declare function generateImage({ model: modelArg, prompt, n, maxImagesPerCall, size, aspectRatio, seed, providerOptions, maxRetries: maxRetriesArg, abortSignal, headers, }: {
|
|
4179
|
+
declare function generateImage({ model: modelArg, prompt: promptArg, n, maxImagesPerCall, size, aspectRatio, seed, providerOptions, maxRetries: maxRetriesArg, abortSignal, headers, }: {
|
|
4191
4180
|
/**
|
|
4192
4181
|
The image model to use.
|
|
4193
4182
|
*/
|
|
@@ -4195,7 +4184,7 @@ declare function generateImage({ model: modelArg, prompt, n, maxImagesPerCall, s
|
|
|
4195
4184
|
/**
|
|
4196
4185
|
The prompt that should be used to generate the image.
|
|
4197
4186
|
*/
|
|
4198
|
-
prompt:
|
|
4187
|
+
prompt: GenerateImagePrompt;
|
|
4199
4188
|
/**
|
|
4200
4189
|
Number of images to generate.
|
|
4201
4190
|
*/
|
|
@@ -4248,6 +4237,16 @@ declare function generateImage({ model: modelArg, prompt, n, maxImagesPerCall, s
|
|
|
4248
4237
|
headers?: Record<string, string>;
|
|
4249
4238
|
}): Promise<GenerateImageResult>;
|
|
4250
4239
|
|
|
4240
|
+
/**
|
|
4241
|
+
* @deprecated Use `generateImage` instead.
|
|
4242
|
+
*/
|
|
4243
|
+
declare const experimental_generateImage: typeof generateImage;
|
|
4244
|
+
|
|
4245
|
+
/**
|
|
4246
|
+
* @deprecated Use `GenerateImageResult` instead.
|
|
4247
|
+
*/
|
|
4248
|
+
type Experimental_GenerateImageResult = GenerateImageResult;
|
|
4249
|
+
|
|
4251
4250
|
/**
|
|
4252
4251
|
The result of a `generateObject` call.
|
|
4253
4252
|
*/
|
|
@@ -5402,4 +5401,4 @@ declare global {
|
|
|
5402
5401
|
var AI_SDK_LOG_WARNINGS: LogWarningsFunction | undefined | false;
|
|
5403
5402
|
}
|
|
5404
5403
|
|
|
5405
|
-
export { AbstractChat, Agent, AgentCallParameters, AgentStreamParameters, AsyncIterableStream, CallSettings, CallWarning, ChatAddToolApproveResponseFunction, ChatInit, ChatOnDataCallback, ChatOnErrorCallback, ChatOnFinishCallback, ChatOnToolCallCallback, ChatRequestOptions, ChatState, ChatStatus, ChatTransport, ChunkDetector, CompletionRequestOptions, ContentPart, CreateUIMessage, DataUIPart, DeepPartial, DefaultChatTransport,
|
|
5404
|
+
export { AbstractChat, Agent, AgentCallParameters, AgentStreamParameters, AsyncIterableStream, CallSettings, CallWarning, ChatAddToolApproveResponseFunction, ChatInit, ChatOnDataCallback, ChatOnErrorCallback, ChatOnFinishCallback, ChatOnToolCallCallback, ChatRequestOptions, ChatState, ChatStatus, ChatTransport, ChunkDetector, CompletionRequestOptions, ContentPart, CreateUIMessage, DataUIPart, DeepPartial, DefaultChatTransport, DynamicToolCall, DynamicToolError, DynamicToolResult, DynamicToolUIPart, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingModelMiddleware, EmbeddingModelUsage, ErrorHandler, ToolLoopAgent as Experimental_Agent, ToolLoopAgentSettings as Experimental_AgentSettings, DownloadFunction as Experimental_DownloadFunction, Experimental_GenerateImageResult, GeneratedFile as Experimental_GeneratedImage, InferAgentUIMessage as Experimental_InferAgentUIMessage, LogWarningsFunction as Experimental_LogWarningsFunction, SpeechResult as Experimental_SpeechResult, TranscriptionResult as Experimental_TranscriptionResult, FileUIPart, FinishReason, GenerateImageResult, 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, addToolInputExamplesMiddleware, assistantModelMessageSchema, callCompletionApi, consumeStream, convertFileListToFileUIParts, convertToModelMessages, cosineSimilarity, createAgentUIStream, createAgentUIStreamResponse, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, defaultEmbeddingSettingsMiddleware, defaultSettingsMiddleware, embed, embedMany, experimental_createProviderRegistry, experimental_customProvider, experimental_generateImage, generateSpeech as experimental_generateSpeech, transcribe as experimental_transcribe, extractReasoningMiddleware, generateImage, generateObject, generateText, getStaticToolName, getTextFromDataUrl, getToolName, getToolOrDynamicToolName, hasToolCall, isDataUIPart, isDeepEqualData, isFileUIPart, isReasoningUIPart, isStaticToolUIPart, 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
|
@@ -2,7 +2,7 @@ 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
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
|
-
export { AssistantContent, AssistantModelMessage, DataContent, FilePart, FlexibleSchema, IdGenerator, ImagePart, InferSchema, InferToolInput, InferToolOutput, ModelMessage, Schema, SystemModelMessage, TextPart, Tool, ToolApprovalRequest, ToolApprovalResponse, ToolCallOptions, ToolCallPart, ToolContent, ToolExecuteFunction, ToolExecutionOptions, ToolModelMessage, ToolResultPart, UserContent, UserModelMessage, asSchema, createIdGenerator, dynamicTool, generateId, jsonSchema, parseJsonEventStream, tool, zodSchema } from '@ai-sdk/provider-utils';
|
|
5
|
+
export { AssistantContent, AssistantModelMessage, DataContent, DownloadError, FilePart, FlexibleSchema, IdGenerator, ImagePart, InferSchema, InferToolInput, InferToolOutput, ModelMessage, Schema, SystemModelMessage, TextPart, Tool, ToolApprovalRequest, ToolApprovalResponse, ToolCallOptions, ToolCallPart, ToolContent, ToolExecuteFunction, ToolExecutionOptions, 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
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, JSONObject, ImageModelV3Usage, LanguageModelV3CallOptions, AISDKError, LanguageModelV3ToolCall, JSONSchema7, JSONParseError, TypeValidationError, 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';
|
|
@@ -1177,9 +1177,9 @@ type StopCondition<TOOLS extends ToolSet> = (options: {
|
|
|
1177
1177
|
declare function stepCountIs(stepCount: number): StopCondition<any>;
|
|
1178
1178
|
declare function hasToolCall(toolName: string): StopCondition<any>;
|
|
1179
1179
|
|
|
1180
|
-
declare const symbol$
|
|
1180
|
+
declare const symbol$c: unique symbol;
|
|
1181
1181
|
declare class InvalidToolInputError extends AISDKError {
|
|
1182
|
-
private readonly [symbol$
|
|
1182
|
+
private readonly [symbol$c];
|
|
1183
1183
|
readonly toolName: string;
|
|
1184
1184
|
readonly toolInput: string;
|
|
1185
1185
|
constructor({ toolInput, toolName, cause, message, }: {
|
|
@@ -1191,9 +1191,9 @@ declare class InvalidToolInputError extends AISDKError {
|
|
|
1191
1191
|
static isInstance(error: unknown): error is InvalidToolInputError;
|
|
1192
1192
|
}
|
|
1193
1193
|
|
|
1194
|
-
declare const symbol$
|
|
1194
|
+
declare const symbol$b: unique symbol;
|
|
1195
1195
|
declare class NoSuchToolError extends AISDKError {
|
|
1196
|
-
private readonly [symbol$
|
|
1196
|
+
private readonly [symbol$b];
|
|
1197
1197
|
readonly toolName: string;
|
|
1198
1198
|
readonly availableTools: string[] | undefined;
|
|
1199
1199
|
constructor({ toolName, availableTools, message, }: {
|
|
@@ -3861,9 +3861,9 @@ declare function embedMany({ model: modelArg, values, maxParallelCalls, maxRetri
|
|
|
3861
3861
|
maxParallelCalls?: number;
|
|
3862
3862
|
}): Promise<EmbedManyResult>;
|
|
3863
3863
|
|
|
3864
|
-
declare const symbol$
|
|
3864
|
+
declare const symbol$a: unique symbol;
|
|
3865
3865
|
declare class InvalidArgumentError extends AISDKError {
|
|
3866
|
-
private readonly [symbol$
|
|
3866
|
+
private readonly [symbol$a];
|
|
3867
3867
|
readonly parameter: string;
|
|
3868
3868
|
readonly value: unknown;
|
|
3869
3869
|
constructor({ parameter, value, message, }: {
|
|
@@ -3951,9 +3951,9 @@ type SingleRequestTextStreamPart<TOOLS extends ToolSet> = {
|
|
|
3951
3951
|
rawValue: unknown;
|
|
3952
3952
|
};
|
|
3953
3953
|
|
|
3954
|
-
declare const symbol$
|
|
3954
|
+
declare const symbol$9: unique symbol;
|
|
3955
3955
|
declare class InvalidStreamPartError extends AISDKError {
|
|
3956
|
-
private readonly [symbol$
|
|
3956
|
+
private readonly [symbol$9];
|
|
3957
3957
|
readonly chunk: SingleRequestTextStreamPart<any>;
|
|
3958
3958
|
constructor({ chunk, message, }: {
|
|
3959
3959
|
chunk: SingleRequestTextStreamPart<any>;
|
|
@@ -3962,7 +3962,7 @@ declare class InvalidStreamPartError extends AISDKError {
|
|
|
3962
3962
|
static isInstance(error: unknown): error is InvalidStreamPartError;
|
|
3963
3963
|
}
|
|
3964
3964
|
|
|
3965
|
-
declare const symbol$
|
|
3965
|
+
declare const symbol$8: unique symbol;
|
|
3966
3966
|
/**
|
|
3967
3967
|
Thrown when no image could be generated. This can have multiple causes:
|
|
3968
3968
|
|
|
@@ -3970,7 +3970,7 @@ Thrown when no image could be generated. This can have multiple causes:
|
|
|
3970
3970
|
- The model generated a response that could not be parsed.
|
|
3971
3971
|
*/
|
|
3972
3972
|
declare class NoImageGeneratedError extends AISDKError {
|
|
3973
|
-
private readonly [symbol$
|
|
3973
|
+
private readonly [symbol$8];
|
|
3974
3974
|
/**
|
|
3975
3975
|
The response metadata for each call.
|
|
3976
3976
|
*/
|
|
@@ -3983,7 +3983,7 @@ declare class NoImageGeneratedError extends AISDKError {
|
|
|
3983
3983
|
static isInstance(error: unknown): error is NoImageGeneratedError;
|
|
3984
3984
|
}
|
|
3985
3985
|
|
|
3986
|
-
declare const symbol$
|
|
3986
|
+
declare const symbol$7: unique symbol;
|
|
3987
3987
|
/**
|
|
3988
3988
|
Thrown when no object could be generated. This can have several causes:
|
|
3989
3989
|
|
|
@@ -3996,7 +3996,7 @@ The error contains the following properties:
|
|
|
3996
3996
|
- `text`: The text that was generated by the model. This can be the raw text or the tool call text, depending on the model.
|
|
3997
3997
|
*/
|
|
3998
3998
|
declare class NoObjectGeneratedError extends AISDKError {
|
|
3999
|
-
private readonly [symbol$
|
|
3999
|
+
private readonly [symbol$7];
|
|
4000
4000
|
/**
|
|
4001
4001
|
The text that was generated by the model. This can be the raw text or the tool call text, depending on the model.
|
|
4002
4002
|
*/
|
|
@@ -4024,12 +4024,12 @@ declare class NoObjectGeneratedError extends AISDKError {
|
|
|
4024
4024
|
static isInstance(error: unknown): error is NoObjectGeneratedError;
|
|
4025
4025
|
}
|
|
4026
4026
|
|
|
4027
|
-
declare const symbol$
|
|
4027
|
+
declare const symbol$6: unique symbol;
|
|
4028
4028
|
/**
|
|
4029
4029
|
Thrown when no LLM output was generated, e.g. because of errors.
|
|
4030
4030
|
*/
|
|
4031
4031
|
declare class NoOutputGeneratedError extends AISDKError {
|
|
4032
|
-
private readonly [symbol$
|
|
4032
|
+
private readonly [symbol$6];
|
|
4033
4033
|
constructor({ message, cause, }?: {
|
|
4034
4034
|
message?: string;
|
|
4035
4035
|
cause?: Error;
|
|
@@ -4047,9 +4047,9 @@ declare class NoSpeechGeneratedError extends AISDKError {
|
|
|
4047
4047
|
});
|
|
4048
4048
|
}
|
|
4049
4049
|
|
|
4050
|
-
declare const symbol$
|
|
4050
|
+
declare const symbol$5: unique symbol;
|
|
4051
4051
|
declare class ToolCallRepairError extends AISDKError {
|
|
4052
|
-
private readonly [symbol$
|
|
4052
|
+
private readonly [symbol$5];
|
|
4053
4053
|
readonly originalError: NoSuchToolError | InvalidToolInputError;
|
|
4054
4054
|
constructor({ cause, originalError, message, }: {
|
|
4055
4055
|
message?: string;
|
|
@@ -4073,9 +4073,9 @@ declare class UnsupportedModelVersionError extends AISDKError {
|
|
|
4073
4073
|
});
|
|
4074
4074
|
}
|
|
4075
4075
|
|
|
4076
|
-
declare const symbol$
|
|
4076
|
+
declare const symbol$4: unique symbol;
|
|
4077
4077
|
declare class InvalidDataContentError extends AISDKError {
|
|
4078
|
-
private readonly [symbol$
|
|
4078
|
+
private readonly [symbol$4];
|
|
4079
4079
|
readonly content: unknown;
|
|
4080
4080
|
constructor({ content, cause, message, }: {
|
|
4081
4081
|
content: unknown;
|
|
@@ -4085,9 +4085,9 @@ declare class InvalidDataContentError extends AISDKError {
|
|
|
4085
4085
|
static isInstance(error: unknown): error is InvalidDataContentError;
|
|
4086
4086
|
}
|
|
4087
4087
|
|
|
4088
|
-
declare const symbol$
|
|
4088
|
+
declare const symbol$3: unique symbol;
|
|
4089
4089
|
declare class InvalidMessageRoleError extends AISDKError {
|
|
4090
|
-
private readonly [symbol$
|
|
4090
|
+
private readonly [symbol$3];
|
|
4091
4091
|
readonly role: string;
|
|
4092
4092
|
constructor({ role, message, }: {
|
|
4093
4093
|
role: string;
|
|
@@ -4096,9 +4096,9 @@ declare class InvalidMessageRoleError extends AISDKError {
|
|
|
4096
4096
|
static isInstance(error: unknown): error is InvalidMessageRoleError;
|
|
4097
4097
|
}
|
|
4098
4098
|
|
|
4099
|
-
declare const symbol$
|
|
4099
|
+
declare const symbol$2: unique symbol;
|
|
4100
4100
|
declare class MessageConversionError extends AISDKError {
|
|
4101
|
-
private readonly [symbol$
|
|
4101
|
+
private readonly [symbol$2];
|
|
4102
4102
|
readonly originalMessage: Omit<UIMessage, 'id'>;
|
|
4103
4103
|
constructor({ originalMessage, message, }: {
|
|
4104
4104
|
originalMessage: Omit<UIMessage, 'id'>;
|
|
@@ -4107,22 +4107,6 @@ declare class MessageConversionError extends AISDKError {
|
|
|
4107
4107
|
static isInstance(error: unknown): error is MessageConversionError;
|
|
4108
4108
|
}
|
|
4109
4109
|
|
|
4110
|
-
declare const symbol$2: unique symbol;
|
|
4111
|
-
declare class DownloadError extends AISDKError {
|
|
4112
|
-
private readonly [symbol$2];
|
|
4113
|
-
readonly url: string;
|
|
4114
|
-
readonly statusCode?: number;
|
|
4115
|
-
readonly statusText?: string;
|
|
4116
|
-
constructor({ url, statusCode, statusText, cause, message, }: {
|
|
4117
|
-
url: string;
|
|
4118
|
-
statusCode?: number;
|
|
4119
|
-
statusText?: string;
|
|
4120
|
-
message?: string;
|
|
4121
|
-
cause?: unknown;
|
|
4122
|
-
});
|
|
4123
|
-
static isInstance(error: unknown): error is DownloadError;
|
|
4124
|
-
}
|
|
4125
|
-
|
|
4126
4110
|
declare const symbol$1: unique symbol;
|
|
4127
4111
|
type RetryErrorReason = 'maxRetriesExceeded' | 'errorNotRetryable' | 'abort';
|
|
4128
4112
|
declare class RetryError extends AISDKError {
|
|
@@ -4170,6 +4154,11 @@ interface GenerateImageResult {
|
|
|
4170
4154
|
readonly usage: ImageModelUsage;
|
|
4171
4155
|
}
|
|
4172
4156
|
|
|
4157
|
+
type GenerateImagePrompt = string | {
|
|
4158
|
+
images: Array<DataContent>;
|
|
4159
|
+
text?: string;
|
|
4160
|
+
mask?: DataContent;
|
|
4161
|
+
};
|
|
4173
4162
|
/**
|
|
4174
4163
|
Generates images using an image model.
|
|
4175
4164
|
|
|
@@ -4187,7 +4176,7 @@ as body parameters.
|
|
|
4187
4176
|
|
|
4188
4177
|
@returns A result object that contains the generated images.
|
|
4189
4178
|
*/
|
|
4190
|
-
declare function generateImage({ model: modelArg, prompt, n, maxImagesPerCall, size, aspectRatio, seed, providerOptions, maxRetries: maxRetriesArg, abortSignal, headers, }: {
|
|
4179
|
+
declare function generateImage({ model: modelArg, prompt: promptArg, n, maxImagesPerCall, size, aspectRatio, seed, providerOptions, maxRetries: maxRetriesArg, abortSignal, headers, }: {
|
|
4191
4180
|
/**
|
|
4192
4181
|
The image model to use.
|
|
4193
4182
|
*/
|
|
@@ -4195,7 +4184,7 @@ declare function generateImage({ model: modelArg, prompt, n, maxImagesPerCall, s
|
|
|
4195
4184
|
/**
|
|
4196
4185
|
The prompt that should be used to generate the image.
|
|
4197
4186
|
*/
|
|
4198
|
-
prompt:
|
|
4187
|
+
prompt: GenerateImagePrompt;
|
|
4199
4188
|
/**
|
|
4200
4189
|
Number of images to generate.
|
|
4201
4190
|
*/
|
|
@@ -4248,6 +4237,16 @@ declare function generateImage({ model: modelArg, prompt, n, maxImagesPerCall, s
|
|
|
4248
4237
|
headers?: Record<string, string>;
|
|
4249
4238
|
}): Promise<GenerateImageResult>;
|
|
4250
4239
|
|
|
4240
|
+
/**
|
|
4241
|
+
* @deprecated Use `generateImage` instead.
|
|
4242
|
+
*/
|
|
4243
|
+
declare const experimental_generateImage: typeof generateImage;
|
|
4244
|
+
|
|
4245
|
+
/**
|
|
4246
|
+
* @deprecated Use `GenerateImageResult` instead.
|
|
4247
|
+
*/
|
|
4248
|
+
type Experimental_GenerateImageResult = GenerateImageResult;
|
|
4249
|
+
|
|
4251
4250
|
/**
|
|
4252
4251
|
The result of a `generateObject` call.
|
|
4253
4252
|
*/
|
|
@@ -5402,4 +5401,4 @@ declare global {
|
|
|
5402
5401
|
var AI_SDK_LOG_WARNINGS: LogWarningsFunction | undefined | false;
|
|
5403
5402
|
}
|
|
5404
5403
|
|
|
5405
|
-
export { AbstractChat, Agent, AgentCallParameters, AgentStreamParameters, AsyncIterableStream, CallSettings, CallWarning, ChatAddToolApproveResponseFunction, ChatInit, ChatOnDataCallback, ChatOnErrorCallback, ChatOnFinishCallback, ChatOnToolCallCallback, ChatRequestOptions, ChatState, ChatStatus, ChatTransport, ChunkDetector, CompletionRequestOptions, ContentPart, CreateUIMessage, DataUIPart, DeepPartial, DefaultChatTransport,
|
|
5404
|
+
export { AbstractChat, Agent, AgentCallParameters, AgentStreamParameters, AsyncIterableStream, CallSettings, CallWarning, ChatAddToolApproveResponseFunction, ChatInit, ChatOnDataCallback, ChatOnErrorCallback, ChatOnFinishCallback, ChatOnToolCallCallback, ChatRequestOptions, ChatState, ChatStatus, ChatTransport, ChunkDetector, CompletionRequestOptions, ContentPart, CreateUIMessage, DataUIPart, DeepPartial, DefaultChatTransport, DynamicToolCall, DynamicToolError, DynamicToolResult, DynamicToolUIPart, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingModelMiddleware, EmbeddingModelUsage, ErrorHandler, ToolLoopAgent as Experimental_Agent, ToolLoopAgentSettings as Experimental_AgentSettings, DownloadFunction as Experimental_DownloadFunction, Experimental_GenerateImageResult, GeneratedFile as Experimental_GeneratedImage, InferAgentUIMessage as Experimental_InferAgentUIMessage, LogWarningsFunction as Experimental_LogWarningsFunction, SpeechResult as Experimental_SpeechResult, TranscriptionResult as Experimental_TranscriptionResult, FileUIPart, FinishReason, GenerateImageResult, 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, addToolInputExamplesMiddleware, assistantModelMessageSchema, callCompletionApi, consumeStream, convertFileListToFileUIParts, convertToModelMessages, cosineSimilarity, createAgentUIStream, createAgentUIStreamResponse, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, defaultEmbeddingSettingsMiddleware, defaultSettingsMiddleware, embed, embedMany, experimental_createProviderRegistry, experimental_customProvider, experimental_generateImage, generateSpeech as experimental_generateSpeech, transcribe as experimental_transcribe, extractReasoningMiddleware, generateImage, generateObject, generateText, getStaticToolName, getTextFromDataUrl, getToolName, getToolOrDynamicToolName, hasToolCall, isDataUIPart, isDeepEqualData, isFileUIPart, isReasoningUIPart, isStaticToolUIPart, 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 };
|