@ai-sdk/provider
Advanced tools
| export * from './v4/index'; |
| import type { | ||
| SharedV4ProviderMetadata, | ||
| SharedV4ProviderOptions, | ||
| SharedV4Warning, | ||
| } from '../../shared'; | ||
| /** | ||
| * Serializable error information for a batch or batch item. | ||
| */ | ||
| export type BatchV4Error = { | ||
| readonly message: string; | ||
| readonly type?: string; | ||
| readonly code?: string; | ||
| readonly statusCode?: number; | ||
| }; | ||
| /** | ||
| * Normalized lifecycle status for a batch. | ||
| */ | ||
| export type BatchV4Status = { | ||
| readonly status: 'pending' | 'completed' | 'failed'; | ||
| readonly rawStatus?: string; | ||
| readonly requestCounts?: { | ||
| readonly total: number; | ||
| readonly pending: number; | ||
| readonly completed: number; | ||
| readonly failed: number; | ||
| }; | ||
| readonly error?: BatchV4Error; | ||
| readonly createdAt?: string; | ||
| readonly expiresAt?: string; | ||
| readonly providerMetadata?: SharedV4ProviderMetadata; | ||
| }; | ||
| /** | ||
| * Options for starting a batch. | ||
| */ | ||
| export type BatchV4StartOptions<REQUEST> = { | ||
| readonly requests: ReadonlyArray<REQUEST>; | ||
| readonly providerOptions?: SharedV4ProviderOptions; | ||
| readonly abortSignal?: AbortSignal; | ||
| readonly headers?: Record<string, string | undefined>; | ||
| }; | ||
| /** | ||
| * Result of starting a batch. | ||
| */ | ||
| export type BatchV4StartResult = BatchV4Status & { | ||
| readonly batchId: string; | ||
| readonly warnings: Array<{ | ||
| readonly requestId?: string; | ||
| readonly warning: SharedV4Warning; | ||
| }>; | ||
| }; | ||
| /** | ||
| * Options for a batch status or results operation. | ||
| */ | ||
| export type BatchV4OperationOptions = { | ||
| readonly batchId: string; | ||
| readonly providerOptions?: SharedV4ProviderOptions; | ||
| readonly abortSignal?: AbortSignal; | ||
| readonly headers?: Record<string, string | undefined>; | ||
| }; | ||
| /** | ||
| * A complete terminal result for one request in a batch. | ||
| */ | ||
| export type BatchV4ItemResult<RESULT> = | ||
| | { | ||
| readonly id: string; | ||
| readonly status: 'succeeded'; | ||
| readonly result: RESULT; | ||
| } | ||
| | { | ||
| readonly id: string; | ||
| readonly status: 'failed'; | ||
| readonly error: BatchV4Error; | ||
| readonly providerMetadata?: SharedV4ProviderMetadata; | ||
| } | ||
| | { | ||
| readonly id: string; | ||
| readonly status: 'cancelled' | 'expired'; | ||
| readonly error?: BatchV4Error; | ||
| readonly providerMetadata?: SharedV4ProviderMetadata; | ||
| }; | ||
| /** | ||
| * Experimental structural capability for models that support durable batch | ||
| * processing. | ||
| */ | ||
| export type BatchModelV4<REQUEST, RESULT> = { | ||
| experimental_doStartBatch( | ||
| options: BatchV4StartOptions<REQUEST>, | ||
| ): PromiseLike<BatchV4StartResult>; | ||
| experimental_doGetBatchStatus( | ||
| options: BatchV4OperationOptions, | ||
| ): PromiseLike<BatchV4Status>; | ||
| experimental_doGetBatchResults( | ||
| options: BatchV4OperationOptions, | ||
| ): PromiseLike<ReadableStream<BatchV4ItemResult<RESULT>>>; | ||
| }; |
| export type { | ||
| BatchModelV4 as Experimental_BatchModelV4, | ||
| BatchV4Error as Experimental_BatchV4Error, | ||
| BatchV4ItemResult as Experimental_BatchV4ItemResult, | ||
| BatchV4OperationOptions as Experimental_BatchV4OperationOptions, | ||
| BatchV4StartOptions as Experimental_BatchV4StartOptions, | ||
| BatchV4StartResult as Experimental_BatchV4StartResult, | ||
| BatchV4Status as Experimental_BatchV4Status, | ||
| } from './batch-v4'; |
| import type { BatchModelV4 } from '../../batch/v4/batch-v4'; | ||
| import type { LanguageModelV4 } from './language-model-v4'; | ||
| import type { LanguageModelV4CallOptions } from './language-model-v4-call-options'; | ||
| import type { LanguageModelV4GenerateResult } from './language-model-v4-generate-result'; | ||
| /** | ||
| * A normalized language model call within a batch. | ||
| */ | ||
| export type LanguageModelV4BatchRequest = { | ||
| /** | ||
| * Application-provided identifier used to correlate the request with its | ||
| * result. | ||
| */ | ||
| readonly id: string; | ||
| /** | ||
| * Normalized text-generation options for the request. | ||
| */ | ||
| readonly options: Pick< | ||
| LanguageModelV4CallOptions, | ||
| | 'prompt' | ||
| | 'maxOutputTokens' | ||
| | 'temperature' | ||
| | 'stopSequences' | ||
| | 'topP' | ||
| | 'topK' | ||
| | 'presencePenalty' | ||
| | 'frequencyPenalty' | ||
| | 'seed' | ||
| | 'reasoning' | ||
| | 'providerOptions' | ||
| >; | ||
| }; | ||
| /** | ||
| * Language model V4 with durable batch-processing support. | ||
| */ | ||
| export type BatchLanguageModelV4 = LanguageModelV4 & | ||
| BatchModelV4<LanguageModelV4BatchRequest, LanguageModelV4GenerateResult>; |
+6
-0
| # @ai-sdk/provider | ||
| ## 4.0.6 | ||
| ### Patch Changes | ||
| - 3469d0c: feat: add batch APIs | ||
| ## 4.0.5 | ||
@@ -4,0 +10,0 @@ |
+1
-1
| { | ||
| "name": "@ai-sdk/provider", | ||
| "version": "4.0.5", | ||
| "version": "4.0.6", | ||
| "type": "module", | ||
@@ -5,0 +5,0 @@ "license": "Apache-2.0", |
+1
-0
@@ -0,1 +1,2 @@ | ||
| export * from './batch/index'; | ||
| export * from './embedding-model/index'; | ||
@@ -2,0 +3,0 @@ export * from './errors/index'; |
@@ -23,1 +23,5 @@ export * from './language-model-v4'; | ||
| export * from './language-model-v4-usage'; | ||
| export type { | ||
| BatchLanguageModelV4 as Experimental_BatchLanguageModelV4, | ||
| LanguageModelV4BatchRequest as Experimental_LanguageModelV4BatchRequest, | ||
| } from './language-model-v4-batch'; |
Sorry, the diff of this file is too big to display
620830
1.34%247
1.65%17273
1.45%