@ai-sdk/provider-utils 3.0.33 → 3.0.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/index.d.mts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +13 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @ai-sdk/provider-utils
|
|
2
2
|
|
|
3
|
+
## 3.0.35
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 77d33c0: Split OpenAI and Azure OpenAI embedding requests by a conservative UTF-8 byte budget derived from their aggregate token limit, in addition to input count limits.
|
|
8
|
+
|
|
9
|
+
## 3.0.34
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 2fff9f1: fix(provider-utils): allow imports in runtimes without a global fetch function
|
|
14
|
+
- f364ea0: Preserve schema-valued additional properties when converting Zod 4 schemas.
|
|
15
|
+
|
|
3
16
|
## 3.0.33
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -72,6 +72,14 @@ declare class DownloadError extends AISDKError {
|
|
|
72
72
|
static isInstance(error: unknown): error is DownloadError;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
/**
|
|
76
|
+
* Symbol for exposing the UTF-8 input byte budget of an embedding model.
|
|
77
|
+
*
|
|
78
|
+
* This capability is experimental and intentionally lives outside the versioned
|
|
79
|
+
* embedding model specification.
|
|
80
|
+
*/
|
|
81
|
+
declare const EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL: unique symbol;
|
|
82
|
+
|
|
75
83
|
/**
|
|
76
84
|
* Fetches a URL while enforcing the SSRF download guard on every hop.
|
|
77
85
|
*
|
|
@@ -1090,4 +1098,4 @@ interface ToolResult<NAME extends string, INPUT, OUTPUT> {
|
|
|
1090
1098
|
dynamic?: boolean;
|
|
1091
1099
|
}
|
|
1092
1100
|
|
|
1093
|
-
export { type AssistantContent, type AssistantModelMessage, DEFAULT_MAX_DOWNLOAD_SIZE, type DataContent, DelayedPromise, DownloadError, type FetchFunction, type FilePart, type FlexibleSchema, type FlexibleValidator, type IdGenerator, type ImagePart, type InferSchema, type InferToolInput, type InferToolOutput, type InferValidator, type LazySchema, type LazyValidator, type ModelMessage, type ParseResult, type ProviderDefinedToolFactory, type ProviderDefinedToolFactoryWithOutputSchema, type ProviderOptions, type ReasoningPart, type Resolvable, type ResponseHandler, type Schema, type SystemModelMessage, type TextPart, type Tool, type ToolCall, type ToolCallOptions, type ToolCallPart, type ToolContent, type ToolExecuteFunction, type ToolModelMessage, type ToolResult, type ToolResultPart, type UserContent, type UserModelMessage, VERSION, type ValidationResult, type Validator, asSchema, asValidator, cancelResponseBody, combineHeaders, convertAsyncIteratorToReadableStream, convertBase64ToUint8Array, convertToBase64, convertUint8ArrayToBase64, createBinaryResponseHandler, createEventSourceResponseHandler, createIdGenerator, createJsonErrorResponseHandler, createJsonResponseHandler, createJsonStreamResponseHandler, createProviderDefinedToolFactory, createProviderDefinedToolFactoryWithOutputSchema, createStatusCodeErrorResponseHandler, delay, dynamicTool, executeTool, extractResponseHeaders, fetchWithValidatedRedirects, generateId, getErrorMessage, getFromApi, getRuntimeEnvironmentUserAgent, injectJsonInstructionIntoMessages, isAbortError, isBrowserRuntime, isParsableJson, isSameOrigin, isUrlSupported, isValidator, jsonSchema, lazySchema, lazyValidator, loadApiKey, loadOptionalSetting, loadSetting, mediaTypeToExtension, normalizeHeaders, parseJSON, parseJsonEventStream, parseProviderOptions, postFormDataToApi, postJsonToApi, postToApi, readResponseWithSizeLimit, removeUndefinedEntries, resolve, safeParseJSON, safeValidateTypes, standardSchemaValidator, tool, validateDownloadUrl, validateTypes, validator, withUserAgentSuffix, withoutTrailingSlash, zodSchema };
|
|
1101
|
+
export { type AssistantContent, type AssistantModelMessage, DEFAULT_MAX_DOWNLOAD_SIZE, type DataContent, DelayedPromise, DownloadError, EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL as EXPERIMENTAL_EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL, type FetchFunction, type FilePart, type FlexibleSchema, type FlexibleValidator, type IdGenerator, type ImagePart, type InferSchema, type InferToolInput, type InferToolOutput, type InferValidator, type LazySchema, type LazyValidator, type ModelMessage, type ParseResult, type ProviderDefinedToolFactory, type ProviderDefinedToolFactoryWithOutputSchema, type ProviderOptions, type ReasoningPart, type Resolvable, type ResponseHandler, type Schema, type SystemModelMessage, type TextPart, type Tool, type ToolCall, type ToolCallOptions, type ToolCallPart, type ToolContent, type ToolExecuteFunction, type ToolModelMessage, type ToolResult, type ToolResultPart, type UserContent, type UserModelMessage, VERSION, type ValidationResult, type Validator, asSchema, asValidator, cancelResponseBody, combineHeaders, convertAsyncIteratorToReadableStream, convertBase64ToUint8Array, convertToBase64, convertUint8ArrayToBase64, createBinaryResponseHandler, createEventSourceResponseHandler, createIdGenerator, createJsonErrorResponseHandler, createJsonResponseHandler, createJsonStreamResponseHandler, createProviderDefinedToolFactory, createProviderDefinedToolFactoryWithOutputSchema, createStatusCodeErrorResponseHandler, delay, dynamicTool, executeTool, extractResponseHeaders, fetchWithValidatedRedirects, generateId, getErrorMessage, getFromApi, getRuntimeEnvironmentUserAgent, injectJsonInstructionIntoMessages, isAbortError, isBrowserRuntime, isParsableJson, isSameOrigin, isUrlSupported, isValidator, jsonSchema, lazySchema, lazyValidator, loadApiKey, loadOptionalSetting, loadSetting, mediaTypeToExtension, normalizeHeaders, parseJSON, parseJsonEventStream, parseProviderOptions, postFormDataToApi, postJsonToApi, postToApi, readResponseWithSizeLimit, removeUndefinedEntries, resolve, safeParseJSON, safeValidateTypes, standardSchemaValidator, tool, validateDownloadUrl, validateTypes, validator, withUserAgentSuffix, withoutTrailingSlash, zodSchema };
|
package/dist/index.d.ts
CHANGED
|
@@ -72,6 +72,14 @@ declare class DownloadError extends AISDKError {
|
|
|
72
72
|
static isInstance(error: unknown): error is DownloadError;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
/**
|
|
76
|
+
* Symbol for exposing the UTF-8 input byte budget of an embedding model.
|
|
77
|
+
*
|
|
78
|
+
* This capability is experimental and intentionally lives outside the versioned
|
|
79
|
+
* embedding model specification.
|
|
80
|
+
*/
|
|
81
|
+
declare const EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL: unique symbol;
|
|
82
|
+
|
|
75
83
|
/**
|
|
76
84
|
* Fetches a URL while enforcing the SSRF download guard on every hop.
|
|
77
85
|
*
|
|
@@ -1090,4 +1098,4 @@ interface ToolResult<NAME extends string, INPUT, OUTPUT> {
|
|
|
1090
1098
|
dynamic?: boolean;
|
|
1091
1099
|
}
|
|
1092
1100
|
|
|
1093
|
-
export { type AssistantContent, type AssistantModelMessage, DEFAULT_MAX_DOWNLOAD_SIZE, type DataContent, DelayedPromise, DownloadError, type FetchFunction, type FilePart, type FlexibleSchema, type FlexibleValidator, type IdGenerator, type ImagePart, type InferSchema, type InferToolInput, type InferToolOutput, type InferValidator, type LazySchema, type LazyValidator, type ModelMessage, type ParseResult, type ProviderDefinedToolFactory, type ProviderDefinedToolFactoryWithOutputSchema, type ProviderOptions, type ReasoningPart, type Resolvable, type ResponseHandler, type Schema, type SystemModelMessage, type TextPart, type Tool, type ToolCall, type ToolCallOptions, type ToolCallPart, type ToolContent, type ToolExecuteFunction, type ToolModelMessage, type ToolResult, type ToolResultPart, type UserContent, type UserModelMessage, VERSION, type ValidationResult, type Validator, asSchema, asValidator, cancelResponseBody, combineHeaders, convertAsyncIteratorToReadableStream, convertBase64ToUint8Array, convertToBase64, convertUint8ArrayToBase64, createBinaryResponseHandler, createEventSourceResponseHandler, createIdGenerator, createJsonErrorResponseHandler, createJsonResponseHandler, createJsonStreamResponseHandler, createProviderDefinedToolFactory, createProviderDefinedToolFactoryWithOutputSchema, createStatusCodeErrorResponseHandler, delay, dynamicTool, executeTool, extractResponseHeaders, fetchWithValidatedRedirects, generateId, getErrorMessage, getFromApi, getRuntimeEnvironmentUserAgent, injectJsonInstructionIntoMessages, isAbortError, isBrowserRuntime, isParsableJson, isSameOrigin, isUrlSupported, isValidator, jsonSchema, lazySchema, lazyValidator, loadApiKey, loadOptionalSetting, loadSetting, mediaTypeToExtension, normalizeHeaders, parseJSON, parseJsonEventStream, parseProviderOptions, postFormDataToApi, postJsonToApi, postToApi, readResponseWithSizeLimit, removeUndefinedEntries, resolve, safeParseJSON, safeValidateTypes, standardSchemaValidator, tool, validateDownloadUrl, validateTypes, validator, withUserAgentSuffix, withoutTrailingSlash, zodSchema };
|
|
1101
|
+
export { type AssistantContent, type AssistantModelMessage, DEFAULT_MAX_DOWNLOAD_SIZE, type DataContent, DelayedPromise, DownloadError, EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL as EXPERIMENTAL_EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL, type FetchFunction, type FilePart, type FlexibleSchema, type FlexibleValidator, type IdGenerator, type ImagePart, type InferSchema, type InferToolInput, type InferToolOutput, type InferValidator, type LazySchema, type LazyValidator, type ModelMessage, type ParseResult, type ProviderDefinedToolFactory, type ProviderDefinedToolFactoryWithOutputSchema, type ProviderOptions, type ReasoningPart, type Resolvable, type ResponseHandler, type Schema, type SystemModelMessage, type TextPart, type Tool, type ToolCall, type ToolCallOptions, type ToolCallPart, type ToolContent, type ToolExecuteFunction, type ToolModelMessage, type ToolResult, type ToolResultPart, type UserContent, type UserModelMessage, VERSION, type ValidationResult, type Validator, asSchema, asValidator, cancelResponseBody, combineHeaders, convertAsyncIteratorToReadableStream, convertBase64ToUint8Array, convertToBase64, convertUint8ArrayToBase64, createBinaryResponseHandler, createEventSourceResponseHandler, createIdGenerator, createJsonErrorResponseHandler, createJsonResponseHandler, createJsonStreamResponseHandler, createProviderDefinedToolFactory, createProviderDefinedToolFactoryWithOutputSchema, createStatusCodeErrorResponseHandler, delay, dynamicTool, executeTool, extractResponseHeaders, fetchWithValidatedRedirects, generateId, getErrorMessage, getFromApi, getRuntimeEnvironmentUserAgent, injectJsonInstructionIntoMessages, isAbortError, isBrowserRuntime, isParsableJson, isSameOrigin, isUrlSupported, isValidator, jsonSchema, lazySchema, lazyValidator, loadApiKey, loadOptionalSetting, loadSetting, mediaTypeToExtension, normalizeHeaders, parseJSON, parseJsonEventStream, parseProviderOptions, postFormDataToApi, postJsonToApi, postToApi, readResponseWithSizeLimit, removeUndefinedEntries, resolve, safeParseJSON, safeValidateTypes, standardSchemaValidator, tool, validateDownloadUrl, validateTypes, validator, withUserAgentSuffix, withoutTrailingSlash, zodSchema };
|
package/dist/index.js
CHANGED
|
@@ -34,6 +34,7 @@ __export(index_exports, {
|
|
|
34
34
|
DEFAULT_MAX_DOWNLOAD_SIZE: () => DEFAULT_MAX_DOWNLOAD_SIZE,
|
|
35
35
|
DelayedPromise: () => DelayedPromise,
|
|
36
36
|
DownloadError: () => DownloadError,
|
|
37
|
+
EXPERIMENTAL_EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL: () => EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL,
|
|
37
38
|
EventSourceParserStream: () => import_stream2.EventSourceParserStream,
|
|
38
39
|
VERSION: () => VERSION,
|
|
39
40
|
asSchema: () => asSchema,
|
|
@@ -255,6 +256,11 @@ var DownloadError = class extends (_b = import_provider.AISDKError, _a = symbol,
|
|
|
255
256
|
}
|
|
256
257
|
};
|
|
257
258
|
|
|
259
|
+
// src/embedding-model-capabilities.ts
|
|
260
|
+
var EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL = /* @__PURE__ */ Symbol.for(
|
|
261
|
+
"vercel.ai.embeddingModel.maxInputBytesPerCall"
|
|
262
|
+
);
|
|
263
|
+
|
|
258
264
|
// src/cancel-response-body.ts
|
|
259
265
|
async function cancelResponseBody(response) {
|
|
260
266
|
var _a2;
|
|
@@ -469,6 +475,9 @@ async function getDefaultDownloadFetch() {
|
|
|
469
475
|
return safeNodeFetchPromise != null ? safeNodeFetchPromise : safeNodeFetchPromise = createSafeNodeFetch();
|
|
470
476
|
}
|
|
471
477
|
function isNodeDefaultFetch(fetch) {
|
|
478
|
+
if (typeof fetch !== "function") {
|
|
479
|
+
return false;
|
|
480
|
+
}
|
|
472
481
|
const source = Function.prototype.toString.call(fetch);
|
|
473
482
|
return source.includes("internal/deps/undici") || source.includes("lazy loading of undici");
|
|
474
483
|
}
|
|
@@ -753,7 +762,7 @@ function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
|
|
|
753
762
|
}
|
|
754
763
|
|
|
755
764
|
// src/version.ts
|
|
756
|
-
var VERSION = true ? "3.0.
|
|
765
|
+
var VERSION = true ? "3.0.35" : "0.0.0-test";
|
|
757
766
|
|
|
758
767
|
// src/get-from-api.ts
|
|
759
768
|
var getOriginalFetch = () => globalThis.fetch;
|
|
@@ -1610,7 +1619,8 @@ var z4 = __toESM(require("zod/v4"));
|
|
|
1610
1619
|
// src/add-additional-properties-to-json-schema.ts
|
|
1611
1620
|
function addAdditionalPropertiesToJsonSchema(jsonSchema2) {
|
|
1612
1621
|
if (jsonSchema2.type === "object") {
|
|
1613
|
-
|
|
1622
|
+
const { additionalProperties } = jsonSchema2;
|
|
1623
|
+
jsonSchema2.additionalProperties = additionalProperties != null && typeof additionalProperties !== "boolean" ? addAdditionalPropertiesToJsonSchema(additionalProperties) : false;
|
|
1614
1624
|
const properties = jsonSchema2.properties;
|
|
1615
1625
|
if (properties != null) {
|
|
1616
1626
|
for (const property in properties) {
|
|
@@ -2929,6 +2939,7 @@ var import_stream2 = require("eventsource-parser/stream");
|
|
|
2929
2939
|
DEFAULT_MAX_DOWNLOAD_SIZE,
|
|
2930
2940
|
DelayedPromise,
|
|
2931
2941
|
DownloadError,
|
|
2942
|
+
EXPERIMENTAL_EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL,
|
|
2932
2943
|
EventSourceParserStream,
|
|
2933
2944
|
VERSION,
|
|
2934
2945
|
asSchema,
|