@ai-sdk/provider-utils 4.0.53 → 4.0.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/dist/index.d.mts +38 -12
- package/dist/index.d.ts +38 -12
- package/dist/index.js +13 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/combine-headers.ts +1 -1
- package/src/delay.ts +1 -1
- package/src/embedding-model-capabilities.ts +23 -0
- package/src/index.ts +5 -1
- package/src/is-url-supported.ts +7 -3
- package/src/resolve.ts +1 -1
- package/src/to-json-schema/zod3-to-json-schema/parsers/string.ts +1 -1
- package/src/types/content-part.ts +6 -0
- package/src/types/tool-approval-request.ts +8 -0
- package/src/validate-download-url.ts +0 -1
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ function combineHeaders(...headers) {
|
|
|
3
3
|
return headers.reduce(
|
|
4
4
|
(combinedHeaders, currentHeaders) => ({
|
|
5
5
|
...combinedHeaders,
|
|
6
|
-
...currentHeaders
|
|
6
|
+
...currentHeaders
|
|
7
7
|
}),
|
|
8
8
|
{}
|
|
9
9
|
);
|
|
@@ -81,7 +81,7 @@ function createToolNameMapping({
|
|
|
81
81
|
// src/delay.ts
|
|
82
82
|
async function delay(delayInMs, options) {
|
|
83
83
|
if (delayInMs == null) {
|
|
84
|
-
return
|
|
84
|
+
return;
|
|
85
85
|
}
|
|
86
86
|
const signal = options == null ? void 0 : options.abortSignal;
|
|
87
87
|
return new Promise((resolve2, reject) => {
|
|
@@ -298,7 +298,6 @@ function validateDownloadUrl(url) {
|
|
|
298
298
|
message: `URL with IP address ${hostname} is not allowed`
|
|
299
299
|
});
|
|
300
300
|
}
|
|
301
|
-
return;
|
|
302
301
|
}
|
|
303
302
|
}
|
|
304
303
|
function validateDownloadAddress({
|
|
@@ -636,6 +635,9 @@ async function downloadBlob(url, options) {
|
|
|
636
635
|
var EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL = /* @__PURE__ */ Symbol.for(
|
|
637
636
|
"vercel.ai.embeddingModel.maxInputBytesPerCall"
|
|
638
637
|
);
|
|
638
|
+
var EMBEDDING_MODEL_PROVIDER_OPTIONS_TRANSFORMER = /* @__PURE__ */ Symbol.for(
|
|
639
|
+
"vercel.ai.embeddingModel.providerOptionsTransformer"
|
|
640
|
+
);
|
|
639
641
|
|
|
640
642
|
// src/generate-id.ts
|
|
641
643
|
import { InvalidArgumentError } from "@ai-sdk/provider";
|
|
@@ -820,7 +822,7 @@ function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
|
|
|
820
822
|
}
|
|
821
823
|
|
|
822
824
|
// src/version.ts
|
|
823
|
-
var VERSION = true ? "4.0.
|
|
825
|
+
var VERSION = true ? "4.0.55" : "0.0.0-test";
|
|
824
826
|
|
|
825
827
|
// src/get-from-api.ts
|
|
826
828
|
var getOriginalFetch = () => globalThis.fetch;
|
|
@@ -956,7 +958,9 @@ function isUrlSupported({
|
|
|
956
958
|
return Object.entries(supportedUrls).map(([key, value]) => {
|
|
957
959
|
const mediaType2 = key.toLowerCase();
|
|
958
960
|
return mediaType2 === "*" || mediaType2 === "*/*" ? { mediaTypePrefix: "", regexes: value } : { mediaTypePrefix: mediaType2.replace(/\*/, ""), regexes: value };
|
|
959
|
-
}).filter(
|
|
961
|
+
}).filter(
|
|
962
|
+
({ mediaTypePrefix }) => mediaTypePrefix === "" || mediaTypePrefix.endsWith("/") ? mediaType.startsWith(mediaTypePrefix) : mediaType === mediaTypePrefix
|
|
963
|
+
).flatMap(({ regexes }) => regexes).some((pattern) => pattern.test(url));
|
|
960
964
|
}
|
|
961
965
|
|
|
962
966
|
// src/load-api-key.ts
|
|
@@ -1400,7 +1404,7 @@ var zodPatterns = {
|
|
|
1400
1404
|
/**
|
|
1401
1405
|
* `a-z` was added to replicate /i flag
|
|
1402
1406
|
*/
|
|
1403
|
-
email: /^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'
|
|
1407
|
+
email: /^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9-]*\.)+[a-zA-Z]{2,}$/,
|
|
1404
1408
|
/**
|
|
1405
1409
|
* Constructed a valid Unicode RegExp
|
|
1406
1410
|
*
|
|
@@ -2779,7 +2783,7 @@ async function resolve(value) {
|
|
|
2779
2783
|
if (typeof value === "function") {
|
|
2780
2784
|
value = value();
|
|
2781
2785
|
}
|
|
2782
|
-
return
|
|
2786
|
+
return value;
|
|
2783
2787
|
}
|
|
2784
2788
|
|
|
2785
2789
|
// src/retry-with-exponential-backoff.ts
|
|
@@ -3118,6 +3122,7 @@ export {
|
|
|
3118
3122
|
DelayedPromise,
|
|
3119
3123
|
DownloadError,
|
|
3120
3124
|
EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL as EXPERIMENTAL_EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL,
|
|
3125
|
+
EMBEDDING_MODEL_PROVIDER_OPTIONS_TRANSFORMER as EXPERIMENTAL_EMBEDDING_MODEL_PROVIDER_OPTIONS_TRANSFORMER,
|
|
3121
3126
|
EventSourceParserStream2 as EventSourceParserStream,
|
|
3122
3127
|
VERSION,
|
|
3123
3128
|
asSchema,
|