ai 7.0.94 → 7.0.96
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 +19 -0
- package/dist/index.d.ts +41 -1
- package/dist/index.js +93 -2
- package/dist/index.js.map +1 -1
- package/dist/internal/index.js +1 -1
- package/docs/03-ai-sdk-core/35-image-generation.mdx +2 -0
- package/docs/03-ai-sdk-core/42-batch.mdx +333 -0
- package/docs/03-ai-sdk-core/index.mdx +5 -0
- package/docs/03-ai-sdk-harnesses/05-harness-adapters.mdx +13 -11
- package/docs/06-advanced/04-caching.mdx +7 -0
- package/docs/07-reference/01-ai-sdk-core/20-start-batch.mdx +155 -0
- package/docs/07-reference/01-ai-sdk-core/21-get-batch-status.mdx +133 -0
- package/docs/07-reference/01-ai-sdk-core/22-get-batch-results.mdx +109 -0
- package/docs/07-reference/01-ai-sdk-core/23-cancel-batch.mdx +96 -0
- package/docs/07-reference/01-ai-sdk-core/24-list-batches.mdx +121 -0
- package/docs/07-reference/01-ai-sdk-core/index.mdx +25 -0
- package/package.json +12 -12
- package/src/batch/batch-types.ts +36 -0
- package/src/batch/batch.ts +100 -0
- package/src/batch/index.ts +6 -0
- package/src/embed/embed.ts +8 -0
- package/src/util/data-url.ts +6 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# ai
|
|
2
2
|
|
|
3
|
+
## 7.0.96
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 912fb01: feat: add batch cancel and list APIs
|
|
8
|
+
- c595e6e: fix(ai): call `atob` without a receiver for Cloudflare Workers compatibility
|
|
9
|
+
- Updated dependencies [912fb01]
|
|
10
|
+
- Updated dependencies [aa4cc14]
|
|
11
|
+
- Updated dependencies [f102e41]
|
|
12
|
+
- @ai-sdk/provider@4.0.12
|
|
13
|
+
- @ai-sdk/gateway@4.0.77
|
|
14
|
+
- @ai-sdk/provider-utils@5.0.38
|
|
15
|
+
|
|
16
|
+
## 7.0.95
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- 27f6d7a: fix(ai): reject embedding model responses that contain no embeddings
|
|
21
|
+
|
|
3
22
|
## 7.0.94
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -6304,6 +6304,38 @@ type StartBatchOptions<TOOLS extends ToolSet = ToolSet, PROVIDER extends BatchPr
|
|
|
6304
6304
|
type StartBatchResult = Batch & {
|
|
6305
6305
|
readonly warnings: Experimental_BatchV4StartResult['warnings'];
|
|
6306
6306
|
};
|
|
6307
|
+
/**
|
|
6308
|
+
* Options for requesting cancellation of a batch.
|
|
6309
|
+
*/
|
|
6310
|
+
type CancelBatchOptions = {
|
|
6311
|
+
provider?: BatchProvider;
|
|
6312
|
+
batch: BatchReference;
|
|
6313
|
+
providerOptions?: ProviderOptions;
|
|
6314
|
+
} & BatchCallOptions;
|
|
6315
|
+
/**
|
|
6316
|
+
* Result of requesting cancellation of a batch.
|
|
6317
|
+
*/
|
|
6318
|
+
type CancelBatchResult = {
|
|
6319
|
+
readonly providerMetadata?: ProviderMetadata;
|
|
6320
|
+
};
|
|
6321
|
+
/**
|
|
6322
|
+
* Options for listing batches.
|
|
6323
|
+
*/
|
|
6324
|
+
type ListBatchesOptions = {
|
|
6325
|
+
provider?: BatchProvider;
|
|
6326
|
+
providerOptions?: ProviderOptions;
|
|
6327
|
+
limit?: number;
|
|
6328
|
+
cursor?: string;
|
|
6329
|
+
maxRetries?: number;
|
|
6330
|
+
} & BatchCallOptions;
|
|
6331
|
+
/**
|
|
6332
|
+
* One page of listed batches.
|
|
6333
|
+
*/
|
|
6334
|
+
type ListBatchesResult = {
|
|
6335
|
+
readonly batches: Array<Batch>;
|
|
6336
|
+
readonly nextCursor?: string;
|
|
6337
|
+
readonly providerMetadata?: ProviderMetadata;
|
|
6338
|
+
};
|
|
6307
6339
|
/**
|
|
6308
6340
|
* Options for retrieving batch status.
|
|
6309
6341
|
*/
|
|
@@ -6368,6 +6400,14 @@ type TextBatchItemResult<TOOLS extends ToolSet = ToolSet> = (TextBatchGeneration
|
|
|
6368
6400
|
*/
|
|
6369
6401
|
type BatchItemResult<TOOLS extends ToolSet = ToolSet> = TextBatchItemResult<TOOLS>;
|
|
6370
6402
|
|
|
6403
|
+
/**
|
|
6404
|
+
* Requests cancellation of a batch.
|
|
6405
|
+
*/
|
|
6406
|
+
declare function cancelBatch({ provider, batch, providerOptions, abortSignal, headers, timeout, }: CancelBatchOptions): Promise<CancelBatchResult>;
|
|
6407
|
+
/**
|
|
6408
|
+
* Lists a page of batches.
|
|
6409
|
+
*/
|
|
6410
|
+
declare function listBatches({ provider, providerOptions, limit, cursor, maxRetries, abortSignal, headers, timeout, }?: ListBatchesOptions): Promise<ListBatchesResult>;
|
|
6371
6411
|
/**
|
|
6372
6412
|
* Starts a batch.
|
|
6373
6413
|
*/
|
|
@@ -9742,4 +9782,4 @@ declare function uploadSkill({ api, files, displayTitle, providerOptions, }: {
|
|
|
9742
9782
|
files: UploadSkillFile[];
|
|
9743
9783
|
}): Promise<UploadSkillResult>;
|
|
9744
9784
|
|
|
9745
|
-
export { AI_SDK_TELEMETRY_TRACING_CHANNEL, AbstractChat, type ActiveTools, type Agent, type AgentCallParameters, type AgentStreamParameters, type AsyncIterableStream, type CallSettings, type CallWarning, type ChatAddToolApproveResponseFunction, type ChatAddToolOutputFunction, type ChatInit, type ChatOnDataCallback, type ChatOnErrorCallback, type ChatOnFinishCallback, type ChatOnToolCallCallback, type ChatRequestOptions, type ChatState, type ChatStatus, type ChatTransport, type ChunkDetector, type CompletionRequestOptions, type ContentPart, type CreateUIMessage, type CustomContentUIPart, type DataUIPart, type DeepPartial, DefaultChatTransport, DefaultGeneratedFile, DirectChatTransport, type DirectChatTransportOptions, type DynamicToolCall, type DynamicToolError, type DynamicToolResult, type DynamicToolUIPart, type EmbedEndEvent, type EmbedManyResult, type EmbedResult, type EmbedStartEvent, type Embedding, type EmbeddingModel, type EmbeddingModelCallEndEvent, type EmbeddingModelCallStartEvent, type EmbeddingModelMiddleware, type EmbeddingModelUsage, type ErrorHandler, AbstractRealtimeSession as Experimental_AbstractRealtimeSession, ToolLoopAgent as Experimental_Agent, type ToolLoopAgentSettings as Experimental_AgentSettings, type Batch as Experimental_Batch, type BatchError as Experimental_BatchError, type BatchItemResult as Experimental_BatchItemResult, type BatchProvider as Experimental_BatchProvider, type BatchReference as Experimental_BatchReference, type BatchRequest as Experimental_BatchRequest, type BatchStatus as Experimental_BatchStatus, type DownloadFunction as Experimental_DownloadFunction, type Experimental_GeneratedImage, type GetBatchResultsOptions as Experimental_GetBatchResultsOptions, type GetBatchStatusOptions as Experimental_GetBatchStatusOptions, type InferAgentUIMessage as Experimental_InferAgentUIMessage, type LanguageModelStreamPart as Experimental_LanguageModelStreamPart, type LogWarningsFunction as Experimental_LogWarningsFunction, type RealtimeClientEvent as Experimental_RealtimeClientEvent, type RealtimeFactory as Experimental_RealtimeFactory, type RealtimeFactoryGetTokenOptions as Experimental_RealtimeFactoryGetTokenOptions, type RealtimeFactoryGetTokenResult as Experimental_RealtimeFactoryGetTokenResult, type RealtimeModel as Experimental_RealtimeModel, type RealtimeServerEvent as Experimental_RealtimeServerEvent, type RealtimeSessionConfig as Experimental_RealtimeSessionConfig, type RealtimeSessionOptions as Experimental_RealtimeSessionOptions, type RealtimeSetupResponse as Experimental_RealtimeSetupResponse, type RealtimeState as Experimental_RealtimeState, type RealtimeStatus as Experimental_RealtimeStatus, type RealtimeToolDefinition as Experimental_RealtimeToolDefinition, type Experimental_SpeechResult, type StartBatchOptions as Experimental_StartBatchOptions, type StartBatchResult as Experimental_StartBatchResult, type StreamTranslationResult as Experimental_StreamTranslationResult, type TextBatchGenerationResult as Experimental_TextBatchGenerationResult, type TextBatchItemResult as Experimental_TextBatchItemResult, type TextBatchRequest as Experimental_TextBatchRequest, type Experimental_ToolCallers, type Experimental_TranscriptionResult, type TranslationStreamPart as Experimental_TranslationStreamPart, type FileUIPart, type FinishReason, type GenerateImageCall, type GenerateImageResult, type GenerateObjectEndEvent, type GenerateObjectResult, type GenerateObjectStartEvent, type GenerateObjectStepEndEvent, type GenerateObjectStepStartEvent, type GenerateTextAbortEvent, type GenerateTextEndEvent, type GenerateTextInclude, type GenerateTextOnAbortCallback, type GenerateTextOnEndCallback, type GenerateTextOnFinishCallback, type GenerateTextOnStartCallback, type GenerateTextOnStepEndCallback, type GenerateTextOnStepFinishCallback, type GenerateTextOnStepStartCallback, type GenerateTextResult, type GenerateTextStartEvent, type GenerateTextStepEndEvent, type GenerateTextStepStartEvent, type GenerateVideoPrompt, type GenerateVideoResult, type GeneratedAudioFile, type GeneratedFile, type GenericToolApprovalFunction, type GetVideoStatusResult, HttpChatTransport, type HttpChatTransportInitOptions, type ImageModel, type ImageModelMiddleware, type ImageModelProviderMetadata, type ImageModelResponseMetadata, type ImageModelUsage, type InferAgentUIMessage, type InferCompleteOutput as InferGenerateOutput, type InferPartialOutput as InferStreamOutput, type InferTelemetryEvent, type InferUIDataParts, type InferUIMessageChunk, type InferUITool, type InferUITools, type Instructions, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolApprovalError, InvalidToolApprovalSignatureError, InvalidToolInputError, type JSONValue, JsonToSseTransformStream, type LanguageModel, type LanguageModelCallEndEvent, type LanguageModelCallOptions, type LanguageModelCallStartEvent, type LanguageModelMiddleware, type LanguageModelRequestMetadata, type LanguageModelResponseMetadata, type LanguageModelUsage, type LogWarningsFunction, MessageConversionError, MissingToolResultsError, type ModelInfo, NoImageGeneratedError, NoObjectGeneratedError, NoOutputGeneratedError, NoSpeechGeneratedError, NoSuchProviderError, NoSuchToolError, NoTranscriptGeneratedError, NoTranslationGeneratedError, NoVideoGeneratedError, type ObjectStreamPart, type OnFinishEvent, type OnLanguageModelCallEndCallback, type OnLanguageModelCallStartCallback, type OnStartEvent, type OnStepFinishEvent, type OnStepStartEvent, type OnToolCallFinishEvent, type OnToolCallStartEvent, type OnToolExecutionEndCallback, type OnToolExecutionStartCallback, output as Output, type OutputChunkTimingStats, type Output as OutputInterface, type PrepareReconnectToStreamRequest, type PrepareSendMessagesRequest, type PrepareStepFunction, type PrepareStepResult, type Prompt, type Provider, type ProviderMetadata, type ProviderReference, type ProviderRegistryProvider, type ReasoningFileOutput, type ReasoningFileUIPart, type ReasoningOutput, type ReasoningUIPart, type RepairTextFunction, type RequestOptions, type RerankEndEvent, type RerankResult, type RerankStartEvent, type RerankingModel, type RerankingModelCallEndEvent, type RerankingModelCallStartEvent, RetryError, type SafeValidateUIMessagesResult, SerialJobExecutor, type SingleToolApprovalFunction, type SourceDocumentUIPart, type SourceUrlUIPart, type SpeechModel, type SpeechModelResponseMetadata, type SpeechResult, type StartVideoResult, type StaticToolCall, type StaticToolError, type StaticToolOutputDenied, type StaticToolResult, type StepResult, type StepResultPerformance, type StepStartUIPart, type StopCondition, type StreamObjectOnFinishCallback, type StreamObjectResult, StreamProviderError, type StreamTextEndEvent, type StreamTextInclude, type StreamTextOnChunkCallback, type StreamTextOnEndCallback, type StreamTextOnErrorCallback, type StreamTextOnErrorResult, type StreamTextOnErrorRetryCallback, type StreamTextResult, type StreamTextTransform, type StreamTranscriptionResult, type Telemetry, type TelemetryOptions, type TelemetryTracingChannelMessage, type TelemetryTracingEventType, TextStreamChatTransport, type TextStreamPart, type TextUIPart, type TimeoutConfiguration, type ToUIMessageChunkOptions, type ToolApprovalConfiguration, type ToolApprovalRequestOutput, type ToolApprovalResponseOutput, type ToolApprovalStatus, ToolCallNotFoundForApprovalError, ToolCallRepairError, type ToolCallRepairFunction, type ToolChoice, ToolChoiceViolationError, type ToolExecutionEndEvent, type ToolExecutionStartEvent, type ToolInputRefinement, ToolLoopAgent, type ToolLoopAgentSettings, type ToolOrder, type ToolUIPart, type TranscriptionModel, type TranscriptionModelResponseMetadata, type TranscriptionResult, type TranscriptionStreamPart, type TypedToolCall, type TypedToolError, type TypedToolOutputDenied, type TypedToolResult, type UIDataPartSchemas, type UIDataTypes, type UIMessage, type UIMessageChunk, type UIMessagePart, UIMessageStreamError, type UIMessageStreamOnEndCallback, type UIMessageStreamOnFinishCallback, type UIMessageStreamOnStepEndCallback, type UIMessageStreamOnStepFinishCallback, type UIMessageStreamOptions, type UIMessageStreamOutcome, type UIMessageStreamWriter, type UIMessageStreamWriterWithOutcome, type UITool, type UIToolInvocation, type UITools, UI_MESSAGE_STREAM_HEADERS, UnsupportedModelVersionError, type UploadFileResult, type UploadSkillResult, type UseCompletionOptions, type Warning, addToolInputExamplesMiddleware, assistantModelMessageSchema, callCompletionApi, consumeStream, convertDataContentToBase64String, convertFileListToFileUIParts, convertToModelMessages, cosineSimilarity, createAgentUIStream, createAgentUIStreamResponse, createDownload, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, defaultEmbeddingSettingsMiddleware, defaultInstructionsMiddleware, defaultSettingsMiddleware, detectToolDrift, embed, embedMany, experimental_createProviderRegistry, decodeRealtimeAudio as experimental_decodeRealtimeAudio, encodeRealtimeAudio as experimental_encodeRealtimeAudio, filterActiveTools as experimental_filterActiveTools, experimental_generateSpeech, experimental_generateVideo, getBatchResults as experimental_getBatchResults, getBatchStatus as experimental_getBatchStatus, getRealtimeToolDefinitions as experimental_getRealtimeToolDefinitions, experimental_getVideoStatus, resampleAudio as experimental_resampleAudio, startBatch as experimental_startBatch, experimental_startVideo, streamLanguageModelCall as experimental_streamLanguageModelCall, streamTranscribe as experimental_streamTranscribe, streamTranslate as experimental_streamTranslate, experimental_transcribe, extractJsonMiddleware, extractReasoningMiddleware, fingerprintTools, generateImage, generateObject, generateSpeech, generateText, getChunkTimeoutMs, getFirstChunkTimeoutMs, getStaticToolName, getStepTimeoutMs, getTextFromDataUrl, getToolName, getToolOrDynamicToolName, getToolTimeoutMs, getTotalTimeoutMs, hasToolCall, isCustomContentUIPart, isDataUIPart, isDeepEqualData, isDynamicToolUIPart, isFileUIPart, isLoopFinished, isReasoningFileUIPart, isReasoningUIPart, isStaticToolUIPart, isStepCount, isTextUIPart, isToolUIPart, lastAssistantMessageIsCompleteWithApprovalResponses, lastAssistantMessageIsCompleteWithToolCalls, modelMessageSchema, parsePartialJson, pipeAgentUIStreamToResponse, pipeTextStreamToResponse, pipeUIMessageStreamToResponse, pruneMessages, readUIMessageStream, registerTelemetry, rerank, safeValidateUIMessages, simulateReadableStream, simulateStreamingMiddleware, smoothStream, isStepCount as stepCountIs, streamObject, streamText, systemModelMessageSchema, toTextStream, toUIMessageChunk, toUIMessageStream, toolModelMessageSchema, transcribe, uiMessageChunkSchema, uploadFile, uploadSkill, userModelMessageSchema, validateUIMessages, wrapEmbeddingModel, wrapImageModel, wrapLanguageModel, wrapProvider };
|
|
9785
|
+
export { AI_SDK_TELEMETRY_TRACING_CHANNEL, AbstractChat, type ActiveTools, type Agent, type AgentCallParameters, type AgentStreamParameters, type AsyncIterableStream, type CallSettings, type CallWarning, type ChatAddToolApproveResponseFunction, type ChatAddToolOutputFunction, type ChatInit, type ChatOnDataCallback, type ChatOnErrorCallback, type ChatOnFinishCallback, type ChatOnToolCallCallback, type ChatRequestOptions, type ChatState, type ChatStatus, type ChatTransport, type ChunkDetector, type CompletionRequestOptions, type ContentPart, type CreateUIMessage, type CustomContentUIPart, type DataUIPart, type DeepPartial, DefaultChatTransport, DefaultGeneratedFile, DirectChatTransport, type DirectChatTransportOptions, type DynamicToolCall, type DynamicToolError, type DynamicToolResult, type DynamicToolUIPart, type EmbedEndEvent, type EmbedManyResult, type EmbedResult, type EmbedStartEvent, type Embedding, type EmbeddingModel, type EmbeddingModelCallEndEvent, type EmbeddingModelCallStartEvent, type EmbeddingModelMiddleware, type EmbeddingModelUsage, type ErrorHandler, AbstractRealtimeSession as Experimental_AbstractRealtimeSession, ToolLoopAgent as Experimental_Agent, type ToolLoopAgentSettings as Experimental_AgentSettings, type Batch as Experimental_Batch, type BatchError as Experimental_BatchError, type BatchItemResult as Experimental_BatchItemResult, type BatchProvider as Experimental_BatchProvider, type BatchReference as Experimental_BatchReference, type BatchRequest as Experimental_BatchRequest, type BatchStatus as Experimental_BatchStatus, type CancelBatchOptions as Experimental_CancelBatchOptions, type CancelBatchResult as Experimental_CancelBatchResult, type DownloadFunction as Experimental_DownloadFunction, type Experimental_GeneratedImage, type GetBatchResultsOptions as Experimental_GetBatchResultsOptions, type GetBatchStatusOptions as Experimental_GetBatchStatusOptions, type InferAgentUIMessage as Experimental_InferAgentUIMessage, type LanguageModelStreamPart as Experimental_LanguageModelStreamPart, type ListBatchesOptions as Experimental_ListBatchesOptions, type ListBatchesResult as Experimental_ListBatchesResult, type LogWarningsFunction as Experimental_LogWarningsFunction, type RealtimeClientEvent as Experimental_RealtimeClientEvent, type RealtimeFactory as Experimental_RealtimeFactory, type RealtimeFactoryGetTokenOptions as Experimental_RealtimeFactoryGetTokenOptions, type RealtimeFactoryGetTokenResult as Experimental_RealtimeFactoryGetTokenResult, type RealtimeModel as Experimental_RealtimeModel, type RealtimeServerEvent as Experimental_RealtimeServerEvent, type RealtimeSessionConfig as Experimental_RealtimeSessionConfig, type RealtimeSessionOptions as Experimental_RealtimeSessionOptions, type RealtimeSetupResponse as Experimental_RealtimeSetupResponse, type RealtimeState as Experimental_RealtimeState, type RealtimeStatus as Experimental_RealtimeStatus, type RealtimeToolDefinition as Experimental_RealtimeToolDefinition, type Experimental_SpeechResult, type StartBatchOptions as Experimental_StartBatchOptions, type StartBatchResult as Experimental_StartBatchResult, type StreamTranslationResult as Experimental_StreamTranslationResult, type TextBatchGenerationResult as Experimental_TextBatchGenerationResult, type TextBatchItemResult as Experimental_TextBatchItemResult, type TextBatchRequest as Experimental_TextBatchRequest, type Experimental_ToolCallers, type Experimental_TranscriptionResult, type TranslationStreamPart as Experimental_TranslationStreamPart, type FileUIPart, type FinishReason, type GenerateImageCall, type GenerateImageResult, type GenerateObjectEndEvent, type GenerateObjectResult, type GenerateObjectStartEvent, type GenerateObjectStepEndEvent, type GenerateObjectStepStartEvent, type GenerateTextAbortEvent, type GenerateTextEndEvent, type GenerateTextInclude, type GenerateTextOnAbortCallback, type GenerateTextOnEndCallback, type GenerateTextOnFinishCallback, type GenerateTextOnStartCallback, type GenerateTextOnStepEndCallback, type GenerateTextOnStepFinishCallback, type GenerateTextOnStepStartCallback, type GenerateTextResult, type GenerateTextStartEvent, type GenerateTextStepEndEvent, type GenerateTextStepStartEvent, type GenerateVideoPrompt, type GenerateVideoResult, type GeneratedAudioFile, type GeneratedFile, type GenericToolApprovalFunction, type GetVideoStatusResult, HttpChatTransport, type HttpChatTransportInitOptions, type ImageModel, type ImageModelMiddleware, type ImageModelProviderMetadata, type ImageModelResponseMetadata, type ImageModelUsage, type InferAgentUIMessage, type InferCompleteOutput as InferGenerateOutput, type InferPartialOutput as InferStreamOutput, type InferTelemetryEvent, type InferUIDataParts, type InferUIMessageChunk, type InferUITool, type InferUITools, type Instructions, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolApprovalError, InvalidToolApprovalSignatureError, InvalidToolInputError, type JSONValue, JsonToSseTransformStream, type LanguageModel, type LanguageModelCallEndEvent, type LanguageModelCallOptions, type LanguageModelCallStartEvent, type LanguageModelMiddleware, type LanguageModelRequestMetadata, type LanguageModelResponseMetadata, type LanguageModelUsage, type LogWarningsFunction, MessageConversionError, MissingToolResultsError, type ModelInfo, NoImageGeneratedError, NoObjectGeneratedError, NoOutputGeneratedError, NoSpeechGeneratedError, NoSuchProviderError, NoSuchToolError, NoTranscriptGeneratedError, NoTranslationGeneratedError, NoVideoGeneratedError, type ObjectStreamPart, type OnFinishEvent, type OnLanguageModelCallEndCallback, type OnLanguageModelCallStartCallback, type OnStartEvent, type OnStepFinishEvent, type OnStepStartEvent, type OnToolCallFinishEvent, type OnToolCallStartEvent, type OnToolExecutionEndCallback, type OnToolExecutionStartCallback, output as Output, type OutputChunkTimingStats, type Output as OutputInterface, type PrepareReconnectToStreamRequest, type PrepareSendMessagesRequest, type PrepareStepFunction, type PrepareStepResult, type Prompt, type Provider, type ProviderMetadata, type ProviderReference, type ProviderRegistryProvider, type ReasoningFileOutput, type ReasoningFileUIPart, type ReasoningOutput, type ReasoningUIPart, type RepairTextFunction, type RequestOptions, type RerankEndEvent, type RerankResult, type RerankStartEvent, type RerankingModel, type RerankingModelCallEndEvent, type RerankingModelCallStartEvent, RetryError, type SafeValidateUIMessagesResult, SerialJobExecutor, type SingleToolApprovalFunction, type SourceDocumentUIPart, type SourceUrlUIPart, type SpeechModel, type SpeechModelResponseMetadata, type SpeechResult, type StartVideoResult, type StaticToolCall, type StaticToolError, type StaticToolOutputDenied, type StaticToolResult, type StepResult, type StepResultPerformance, type StepStartUIPart, type StopCondition, type StreamObjectOnFinishCallback, type StreamObjectResult, StreamProviderError, type StreamTextEndEvent, type StreamTextInclude, type StreamTextOnChunkCallback, type StreamTextOnEndCallback, type StreamTextOnErrorCallback, type StreamTextOnErrorResult, type StreamTextOnErrorRetryCallback, type StreamTextResult, type StreamTextTransform, type StreamTranscriptionResult, type Telemetry, type TelemetryOptions, type TelemetryTracingChannelMessage, type TelemetryTracingEventType, TextStreamChatTransport, type TextStreamPart, type TextUIPart, type TimeoutConfiguration, type ToUIMessageChunkOptions, type ToolApprovalConfiguration, type ToolApprovalRequestOutput, type ToolApprovalResponseOutput, type ToolApprovalStatus, ToolCallNotFoundForApprovalError, ToolCallRepairError, type ToolCallRepairFunction, type ToolChoice, ToolChoiceViolationError, type ToolExecutionEndEvent, type ToolExecutionStartEvent, type ToolInputRefinement, ToolLoopAgent, type ToolLoopAgentSettings, type ToolOrder, type ToolUIPart, type TranscriptionModel, type TranscriptionModelResponseMetadata, type TranscriptionResult, type TranscriptionStreamPart, type TypedToolCall, type TypedToolError, type TypedToolOutputDenied, type TypedToolResult, type UIDataPartSchemas, type UIDataTypes, type UIMessage, type UIMessageChunk, type UIMessagePart, UIMessageStreamError, type UIMessageStreamOnEndCallback, type UIMessageStreamOnFinishCallback, type UIMessageStreamOnStepEndCallback, type UIMessageStreamOnStepFinishCallback, type UIMessageStreamOptions, type UIMessageStreamOutcome, type UIMessageStreamWriter, type UIMessageStreamWriterWithOutcome, type UITool, type UIToolInvocation, type UITools, UI_MESSAGE_STREAM_HEADERS, UnsupportedModelVersionError, type UploadFileResult, type UploadSkillResult, type UseCompletionOptions, type Warning, addToolInputExamplesMiddleware, assistantModelMessageSchema, callCompletionApi, consumeStream, convertDataContentToBase64String, convertFileListToFileUIParts, convertToModelMessages, cosineSimilarity, createAgentUIStream, createAgentUIStreamResponse, createDownload, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, defaultEmbeddingSettingsMiddleware, defaultInstructionsMiddleware, defaultSettingsMiddleware, detectToolDrift, embed, embedMany, cancelBatch as experimental_cancelBatch, experimental_createProviderRegistry, decodeRealtimeAudio as experimental_decodeRealtimeAudio, encodeRealtimeAudio as experimental_encodeRealtimeAudio, filterActiveTools as experimental_filterActiveTools, experimental_generateSpeech, experimental_generateVideo, getBatchResults as experimental_getBatchResults, getBatchStatus as experimental_getBatchStatus, getRealtimeToolDefinitions as experimental_getRealtimeToolDefinitions, experimental_getVideoStatus, listBatches as experimental_listBatches, resampleAudio as experimental_resampleAudio, startBatch as experimental_startBatch, experimental_startVideo, streamLanguageModelCall as experimental_streamLanguageModelCall, streamTranscribe as experimental_streamTranscribe, streamTranslate as experimental_streamTranslate, experimental_transcribe, extractJsonMiddleware, extractReasoningMiddleware, fingerprintTools, generateImage, generateObject, generateSpeech, generateText, getChunkTimeoutMs, getFirstChunkTimeoutMs, getStaticToolName, getStepTimeoutMs, getTextFromDataUrl, getToolName, getToolOrDynamicToolName, getToolTimeoutMs, getTotalTimeoutMs, hasToolCall, isCustomContentUIPart, isDataUIPart, isDeepEqualData, isDynamicToolUIPart, isFileUIPart, isLoopFinished, isReasoningFileUIPart, isReasoningUIPart, isStaticToolUIPart, isStepCount, isTextUIPart, isToolUIPart, lastAssistantMessageIsCompleteWithApprovalResponses, lastAssistantMessageIsCompleteWithToolCalls, modelMessageSchema, parsePartialJson, pipeAgentUIStreamToResponse, pipeTextStreamToResponse, pipeUIMessageStreamToResponse, pruneMessages, readUIMessageStream, registerTelemetry, rerank, safeValidateUIMessages, simulateReadableStream, simulateStreamingMiddleware, smoothStream, isStepCount as stepCountIs, streamObject, streamText, systemModelMessageSchema, toTextStream, toUIMessageChunk, toUIMessageStream, toolModelMessageSchema, transcribe, uiMessageChunkSchema, uploadFile, uploadSkill, userModelMessageSchema, validateUIMessages, wrapEmbeddingModel, wrapImageModel, wrapLanguageModel, wrapProvider };
|
package/dist/index.js
CHANGED
|
@@ -1178,7 +1178,7 @@ import {
|
|
|
1178
1178
|
} from "@ai-sdk/provider-utils";
|
|
1179
1179
|
|
|
1180
1180
|
// src/version.ts
|
|
1181
|
-
var VERSION = true ? "7.0.
|
|
1181
|
+
var VERSION = true ? "7.0.96" : "0.0.0-test";
|
|
1182
1182
|
|
|
1183
1183
|
// src/util/download/download.ts
|
|
1184
1184
|
var download = async ({
|
|
@@ -12611,6 +12611,88 @@ function isDeepEqualData(obj1, obj2) {
|
|
|
12611
12611
|
}
|
|
12612
12612
|
|
|
12613
12613
|
// src/batch/batch.ts
|
|
12614
|
+
async function cancelBatch({
|
|
12615
|
+
provider,
|
|
12616
|
+
batch,
|
|
12617
|
+
providerOptions,
|
|
12618
|
+
abortSignal,
|
|
12619
|
+
headers,
|
|
12620
|
+
timeout
|
|
12621
|
+
}) {
|
|
12622
|
+
const batchApi = resolveBatchApi(provider);
|
|
12623
|
+
validateBatchReference({ batchApi, batch });
|
|
12624
|
+
if (batchApi.doCancelBatch == null) {
|
|
12625
|
+
throw new UnsupportedFunctionalityError3({
|
|
12626
|
+
functionality: "batch cancellation",
|
|
12627
|
+
message: "The provider does not support batch cancellation."
|
|
12628
|
+
});
|
|
12629
|
+
}
|
|
12630
|
+
const operationAbortSignal = mergeAbortSignals(
|
|
12631
|
+
abortSignal,
|
|
12632
|
+
getTotalTimeoutMs(timeout)
|
|
12633
|
+
);
|
|
12634
|
+
try {
|
|
12635
|
+
return await batchApi.doCancelBatch({
|
|
12636
|
+
batchId: batch.id,
|
|
12637
|
+
providerOptions,
|
|
12638
|
+
abortSignal: operationAbortSignal,
|
|
12639
|
+
headers: withUserAgentSuffix4(headers != null ? headers : {}, `ai/${VERSION}`)
|
|
12640
|
+
});
|
|
12641
|
+
} catch (error) {
|
|
12642
|
+
throw wrapGatewayError(error);
|
|
12643
|
+
}
|
|
12644
|
+
}
|
|
12645
|
+
async function listBatches({
|
|
12646
|
+
provider,
|
|
12647
|
+
providerOptions,
|
|
12648
|
+
limit,
|
|
12649
|
+
cursor,
|
|
12650
|
+
maxRetries,
|
|
12651
|
+
abortSignal,
|
|
12652
|
+
headers,
|
|
12653
|
+
timeout
|
|
12654
|
+
} = {}) {
|
|
12655
|
+
var _a25;
|
|
12656
|
+
const batchApi = resolveBatchApi(provider);
|
|
12657
|
+
const doListBatches = (_a25 = batchApi.doListBatches) == null ? void 0 : _a25.bind(batchApi);
|
|
12658
|
+
if (doListBatches == null) {
|
|
12659
|
+
throw new UnsupportedFunctionalityError3({
|
|
12660
|
+
functionality: "batch listing",
|
|
12661
|
+
message: "The provider does not support listing batches."
|
|
12662
|
+
});
|
|
12663
|
+
}
|
|
12664
|
+
const operationAbortSignal = mergeAbortSignals(
|
|
12665
|
+
abortSignal,
|
|
12666
|
+
getTotalTimeoutMs(timeout)
|
|
12667
|
+
);
|
|
12668
|
+
const { retry } = prepareRetries({
|
|
12669
|
+
maxRetries,
|
|
12670
|
+
abortSignal: operationAbortSignal
|
|
12671
|
+
});
|
|
12672
|
+
try {
|
|
12673
|
+
const { batches, nextCursor, providerMetadata } = await retry(
|
|
12674
|
+
() => doListBatches({
|
|
12675
|
+
providerOptions,
|
|
12676
|
+
abortSignal: operationAbortSignal,
|
|
12677
|
+
headers: withUserAgentSuffix4(headers != null ? headers : {}, `ai/${VERSION}`),
|
|
12678
|
+
...limit != null && { limit },
|
|
12679
|
+
...cursor != null && { cursor }
|
|
12680
|
+
})
|
|
12681
|
+
);
|
|
12682
|
+
return {
|
|
12683
|
+
batches: batches.map(({ batchId, ...status }) => ({
|
|
12684
|
+
version: 2,
|
|
12685
|
+
id: batchId,
|
|
12686
|
+
provider: batchApi.provider,
|
|
12687
|
+
...status
|
|
12688
|
+
})),
|
|
12689
|
+
...nextCursor != null && { nextCursor },
|
|
12690
|
+
...providerMetadata != null && { providerMetadata }
|
|
12691
|
+
};
|
|
12692
|
+
} catch (error) {
|
|
12693
|
+
throw wrapGatewayError(error);
|
|
12694
|
+
}
|
|
12695
|
+
}
|
|
12614
12696
|
async function startBatch({
|
|
12615
12697
|
provider,
|
|
12616
12698
|
requests,
|
|
@@ -13043,6 +13125,12 @@ async function embed({
|
|
|
13043
13125
|
},
|
|
13044
13126
|
callbacks: [telemetryDispatcher.onEmbedEnd]
|
|
13045
13127
|
});
|
|
13128
|
+
if (embedding2 == null) {
|
|
13129
|
+
throw new InvalidResponseDataError({
|
|
13130
|
+
data: modelResponse.embeddings,
|
|
13131
|
+
message: "No embedding generated."
|
|
13132
|
+
});
|
|
13133
|
+
}
|
|
13046
13134
|
return {
|
|
13047
13135
|
embedding: embedding2,
|
|
13048
13136
|
usage: usage2,
|
|
@@ -14513,6 +14601,7 @@ function createDownload(options) {
|
|
|
14513
14601
|
}
|
|
14514
14602
|
|
|
14515
14603
|
// src/util/data-url.ts
|
|
14604
|
+
var { atob: atob2 } = globalThis;
|
|
14516
14605
|
function getTextFromDataUrl(dataUrl) {
|
|
14517
14606
|
const [header, base64Content] = dataUrl.split(",");
|
|
14518
14607
|
const mediaType = header.split(";")[0].split(":")[1];
|
|
@@ -14520,7 +14609,7 @@ function getTextFromDataUrl(dataUrl) {
|
|
|
14520
14609
|
throw new Error("Invalid data URL format");
|
|
14521
14610
|
}
|
|
14522
14611
|
try {
|
|
14523
|
-
return
|
|
14612
|
+
return atob2(base64Content);
|
|
14524
14613
|
} catch (e) {
|
|
14525
14614
|
throw new Error(`Error decoding data URL`);
|
|
14526
14615
|
}
|
|
@@ -19765,6 +19854,7 @@ export {
|
|
|
19765
19854
|
dynamicTool,
|
|
19766
19855
|
embed,
|
|
19767
19856
|
embedMany,
|
|
19857
|
+
cancelBatch as experimental_cancelBatch,
|
|
19768
19858
|
experimental_createProviderRegistry,
|
|
19769
19859
|
decodeRealtimeAudio as experimental_decodeRealtimeAudio,
|
|
19770
19860
|
encodeRealtimeAudio as experimental_encodeRealtimeAudio,
|
|
@@ -19775,6 +19865,7 @@ export {
|
|
|
19775
19865
|
getBatchStatus as experimental_getBatchStatus,
|
|
19776
19866
|
getRealtimeToolDefinitions as experimental_getRealtimeToolDefinitions,
|
|
19777
19867
|
experimental_getVideoStatus,
|
|
19868
|
+
listBatches as experimental_listBatches,
|
|
19778
19869
|
resampleAudio as experimental_resampleAudio,
|
|
19779
19870
|
startBatch as experimental_startBatch,
|
|
19780
19871
|
experimental_startVideo,
|