@ai-sdk/provider
Advanced tools
+6
-0
| # @ai-sdk/provider | ||
| ## 3.0.6 | ||
| ### Patch Changes | ||
| - 2810850: fix(ai): improve type validation error messages with field paths and entity identifiers | ||
| ## 3.0.5 | ||
@@ -4,0 +10,0 @@ |
+32
-5
@@ -327,6 +327,26 @@ "use strict"; | ||
| var TypeValidationError = class _TypeValidationError extends (_b13 = AISDKError, _a13 = symbol13, _b13) { | ||
| constructor({ value, cause }) { | ||
| constructor({ | ||
| value, | ||
| cause, | ||
| context | ||
| }) { | ||
| let contextPrefix = "Type validation failed"; | ||
| if (context == null ? void 0 : context.field) { | ||
| contextPrefix += ` for ${context.field}`; | ||
| } | ||
| if ((context == null ? void 0 : context.entityName) || (context == null ? void 0 : context.entityId)) { | ||
| contextPrefix += " ("; | ||
| const parts = []; | ||
| if (context.entityName) { | ||
| parts.push(context.entityName); | ||
| } | ||
| if (context.entityId) { | ||
| parts.push(`id: "${context.entityId}"`); | ||
| } | ||
| contextPrefix += parts.join(", "); | ||
| contextPrefix += ")"; | ||
| } | ||
| super({ | ||
| name: name12, | ||
| message: `Type validation failed: Value: ${JSON.stringify(value)}. | ||
| message: `${contextPrefix}: Value: ${JSON.stringify(value)}. | ||
| Error message: ${getErrorMessage(cause)}`, | ||
@@ -337,2 +357,3 @@ cause | ||
| this.value = value; | ||
| this.context = context; | ||
| } | ||
@@ -344,3 +365,3 @@ static isInstance(error) { | ||
| * Wraps an error into a TypeValidationError. | ||
| * If the cause is already a TypeValidationError with the same value, it returns the cause. | ||
| * If the cause is already a TypeValidationError with the same value and context, it returns the cause. | ||
| * Otherwise, it creates a new TypeValidationError. | ||
@@ -351,2 +372,3 @@ * | ||
| * @param {unknown} params.cause - The original error or cause of the validation failure. | ||
| * @param {TypeValidationContext} params.context - Optional context about what is being validated. | ||
| * @returns {TypeValidationError} A TypeValidationError instance. | ||
@@ -356,5 +378,10 @@ */ | ||
| value, | ||
| cause | ||
| cause, | ||
| context | ||
| }) { | ||
| return _TypeValidationError.isInstance(cause) && cause.value === value ? cause : new _TypeValidationError({ value, cause }); | ||
| var _a15, _b15, _c; | ||
| if (_TypeValidationError.isInstance(cause) && cause.value === value && ((_a15 = cause.context) == null ? void 0 : _a15.field) === (context == null ? void 0 : context.field) && ((_b15 = cause.context) == null ? void 0 : _b15.entityName) === (context == null ? void 0 : context.entityName) && ((_c = cause.context) == null ? void 0 : _c.entityId) === (context == null ? void 0 : context.entityId)) { | ||
| return cause; | ||
| } | ||
| return new _TypeValidationError({ value, cause, context }); | ||
| } | ||
@@ -361,0 +388,0 @@ }; |
+32
-5
@@ -284,6 +284,26 @@ // src/errors/ai-sdk-error.ts | ||
| var TypeValidationError = class _TypeValidationError extends (_b13 = AISDKError, _a13 = symbol13, _b13) { | ||
| constructor({ value, cause }) { | ||
| constructor({ | ||
| value, | ||
| cause, | ||
| context | ||
| }) { | ||
| let contextPrefix = "Type validation failed"; | ||
| if (context == null ? void 0 : context.field) { | ||
| contextPrefix += ` for ${context.field}`; | ||
| } | ||
| if ((context == null ? void 0 : context.entityName) || (context == null ? void 0 : context.entityId)) { | ||
| contextPrefix += " ("; | ||
| const parts = []; | ||
| if (context.entityName) { | ||
| parts.push(context.entityName); | ||
| } | ||
| if (context.entityId) { | ||
| parts.push(`id: "${context.entityId}"`); | ||
| } | ||
| contextPrefix += parts.join(", "); | ||
| contextPrefix += ")"; | ||
| } | ||
| super({ | ||
| name: name12, | ||
| message: `Type validation failed: Value: ${JSON.stringify(value)}. | ||
| message: `${contextPrefix}: Value: ${JSON.stringify(value)}. | ||
| Error message: ${getErrorMessage(cause)}`, | ||
@@ -294,2 +314,3 @@ cause | ||
| this.value = value; | ||
| this.context = context; | ||
| } | ||
@@ -301,3 +322,3 @@ static isInstance(error) { | ||
| * Wraps an error into a TypeValidationError. | ||
| * If the cause is already a TypeValidationError with the same value, it returns the cause. | ||
| * If the cause is already a TypeValidationError with the same value and context, it returns the cause. | ||
| * Otherwise, it creates a new TypeValidationError. | ||
@@ -308,2 +329,3 @@ * | ||
| * @param {unknown} params.cause - The original error or cause of the validation failure. | ||
| * @param {TypeValidationContext} params.context - Optional context about what is being validated. | ||
| * @returns {TypeValidationError} A TypeValidationError instance. | ||
@@ -313,5 +335,10 @@ */ | ||
| value, | ||
| cause | ||
| cause, | ||
| context | ||
| }) { | ||
| return _TypeValidationError.isInstance(cause) && cause.value === value ? cause : new _TypeValidationError({ value, cause }); | ||
| var _a15, _b15, _c; | ||
| if (_TypeValidationError.isInstance(cause) && cause.value === value && ((_a15 = cause.context) == null ? void 0 : _a15.field) === (context == null ? void 0 : context.field) && ((_b15 = cause.context) == null ? void 0 : _b15.entityName) === (context == null ? void 0 : context.entityName) && ((_c = cause.context) == null ? void 0 : _c.entityId) === (context == null ? void 0 : context.entityId)) { | ||
| return cause; | ||
| } | ||
| return new _TypeValidationError({ value, cause, context }); | ||
| } | ||
@@ -318,0 +345,0 @@ }; |
+1
-1
| { | ||
| "name": "@ai-sdk/provider", | ||
| "version": "3.0.5", | ||
| "version": "3.0.6", | ||
| "license": "Apache-2.0", | ||
@@ -5,0 +5,0 @@ "sideEffects": false, |
| /** | ||
| An embedding is a vector, i.e. an array of numbers. | ||
| It is e.g. used to represent a text as a vector of word embeddings. | ||
| * An embedding is a vector, i.e. an array of numbers. | ||
| * It is e.g. used to represent a text as a vector of word embeddings. | ||
| */ | ||
| export type EmbeddingModelV2Embedding = Array<number>; |
@@ -9,16 +9,16 @@ import { | ||
| /** | ||
| Specification for an embedding model that implements the embedding model | ||
| interface version 2. | ||
| VALUE is the type of the values that the model can embed. | ||
| This will allow us to go beyond text embeddings in the future, | ||
| e.g. to support image embeddings | ||
| * Specification for an embedding model that implements the embedding model | ||
| * interface version 2. | ||
| * | ||
| * VALUE is the type of the values that the model can embed. | ||
| * This will allow us to go beyond text embeddings in the future, | ||
| * e.g. to support image embeddings | ||
| */ | ||
| export type EmbeddingModelV2<VALUE> = { | ||
| /** | ||
| The embedding model must specify which embedding model interface | ||
| version it implements. This will allow us to evolve the embedding | ||
| model interface and retain backwards compatibility. The different | ||
| implementation versions can be handled as a discriminated union | ||
| on our side. | ||
| * The embedding model must specify which embedding model interface | ||
| * version it implements. This will allow us to evolve the embedding | ||
| * model interface and retain backwards compatibility. The different | ||
| * implementation versions can be handled as a discriminated union | ||
| * on our side. | ||
| */ | ||
@@ -28,3 +28,3 @@ readonly specificationVersion: 'v2'; | ||
| /** | ||
| Name of the provider for logging purposes. | ||
| * Name of the provider for logging purposes. | ||
| */ | ||
@@ -34,3 +34,3 @@ readonly provider: string; | ||
| /** | ||
| Provider-specific model ID for logging purposes. | ||
| * Provider-specific model ID for logging purposes. | ||
| */ | ||
@@ -40,5 +40,5 @@ readonly modelId: string; | ||
| /** | ||
| Limit of how many embeddings can be generated in a single API call. | ||
| Use Infinity for models that do not have a limit. | ||
| * Limit of how many embeddings can be generated in a single API call. | ||
| * | ||
| * Use Infinity for models that do not have a limit. | ||
| */ | ||
@@ -51,3 +51,3 @@ readonly maxEmbeddingsPerCall: | ||
| /** | ||
| True if the model can handle multiple embedding calls in parallel. | ||
| * True if the model can handle multiple embedding calls in parallel. | ||
| */ | ||
@@ -57,10 +57,10 @@ readonly supportsParallelCalls: PromiseLike<boolean> | boolean; | ||
| /** | ||
| Generates a list of embeddings for the given input text. | ||
| Naming: "do" prefix to prevent accidental direct usage of the method | ||
| by the user. | ||
| * Generates a list of embeddings for the given input text. | ||
| * | ||
| * Naming: "do" prefix to prevent accidental direct usage of the method | ||
| * by the user. | ||
| */ | ||
| doEmbed(options: { | ||
| /** | ||
| List of values to embed. | ||
| * List of values to embed. | ||
| */ | ||
@@ -70,3 +70,3 @@ values: Array<VALUE>; | ||
| /** | ||
| Abort signal for cancelling the operation. | ||
| * Abort signal for cancelling the operation. | ||
| */ | ||
@@ -76,11 +76,11 @@ abortSignal?: AbortSignal; | ||
| /** | ||
| Additional provider-specific options. They are passed through | ||
| to the provider from the AI SDK and enable provider-specific | ||
| functionality that can be fully encapsulated in the provider. | ||
| */ | ||
| * Additional provider-specific options. They are passed through | ||
| * to the provider from the AI SDK and enable provider-specific | ||
| * functionality that can be fully encapsulated in the provider. | ||
| */ | ||
| providerOptions?: SharedV2ProviderOptions; | ||
| /** | ||
| Additional HTTP headers to be sent with the request. | ||
| Only applicable for HTTP-based providers. | ||
| * Additional HTTP headers to be sent with the request. | ||
| * Only applicable for HTTP-based providers. | ||
| */ | ||
@@ -90,3 +90,3 @@ headers?: Record<string, string | undefined>; | ||
| /** | ||
| Generated embeddings. They are in the same order as the input values. | ||
| * Generated embeddings. They are in the same order as the input values. | ||
| */ | ||
@@ -96,10 +96,10 @@ embeddings: Array<EmbeddingModelV2Embedding>; | ||
| /** | ||
| Token usage. We only have input tokens for embeddings. | ||
| */ | ||
| * Token usage. We only have input tokens for embeddings. | ||
| */ | ||
| usage?: { tokens: number }; | ||
| /** | ||
| Additional provider-specific metadata. They are passed through | ||
| from the provider to the AI SDK and enable provider-specific | ||
| results that can be fully encapsulated in the provider. | ||
| * Additional provider-specific metadata. They are passed through | ||
| * from the provider to the AI SDK and enable provider-specific | ||
| * results that can be fully encapsulated in the provider. | ||
| */ | ||
@@ -109,7 +109,7 @@ providerMetadata?: SharedV2ProviderMetadata; | ||
| /** | ||
| Optional response information for debugging purposes. | ||
| * Optional response information for debugging purposes. | ||
| */ | ||
| response?: { | ||
| /** | ||
| Response headers. | ||
| * Response headers. | ||
| */ | ||
@@ -119,4 +119,4 @@ headers?: SharedV2Headers; | ||
| /** | ||
| The response body. | ||
| */ | ||
| * The response body. | ||
| */ | ||
| body?: unknown; | ||
@@ -123,0 +123,0 @@ }; |
@@ -5,23 +5,23 @@ import { SharedV3Headers, SharedV3ProviderOptions } from '../../shared'; | ||
| /** | ||
| List of text values to generate embeddings for. | ||
| */ | ||
| * List of text values to generate embeddings for. | ||
| */ | ||
| values: Array<string>; | ||
| /** | ||
| Abort signal for cancelling the operation. | ||
| */ | ||
| * Abort signal for cancelling the operation. | ||
| */ | ||
| abortSignal?: AbortSignal; | ||
| /** | ||
| Additional provider-specific options. They are passed through | ||
| to the provider from the AI SDK and enable provider-specific | ||
| functionality that can be fully encapsulated in the provider. | ||
| */ | ||
| * Additional provider-specific options. They are passed through | ||
| * to the provider from the AI SDK and enable provider-specific | ||
| * functionality that can be fully encapsulated in the provider. | ||
| */ | ||
| providerOptions?: SharedV3ProviderOptions; | ||
| /** | ||
| Additional HTTP headers to be sent with the request. | ||
| Only applicable for HTTP-based providers. | ||
| */ | ||
| * Additional HTTP headers to be sent with the request. | ||
| * Only applicable for HTTP-based providers. | ||
| */ | ||
| headers?: SharedV3Headers; | ||
| }; |
| /** | ||
| An embedding is a vector, i.e. an array of numbers. | ||
| It is e.g. used to represent a text as a vector of word embeddings. | ||
| * An embedding is a vector, i.e. an array of numbers. | ||
| * It is e.g. used to represent a text as a vector of word embeddings. | ||
| */ | ||
| export type EmbeddingModelV3Embedding = Array<number>; |
@@ -39,4 +39,4 @@ import { | ||
| /** | ||
| The response body. | ||
| */ | ||
| * The response body. | ||
| */ | ||
| body?: unknown; | ||
@@ -43,0 +43,0 @@ }; |
@@ -5,14 +5,14 @@ import { EmbeddingModelV3CallOptions } from './embedding-model-v3-call-options'; | ||
| /** | ||
| Specification for an embedding model that implements the embedding model | ||
| interface version 3. | ||
| It is specific to text embeddings. | ||
| * Specification for an embedding model that implements the embedding model | ||
| * interface version 3. | ||
| * | ||
| * It is specific to text embeddings. | ||
| */ | ||
| export type EmbeddingModelV3 = { | ||
| /** | ||
| The embedding model must specify which embedding model interface | ||
| version it implements. This will allow us to evolve the embedding | ||
| model interface and retain backwards compatibility. The different | ||
| implementation versions can be handled as a discriminated union | ||
| on our side. | ||
| * The embedding model must specify which embedding model interface | ||
| * version it implements. This will allow us to evolve the embedding | ||
| * model interface and retain backwards compatibility. The different | ||
| * implementation versions can be handled as a discriminated union | ||
| * on our side. | ||
| */ | ||
@@ -22,3 +22,3 @@ readonly specificationVersion: 'v3'; | ||
| /** | ||
| Name of the provider for logging purposes. | ||
| * Name of the provider for logging purposes. | ||
| */ | ||
@@ -28,3 +28,3 @@ readonly provider: string; | ||
| /** | ||
| Provider-specific model ID for logging purposes. | ||
| * Provider-specific model ID for logging purposes. | ||
| */ | ||
@@ -34,5 +34,5 @@ readonly modelId: string; | ||
| /** | ||
| Limit of how many embeddings can be generated in a single API call. | ||
| Use Infinity for models that do not have a limit. | ||
| * Limit of how many embeddings can be generated in a single API call. | ||
| * | ||
| * Use Infinity for models that do not have a limit. | ||
| */ | ||
@@ -45,3 +45,3 @@ readonly maxEmbeddingsPerCall: | ||
| /** | ||
| True if the model can handle multiple embedding calls in parallel. | ||
| * True if the model can handle multiple embedding calls in parallel. | ||
| */ | ||
@@ -51,6 +51,6 @@ readonly supportsParallelCalls: PromiseLike<boolean> | boolean; | ||
| /** | ||
| Generates a list of embeddings for the given input text. | ||
| Naming: "do" prefix to prevent accidental direct usage of the method | ||
| by the user. | ||
| * Generates a list of embeddings for the given input text. | ||
| * | ||
| * Naming: "do" prefix to prevent accidental direct usage of the method | ||
| * by the user. | ||
| */ | ||
@@ -57,0 +57,0 @@ doEmbed( |
@@ -14,3 +14,4 @@ export { AISDKError } from './ai-sdk-error'; | ||
| export { TooManyEmbeddingValuesForCallError } from './too-many-embedding-values-for-call-error'; | ||
| export type { TypeValidationContext } from './type-validation-error'; | ||
| export { TypeValidationError } from './type-validation-error'; | ||
| export { UnsupportedFunctionalityError } from './unsupported-functionality-error'; |
@@ -8,3 +8,3 @@ import { AISDKError } from './ai-sdk-error'; | ||
| /** | ||
| Thrown when the AI provider fails to generate any content. | ||
| * Thrown when the AI provider fails to generate any content. | ||
| */ | ||
@@ -11,0 +11,0 @@ export class NoContentGeneratedError extends AISDKError { |
@@ -8,2 +8,19 @@ import { AISDKError } from './ai-sdk-error'; | ||
| export interface TypeValidationContext { | ||
| /** | ||
| * Field path in dot notation (e.g., "message.metadata", "message.parts[3].data") | ||
| */ | ||
| field?: string; | ||
| /** | ||
| * Entity name (e.g., tool name, data type name) | ||
| */ | ||
| entityName?: string; | ||
| /** | ||
| * Entity identifier (e.g., message ID, tool call ID) | ||
| */ | ||
| entityId?: string; | ||
| } | ||
| export class TypeValidationError extends AISDKError { | ||
@@ -13,8 +30,36 @@ private readonly [symbol] = true; // used in isInstance | ||
| readonly value: unknown; | ||
| readonly context?: TypeValidationContext; | ||
| constructor({ value, cause }: { value: unknown; cause: unknown }) { | ||
| constructor({ | ||
| value, | ||
| cause, | ||
| context, | ||
| }: { | ||
| value: unknown; | ||
| cause: unknown; | ||
| context?: TypeValidationContext; | ||
| }) { | ||
| let contextPrefix = 'Type validation failed'; | ||
| if (context?.field) { | ||
| contextPrefix += ` for ${context.field}`; | ||
| } | ||
| if (context?.entityName || context?.entityId) { | ||
| contextPrefix += ' ('; | ||
| const parts: string[] = []; | ||
| if (context.entityName) { | ||
| parts.push(context.entityName); | ||
| } | ||
| if (context.entityId) { | ||
| parts.push(`id: "${context.entityId}"`); | ||
| } | ||
| contextPrefix += parts.join(', '); | ||
| contextPrefix += ')'; | ||
| } | ||
| super({ | ||
| name, | ||
| message: | ||
| `Type validation failed: ` + | ||
| `${contextPrefix}: ` + | ||
| `Value: ${JSON.stringify(value)}.\n` + | ||
@@ -26,2 +71,3 @@ `Error message: ${getErrorMessage(cause)}`, | ||
| this.value = value; | ||
| this.context = context; | ||
| } | ||
@@ -35,3 +81,3 @@ | ||
| * Wraps an error into a TypeValidationError. | ||
| * If the cause is already a TypeValidationError with the same value, it returns the cause. | ||
| * If the cause is already a TypeValidationError with the same value and context, it returns the cause. | ||
| * Otherwise, it creates a new TypeValidationError. | ||
@@ -42,2 +88,3 @@ * | ||
| * @param {unknown} params.cause - The original error or cause of the validation failure. | ||
| * @param {TypeValidationContext} params.context - Optional context about what is being validated. | ||
| * @returns {TypeValidationError} A TypeValidationError instance. | ||
@@ -48,10 +95,20 @@ */ | ||
| cause, | ||
| context, | ||
| }: { | ||
| value: unknown; | ||
| cause: unknown; | ||
| context?: TypeValidationContext; | ||
| }): TypeValidationError { | ||
| return TypeValidationError.isInstance(cause) && cause.value === value | ||
| ? cause | ||
| : new TypeValidationError({ value, cause }); | ||
| if ( | ||
| TypeValidationError.isInstance(cause) && | ||
| cause.value === value && | ||
| cause.context?.field === context?.field && | ||
| cause.context?.entityName === context?.entityName && | ||
| cause.context?.entityId === context?.entityId | ||
| ) { | ||
| return cause; | ||
| } | ||
| return new TypeValidationError({ value, cause, context }); | ||
| } | ||
| } |
@@ -5,57 +5,57 @@ import { SharedV2ProviderOptions } from '../../shared'; | ||
| /** | ||
| Prompt for the image generation. | ||
| */ | ||
| * Prompt for the image generation. | ||
| */ | ||
| prompt: string; | ||
| /** | ||
| Number of images to generate. | ||
| */ | ||
| * Number of images to generate. | ||
| */ | ||
| n: number; | ||
| /** | ||
| Size of the images to generate. | ||
| Must have the format `{width}x{height}`. | ||
| `undefined` will use the provider's default size. | ||
| */ | ||
| * Size of the images to generate. | ||
| * Must have the format `{width}x{height}`. | ||
| * `undefined` will use the provider's default size. | ||
| */ | ||
| size: `${number}x${number}` | undefined; | ||
| /** | ||
| Aspect ratio of the images to generate. | ||
| Must have the format `{width}:{height}`. | ||
| `undefined` will use the provider's default aspect ratio. | ||
| */ | ||
| * Aspect ratio of the images to generate. | ||
| * Must have the format `{width}:{height}`. | ||
| * `undefined` will use the provider's default aspect ratio. | ||
| */ | ||
| aspectRatio: `${number}:${number}` | undefined; | ||
| /** | ||
| Seed for the image generation. | ||
| `undefined` will use the provider's default seed. | ||
| */ | ||
| * Seed for the image generation. | ||
| * `undefined` will use the provider's default seed. | ||
| */ | ||
| seed: number | undefined; | ||
| /** | ||
| Additional provider-specific options that are passed through to the provider | ||
| as body parameters. | ||
| The outer record is keyed by the provider name, and the inner | ||
| record is keyed by the provider-specific metadata key. | ||
| ```ts | ||
| { | ||
| "openai": { | ||
| "style": "vivid" | ||
| } | ||
| } | ||
| ``` | ||
| */ | ||
| * Additional provider-specific options that are passed through to the provider | ||
| * as body parameters. | ||
| * | ||
| * The outer record is keyed by the provider name, and the inner | ||
| * record is keyed by the provider-specific metadata key. | ||
| * ```ts | ||
| * { | ||
| * "openai": { | ||
| * "style": "vivid" | ||
| * } | ||
| * } | ||
| * ``` | ||
| */ | ||
| providerOptions: SharedV2ProviderOptions; | ||
| /** | ||
| Abort signal for cancelling the operation. | ||
| */ | ||
| * Abort signal for cancelling the operation. | ||
| */ | ||
| abortSignal?: AbortSignal; | ||
| /** | ||
| Additional HTTP headers to be sent with the request. | ||
| Only applicable for HTTP-based providers. | ||
| */ | ||
| * Additional HTTP headers to be sent with the request. | ||
| * Only applicable for HTTP-based providers. | ||
| */ | ||
| headers?: Record<string, string | undefined>; | ||
| }; |
| import { ImageModelV2CallOptions } from './image-model-v2-call-options'; | ||
| /** | ||
| Warning from the model provider for this call. The call will proceed, but e.g. | ||
| some settings might not be supported, which can lead to suboptimal results. | ||
| * Warning from the model provider for this call. The call will proceed, but e.g. | ||
| * some settings might not be supported, which can lead to suboptimal results. | ||
| */ | ||
@@ -7,0 +7,0 @@ export type ImageModelV2CallWarning = |
@@ -17,11 +17,11 @@ import { JSONArray, JSONValue } from '../../json-value'; | ||
| /** | ||
| Image generation model specification version 2. | ||
| * Image generation model specification version 2. | ||
| */ | ||
| export type ImageModelV2 = { | ||
| /** | ||
| The image model must specify which image model interface | ||
| version it implements. This will allow us to evolve the image | ||
| model interface and retain backwards compatibility. The different | ||
| implementation versions can be handled as a discriminated union | ||
| on our side. | ||
| * The image model must specify which image model interface | ||
| * version it implements. This will allow us to evolve the image | ||
| * model interface and retain backwards compatibility. The different | ||
| * implementation versions can be handled as a discriminated union | ||
| * on our side. | ||
| */ | ||
@@ -31,3 +31,3 @@ readonly specificationVersion: 'v2'; | ||
| /** | ||
| Name of the provider for logging purposes. | ||
| * Name of the provider for logging purposes. | ||
| */ | ||
@@ -37,3 +37,3 @@ readonly provider: string; | ||
| /** | ||
| Provider-specific model ID for logging purposes. | ||
| * Provider-specific model ID for logging purposes. | ||
| */ | ||
@@ -43,6 +43,6 @@ readonly modelId: string; | ||
| /** | ||
| Limit of how many images can be generated in a single API call. | ||
| Can be set to a number for a fixed limit, to undefined to use | ||
| the global limit, or a function that returns a number or undefined, | ||
| optionally as a promise. | ||
| * Limit of how many images can be generated in a single API call. | ||
| * Can be set to a number for a fixed limit, to undefined to use | ||
| * the global limit, or a function that returns a number or undefined, | ||
| * optionally as a promise. | ||
| */ | ||
@@ -52,11 +52,11 @@ readonly maxImagesPerCall: number | undefined | GetMaxImagesPerCallFunction; | ||
| /** | ||
| Generates an array of images. | ||
| * Generates an array of images. | ||
| */ | ||
| doGenerate(options: ImageModelV2CallOptions): PromiseLike<{ | ||
| /** | ||
| Generated images as base64 encoded strings or binary data. | ||
| The images should be returned without any unnecessary conversion. | ||
| If the API returns base64 encoded strings, the images should be returned | ||
| as base64 encoded strings. If the API returns binary data, the images should | ||
| be returned as binary data. | ||
| * Generated images as base64 encoded strings or binary data. | ||
| * The images should be returned without any unnecessary conversion. | ||
| * If the API returns base64 encoded strings, the images should be returned | ||
| * as base64 encoded strings. If the API returns binary data, the images should | ||
| * be returned as binary data. | ||
| */ | ||
@@ -66,3 +66,3 @@ images: Array<string> | Array<Uint8Array>; | ||
| /** | ||
| Warnings for the call, e.g. unsupported settings. | ||
| * Warnings for the call, e.g. unsupported settings. | ||
| */ | ||
@@ -72,37 +72,37 @@ warnings: Array<ImageModelV2CallWarning>; | ||
| /** | ||
| Additional provider-specific metadata. They are passed through | ||
| from the provider to the AI SDK and enable provider-specific | ||
| results that can be fully encapsulated in the provider. | ||
| The outer record is keyed by the provider name, and the inner | ||
| record is provider-specific metadata. It always includes an | ||
| `images` key with image-specific metadata | ||
| ```ts | ||
| { | ||
| "openai": { | ||
| "images": ["revisedPrompt": "Revised prompt here."] | ||
| } | ||
| } | ||
| ``` | ||
| */ | ||
| * Additional provider-specific metadata. They are passed through | ||
| * from the provider to the AI SDK and enable provider-specific | ||
| * results that can be fully encapsulated in the provider. | ||
| * | ||
| * The outer record is keyed by the provider name, and the inner | ||
| * record is provider-specific metadata. It always includes an | ||
| * `images` key with image-specific metadata | ||
| * | ||
| * ```ts | ||
| * { | ||
| * "openai": { | ||
| * "images": ["revisedPrompt": "Revised prompt here."] | ||
| * } | ||
| * } | ||
| * ``` | ||
| */ | ||
| providerMetadata?: ImageModelV2ProviderMetadata; | ||
| /** | ||
| Response information for telemetry and debugging purposes. | ||
| * Response information for telemetry and debugging purposes. | ||
| */ | ||
| response: { | ||
| /** | ||
| Timestamp for the start of the generated response. | ||
| */ | ||
| * Timestamp for the start of the generated response. | ||
| */ | ||
| timestamp: Date; | ||
| /** | ||
| The ID of the response model that was used to generate the response. | ||
| */ | ||
| * The ID of the response model that was used to generate the response. | ||
| */ | ||
| modelId: string; | ||
| /** | ||
| Response headers. | ||
| */ | ||
| * Response headers. | ||
| */ | ||
| headers: Record<string, string> | undefined; | ||
@@ -109,0 +109,0 @@ }; |
| /** | ||
| Usage information for an image model call. | ||
| * Usage information for an image model call. | ||
| */ | ||
| export type ImageModelV3Usage = { | ||
| /** | ||
| The number of input (prompt) tokens used. | ||
| * The number of input (prompt) tokens used. | ||
| */ | ||
@@ -11,3 +11,3 @@ inputTokens: number | undefined; | ||
| /** | ||
| The number of output tokens used, if reported by the provider. | ||
| * The number of output tokens used, if reported by the provider. | ||
| */ | ||
@@ -17,5 +17,5 @@ outputTokens: number | undefined; | ||
| /** | ||
| The total number of tokens as reported by the provider. | ||
| * The total number of tokens as reported by the provider. | ||
| */ | ||
| totalTokens: number | undefined; | ||
| }; |
@@ -18,11 +18,11 @@ import { JSONArray, JSONValue } from '../../json-value'; | ||
| /** | ||
| Image generation model specification version 3. | ||
| * Image generation model specification version 3. | ||
| */ | ||
| export type ImageModelV3 = { | ||
| /** | ||
| The image model must specify which image model interface | ||
| version it implements. This will allow us to evolve the image | ||
| model interface and retain backwards compatibility. The different | ||
| implementation versions can be handled as a discriminated union | ||
| on our side. | ||
| * The image model must specify which image model interface | ||
| * version it implements. This will allow us to evolve the image | ||
| * model interface and retain backwards compatibility. The different | ||
| * implementation versions can be handled as a discriminated union | ||
| * on our side. | ||
| */ | ||
@@ -32,3 +32,3 @@ readonly specificationVersion: 'v3'; | ||
| /** | ||
| Name of the provider for logging purposes. | ||
| * Name of the provider for logging purposes. | ||
| */ | ||
@@ -38,3 +38,3 @@ readonly provider: string; | ||
| /** | ||
| Provider-specific model ID for logging purposes. | ||
| * Provider-specific model ID for logging purposes. | ||
| */ | ||
@@ -44,6 +44,6 @@ readonly modelId: string; | ||
| /** | ||
| Limit of how many images can be generated in a single API call. | ||
| Can be set to a number for a fixed limit, to undefined to use | ||
| the global limit, or a function that returns a number or undefined, | ||
| optionally as a promise. | ||
| * Limit of how many images can be generated in a single API call. | ||
| * Can be set to a number for a fixed limit, to undefined to use | ||
| * the global limit, or a function that returns a number or undefined, | ||
| * optionally as a promise. | ||
| */ | ||
@@ -53,11 +53,11 @@ readonly maxImagesPerCall: number | undefined | GetMaxImagesPerCallFunction; | ||
| /** | ||
| Generates an array of images. | ||
| * Generates an array of images. | ||
| */ | ||
| doGenerate(options: ImageModelV3CallOptions): PromiseLike<{ | ||
| /** | ||
| Generated images as base64 encoded strings or binary data. | ||
| The images should be returned without any unnecessary conversion. | ||
| If the API returns base64 encoded strings, the images should be returned | ||
| as base64 encoded strings. If the API returns binary data, the images should | ||
| be returned as binary data. | ||
| * Generated images as base64 encoded strings or binary data. | ||
| * The images should be returned without any unnecessary conversion. | ||
| * If the API returns base64 encoded strings, the images should be returned | ||
| * as base64 encoded strings. If the API returns binary data, the images should | ||
| * be returned as binary data. | ||
| */ | ||
@@ -67,3 +67,3 @@ images: Array<string> | Array<Uint8Array>; | ||
| /** | ||
| Warnings for the call, e.g. unsupported features. | ||
| * Warnings for the call, e.g. unsupported features. | ||
| */ | ||
@@ -73,37 +73,37 @@ warnings: Array<SharedV3Warning>; | ||
| /** | ||
| Additional provider-specific metadata. They are passed through | ||
| from the provider to the AI SDK and enable provider-specific | ||
| results that can be fully encapsulated in the provider. | ||
| The outer record is keyed by the provider name, and the inner | ||
| record is provider-specific metadata. It always includes an | ||
| `images` key with image-specific metadata | ||
| ```ts | ||
| { | ||
| "openai": { | ||
| "images": ["revisedPrompt": "Revised prompt here."] | ||
| } | ||
| } | ||
| ``` | ||
| */ | ||
| * Additional provider-specific metadata. They are passed through | ||
| * from the provider to the AI SDK and enable provider-specific | ||
| * results that can be fully encapsulated in the provider. | ||
| * | ||
| * The outer record is keyed by the provider name, and the inner | ||
| * record is provider-specific metadata. It always includes an | ||
| * `images` key with image-specific metadata | ||
| * | ||
| * ```ts | ||
| * { | ||
| * "openai": { | ||
| * "images": ["revisedPrompt": "Revised prompt here."] | ||
| * } | ||
| * } | ||
| * ``` | ||
| */ | ||
| providerMetadata?: ImageModelV3ProviderMetadata; | ||
| /** | ||
| Response information for telemetry and debugging purposes. | ||
| * Response information for telemetry and debugging purposes. | ||
| */ | ||
| response: { | ||
| /** | ||
| Timestamp for the start of the generated response. | ||
| */ | ||
| * Timestamp for the start of the generated response. | ||
| */ | ||
| timestamp: Date; | ||
| /** | ||
| The ID of the response model that was used to generate the response. | ||
| */ | ||
| * The ID of the response model that was used to generate the response. | ||
| */ | ||
| modelId: string; | ||
| /** | ||
| Response headers. | ||
| */ | ||
| * Response headers. | ||
| */ | ||
| headers: Record<string, string> | undefined; | ||
@@ -113,3 +113,3 @@ }; | ||
| /** | ||
| Optional token usage for the image generation call (if the provider reports it). | ||
| * Optional token usage for the image generation call (if the provider reports it). | ||
| */ | ||
@@ -116,0 +116,0 @@ usage?: ImageModelV3Usage; |
| /** | ||
| A JSON value can be a string, number, boolean, object, array, or null. | ||
| JSON values can be serialized and deserialized by the JSON.stringify and JSON.parse methods. | ||
| * A JSON value can be a string, number, boolean, object, array, or null. | ||
| * JSON values can be serialized and deserialized by the JSON.stringify and JSON.parse methods. | ||
| */ | ||
@@ -5,0 +5,0 @@ export type JSONValue = |
@@ -10,8 +10,8 @@ import { JSONSchema7 } from 'json-schema'; | ||
| /** | ||
| A language mode prompt is a standardized prompt type. | ||
| Note: This is **not** the user-facing prompt. The AI SDK methods will map the | ||
| user-facing prompt types such as chat or instruction prompts to this format. | ||
| That approach allows us to evolve the user facing prompts without breaking | ||
| the language model interface. | ||
| * A language mode prompt is a standardized prompt type. | ||
| * | ||
| * Note: This is **not** the user-facing prompt. The AI SDK methods will map the | ||
| * user-facing prompt types such as chat or instruction prompts to this format. | ||
| * That approach allows us to evolve the user facing prompts without breaking | ||
| * the language model interface. | ||
| */ | ||
@@ -21,3 +21,3 @@ prompt: LanguageModelV2Prompt; | ||
| /** | ||
| Maximum number of tokens to generate. | ||
| * Maximum number of tokens to generate. | ||
| */ | ||
@@ -27,43 +27,43 @@ maxOutputTokens?: number; | ||
| /** | ||
| Temperature setting. The range depends on the provider and model. | ||
| */ | ||
| * Temperature setting. The range depends on the provider and model. | ||
| */ | ||
| temperature?: number; | ||
| /** | ||
| Stop sequences. | ||
| If set, the model will stop generating text when one of the stop sequences is generated. | ||
| Providers may have limits on the number of stop sequences. | ||
| */ | ||
| * Stop sequences. | ||
| * If set, the model will stop generating text when one of the stop sequences is generated. | ||
| * Providers may have limits on the number of stop sequences. | ||
| */ | ||
| stopSequences?: string[]; | ||
| /** | ||
| Nucleus sampling. | ||
| */ | ||
| * Nucleus sampling. | ||
| */ | ||
| topP?: number; | ||
| /** | ||
| Only sample from the top K options for each subsequent token. | ||
| Used to remove "long tail" low probability responses. | ||
| Recommended for advanced use cases only. You usually only need to use temperature. | ||
| */ | ||
| * Only sample from the top K options for each subsequent token. | ||
| * | ||
| * Used to remove "long tail" low probability responses. | ||
| * Recommended for advanced use cases only. You usually only need to use temperature. | ||
| */ | ||
| topK?: number; | ||
| /** | ||
| Presence penalty setting. It affects the likelihood of the model to | ||
| repeat information that is already in the prompt. | ||
| */ | ||
| * Presence penalty setting. It affects the likelihood of the model to | ||
| * repeat information that is already in the prompt. | ||
| */ | ||
| presencePenalty?: number; | ||
| /** | ||
| Frequency penalty setting. It affects the likelihood of the model | ||
| to repeatedly use the same words or phrases. | ||
| */ | ||
| * Frequency penalty setting. It affects the likelihood of the model | ||
| * to repeatedly use the same words or phrases. | ||
| */ | ||
| frequencyPenalty?: number; | ||
| /** | ||
| Response format. The output can either be text or JSON. Default is text. | ||
| If JSON is selected, a schema can optionally be provided to guide the LLM. | ||
| */ | ||
| * Response format. The output can either be text or JSON. Default is text. | ||
| * | ||
| * If JSON is selected, a schema can optionally be provided to guide the LLM. | ||
| */ | ||
| responseFormat?: | ||
@@ -91,10 +91,10 @@ | { type: 'text' } | ||
| /** | ||
| The seed (integer) to use for random sampling. If set and supported | ||
| by the model, calls will generate deterministic results. | ||
| */ | ||
| * The seed (integer) to use for random sampling. If set and supported | ||
| * by the model, calls will generate deterministic results. | ||
| */ | ||
| seed?: number; | ||
| /** | ||
| The tools that are available for the model. | ||
| */ | ||
| * The tools that are available for the model. | ||
| */ | ||
| tools?: Array< | ||
@@ -105,20 +105,20 @@ LanguageModelV2FunctionTool | LanguageModelV2ProviderDefinedTool | ||
| /** | ||
| Specifies how the tool should be selected. Defaults to 'auto'. | ||
| */ | ||
| * Specifies how the tool should be selected. Defaults to 'auto'. | ||
| */ | ||
| toolChoice?: LanguageModelV2ToolChoice; | ||
| /** | ||
| Include raw chunks in the stream. Only applicable for streaming calls. | ||
| */ | ||
| * Include raw chunks in the stream. Only applicable for streaming calls. | ||
| */ | ||
| includeRawChunks?: boolean; | ||
| /** | ||
| Abort signal for cancelling the operation. | ||
| */ | ||
| * Abort signal for cancelling the operation. | ||
| */ | ||
| abortSignal?: AbortSignal; | ||
| /** | ||
| Additional HTTP headers to be sent with the request. | ||
| Only applicable for HTTP-based providers. | ||
| */ | ||
| * Additional HTTP headers to be sent with the request. | ||
| * Only applicable for HTTP-based providers. | ||
| */ | ||
| headers?: Record<string, string | undefined>; | ||
@@ -125,0 +125,0 @@ |
@@ -6,4 +6,4 @@ import { LanguageModelV2CallOptions } from './language-model-v2-call-options'; | ||
| /** | ||
| Warning from the model provider for this call. The call will proceed, but e.g. | ||
| some settings might not be supported, which can lead to suboptimal results. | ||
| * Warning from the model provider for this call. The call will proceed, but e.g. | ||
| * some settings might not be supported, which can lead to suboptimal results. | ||
| */ | ||
@@ -10,0 +10,0 @@ export type LanguageModelV2CallWarning = |
| /** | ||
| Data content. Can be a Uint8Array, base64 encoded data as a string or a URL. | ||
| */ | ||
| * Data content. Can be a Uint8Array, base64 encoded data as a string or a URL. | ||
| */ | ||
| export type LanguageModelV2DataContent = Uint8Array | string | URL; |
| /** | ||
| A file that has been generated by the model. | ||
| Generated files as base64 encoded strings or binary data. | ||
| The files should be returned without any unnecessary conversion. | ||
| * A file that has been generated by the model. | ||
| * Generated files as base64 encoded strings or binary data. | ||
| * The files should be returned without any unnecessary conversion. | ||
| */ | ||
@@ -10,17 +10,17 @@ export type LanguageModelV2File = { | ||
| /** | ||
| The IANA media type of the file, e.g. `image/png` or `audio/mp3`. | ||
| @see https://www.iana.org/assignments/media-types/media-types.xhtml | ||
| */ | ||
| * The IANA media type of the file, e.g. `image/png` or `audio/mp3`. | ||
| * | ||
| * @see https://www.iana.org/assignments/media-types/media-types.xhtml | ||
| */ | ||
| mediaType: string; | ||
| /** | ||
| Generated file data as base64 encoded strings or binary data. | ||
| The file data should be returned without any unnecessary conversion. | ||
| If the API returns base64 encoded strings, the file data should be returned | ||
| as base64 encoded strings. If the API returns binary data, the file data should | ||
| be returned as binary data. | ||
| */ | ||
| * Generated file data as base64 encoded strings or binary data. | ||
| * | ||
| * The file data should be returned without any unnecessary conversion. | ||
| * If the API returns base64 encoded strings, the file data should be returned | ||
| * as base64 encoded strings. If the API returns binary data, the file data should | ||
| * be returned as binary data. | ||
| */ | ||
| data: string | Uint8Array; | ||
| }; |
| /** | ||
| Reason why a language model finished generating a response. | ||
| Can be one of the following: | ||
| - `stop`: model generated stop sequence | ||
| - `length`: model generated maximum number of tokens | ||
| - `content-filter`: content filter violation stopped the model | ||
| - `tool-calls`: model triggered tool calls | ||
| - `error`: model stopped because of an error | ||
| - `other`: model stopped for other reasons | ||
| - `unknown`: the model has not transmitted a finish reason | ||
| * Reason why a language model finished generating a response. | ||
| * | ||
| * Can be one of the following: | ||
| * - `stop`: model generated stop sequence | ||
| * - `length`: model generated maximum number of tokens | ||
| * - `content-filter`: content filter violation stopped the model | ||
| * - `tool-calls`: model triggered tool calls | ||
| * - `error`: model stopped because of an error | ||
| * - `other`: model stopped for other reasons | ||
| * - `unknown`: the model has not transmitted a finish reason | ||
| */ | ||
@@ -13,0 +13,0 @@ export type LanguageModelV2FinishReason = |
@@ -5,10 +5,10 @@ import { JSONSchema7 } from 'json-schema'; | ||
| /** | ||
| A tool has a name, a description, and a set of parameters. | ||
| Note: this is **not** the user-facing tool definition. The AI SDK methods will | ||
| map the user-facing tool definitions to this format. | ||
| * A tool has a name, a description, and a set of parameters. | ||
| * | ||
| * Note: this is **not** the user-facing tool definition. The AI SDK methods will | ||
| * map the user-facing tool definitions to this format. | ||
| */ | ||
| export type LanguageModelV2FunctionTool = { | ||
| /** | ||
| The type of the tool (always 'function'). | ||
| * The type of the tool (always 'function'). | ||
| */ | ||
@@ -18,3 +18,3 @@ type: 'function'; | ||
| /** | ||
| The name of the tool. Unique within this model call. | ||
| * The name of the tool. Unique within this model call. | ||
| */ | ||
@@ -24,4 +24,4 @@ name: string; | ||
| /** | ||
| A description of the tool. The language model uses this to understand the | ||
| tool's purpose and to provide better completion suggestions. | ||
| * A description of the tool. The language model uses this to understand the | ||
| * tool's purpose and to provide better completion suggestions. | ||
| */ | ||
@@ -31,4 +31,4 @@ description?: string; | ||
| /** | ||
| The parameters that the tool expects. The language model uses this to | ||
| understand the tool's input requirements and to provide matching suggestions. | ||
| * The parameters that the tool expects. The language model uses this to | ||
| * understand the tool's input requirements and to provide matching suggestions. | ||
| */ | ||
@@ -38,5 +38,5 @@ inputSchema: JSONSchema7; | ||
| /** | ||
| The provider-specific options for the tool. | ||
| * The provider-specific options for the tool. | ||
| */ | ||
| providerOptions?: SharedV2ProviderOptions; | ||
| }; |
@@ -6,9 +6,9 @@ import { JSONValue } from '../../json-value/json-value'; | ||
| /** | ||
| A prompt is a list of messages. | ||
| Note: Not all models and prompt formats support multi-modal inputs and | ||
| tool calls. The validation happens at runtime. | ||
| Note: This is not a user-facing prompt. The AI SDK methods will map the | ||
| user-facing prompt types such as chat or instruction prompts to this format. | ||
| * A prompt is a list of messages. | ||
| * | ||
| * Note: Not all models and prompt formats support multi-modal inputs and | ||
| * tool calls. The validation happens at runtime. | ||
| * | ||
| * Note: This is not a user-facing prompt. The AI SDK methods will map the | ||
| * user-facing prompt types such as chat or instruction prompts to this format. | ||
| */ | ||
@@ -54,3 +54,3 @@ export type LanguageModelV2Prompt = Array<LanguageModelV2Message>; | ||
| /** | ||
| Text content part of a prompt. It contains a string of text. | ||
| * Text content part of a prompt. It contains a string of text. | ||
| */ | ||
@@ -61,3 +61,3 @@ export interface LanguageModelV2TextPart { | ||
| /** | ||
| The text content. | ||
| * The text content. | ||
| */ | ||
@@ -75,3 +75,3 @@ text: string; | ||
| /** | ||
| Reasoning content part of a prompt. It contains a string of reasoning text. | ||
| * Reasoning content part of a prompt. It contains a string of reasoning text. | ||
| */ | ||
@@ -82,3 +82,3 @@ export interface LanguageModelV2ReasoningPart { | ||
| /** | ||
| The reasoning text. | ||
| * The reasoning text. | ||
| */ | ||
@@ -96,3 +96,3 @@ text: string; | ||
| /** | ||
| File content part of a prompt. It contains a file. | ||
| * File content part of a prompt. It contains a file. | ||
| */ | ||
@@ -108,12 +108,12 @@ export interface LanguageModelV2FilePart { | ||
| /** | ||
| File data. Can be a Uint8Array, base64 encoded data as a string or a URL. | ||
| */ | ||
| * File data. Can be a Uint8Array, base64 encoded data as a string or a URL. | ||
| */ | ||
| data: LanguageModelV2DataContent; | ||
| /** | ||
| IANA media type of the file. | ||
| Can support wildcards, e.g. `image/*` (in which case the provider needs to take appropriate action). | ||
| @see https://www.iana.org/assignments/media-types/media-types.xhtml | ||
| * IANA media type of the file. | ||
| * | ||
| * Can support wildcards, e.g. `image/*` (in which case the provider needs to take appropriate action). | ||
| * | ||
| * @see https://www.iana.org/assignments/media-types/media-types.xhtml | ||
| */ | ||
@@ -131,3 +131,3 @@ mediaType: string; | ||
| /** | ||
| Tool call content part of a prompt. It contains a tool call (usually generated by the AI model). | ||
| * Tool call content part of a prompt. It contains a tool call (usually generated by the AI model). | ||
| */ | ||
@@ -138,13 +138,13 @@ export interface LanguageModelV2ToolCallPart { | ||
| /** | ||
| ID of the tool call. This ID is used to match the tool call with the tool result. | ||
| */ | ||
| * ID of the tool call. This ID is used to match the tool call with the tool result. | ||
| */ | ||
| toolCallId: string; | ||
| /** | ||
| Name of the tool that is being called. | ||
| */ | ||
| * Name of the tool that is being called. | ||
| */ | ||
| toolName: string; | ||
| /** | ||
| Arguments of the tool call. This is a JSON-serializable object that matches the tool's input schema. | ||
| * Arguments of the tool call. This is a JSON-serializable object that matches the tool's input schema. | ||
| */ | ||
@@ -168,3 +168,3 @@ input: unknown; | ||
| /** | ||
| Tool result content part of a prompt. It contains the result of the tool call with the matching ID. | ||
| * Tool result content part of a prompt. It contains the result of the tool call with the matching ID. | ||
| */ | ||
@@ -175,13 +175,13 @@ export interface LanguageModelV2ToolResultPart { | ||
| /** | ||
| ID of the tool call that this result is associated with. | ||
| */ | ||
| * ID of the tool call that this result is associated with. | ||
| */ | ||
| toolCallId: string; | ||
| /** | ||
| Name of the tool that generated this result. | ||
| */ | ||
| * Name of the tool that generated this result. | ||
| */ | ||
| toolName: string; | ||
| /** | ||
| Result of the tool call. | ||
| * Result of the tool call. | ||
| */ | ||
@@ -210,4 +210,4 @@ output: LanguageModelV2ToolResultOutput; | ||
| /** | ||
| Text content. | ||
| */ | ||
| * Text content. | ||
| */ | ||
| text: string; | ||
@@ -219,10 +219,10 @@ } | ||
| /** | ||
| Base-64 encoded media data. | ||
| */ | ||
| * Base-64 encoded media data. | ||
| */ | ||
| data: string; | ||
| /** | ||
| IANA media type. | ||
| @see https://www.iana.org/assignments/media-types/media-types.xhtml | ||
| */ | ||
| * IANA media type. | ||
| * @see https://www.iana.org/assignments/media-types/media-types.xhtml | ||
| */ | ||
| mediaType: string; | ||
@@ -229,0 +229,0 @@ } |
| /** | ||
| The configuration of a tool that is defined by the provider. | ||
| * The configuration of a tool that is defined by the provider. | ||
| */ | ||
| export type LanguageModelV2ProviderDefinedTool = { | ||
| /** | ||
| The type of the tool (always 'provider-defined'). | ||
| * The type of the tool (always 'provider-defined'). | ||
| */ | ||
@@ -11,3 +11,3 @@ type: 'provider-defined'; | ||
| /** | ||
| The ID of the tool. Should follow the format `<provider-name>.<unique-tool-name>`. | ||
| * The ID of the tool. Should follow the format `<provider-name>.<unique-tool-name>`. | ||
| */ | ||
@@ -17,3 +17,3 @@ id: `${string}.${string}`; | ||
| /** | ||
| The name of the tool that the user must use in the tool set. | ||
| * The name of the tool that the user must use in the tool set. | ||
| */ | ||
@@ -23,5 +23,5 @@ name: string; | ||
| /** | ||
| The arguments for configuring the tool. Must match the expected arguments defined by the provider for this tool. | ||
| */ | ||
| * The arguments for configuring the tool. Must match the expected arguments defined by the provider for this tool. | ||
| */ | ||
| args: Record<string, unknown>; | ||
| }; |
| import { SharedV2ProviderMetadata } from '../../shared'; | ||
| /** | ||
| Reasoning that the model has generated. | ||
| * Reasoning that the model has generated. | ||
| */ | ||
@@ -6,0 +6,0 @@ export type LanguageModelV2Reasoning = { |
| export interface LanguageModelV2ResponseMetadata { | ||
| /** | ||
| ID for the generated response, if the provider sends one. | ||
| */ | ||
| * ID for the generated response, if the provider sends one. | ||
| */ | ||
| id?: string; | ||
| /** | ||
| Timestamp for the start of the generated response, if the provider sends one. | ||
| */ | ||
| * Timestamp for the start of the generated response, if the provider sends one. | ||
| */ | ||
| timestamp?: Date; | ||
| /** | ||
| The ID of the response model that was used to generate the response, if the provider sends one. | ||
| */ | ||
| * The ID of the response model that was used to generate the response, if the provider sends one. | ||
| */ | ||
| modelId?: string; | ||
| } |
| import { SharedV2ProviderMetadata } from '../../shared/v2/shared-v2-provider-metadata'; | ||
| /** | ||
| A source that has been used as input to generate the response. | ||
| * A source that has been used as input to generate the response. | ||
| */ | ||
@@ -6,0 +6,0 @@ export type LanguageModelV2Source = |
| import { SharedV2ProviderMetadata } from '../../shared/v2/shared-v2-provider-metadata'; | ||
| /** | ||
| Text that the model has generated. | ||
| * Text that the model has generated. | ||
| */ | ||
@@ -10,3 +10,3 @@ export type LanguageModelV2Text = { | ||
| /** | ||
| The text content. | ||
| * The text content. | ||
| */ | ||
@@ -13,0 +13,0 @@ text: string; |
| import { SharedV2ProviderMetadata } from '../../shared/v2/shared-v2-provider-metadata'; | ||
| /** | ||
| Result of a tool call that has been executed by the provider. | ||
| * Result of a tool call that has been executed by the provider. | ||
| */ | ||
@@ -6,0 +6,0 @@ export type LanguageModelV2ToolResult = { |
| /** | ||
| Usage information for a language model call. | ||
| If your API return additional usage information, you can add it to the | ||
| provider metadata under your provider's key. | ||
| * Usage information for a language model call. | ||
| * | ||
| * If your API return additional usage information, you can add it to the | ||
| * provider metadata under your provider's key. | ||
| */ | ||
| export type LanguageModelV2Usage = { | ||
| /** | ||
| The number of input (prompt) tokens used. | ||
| * The number of input (prompt) tokens used. | ||
| */ | ||
@@ -14,3 +14,3 @@ inputTokens: number | undefined; | ||
| /** | ||
| The number of output (completion) tokens used. | ||
| * The number of output (completion) tokens used. | ||
| */ | ||
@@ -20,5 +20,5 @@ outputTokens: number | undefined; | ||
| /** | ||
| The total number of tokens as reported by the provider. | ||
| This number might be different from the sum of `inputTokens` and `outputTokens` | ||
| and e.g. include reasoning tokens or other overhead. | ||
| * The total number of tokens as reported by the provider. | ||
| * This number might be different from the sum of `inputTokens` and `outputTokens` | ||
| * and e.g. include reasoning tokens or other overhead. | ||
| */ | ||
@@ -28,3 +28,3 @@ totalTokens: number | undefined; | ||
| /** | ||
| The number of reasoning tokens used. | ||
| * The number of reasoning tokens used. | ||
| */ | ||
@@ -34,5 +34,5 @@ reasoningTokens?: number | undefined; | ||
| /** | ||
| The number of cached input tokens. | ||
| * The number of cached input tokens. | ||
| */ | ||
| cachedInputTokens?: number | undefined; | ||
| }; |
@@ -12,7 +12,7 @@ import { SharedV2Headers } from '../../shared'; | ||
| /** | ||
| Specification for a language model that implements the language model interface version 2. | ||
| * Specification for a language model that implements the language model interface version 2. | ||
| */ | ||
| export type LanguageModelV2 = { | ||
| /** | ||
| The language model must specify which language model interface version it implements. | ||
| * The language model must specify which language model interface version it implements. | ||
| */ | ||
@@ -22,3 +22,3 @@ readonly specificationVersion: 'v2'; | ||
| /** | ||
| Name of the provider for logging purposes. | ||
| * Name of the provider for logging purposes. | ||
| */ | ||
@@ -28,3 +28,3 @@ readonly provider: string; | ||
| /** | ||
| Provider-specific model ID for logging purposes. | ||
| * Provider-specific model ID for logging purposes. | ||
| */ | ||
@@ -34,12 +34,12 @@ readonly modelId: string; | ||
| /** | ||
| Supported URL patterns by media type for the provider. | ||
| The keys are media type patterns or full media types (e.g. `*\/*` for everything, `audio/*`, `video/*`, or `application/pdf`). | ||
| and the values are arrays of regular expressions that match the URL paths. | ||
| The matching should be against lower-case URLs. | ||
| Matched URLs are supported natively by the model and are not downloaded. | ||
| @returns A map of supported URL patterns by media type (as a promise or a plain object). | ||
| * Supported URL patterns by media type for the provider. | ||
| * | ||
| * The keys are media type patterns or full media types (e.g. `*\/*` for everything, `audio/*`, `video/*`, or `application/pdf`). | ||
| * and the values are arrays of regular expressions that match the URL paths. | ||
| * | ||
| * The matching should be against lower-case URLs. | ||
| * | ||
| * Matched URLs are supported natively by the model and are not downloaded. | ||
| * | ||
| * @returns A map of supported URL patterns by media type (as a promise or a plain object). | ||
| */ | ||
@@ -51,10 +51,10 @@ supportedUrls: | ||
| /** | ||
| Generates a language model output (non-streaming). | ||
| Naming: "do" prefix to prevent accidental direct usage of the method | ||
| by the user. | ||
| * Generates a language model output (non-streaming). | ||
| * | ||
| * Naming: "do" prefix to prevent accidental direct usage of the method | ||
| * by the user. | ||
| */ | ||
| doGenerate(options: LanguageModelV2CallOptions): PromiseLike<{ | ||
| /** | ||
| Ordered content that the model has generated. | ||
| * Ordered content that the model has generated. | ||
| */ | ||
@@ -64,3 +64,3 @@ content: Array<LanguageModelV2Content>; | ||
| /** | ||
| Finish reason. | ||
| * Finish reason. | ||
| */ | ||
@@ -70,3 +70,3 @@ finishReason: LanguageModelV2FinishReason; | ||
| /** | ||
| Usage information. | ||
| * Usage information. | ||
| */ | ||
@@ -76,5 +76,5 @@ usage: LanguageModelV2Usage; | ||
| /** | ||
| Additional provider-specific metadata. They are passed through | ||
| from the provider to the AI SDK and enable provider-specific | ||
| results that can be fully encapsulated in the provider. | ||
| * Additional provider-specific metadata. They are passed through | ||
| * from the provider to the AI SDK and enable provider-specific | ||
| * results that can be fully encapsulated in the provider. | ||
| */ | ||
@@ -84,7 +84,7 @@ providerMetadata?: SharedV2ProviderMetadata; | ||
| /** | ||
| Optional request information for telemetry and debugging purposes. | ||
| * Optional request information for telemetry and debugging purposes. | ||
| */ | ||
| request?: { | ||
| /** | ||
| Request HTTP body that was sent to the provider API. | ||
| * Request HTTP body that was sent to the provider API. | ||
| */ | ||
@@ -95,13 +95,13 @@ body?: unknown; | ||
| /** | ||
| Optional response information for telemetry and debugging purposes. | ||
| * Optional response information for telemetry and debugging purposes. | ||
| */ | ||
| response?: LanguageModelV2ResponseMetadata & { | ||
| /** | ||
| Response headers. | ||
| */ | ||
| * Response headers. | ||
| */ | ||
| headers?: SharedV2Headers; | ||
| /** | ||
| Response HTTP body. | ||
| */ | ||
| * Response HTTP body. | ||
| */ | ||
| body?: unknown; | ||
@@ -111,3 +111,3 @@ }; | ||
| /** | ||
| Warnings for the call, e.g. unsupported settings. | ||
| * Warnings for the call, e.g. unsupported settings. | ||
| */ | ||
@@ -118,8 +118,8 @@ warnings: Array<LanguageModelV2CallWarning>; | ||
| /** | ||
| Generates a language model output (streaming). | ||
| Naming: "do" prefix to prevent accidental direct usage of the method | ||
| by the user. | ||
| * Generates a language model output (streaming). | ||
| * | ||
| @return A stream of higher-level language model output parts. | ||
| * Naming: "do" prefix to prevent accidental direct usage of the method | ||
| * by the user. | ||
| * | ||
| * @return A stream of higher-level language model output parts. | ||
| */ | ||
@@ -130,8 +130,8 @@ doStream(options: LanguageModelV2CallOptions): PromiseLike<{ | ||
| /** | ||
| Optional request information for telemetry and debugging purposes. | ||
| * Optional request information for telemetry and debugging purposes. | ||
| */ | ||
| request?: { | ||
| /** | ||
| Request HTTP body that was sent to the provider API. | ||
| */ | ||
| * Request HTTP body that was sent to the provider API. | ||
| */ | ||
| body?: unknown; | ||
@@ -141,7 +141,7 @@ }; | ||
| /** | ||
| Optional response data. | ||
| * Optional response data. | ||
| */ | ||
| response?: { | ||
| /** | ||
| Response headers. | ||
| * Response headers. | ||
| */ | ||
@@ -148,0 +148,0 @@ headers?: SharedV2Headers; |
@@ -10,8 +10,8 @@ import { JSONSchema7 } from 'json-schema'; | ||
| /** | ||
| A language mode prompt is a standardized prompt type. | ||
| Note: This is **not** the user-facing prompt. The AI SDK methods will map the | ||
| user-facing prompt types such as chat or instruction prompts to this format. | ||
| That approach allows us to evolve the user facing prompts without breaking | ||
| the language model interface. | ||
| * A language mode prompt is a standardized prompt type. | ||
| * | ||
| * Note: This is **not** the user-facing prompt. The AI SDK methods will map the | ||
| * user-facing prompt types such as chat or instruction prompts to this format. | ||
| * That approach allows us to evolve the user facing prompts without breaking | ||
| * the language model interface. | ||
| */ | ||
@@ -21,3 +21,3 @@ prompt: LanguageModelV3Prompt; | ||
| /** | ||
| Maximum number of tokens to generate. | ||
| * Maximum number of tokens to generate. | ||
| */ | ||
@@ -27,43 +27,43 @@ maxOutputTokens?: number; | ||
| /** | ||
| Temperature setting. The range depends on the provider and model. | ||
| */ | ||
| * Temperature setting. The range depends on the provider and model. | ||
| */ | ||
| temperature?: number; | ||
| /** | ||
| Stop sequences. | ||
| If set, the model will stop generating text when one of the stop sequences is generated. | ||
| Providers may have limits on the number of stop sequences. | ||
| */ | ||
| * Stop sequences. | ||
| * If set, the model will stop generating text when one of the stop sequences is generated. | ||
| * Providers may have limits on the number of stop sequences. | ||
| */ | ||
| stopSequences?: string[]; | ||
| /** | ||
| Nucleus sampling. | ||
| */ | ||
| * Nucleus sampling. | ||
| */ | ||
| topP?: number; | ||
| /** | ||
| Only sample from the top K options for each subsequent token. | ||
| Used to remove "long tail" low probability responses. | ||
| Recommended for advanced use cases only. You usually only need to use temperature. | ||
| */ | ||
| * Only sample from the top K options for each subsequent token. | ||
| * | ||
| * Used to remove "long tail" low probability responses. | ||
| * Recommended for advanced use cases only. You usually only need to use temperature. | ||
| */ | ||
| topK?: number; | ||
| /** | ||
| Presence penalty setting. It affects the likelihood of the model to | ||
| repeat information that is already in the prompt. | ||
| */ | ||
| * Presence penalty setting. It affects the likelihood of the model to | ||
| * repeat information that is already in the prompt. | ||
| */ | ||
| presencePenalty?: number; | ||
| /** | ||
| Frequency penalty setting. It affects the likelihood of the model | ||
| to repeatedly use the same words or phrases. | ||
| */ | ||
| * Frequency penalty setting. It affects the likelihood of the model | ||
| * to repeatedly use the same words or phrases. | ||
| */ | ||
| frequencyPenalty?: number; | ||
| /** | ||
| Response format. The output can either be text or JSON. Default is text. | ||
| If JSON is selected, a schema can optionally be provided to guide the LLM. | ||
| */ | ||
| * Response format. The output can either be text or JSON. Default is text. | ||
| * | ||
| * If JSON is selected, a schema can optionally be provided to guide the LLM. | ||
| */ | ||
| responseFormat?: | ||
@@ -91,31 +91,31 @@ | { type: 'text' } | ||
| /** | ||
| The seed (integer) to use for random sampling. If set and supported | ||
| by the model, calls will generate deterministic results. | ||
| */ | ||
| * The seed (integer) to use for random sampling. If set and supported | ||
| * by the model, calls will generate deterministic results. | ||
| */ | ||
| seed?: number; | ||
| /** | ||
| The tools that are available for the model. | ||
| */ | ||
| * The tools that are available for the model. | ||
| */ | ||
| tools?: Array<LanguageModelV3FunctionTool | LanguageModelV3ProviderTool>; | ||
| /** | ||
| Specifies how the tool should be selected. Defaults to 'auto'. | ||
| */ | ||
| * Specifies how the tool should be selected. Defaults to 'auto'. | ||
| */ | ||
| toolChoice?: LanguageModelV3ToolChoice; | ||
| /** | ||
| Include raw chunks in the stream. Only applicable for streaming calls. | ||
| */ | ||
| * Include raw chunks in the stream. Only applicable for streaming calls. | ||
| */ | ||
| includeRawChunks?: boolean; | ||
| /** | ||
| Abort signal for cancelling the operation. | ||
| */ | ||
| * Abort signal for cancelling the operation. | ||
| */ | ||
| abortSignal?: AbortSignal; | ||
| /** | ||
| Additional HTTP headers to be sent with the request. | ||
| Only applicable for HTTP-based providers. | ||
| */ | ||
| * Additional HTTP headers to be sent with the request. | ||
| * Only applicable for HTTP-based providers. | ||
| */ | ||
| headers?: Record<string, string | undefined>; | ||
@@ -122,0 +122,0 @@ |
| /** | ||
| Data content. Can be a Uint8Array, base64 encoded data as a string or a URL. | ||
| */ | ||
| * Data content. Can be a Uint8Array, base64 encoded data as a string or a URL. | ||
| */ | ||
| export type LanguageModelV3DataContent = Uint8Array | string | URL; |
| import { SharedV3ProviderMetadata } from '../../shared'; | ||
| /** | ||
| A file that has been generated by the model. | ||
| Generated files as base64 encoded strings or binary data. | ||
| The files should be returned without any unnecessary conversion. | ||
| * A file that has been generated by the model. | ||
| * Generated files as base64 encoded strings or binary data. | ||
| * The files should be returned without any unnecessary conversion. | ||
| */ | ||
@@ -12,16 +12,16 @@ export type LanguageModelV3File = { | ||
| /** | ||
| The IANA media type of the file, e.g. `image/png` or `audio/mp3`. | ||
| @see https://www.iana.org/assignments/media-types/media-types.xhtml | ||
| */ | ||
| * The IANA media type of the file, e.g. `image/png` or `audio/mp3`. | ||
| * | ||
| * @see https://www.iana.org/assignments/media-types/media-types.xhtml | ||
| */ | ||
| mediaType: string; | ||
| /** | ||
| Generated file data as base64 encoded strings or binary data. | ||
| The file data should be returned without any unnecessary conversion. | ||
| If the API returns base64 encoded strings, the file data should be returned | ||
| as base64 encoded strings. If the API returns binary data, the file data should | ||
| be returned as binary data. | ||
| */ | ||
| * Generated file data as base64 encoded strings or binary data. | ||
| * | ||
| * The file data should be returned without any unnecessary conversion. | ||
| * If the API returns base64 encoded strings, the file data should be returned | ||
| * as base64 encoded strings. If the API returns binary data, the file data should | ||
| * be returned as binary data. | ||
| */ | ||
| data: string | Uint8Array; | ||
@@ -28,0 +28,0 @@ |
@@ -6,10 +6,10 @@ import { JSONSchema7 } from 'json-schema'; | ||
| /** | ||
| A tool has a name, a description, and a set of parameters. | ||
| Note: this is **not** the user-facing tool definition. The AI SDK methods will | ||
| map the user-facing tool definitions to this format. | ||
| * A tool has a name, a description, and a set of parameters. | ||
| * | ||
| * Note: this is **not** the user-facing tool definition. The AI SDK methods will | ||
| * map the user-facing tool definitions to this format. | ||
| */ | ||
| export type LanguageModelV3FunctionTool = { | ||
| /** | ||
| The type of the tool (always 'function'). | ||
| * The type of the tool (always 'function'). | ||
| */ | ||
@@ -19,3 +19,3 @@ type: 'function'; | ||
| /** | ||
| The name of the tool. Unique within this model call. | ||
| * The name of the tool. Unique within this model call. | ||
| */ | ||
@@ -25,4 +25,4 @@ name: string; | ||
| /** | ||
| A description of the tool. The language model uses this to understand the | ||
| tool's purpose and to provide better completion suggestions. | ||
| * A description of the tool. The language model uses this to understand the | ||
| * tool's purpose and to provide better completion suggestions. | ||
| */ | ||
@@ -32,4 +32,4 @@ description?: string; | ||
| /** | ||
| The parameters that the tool expects. The language model uses this to | ||
| understand the tool's input requirements and to provide matching suggestions. | ||
| * The parameters that the tool expects. The language model uses this to | ||
| * understand the tool's input requirements and to provide matching suggestions. | ||
| */ | ||
@@ -54,5 +54,5 @@ inputSchema: JSONSchema7; | ||
| /** | ||
| The provider-specific options for the tool. | ||
| * The provider-specific options for the tool. | ||
| */ | ||
| providerOptions?: SharedV3ProviderOptions; | ||
| }; |
@@ -6,9 +6,9 @@ import { JSONValue } from '../../json-value/json-value'; | ||
| /** | ||
| A prompt is a list of messages. | ||
| Note: Not all models and prompt formats support multi-modal inputs and | ||
| tool calls. The validation happens at runtime. | ||
| Note: This is not a user-facing prompt. The AI SDK methods will map the | ||
| user-facing prompt types such as chat or instruction prompts to this format. | ||
| * A prompt is a list of messages. | ||
| * | ||
| * Note: Not all models and prompt formats support multi-modal inputs and | ||
| * tool calls. The validation happens at runtime. | ||
| * | ||
| * Note: This is not a user-facing prompt. The AI SDK methods will map the | ||
| * user-facing prompt types such as chat or instruction prompts to this format. | ||
| */ | ||
@@ -57,3 +57,3 @@ export type LanguageModelV3Prompt = Array<LanguageModelV3Message>; | ||
| /** | ||
| Text content part of a prompt. It contains a string of text. | ||
| * Text content part of a prompt. It contains a string of text. | ||
| */ | ||
@@ -64,3 +64,3 @@ export interface LanguageModelV3TextPart { | ||
| /** | ||
| The text content. | ||
| * The text content. | ||
| */ | ||
@@ -78,3 +78,3 @@ text: string; | ||
| /** | ||
| Reasoning content part of a prompt. It contains a string of reasoning text. | ||
| * Reasoning content part of a prompt. It contains a string of reasoning text. | ||
| */ | ||
@@ -85,3 +85,3 @@ export interface LanguageModelV3ReasoningPart { | ||
| /** | ||
| The reasoning text. | ||
| * The reasoning text. | ||
| */ | ||
@@ -99,3 +99,3 @@ text: string; | ||
| /** | ||
| File content part of a prompt. It contains a file. | ||
| * File content part of a prompt. It contains a file. | ||
| */ | ||
@@ -111,12 +111,12 @@ export interface LanguageModelV3FilePart { | ||
| /** | ||
| File data. Can be a Uint8Array, base64 encoded data as a string or a URL. | ||
| */ | ||
| * File data. Can be a Uint8Array, base64 encoded data as a string or a URL. | ||
| */ | ||
| data: LanguageModelV3DataContent; | ||
| /** | ||
| IANA media type of the file. | ||
| Can support wildcards, e.g. `image/*` (in which case the provider needs to take appropriate action). | ||
| @see https://www.iana.org/assignments/media-types/media-types.xhtml | ||
| * IANA media type of the file. | ||
| * | ||
| * Can support wildcards, e.g. `image/*` (in which case the provider needs to take appropriate action). | ||
| * | ||
| * @see https://www.iana.org/assignments/media-types/media-types.xhtml | ||
| */ | ||
@@ -134,3 +134,3 @@ mediaType: string; | ||
| /** | ||
| Tool call content part of a prompt. It contains a tool call (usually generated by the AI model). | ||
| * Tool call content part of a prompt. It contains a tool call (usually generated by the AI model). | ||
| */ | ||
@@ -141,13 +141,13 @@ export interface LanguageModelV3ToolCallPart { | ||
| /** | ||
| ID of the tool call. This ID is used to match the tool call with the tool result. | ||
| */ | ||
| * ID of the tool call. This ID is used to match the tool call with the tool result. | ||
| */ | ||
| toolCallId: string; | ||
| /** | ||
| Name of the tool that is being called. | ||
| */ | ||
| * Name of the tool that is being called. | ||
| */ | ||
| toolName: string; | ||
| /** | ||
| Arguments of the tool call. This is a JSON-serializable object that matches the tool's input schema. | ||
| * Arguments of the tool call. This is a JSON-serializable object that matches the tool's input schema. | ||
| */ | ||
@@ -171,3 +171,3 @@ input: unknown; | ||
| /** | ||
| Tool result content part of a prompt. It contains the result of the tool call with the matching ID. | ||
| * Tool result content part of a prompt. It contains the result of the tool call with the matching ID. | ||
| */ | ||
@@ -178,13 +178,13 @@ export interface LanguageModelV3ToolResultPart { | ||
| /** | ||
| ID of the tool call that this result is associated with. | ||
| */ | ||
| * ID of the tool call that this result is associated with. | ||
| */ | ||
| toolCallId: string; | ||
| /** | ||
| Name of the tool that generated this result. | ||
| */ | ||
| * Name of the tool that generated this result. | ||
| */ | ||
| toolName: string; | ||
| /** | ||
| Result of the tool call. | ||
| * Result of the tool call. | ||
| */ | ||
@@ -297,4 +297,4 @@ output: LanguageModelV3ToolResultOutput; | ||
| /** | ||
| Text content. | ||
| */ | ||
| * Text content. | ||
| */ | ||
| text: string; | ||
@@ -311,10 +311,10 @@ | ||
| /** | ||
| Base-64 encoded media data. | ||
| */ | ||
| * Base-64 encoded media data. | ||
| */ | ||
| data: string; | ||
| /** | ||
| IANA media type. | ||
| @see https://www.iana.org/assignments/media-types/media-types.xhtml | ||
| */ | ||
| * IANA media type. | ||
| * @see https://www.iana.org/assignments/media-types/media-types.xhtml | ||
| */ | ||
| mediaType: string; | ||
@@ -370,10 +370,10 @@ | ||
| /** | ||
| Base-64 encoded image data. | ||
| */ | ||
| * Base-64 encoded image data. | ||
| */ | ||
| data: string; | ||
| /** | ||
| IANA media type. | ||
| @see https://www.iana.org/assignments/media-types/media-types.xhtml | ||
| */ | ||
| * IANA media type. | ||
| * @see https://www.iana.org/assignments/media-types/media-types.xhtml | ||
| */ | ||
| mediaType: string; | ||
@@ -380,0 +380,0 @@ |
| import { SharedV3ProviderMetadata } from '../../shared'; | ||
| /** | ||
| Reasoning that the model has generated. | ||
| * Reasoning that the model has generated. | ||
| */ | ||
@@ -6,0 +6,0 @@ export type LanguageModelV3Reasoning = { |
| export interface LanguageModelV3ResponseMetadata { | ||
| /** | ||
| ID for the generated response, if the provider sends one. | ||
| */ | ||
| * ID for the generated response, if the provider sends one. | ||
| */ | ||
| id?: string; | ||
| /** | ||
| Timestamp for the start of the generated response, if the provider sends one. | ||
| */ | ||
| * Timestamp for the start of the generated response, if the provider sends one. | ||
| */ | ||
| timestamp?: Date; | ||
| /** | ||
| The ID of the response model that was used to generate the response, if the provider sends one. | ||
| */ | ||
| * The ID of the response model that was used to generate the response, if the provider sends one. | ||
| */ | ||
| modelId?: string; | ||
| } |
| import { SharedV3ProviderMetadata } from '../../shared/v3/shared-v3-provider-metadata'; | ||
| /** | ||
| A source that has been used as input to generate the response. | ||
| * A source that has been used as input to generate the response. | ||
| */ | ||
@@ -6,0 +6,0 @@ export type LanguageModelV3Source = |
| import { SharedV3ProviderMetadata } from '../../shared/v3/shared-v3-provider-metadata'; | ||
| /** | ||
| Text that the model has generated. | ||
| * Text that the model has generated. | ||
| */ | ||
@@ -10,3 +10,3 @@ export type LanguageModelV3Text = { | ||
| /** | ||
| The text content. | ||
| * The text content. | ||
| */ | ||
@@ -13,0 +13,0 @@ text: string; |
@@ -5,3 +5,3 @@ import { JSONValue } from '../../json-value'; | ||
| /** | ||
| Result of a tool call that has been executed by the provider. | ||
| * Result of a tool call that has been executed by the provider. | ||
| */ | ||
@@ -8,0 +8,0 @@ export type LanguageModelV3ToolResult = { |
@@ -12,3 +12,3 @@ import { JSONObject } from '../../json-value'; | ||
| /** | ||
| *The total number of input (prompt) tokens used. | ||
| * The total number of input (prompt) tokens used. | ||
| */ | ||
@@ -15,0 +15,0 @@ total: number | undefined; |
@@ -12,10 +12,10 @@ import { EmbeddingModelV2 } from '../../embedding-model/v2/embedding-model-v2'; | ||
| /** | ||
| Returns the language model with the given id. | ||
| The model id is then passed to the provider function to get the model. | ||
| @param {string} modelId - The id of the model to return. | ||
| @returns {LanguageModel} The language model associated with the id | ||
| @throws {NoSuchModelError} If no such model exists. | ||
| * Returns the language model with the given id. | ||
| * The model id is then passed to the provider function to get the model. | ||
| * | ||
| * @param {string} modelId - The id of the model to return. | ||
| * | ||
| * @returns {LanguageModel} The language model associated with the id | ||
| * | ||
| * @throws {NoSuchModelError} If no such model exists. | ||
| */ | ||
@@ -25,10 +25,10 @@ languageModel(modelId: string): LanguageModelV2; | ||
| /** | ||
| Returns the text embedding model with the given id. | ||
| The model id is then passed to the provider function to get the model. | ||
| @param {string} modelId - The id of the model to return. | ||
| @returns {LanguageModel} The language model associated with the id | ||
| @throws {NoSuchModelError} If no such model exists. | ||
| * Returns the text embedding model with the given id. | ||
| * The model id is then passed to the provider function to get the model. | ||
| * | ||
| * @param {string} modelId - The id of the model to return. | ||
| * | ||
| * @returns {LanguageModel} The language model associated with the id | ||
| * | ||
| * @throws {NoSuchModelError} If no such model exists. | ||
| */ | ||
@@ -38,30 +38,30 @@ textEmbeddingModel(modelId: string): EmbeddingModelV2<string>; | ||
| /** | ||
| Returns the image model with the given id. | ||
| The model id is then passed to the provider function to get the model. | ||
| @param {string} modelId - The id of the model to return. | ||
| @returns {ImageModel} The image model associated with the id | ||
| */ | ||
| * Returns the image model with the given id. | ||
| * The model id is then passed to the provider function to get the model. | ||
| * | ||
| * @param {string} modelId - The id of the model to return. | ||
| * | ||
| * @returns {ImageModel} The image model associated with the id | ||
| */ | ||
| imageModel(modelId: string): ImageModelV2; | ||
| /** | ||
| Returns the transcription model with the given id. | ||
| The model id is then passed to the provider function to get the model. | ||
| @param {string} modelId - The id of the model to return. | ||
| @returns {TranscriptionModel} The transcription model associated with the id | ||
| */ | ||
| * Returns the transcription model with the given id. | ||
| * The model id is then passed to the provider function to get the model. | ||
| * | ||
| * @param {string} modelId - The id of the model to return. | ||
| * | ||
| * @returns {TranscriptionModel} The transcription model associated with the id | ||
| */ | ||
| transcriptionModel?(modelId: string): TranscriptionModelV2; | ||
| /** | ||
| Returns the speech model with the given id. | ||
| The model id is then passed to the provider function to get the model. | ||
| @param {string} modelId - The id of the model to return. | ||
| @returns {SpeechModel} The speech model associated with the id | ||
| */ | ||
| * Returns the speech model with the given id. | ||
| * The model id is then passed to the provider function to get the model. | ||
| * | ||
| * @param {string} modelId - The id of the model to return. | ||
| * | ||
| * @returns {SpeechModel} The speech model associated with the id | ||
| */ | ||
| speechModel?(modelId: string): SpeechModelV2; | ||
| } |
@@ -15,10 +15,10 @@ import { EmbeddingModelV3 } from '../../embedding-model/v3/embedding-model-v3'; | ||
| /** | ||
| Returns the language model with the given id. | ||
| The model id is then passed to the provider function to get the model. | ||
| @param {string} modelId - The id of the model to return. | ||
| @returns {LanguageModel} The language model associated with the id | ||
| @throws {NoSuchModelError} If no such model exists. | ||
| * Returns the language model with the given id. | ||
| * The model id is then passed to the provider function to get the model. | ||
| * | ||
| * @param {string} modelId - The id of the model to return. | ||
| * | ||
| * @returns {LanguageModel} The language model associated with the id | ||
| * | ||
| * @throws {NoSuchModelError} If no such model exists. | ||
| */ | ||
@@ -28,10 +28,10 @@ languageModel(modelId: string): LanguageModelV3; | ||
| /** | ||
| Returns the text embedding model with the given id. | ||
| The model id is then passed to the provider function to get the model. | ||
| @param {string} modelId - The id of the model to return. | ||
| @returns {LanguageModel} The language model associated with the id | ||
| @throws {NoSuchModelError} If no such model exists. | ||
| * Returns the text embedding model with the given id. | ||
| * The model id is then passed to the provider function to get the model. | ||
| * | ||
| * @param {string} modelId - The id of the model to return. | ||
| * | ||
| * @returns {LanguageModel} The language model associated with the id | ||
| * | ||
| * @throws {NoSuchModelError} If no such model exists. | ||
| */ | ||
@@ -41,12 +41,12 @@ embeddingModel(modelId: string): EmbeddingModelV3; | ||
| /** | ||
| Returns the text embedding model with the given id. | ||
| The model id is then passed to the provider function to get the model. | ||
| @param {string} modelId - The id of the model to return. | ||
| @returns {EmbeddingModel} The embedding model associated with the id | ||
| @throws {NoSuchModelError} If no such model exists. | ||
| @deprecated Use `embeddingModel` instead. | ||
| * Returns the text embedding model with the given id. | ||
| * The model id is then passed to the provider function to get the model. | ||
| * | ||
| * @param {string} modelId - The id of the model to return. | ||
| * | ||
| * @returns {EmbeddingModel} The embedding model associated with the id | ||
| * | ||
| * @throws {NoSuchModelError} If no such model exists. | ||
| * | ||
| * @deprecated Use `embeddingModel` instead. | ||
| */ | ||
@@ -56,42 +56,42 @@ textEmbeddingModel?(modelId: string): EmbeddingModelV3; | ||
| /** | ||
| Returns the image model with the given id. | ||
| The model id is then passed to the provider function to get the model. | ||
| @param {string} modelId - The id of the model to return. | ||
| @returns {ImageModel} The image model associated with the id | ||
| */ | ||
| * Returns the image model with the given id. | ||
| * The model id is then passed to the provider function to get the model. | ||
| * | ||
| * @param {string} modelId - The id of the model to return. | ||
| * | ||
| * @returns {ImageModel} The image model associated with the id | ||
| */ | ||
| imageModel(modelId: string): ImageModelV3; | ||
| /** | ||
| Returns the transcription model with the given id. | ||
| The model id is then passed to the provider function to get the model. | ||
| @param {string} modelId - The id of the model to return. | ||
| @returns {TranscriptionModel} The transcription model associated with the id | ||
| */ | ||
| * Returns the transcription model with the given id. | ||
| * The model id is then passed to the provider function to get the model. | ||
| * | ||
| * @param {string} modelId - The id of the model to return. | ||
| * | ||
| * @returns {TranscriptionModel} The transcription model associated with the id | ||
| */ | ||
| transcriptionModel?(modelId: string): TranscriptionModelV3; | ||
| /** | ||
| Returns the speech model with the given id. | ||
| The model id is then passed to the provider function to get the model. | ||
| @param {string} modelId - The id of the model to return. | ||
| @returns {SpeechModel} The speech model associated with the id | ||
| */ | ||
| * Returns the speech model with the given id. | ||
| * The model id is then passed to the provider function to get the model. | ||
| * | ||
| * @param {string} modelId - The id of the model to return. | ||
| * | ||
| * @returns {SpeechModel} The speech model associated with the id | ||
| */ | ||
| speechModel?(modelId: string): SpeechModelV3; | ||
| /** | ||
| Returns the reranking model with the given id. | ||
| The model id is then passed to the provider function to get the model. | ||
| @param {string} modelId - The id of the model to return. | ||
| @returns {RerankingModel} The reranking model associated with the id | ||
| @throws {NoSuchModelError} If no such model exists. | ||
| * Returns the reranking model with the given id. | ||
| * The model id is then passed to the provider function to get the model. | ||
| * | ||
| * @param {string} modelId - The id of the model to return. | ||
| * | ||
| * @returns {RerankingModel} The reranking model associated with the id | ||
| * | ||
| * @throws {NoSuchModelError} If no such model exists. | ||
| */ | ||
| rerankingModel?(modelId: string): RerankingModelV3; | ||
| } |
@@ -10,11 +10,11 @@ import { JSONValue } from '../../json-value/json-value'; | ||
| /** | ||
| Audio data to transcribe. | ||
| Accepts a `Uint8Array` or `string`, where `string` is a base64 encoded audio file. | ||
| */ | ||
| * Audio data to transcribe. | ||
| * Accepts a `Uint8Array` or `string`, where `string` is a base64 encoded audio file. | ||
| */ | ||
| audio: Uint8Array | string; | ||
| /** | ||
| The IANA media type of the audio data. | ||
| @see https://www.iana.org/assignments/media-types/media-types.xhtml | ||
| * The IANA media type of the audio data. | ||
| * | ||
| * @see https://www.iana.org/assignments/media-types/media-types.xhtml | ||
| */ | ||
@@ -24,27 +24,27 @@ mediaType: string; | ||
| /** | ||
| Additional provider-specific options that are passed through to the provider | ||
| as body parameters. | ||
| The outer record is keyed by the provider name, and the inner | ||
| record is keyed by the provider-specific metadata key. | ||
| ```ts | ||
| { | ||
| "openai": { | ||
| "timestampGranularities": ["word"] | ||
| } | ||
| } | ||
| ``` | ||
| */ | ||
| * Additional provider-specific options that are passed through to the provider | ||
| * as body parameters. | ||
| * | ||
| * The outer record is keyed by the provider name, and the inner | ||
| * record is keyed by the provider-specific metadata key. | ||
| * ```ts | ||
| * { | ||
| * "openai": { | ||
| * "timestampGranularities": ["word"] | ||
| * } | ||
| * } | ||
| * ``` | ||
| */ | ||
| providerOptions?: TranscriptionModelV2ProviderOptions; | ||
| /** | ||
| Abort signal for cancelling the operation. | ||
| */ | ||
| * Abort signal for cancelling the operation. | ||
| */ | ||
| abortSignal?: AbortSignal; | ||
| /** | ||
| Additional HTTP headers to be sent with the request. | ||
| Only applicable for HTTP-based providers. | ||
| */ | ||
| * Additional HTTP headers to be sent with the request. | ||
| * Only applicable for HTTP-based providers. | ||
| */ | ||
| headers?: Record<string, string | undefined>; | ||
| }; |
| import { TranscriptionModelV2CallOptions } from './transcription-model-v2-call-options'; | ||
| /** | ||
| Warning from the model provider for this call. The call will proceed, but e.g. | ||
| some settings might not be supported, which can lead to suboptimal results. | ||
| * Warning from the model provider for this call. The call will proceed, but e.g. | ||
| * some settings might not be supported, which can lead to suboptimal results. | ||
| */ | ||
@@ -7,0 +7,0 @@ export type TranscriptionModelV2CallWarning = |
@@ -7,11 +7,11 @@ import { JSONValue } from '../../json-value'; | ||
| /** | ||
| Transcription model specification version 2. | ||
| * Transcription model specification version 2. | ||
| */ | ||
| export type TranscriptionModelV2 = { | ||
| /** | ||
| The transcription model must specify which transcription model interface | ||
| version it implements. This will allow us to evolve the transcription | ||
| model interface and retain backwards compatibility. The different | ||
| implementation versions can be handled as a discriminated union | ||
| on our side. | ||
| * The transcription model must specify which transcription model interface | ||
| * version it implements. This will allow us to evolve the transcription | ||
| * model interface and retain backwards compatibility. The different | ||
| * implementation versions can be handled as a discriminated union | ||
| * on our side. | ||
| */ | ||
@@ -21,3 +21,3 @@ readonly specificationVersion: 'v2'; | ||
| /** | ||
| Name of the provider for logging purposes. | ||
| * Name of the provider for logging purposes. | ||
| */ | ||
@@ -27,3 +27,3 @@ readonly provider: string; | ||
| /** | ||
| Provider-specific model ID for logging purposes. | ||
| * Provider-specific model ID for logging purposes. | ||
| */ | ||
@@ -33,3 +33,3 @@ readonly modelId: string; | ||
| /** | ||
| Generates a transcript. | ||
| * Generates a transcript. | ||
| */ | ||
@@ -74,3 +74,3 @@ doGenerate(options: TranscriptionModelV2CallOptions): PromiseLike<{ | ||
| /** | ||
| Warnings for the call, e.g. unsupported settings. | ||
| * Warnings for the call, e.g. unsupported settings. | ||
| */ | ||
@@ -80,8 +80,8 @@ warnings: Array<TranscriptionModelV2CallWarning>; | ||
| /** | ||
| Optional request information for telemetry and debugging purposes. | ||
| * Optional request information for telemetry and debugging purposes. | ||
| */ | ||
| request?: { | ||
| /** | ||
| Raw request HTTP body that was sent to the provider API as a string (JSON should be stringified). | ||
| Non-HTTP(s) providers should not set this. | ||
| * Raw request HTTP body that was sent to the provider API as a string (JSON should be stringified). | ||
| * Non-HTTP(s) providers should not set this. | ||
| */ | ||
@@ -92,23 +92,23 @@ body?: string; | ||
| /** | ||
| Response information for telemetry and debugging purposes. | ||
| * Response information for telemetry and debugging purposes. | ||
| */ | ||
| response: { | ||
| /** | ||
| Timestamp for the start of the generated response. | ||
| */ | ||
| * Timestamp for the start of the generated response. | ||
| */ | ||
| timestamp: Date; | ||
| /** | ||
| The ID of the response model that was used to generate the response. | ||
| */ | ||
| * The ID of the response model that was used to generate the response. | ||
| */ | ||
| modelId: string; | ||
| /** | ||
| Response headers. | ||
| */ | ||
| * Response headers. | ||
| */ | ||
| headers?: SharedV2Headers; | ||
| /** | ||
| Response body. | ||
| */ | ||
| * Response body. | ||
| */ | ||
| body?: unknown; | ||
@@ -118,5 +118,5 @@ }; | ||
| /** | ||
| Additional provider-specific metadata. They are passed through | ||
| from the provider to the AI SDK and enable provider-specific | ||
| results that can be fully encapsulated in the provider. | ||
| * Additional provider-specific metadata. They are passed through | ||
| * from the provider to the AI SDK and enable provider-specific | ||
| * results that can be fully encapsulated in the provider. | ||
| */ | ||
@@ -123,0 +123,0 @@ providerMetadata?: Record<string, Record<string, JSONValue>>; |
@@ -7,11 +7,11 @@ import { JSONObject } from '../../json-value/json-value'; | ||
| /** | ||
| Audio data to transcribe. | ||
| Accepts a `Uint8Array` or `string`, where `string` is a base64 encoded audio file. | ||
| */ | ||
| * Audio data to transcribe. | ||
| * Accepts a `Uint8Array` or `string`, where `string` is a base64 encoded audio file. | ||
| */ | ||
| audio: Uint8Array | string; | ||
| /** | ||
| The IANA media type of the audio data. | ||
| @see https://www.iana.org/assignments/media-types/media-types.xhtml | ||
| * The IANA media type of the audio data. | ||
| * | ||
| * @see https://www.iana.org/assignments/media-types/media-types.xhtml | ||
| */ | ||
@@ -21,27 +21,27 @@ mediaType: string; | ||
| /** | ||
| Additional provider-specific options that are passed through to the provider | ||
| as body parameters. | ||
| The outer record is keyed by the provider name, and the inner | ||
| record is keyed by the provider-specific metadata key. | ||
| ```ts | ||
| { | ||
| "openai": { | ||
| "timestampGranularities": ["word"] | ||
| } | ||
| } | ||
| ``` | ||
| */ | ||
| * Additional provider-specific options that are passed through to the provider | ||
| * as body parameters. | ||
| * | ||
| * The outer record is keyed by the provider name, and the inner | ||
| * record is keyed by the provider-specific metadata key. | ||
| * ```ts | ||
| * { | ||
| * "openai": { | ||
| * "timestampGranularities": ["word"] | ||
| * } | ||
| * } | ||
| * ``` | ||
| */ | ||
| providerOptions?: TranscriptionModelV3ProviderOptions; | ||
| /** | ||
| Abort signal for cancelling the operation. | ||
| */ | ||
| * Abort signal for cancelling the operation. | ||
| */ | ||
| abortSignal?: AbortSignal; | ||
| /** | ||
| Additional HTTP headers to be sent with the request. | ||
| Only applicable for HTTP-based providers. | ||
| */ | ||
| * Additional HTTP headers to be sent with the request. | ||
| * Only applicable for HTTP-based providers. | ||
| */ | ||
| headers?: Record<string, string | undefined>; | ||
| }; |
@@ -7,11 +7,11 @@ import { JSONObject } from '../../json-value'; | ||
| /** | ||
| Transcription model specification version 3. | ||
| * Transcription model specification version 3. | ||
| */ | ||
| export type TranscriptionModelV3 = { | ||
| /** | ||
| The transcription model must specify which transcription model interface | ||
| version it implements. This will allow us to evolve the transcription | ||
| model interface and retain backwards compatibility. The different | ||
| implementation versions can be handled as a discriminated union | ||
| on our side. | ||
| * The transcription model must specify which transcription model interface | ||
| * version it implements. This will allow us to evolve the transcription | ||
| * model interface and retain backwards compatibility. The different | ||
| * implementation versions can be handled as a discriminated union | ||
| * on our side. | ||
| */ | ||
@@ -21,3 +21,3 @@ readonly specificationVersion: 'v3'; | ||
| /** | ||
| Name of the provider for logging purposes. | ||
| * Name of the provider for logging purposes. | ||
| */ | ||
@@ -27,3 +27,3 @@ readonly provider: string; | ||
| /** | ||
| Provider-specific model ID for logging purposes. | ||
| * Provider-specific model ID for logging purposes. | ||
| */ | ||
@@ -33,3 +33,3 @@ readonly modelId: string; | ||
| /** | ||
| Generates a transcript. | ||
| * Generates a transcript. | ||
| */ | ||
@@ -74,3 +74,3 @@ doGenerate(options: TranscriptionModelV3CallOptions): PromiseLike<{ | ||
| /** | ||
| Warnings for the call, e.g. unsupported settings. | ||
| * Warnings for the call, e.g. unsupported settings. | ||
| */ | ||
@@ -80,8 +80,8 @@ warnings: Array<SharedV3Warning>; | ||
| /** | ||
| Optional request information for telemetry and debugging purposes. | ||
| * Optional request information for telemetry and debugging purposes. | ||
| */ | ||
| request?: { | ||
| /** | ||
| Raw request HTTP body that was sent to the provider API as a string (JSON should be stringified). | ||
| Non-HTTP(s) providers should not set this. | ||
| * Raw request HTTP body that was sent to the provider API as a string (JSON should be stringified). | ||
| * Non-HTTP(s) providers should not set this. | ||
| */ | ||
@@ -92,23 +92,23 @@ body?: string; | ||
| /** | ||
| Response information for telemetry and debugging purposes. | ||
| * Response information for telemetry and debugging purposes. | ||
| */ | ||
| response: { | ||
| /** | ||
| Timestamp for the start of the generated response. | ||
| */ | ||
| * Timestamp for the start of the generated response. | ||
| */ | ||
| timestamp: Date; | ||
| /** | ||
| The ID of the response model that was used to generate the response. | ||
| */ | ||
| * The ID of the response model that was used to generate the response. | ||
| */ | ||
| modelId: string; | ||
| /** | ||
| Response headers. | ||
| */ | ||
| * Response headers. | ||
| */ | ||
| headers?: SharedV3Headers; | ||
| /** | ||
| Response body. | ||
| */ | ||
| * Response body. | ||
| */ | ||
| body?: unknown; | ||
@@ -118,5 +118,5 @@ }; | ||
| /** | ||
| Additional provider-specific metadata. They are passed through | ||
| from the provider to the AI SDK and enable provider-specific | ||
| results that can be fully encapsulated in the provider. | ||
| * Additional provider-specific metadata. They are passed through | ||
| * from the provider to the AI SDK and enable provider-specific | ||
| * results that can be fully encapsulated in the provider. | ||
| */ | ||
@@ -123,0 +123,0 @@ providerMetadata?: Record<string, JSONObject>; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
489943
3.98%8984
3.15%