Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ai-sdk/provider

Package Overview
Dependencies
Maintainers
2
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ai-sdk/provider - npm Package Compare versions

Comparing version 0.0.24 to 0.0.26

211

./dist/index.js

@@ -7,4 +7,4 @@ "use strict";

var __export = (target, all) => {
for (var name13 in all)
__defProp(target, name13, { get: all[name13], enumerable: true });
for (var name14 in all)
__defProp(target, name14, { get: all[name14], enumerable: true });
};

@@ -27,2 +27,3 @@ var __copyProps = (to, from, except, desc) => {

EmptyResponseBodyError: () => EmptyResponseBodyError,
InvalidArgumentError: () => InvalidArgumentError,
InvalidPromptError: () => InvalidPromptError,

@@ -59,3 +60,3 @@ InvalidResponseDataError: () => InvalidResponseDataError,

constructor({
name: name13,
name: name14,
message,

@@ -66,3 +67,3 @@ cause

this[_a] = true;
this.name = name13;
this.name = name14;
this.cause = cause;

@@ -78,4 +79,4 @@ }

}
static hasMarker(error, marker14) {
const markerSymbol = Symbol.for(marker14);
static hasMarker(error, marker15) {
const markerSymbol = Symbol.for(marker15);
return error != null && typeof error === "object" && markerSymbol in error && typeof error[markerSymbol] === "boolean" && error[markerSymbol] === true;

@@ -196,7 +197,28 @@ }

// src/errors/invalid-prompt-error.ts
var name3 = "AI_InvalidPromptError";
// src/errors/invalid-argument-error.ts
var name3 = "AI_InvalidArgumentError";
var marker4 = `vercel.ai.error.${name3}`;
var symbol4 = Symbol.for(marker4);
var _a4;
var InvalidArgumentError = class extends AISDKError {
constructor({
message,
cause,
argument
}) {
super({ name: name3, message, cause });
this[_a4] = true;
this.argument = argument;
}
static isInstance(error) {
return AISDKError.hasMarker(error, marker4);
}
};
_a4 = symbol4;
// src/errors/invalid-prompt-error.ts
var name4 = "AI_InvalidPromptError";
var marker5 = `vercel.ai.error.${name4}`;
var symbol5 = Symbol.for(marker5);
var _a5;
var InvalidPromptError = class extends AISDKError {

@@ -208,8 +230,8 @@ constructor({

}) {
super({ name: name3, message: `Invalid prompt: ${message}`, cause });
this[_a4] = true;
super({ name: name4, message: `Invalid prompt: ${message}`, cause });
this[_a5] = true;
this.prompt = prompt2;
}
static isInstance(error) {
return AISDKError.hasMarker(error, marker4);
return AISDKError.hasMarker(error, marker5);
}

@@ -220,3 +242,3 @@ /**

static isInvalidPromptError(error) {
return error instanceof Error && error.name === name3 && prompt != null;
return error instanceof Error && error.name === name4 && prompt != null;
}

@@ -235,9 +257,9 @@ /**

};
_a4 = symbol4;
_a5 = symbol5;
// src/errors/invalid-response-data-error.ts
var name4 = "AI_InvalidResponseDataError";
var marker5 = `vercel.ai.error.${name4}`;
var symbol5 = Symbol.for(marker5);
var _a5;
var name5 = "AI_InvalidResponseDataError";
var marker6 = `vercel.ai.error.${name5}`;
var symbol6 = Symbol.for(marker6);
var _a6;
var InvalidResponseDataError = class extends AISDKError {

@@ -248,8 +270,8 @@ constructor({

}) {
super({ name: name4, message });
this[_a5] = true;
super({ name: name5, message });
this[_a6] = true;
this.data = data;
}
static isInstance(error) {
return AISDKError.hasMarker(error, marker5);
return AISDKError.hasMarker(error, marker6);
}

@@ -260,3 +282,3 @@ /**

static isInvalidResponseDataError(error) {
return error instanceof Error && error.name === name4 && error.data != null;
return error instanceof Error && error.name === name5 && error.data != null;
}

@@ -275,13 +297,13 @@ /**

};
_a5 = symbol5;
_a6 = symbol6;
// src/errors/json-parse-error.ts
var name5 = "AI_JSONParseError";
var marker6 = `vercel.ai.error.${name5}`;
var symbol6 = Symbol.for(marker6);
var _a6;
var name6 = "AI_JSONParseError";
var marker7 = `vercel.ai.error.${name6}`;
var symbol7 = Symbol.for(marker7);
var _a7;
var JSONParseError = class extends AISDKError {
constructor({ text, cause }) {
super({
name: name5,
name: name6,
message: `JSON parsing failed: Text: ${text}.

@@ -291,7 +313,7 @@ Error message: ${getErrorMessage(cause)}`,

});
this[_a6] = true;
this[_a7] = true;
this.text = text;
}
static isInstance(error) {
return AISDKError.hasMarker(error, marker6);
return AISDKError.hasMarker(error, marker7);
}

@@ -302,3 +324,3 @@ /**

static isJSONParseError(error) {
return error instanceof Error && error.name === name5 && "text" in error && typeof error.text === "string";
return error instanceof Error && error.name === name6 && "text" in error && typeof error.text === "string";
}

@@ -318,17 +340,17 @@ /**

};
_a6 = symbol6;
_a7 = symbol7;
// src/errors/load-api-key-error.ts
var name6 = "AI_LoadAPIKeyError";
var marker7 = `vercel.ai.error.${name6}`;
var symbol7 = Symbol.for(marker7);
var _a7;
var name7 = "AI_LoadAPIKeyError";
var marker8 = `vercel.ai.error.${name7}`;
var symbol8 = Symbol.for(marker8);
var _a8;
var LoadAPIKeyError = class extends AISDKError {
// used in isInstance
constructor({ message }) {
super({ name: name6, message });
this[_a7] = true;
super({ name: name7, message });
this[_a8] = true;
}
static isInstance(error) {
return AISDKError.hasMarker(error, marker7);
return AISDKError.hasMarker(error, marker8);
}

@@ -339,20 +361,20 @@ /**

static isLoadAPIKeyError(error) {
return error instanceof Error && error.name === name6;
return error instanceof Error && error.name === name7;
}
};
_a7 = symbol7;
_a8 = symbol8;
// src/errors/load-setting-error.ts
var name7 = "AI_LoadSettingError";
var marker8 = `vercel.ai.error.${name7}`;
var symbol8 = Symbol.for(marker8);
var _a8;
var name8 = "AI_LoadSettingError";
var marker9 = `vercel.ai.error.${name8}`;
var symbol9 = Symbol.for(marker9);
var _a9;
var LoadSettingError = class extends AISDKError {
// used in isInstance
constructor({ message }) {
super({ name: name7, message });
this[_a8] = true;
super({ name: name8, message });
this[_a9] = true;
}
static isInstance(error) {
return AISDKError.hasMarker(error, marker8);
return AISDKError.hasMarker(error, marker9);
}

@@ -363,12 +385,12 @@ /**

static isLoadSettingError(error) {
return error instanceof Error && error.name === name7;
return error instanceof Error && error.name === name8;
}
};
_a8 = symbol8;
_a9 = symbol9;
// src/errors/no-content-generated-error.ts
var name8 = "AI_NoContentGeneratedError";
var marker9 = `vercel.ai.error.${name8}`;
var symbol9 = Symbol.for(marker9);
var _a9;
var name9 = "AI_NoContentGeneratedError";
var marker10 = `vercel.ai.error.${name9}`;
var symbol10 = Symbol.for(marker10);
var _a10;
var NoContentGeneratedError = class extends AISDKError {

@@ -379,7 +401,7 @@ // used in isInstance

} = {}) {
super({ name: name8, message });
this[_a9] = true;
super({ name: name9, message });
this[_a10] = true;
}
static isInstance(error) {
return AISDKError.hasMarker(error, marker9);
return AISDKError.hasMarker(error, marker10);
}

@@ -390,3 +412,3 @@ /**

static isNoContentGeneratedError(error) {
return error instanceof Error && error.name === name8;
return error instanceof Error && error.name === name9;
}

@@ -405,12 +427,12 @@ /**

};
_a9 = symbol9;
_a10 = symbol10;
// src/errors/no-such-model-error.ts
var name9 = "AI_NoSuchModelError";
var marker10 = `vercel.ai.error.${name9}`;
var symbol10 = Symbol.for(marker10);
var _a10;
var name10 = "AI_NoSuchModelError";
var marker11 = `vercel.ai.error.${name10}`;
var symbol11 = Symbol.for(marker11);
var _a11;
var NoSuchModelError = class extends AISDKError {
constructor({
errorName = name9,
errorName = name10,
modelId,

@@ -421,3 +443,3 @@ modelType,

super({ name: errorName, message });
this[_a10] = true;
this[_a11] = true;
this.modelId = modelId;

@@ -427,3 +449,3 @@ this.modelType = modelType;

static isInstance(error) {
return AISDKError.hasMarker(error, marker10);
return AISDKError.hasMarker(error, marker11);
}

@@ -434,3 +456,3 @@ /**

static isNoSuchModelError(error) {
return error instanceof Error && error.name === name9 && typeof error.modelId === "string" && typeof error.modelType === "string";
return error instanceof Error && error.name === name10 && typeof error.modelId === "string" && typeof error.modelType === "string";
}

@@ -450,16 +472,16 @@ /**

};
_a10 = symbol10;
_a11 = symbol11;
// src/errors/too-many-embedding-values-for-call-error.ts
var name10 = "AI_TooManyEmbeddingValuesForCallError";
var marker11 = `vercel.ai.error.${name10}`;
var symbol11 = Symbol.for(marker11);
var _a11;
var name11 = "AI_TooManyEmbeddingValuesForCallError";
var marker12 = `vercel.ai.error.${name11}`;
var symbol12 = Symbol.for(marker12);
var _a12;
var TooManyEmbeddingValuesForCallError = class extends AISDKError {
constructor(options) {
super({
name: name10,
name: name11,
message: `Too many values for a single embedding call. The ${options.provider} model "${options.modelId}" can only embed up to ${options.maxEmbeddingsPerCall} values per call, but ${options.values.length} values were provided.`
});
this[_a11] = true;
this[_a12] = true;
this.provider = options.provider;

@@ -471,3 +493,3 @@ this.modelId = options.modelId;

static isInstance(error) {
return AISDKError.hasMarker(error, marker11);
return AISDKError.hasMarker(error, marker12);
}

@@ -478,3 +500,3 @@ /**

static isTooManyEmbeddingValuesForCallError(error) {
return error instanceof Error && error.name === name10 && "provider" in error && typeof error.provider === "string" && "modelId" in error && typeof error.modelId === "string" && "maxEmbeddingsPerCall" in error && typeof error.maxEmbeddingsPerCall === "number" && "values" in error && Array.isArray(error.values);
return error instanceof Error && error.name === name11 && "provider" in error && typeof error.provider === "string" && "modelId" in error && typeof error.modelId === "string" && "maxEmbeddingsPerCall" in error && typeof error.maxEmbeddingsPerCall === "number" && "values" in error && Array.isArray(error.values);
}

@@ -496,13 +518,13 @@ /**

};
_a11 = symbol11;
_a12 = symbol12;
// src/errors/type-validation-error.ts
var name11 = "AI_TypeValidationError";
var marker12 = `vercel.ai.error.${name11}`;
var symbol12 = Symbol.for(marker12);
var _a12;
var name12 = "AI_TypeValidationError";
var marker13 = `vercel.ai.error.${name12}`;
var symbol13 = Symbol.for(marker13);
var _a13;
var _TypeValidationError = class _TypeValidationError extends AISDKError {
constructor({ value, cause }) {
super({
name: name11,
name: name12,
message: `Type validation failed: Value: ${JSON.stringify(value)}.

@@ -512,7 +534,7 @@ Error message: ${getErrorMessage(cause)}`,

});
this[_a12] = true;
this[_a13] = true;
this.value = value;
}
static isInstance(error) {
return AISDKError.hasMarker(error, marker12);
return AISDKError.hasMarker(error, marker13);
}

@@ -539,3 +561,3 @@ /**

static isTypeValidationError(error) {
return error instanceof Error && error.name === name11;
return error instanceof Error && error.name === name12;
}

@@ -555,21 +577,21 @@ /**

};
_a12 = symbol12;
_a13 = symbol13;
var TypeValidationError = _TypeValidationError;
// src/errors/unsupported-functionality-error.ts
var name12 = "AI_UnsupportedFunctionalityError";
var marker13 = `vercel.ai.error.${name12}`;
var symbol13 = Symbol.for(marker13);
var _a13;
var name13 = "AI_UnsupportedFunctionalityError";
var marker14 = `vercel.ai.error.${name13}`;
var symbol14 = Symbol.for(marker14);
var _a14;
var UnsupportedFunctionalityError = class extends AISDKError {
constructor({ functionality }) {
super({
name: name12,
name: name13,
message: `'${functionality}' functionality not supported.`
});
this[_a13] = true;
this[_a14] = true;
this.functionality = functionality;
}
static isInstance(error) {
return AISDKError.hasMarker(error, marker13);
return AISDKError.hasMarker(error, marker14);
}

@@ -580,3 +602,3 @@ /**

static isUnsupportedFunctionalityError(error) {
return error instanceof Error && error.name === name12 && typeof error.functionality === "string";
return error instanceof Error && error.name === name13 && typeof error.functionality === "string";
}

@@ -595,3 +617,3 @@ /**

};
_a13 = symbol13;
_a14 = symbol14;

@@ -626,2 +648,3 @@ // src/json-value/is-json.ts

EmptyResponseBodyError,
InvalidArgumentError,
InvalidPromptError,

@@ -628,0 +651,0 @@ InvalidResponseDataError,

# @ai-sdk/provider
## 0.0.26
### Patch Changes
- aa98cdb: chore: more flexible dependency versioning
- 1486128: feat: add supportsUrl to language model specification
- 7b937c5: feat (provider-utils): improve id generator robustness
- 3b1b69a: feat: provider-defined tools
- 811a317: feat (ai/core): multi-part tool results (incl. images)
## 0.0.25
### Patch Changes
- b9b0d7b: feat (ai): access raw request body
## 0.0.24

@@ -4,0 +20,0 @@

import { JSONSchema7 } from 'json-schema';
export { JSONSchema7, JSONSchema7Definition } from 'json-schema';

@@ -85,3 +86,3 @@ /**

declare const symbol$c: unique symbol;
declare const symbol$d: unique symbol;
/**

@@ -92,3 +93,3 @@ * Custom error class for AI SDK related errors.

declare class AISDKError extends Error {
private readonly [symbol$c];
private readonly [symbol$d];
/**

@@ -130,5 +131,5 @@ * The underlying cause of the error, if any.

declare const symbol$b: unique symbol;
declare const symbol$c: unique symbol;
declare class APICallError extends AISDKError {
private readonly [symbol$b];
private readonly [symbol$c];
readonly url: string;

@@ -175,5 +176,5 @@ readonly requestBodyValues: unknown;

declare const symbol$a: unique symbol;
declare const symbol$b: unique symbol;
declare class EmptyResponseBodyError extends AISDKError {
private readonly [symbol$a];
private readonly [symbol$b];
constructor({ message }?: {

@@ -191,2 +192,17 @@ message?: string;

declare const symbol$a: unique symbol;
/**
* A function argument is invalid.
*/
declare class InvalidArgumentError extends AISDKError {
private readonly [symbol$a];
readonly argument: string;
constructor({ message, cause, argument, }: {
argument: string;
message: string;
cause?: unknown;
});
static isInstance(error: unknown): error is InvalidArgumentError;
}
declare const symbol$9: unique symbol;

@@ -543,4 +559,3 @@ /**

/**
The type of the tool. Only functions for now, but this gives us room to
add more specific tool types in the future and use a discriminated union.
The type of the tool (always 'function').
*/

@@ -717,2 +732,23 @@ type: 'function';

/**
Tool results as an array of parts. This enables advanced tool results including images.
When this is used, the `result` field should be ignored (if the provider supports content).
*/
content?: Array<{
type: 'text';
/**
Text content.
*/
text: string;
} | {
type: 'image';
/**
base-64 encoded image data
*/
data: string;
/**
Mime type of the image.
*/
mimeType?: string;
}>;
/**
* Additional provider-specific metadata. They are passed through

@@ -725,2 +761,24 @@ * to the provider from the AI SDK and enable provider-specific

/**
The configuration of a tool that is defined by the provider.
*/
type LanguageModelV1ProviderDefinedTool = {
/**
The type of the tool (always 'provider-defined').
*/
type: 'provider-defined';
/**
The ID of the tool. Should follow the format `<provider-name>.<tool-name>`.
*/
id: `${string}.${string}`;
/**
The name of the tool. Unique within this model call.
*/
name: string;
/**
The arguments for configuring the tool. Must match the expected arguments defined by the provider for this tool.
*/
args: Record<string, unknown>;
};
type LanguageModelV1ToolChoice = {

@@ -762,3 +820,3 @@ type: 'auto';

*/
tools?: Array<LanguageModelV1FunctionTool>;
tools?: Array<LanguageModelV1FunctionTool | LanguageModelV1ProviderDefinedTool>;
/**

@@ -812,2 +870,6 @@ Specifies how the tool should be selected. Defaults to 'auto'.

} | {
type: 'unsupported-tool';
tool: LanguageModelV1FunctionTool | LanguageModelV1ProviderDefinedTool;
details?: string;
} | {
type: 'other';

@@ -908,2 +970,10 @@ message: string;

/**
Checks if the model supports the given URL for file parts natively.
If the model does not support the URL,
the AI SDK will download the file and pass the file data to the model.
When undefined, the AI SDK will download the file.
*/
supportsUrl?(url: URL): boolean;
/**
Generates a language model output (non-streaming).

@@ -960,2 +1030,15 @@

};
/**
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.
*/
body?: string;
};
/**
Optional response information for telemetry and debugging purposes.
*/
response?: {

@@ -1024,2 +1107,12 @@ /**

};
/**
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.
*/
body?: string;
};
warnings?: LanguageModelV1CallWarning[];

@@ -1086,2 +1179,2 @@ }>;

export { AISDKError, APICallError, type EmbeddingModelV1, type EmbeddingModelV1Embedding, EmptyResponseBodyError, InvalidPromptError, InvalidResponseDataError, type JSONArray, type JSONObject, JSONParseError, type JSONValue, type LanguageModelV1, type LanguageModelV1CallOptions, type LanguageModelV1CallWarning, type LanguageModelV1FilePart, type LanguageModelV1FinishReason, type LanguageModelV1FunctionTool, type LanguageModelV1FunctionToolCall, type LanguageModelV1ImagePart, type LanguageModelV1LogProbs, type LanguageModelV1Message, type LanguageModelV1Prompt, type LanguageModelV1ProviderMetadata, type LanguageModelV1StreamPart, type LanguageModelV1TextPart, type LanguageModelV1ToolCallPart, type LanguageModelV1ToolChoice, type LanguageModelV1ToolResultPart, LoadAPIKeyError, LoadSettingError, NoContentGeneratedError, NoSuchModelError, type ProviderV1, TooManyEmbeddingValuesForCallError, TypeValidationError, UnsupportedFunctionalityError, getErrorMessage, isJSONArray, isJSONObject, isJSONValue };
export { AISDKError, APICallError, type EmbeddingModelV1, type EmbeddingModelV1Embedding, EmptyResponseBodyError, InvalidArgumentError, InvalidPromptError, InvalidResponseDataError, type JSONArray, type JSONObject, JSONParseError, type JSONValue, type LanguageModelV1, type LanguageModelV1CallOptions, type LanguageModelV1CallWarning, type LanguageModelV1FilePart, type LanguageModelV1FinishReason, type LanguageModelV1FunctionTool, type LanguageModelV1FunctionToolCall, type LanguageModelV1ImagePart, type LanguageModelV1LogProbs, type LanguageModelV1Message, type LanguageModelV1Prompt, type LanguageModelV1ProviderDefinedTool, type LanguageModelV1ProviderMetadata, type LanguageModelV1StreamPart, type LanguageModelV1TextPart, type LanguageModelV1ToolCallPart, type LanguageModelV1ToolChoice, type LanguageModelV1ToolResultPart, LoadAPIKeyError, LoadSettingError, NoContentGeneratedError, NoSuchModelError, type ProviderV1, TooManyEmbeddingValuesForCallError, TypeValidationError, UnsupportedFunctionalityError, getErrorMessage, isJSONArray, isJSONObject, isJSONValue };

@@ -7,4 +7,4 @@ "use strict";

var __export = (target, all) => {
for (var name13 in all)
__defProp(target, name13, { get: all[name13], enumerable: true });
for (var name14 in all)
__defProp(target, name14, { get: all[name14], enumerable: true });
};

@@ -27,2 +27,3 @@ var __copyProps = (to, from, except, desc) => {

EmptyResponseBodyError: () => EmptyResponseBodyError,
InvalidArgumentError: () => InvalidArgumentError,
InvalidPromptError: () => InvalidPromptError,

@@ -59,3 +60,3 @@ InvalidResponseDataError: () => InvalidResponseDataError,

constructor({
name: name13,
name: name14,
message,

@@ -66,3 +67,3 @@ cause

this[_a] = true;
this.name = name13;
this.name = name14;
this.cause = cause;

@@ -78,4 +79,4 @@ }

}
static hasMarker(error, marker14) {
const markerSymbol = Symbol.for(marker14);
static hasMarker(error, marker15) {
const markerSymbol = Symbol.for(marker15);
return error != null && typeof error === "object" && markerSymbol in error && typeof error[markerSymbol] === "boolean" && error[markerSymbol] === true;

@@ -196,7 +197,28 @@ }

// src/errors/invalid-prompt-error.ts
var name3 = "AI_InvalidPromptError";
// src/errors/invalid-argument-error.ts
var name3 = "AI_InvalidArgumentError";
var marker4 = `vercel.ai.error.${name3}`;
var symbol4 = Symbol.for(marker4);
var _a4;
var InvalidArgumentError = class extends AISDKError {
constructor({
message,
cause,
argument
}) {
super({ name: name3, message, cause });
this[_a4] = true;
this.argument = argument;
}
static isInstance(error) {
return AISDKError.hasMarker(error, marker4);
}
};
_a4 = symbol4;
// src/errors/invalid-prompt-error.ts
var name4 = "AI_InvalidPromptError";
var marker5 = `vercel.ai.error.${name4}`;
var symbol5 = Symbol.for(marker5);
var _a5;
var InvalidPromptError = class extends AISDKError {

@@ -208,8 +230,8 @@ constructor({

}) {
super({ name: name3, message: `Invalid prompt: ${message}`, cause });
this[_a4] = true;
super({ name: name4, message: `Invalid prompt: ${message}`, cause });
this[_a5] = true;
this.prompt = prompt2;
}
static isInstance(error) {
return AISDKError.hasMarker(error, marker4);
return AISDKError.hasMarker(error, marker5);
}

@@ -220,3 +242,3 @@ /**

static isInvalidPromptError(error) {
return error instanceof Error && error.name === name3 && prompt != null;
return error instanceof Error && error.name === name4 && prompt != null;
}

@@ -235,9 +257,9 @@ /**

};
_a4 = symbol4;
_a5 = symbol5;
// src/errors/invalid-response-data-error.ts
var name4 = "AI_InvalidResponseDataError";
var marker5 = `vercel.ai.error.${name4}`;
var symbol5 = Symbol.for(marker5);
var _a5;
var name5 = "AI_InvalidResponseDataError";
var marker6 = `vercel.ai.error.${name5}`;
var symbol6 = Symbol.for(marker6);
var _a6;
var InvalidResponseDataError = class extends AISDKError {

@@ -248,8 +270,8 @@ constructor({

}) {
super({ name: name4, message });
this[_a5] = true;
super({ name: name5, message });
this[_a6] = true;
this.data = data;
}
static isInstance(error) {
return AISDKError.hasMarker(error, marker5);
return AISDKError.hasMarker(error, marker6);
}

@@ -260,3 +282,3 @@ /**

static isInvalidResponseDataError(error) {
return error instanceof Error && error.name === name4 && error.data != null;
return error instanceof Error && error.name === name5 && error.data != null;
}

@@ -275,13 +297,13 @@ /**

};
_a5 = symbol5;
_a6 = symbol6;
// src/errors/json-parse-error.ts
var name5 = "AI_JSONParseError";
var marker6 = `vercel.ai.error.${name5}`;
var symbol6 = Symbol.for(marker6);
var _a6;
var name6 = "AI_JSONParseError";
var marker7 = `vercel.ai.error.${name6}`;
var symbol7 = Symbol.for(marker7);
var _a7;
var JSONParseError = class extends AISDKError {
constructor({ text, cause }) {
super({
name: name5,
name: name6,
message: `JSON parsing failed: Text: ${text}.

@@ -291,7 +313,7 @@ Error message: ${getErrorMessage(cause)}`,

});
this[_a6] = true;
this[_a7] = true;
this.text = text;
}
static isInstance(error) {
return AISDKError.hasMarker(error, marker6);
return AISDKError.hasMarker(error, marker7);
}

@@ -302,3 +324,3 @@ /**

static isJSONParseError(error) {
return error instanceof Error && error.name === name5 && "text" in error && typeof error.text === "string";
return error instanceof Error && error.name === name6 && "text" in error && typeof error.text === "string";
}

@@ -318,17 +340,17 @@ /**

};
_a6 = symbol6;
_a7 = symbol7;
// src/errors/load-api-key-error.ts
var name6 = "AI_LoadAPIKeyError";
var marker7 = `vercel.ai.error.${name6}`;
var symbol7 = Symbol.for(marker7);
var _a7;
var name7 = "AI_LoadAPIKeyError";
var marker8 = `vercel.ai.error.${name7}`;
var symbol8 = Symbol.for(marker8);
var _a8;
var LoadAPIKeyError = class extends AISDKError {
// used in isInstance
constructor({ message }) {
super({ name: name6, message });
this[_a7] = true;
super({ name: name7, message });
this[_a8] = true;
}
static isInstance(error) {
return AISDKError.hasMarker(error, marker7);
return AISDKError.hasMarker(error, marker8);
}

@@ -339,20 +361,20 @@ /**

static isLoadAPIKeyError(error) {
return error instanceof Error && error.name === name6;
return error instanceof Error && error.name === name7;
}
};
_a7 = symbol7;
_a8 = symbol8;
// src/errors/load-setting-error.ts
var name7 = "AI_LoadSettingError";
var marker8 = `vercel.ai.error.${name7}`;
var symbol8 = Symbol.for(marker8);
var _a8;
var name8 = "AI_LoadSettingError";
var marker9 = `vercel.ai.error.${name8}`;
var symbol9 = Symbol.for(marker9);
var _a9;
var LoadSettingError = class extends AISDKError {
// used in isInstance
constructor({ message }) {
super({ name: name7, message });
this[_a8] = true;
super({ name: name8, message });
this[_a9] = true;
}
static isInstance(error) {
return AISDKError.hasMarker(error, marker8);
return AISDKError.hasMarker(error, marker9);
}

@@ -363,12 +385,12 @@ /**

static isLoadSettingError(error) {
return error instanceof Error && error.name === name7;
return error instanceof Error && error.name === name8;
}
};
_a8 = symbol8;
_a9 = symbol9;
// src/errors/no-content-generated-error.ts
var name8 = "AI_NoContentGeneratedError";
var marker9 = `vercel.ai.error.${name8}`;
var symbol9 = Symbol.for(marker9);
var _a9;
var name9 = "AI_NoContentGeneratedError";
var marker10 = `vercel.ai.error.${name9}`;
var symbol10 = Symbol.for(marker10);
var _a10;
var NoContentGeneratedError = class extends AISDKError {

@@ -379,7 +401,7 @@ // used in isInstance

} = {}) {
super({ name: name8, message });
this[_a9] = true;
super({ name: name9, message });
this[_a10] = true;
}
static isInstance(error) {
return AISDKError.hasMarker(error, marker9);
return AISDKError.hasMarker(error, marker10);
}

@@ -390,3 +412,3 @@ /**

static isNoContentGeneratedError(error) {
return error instanceof Error && error.name === name8;
return error instanceof Error && error.name === name9;
}

@@ -405,12 +427,12 @@ /**

};
_a9 = symbol9;
_a10 = symbol10;
// src/errors/no-such-model-error.ts
var name9 = "AI_NoSuchModelError";
var marker10 = `vercel.ai.error.${name9}`;
var symbol10 = Symbol.for(marker10);
var _a10;
var name10 = "AI_NoSuchModelError";
var marker11 = `vercel.ai.error.${name10}`;
var symbol11 = Symbol.for(marker11);
var _a11;
var NoSuchModelError = class extends AISDKError {
constructor({
errorName = name9,
errorName = name10,
modelId,

@@ -421,3 +443,3 @@ modelType,

super({ name: errorName, message });
this[_a10] = true;
this[_a11] = true;
this.modelId = modelId;

@@ -427,3 +449,3 @@ this.modelType = modelType;

static isInstance(error) {
return AISDKError.hasMarker(error, marker10);
return AISDKError.hasMarker(error, marker11);
}

@@ -434,3 +456,3 @@ /**

static isNoSuchModelError(error) {
return error instanceof Error && error.name === name9 && typeof error.modelId === "string" && typeof error.modelType === "string";
return error instanceof Error && error.name === name10 && typeof error.modelId === "string" && typeof error.modelType === "string";
}

@@ -450,16 +472,16 @@ /**

};
_a10 = symbol10;
_a11 = symbol11;
// src/errors/too-many-embedding-values-for-call-error.ts
var name10 = "AI_TooManyEmbeddingValuesForCallError";
var marker11 = `vercel.ai.error.${name10}`;
var symbol11 = Symbol.for(marker11);
var _a11;
var name11 = "AI_TooManyEmbeddingValuesForCallError";
var marker12 = `vercel.ai.error.${name11}`;
var symbol12 = Symbol.for(marker12);
var _a12;
var TooManyEmbeddingValuesForCallError = class extends AISDKError {
constructor(options) {
super({
name: name10,
name: name11,
message: `Too many values for a single embedding call. The ${options.provider} model "${options.modelId}" can only embed up to ${options.maxEmbeddingsPerCall} values per call, but ${options.values.length} values were provided.`
});
this[_a11] = true;
this[_a12] = true;
this.provider = options.provider;

@@ -471,3 +493,3 @@ this.modelId = options.modelId;

static isInstance(error) {
return AISDKError.hasMarker(error, marker11);
return AISDKError.hasMarker(error, marker12);
}

@@ -478,3 +500,3 @@ /**

static isTooManyEmbeddingValuesForCallError(error) {
return error instanceof Error && error.name === name10 && "provider" in error && typeof error.provider === "string" && "modelId" in error && typeof error.modelId === "string" && "maxEmbeddingsPerCall" in error && typeof error.maxEmbeddingsPerCall === "number" && "values" in error && Array.isArray(error.values);
return error instanceof Error && error.name === name11 && "provider" in error && typeof error.provider === "string" && "modelId" in error && typeof error.modelId === "string" && "maxEmbeddingsPerCall" in error && typeof error.maxEmbeddingsPerCall === "number" && "values" in error && Array.isArray(error.values);
}

@@ -496,13 +518,13 @@ /**

};
_a11 = symbol11;
_a12 = symbol12;
// src/errors/type-validation-error.ts
var name11 = "AI_TypeValidationError";
var marker12 = `vercel.ai.error.${name11}`;
var symbol12 = Symbol.for(marker12);
var _a12;
var name12 = "AI_TypeValidationError";
var marker13 = `vercel.ai.error.${name12}`;
var symbol13 = Symbol.for(marker13);
var _a13;
var _TypeValidationError = class _TypeValidationError extends AISDKError {
constructor({ value, cause }) {
super({
name: name11,
name: name12,
message: `Type validation failed: Value: ${JSON.stringify(value)}.

@@ -512,7 +534,7 @@ Error message: ${getErrorMessage(cause)}`,

});
this[_a12] = true;
this[_a13] = true;
this.value = value;
}
static isInstance(error) {
return AISDKError.hasMarker(error, marker12);
return AISDKError.hasMarker(error, marker13);
}

@@ -539,3 +561,3 @@ /**

static isTypeValidationError(error) {
return error instanceof Error && error.name === name11;
return error instanceof Error && error.name === name12;
}

@@ -555,21 +577,21 @@ /**

};
_a12 = symbol12;
_a13 = symbol13;
var TypeValidationError = _TypeValidationError;
// src/errors/unsupported-functionality-error.ts
var name12 = "AI_UnsupportedFunctionalityError";
var marker13 = `vercel.ai.error.${name12}`;
var symbol13 = Symbol.for(marker13);
var _a13;
var name13 = "AI_UnsupportedFunctionalityError";
var marker14 = `vercel.ai.error.${name13}`;
var symbol14 = Symbol.for(marker14);
var _a14;
var UnsupportedFunctionalityError = class extends AISDKError {
constructor({ functionality }) {
super({
name: name12,
name: name13,
message: `'${functionality}' functionality not supported.`
});
this[_a13] = true;
this[_a14] = true;
this.functionality = functionality;
}
static isInstance(error) {
return AISDKError.hasMarker(error, marker13);
return AISDKError.hasMarker(error, marker14);
}

@@ -580,3 +602,3 @@ /**

static isUnsupportedFunctionalityError(error) {
return error instanceof Error && error.name === name12 && typeof error.functionality === "string";
return error instanceof Error && error.name === name13 && typeof error.functionality === "string";
}

@@ -595,3 +617,3 @@ /**

};
_a13 = symbol13;
_a14 = symbol14;

@@ -626,2 +648,3 @@ // src/json-value/is-json.ts

EmptyResponseBodyError,
InvalidArgumentError,
InvalidPromptError,

@@ -628,0 +651,0 @@ InvalidResponseDataError,

{
"name": "@ai-sdk/provider",
"version": "0.0.24",
"version": "0.0.26",
"license": "Apache-2.0",

@@ -22,3 +22,3 @@ "sideEffects": false,

"dependencies": {
"json-schema": "0.4.0"
"json-schema": "^0.4.0"
},

@@ -25,0 +25,0 @@ "devDependencies": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc