@ai-sdk/provider-utils 4.0.54 → 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 +8 -0
- package/dist/index.d.mts +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/is-url-supported.ts +7 -3
- package/src/types/content-part.ts +6 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @ai-sdk/provider-utils
|
|
2
2
|
|
|
3
|
+
## 4.0.55
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 3983fea: fix(provider): preserve media types on tool result file URLs and match full MIME types exactly when checking native URL support.
|
|
8
|
+
- Updated dependencies [3983fea]
|
|
9
|
+
- @ai-sdk/provider@3.0.18
|
|
10
|
+
|
|
3
11
|
## 4.0.54
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -495,9 +495,9 @@ declare function isSameOrigin(url: string, baseUrl: string): boolean;
|
|
|
495
495
|
/**
|
|
496
496
|
* Checks if the given URL is supported natively by the model.
|
|
497
497
|
*
|
|
498
|
-
* @param mediaType - The media type of the URL. Case-
|
|
498
|
+
* @param mediaType - The media type of the URL. Case-insensitive.
|
|
499
499
|
* @param url - The URL to check.
|
|
500
|
-
* @param supportedUrls - A record where keys are case-
|
|
500
|
+
* @param supportedUrls - A record where keys are case-insensitive media types (or '*')
|
|
501
501
|
* and values are arrays of RegExp patterns for URLs.
|
|
502
502
|
*
|
|
503
503
|
* @returns `true` if the URL matches a pattern under the specific media type
|
|
@@ -865,6 +865,11 @@ type ToolResultOutput = {
|
|
|
865
865
|
* URL of the file.
|
|
866
866
|
*/
|
|
867
867
|
url: string;
|
|
868
|
+
/**
|
|
869
|
+
* IANA media type.
|
|
870
|
+
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
871
|
+
*/
|
|
872
|
+
mediaType?: string;
|
|
868
873
|
/**
|
|
869
874
|
* Provider-specific options.
|
|
870
875
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -495,9 +495,9 @@ declare function isSameOrigin(url: string, baseUrl: string): boolean;
|
|
|
495
495
|
/**
|
|
496
496
|
* Checks if the given URL is supported natively by the model.
|
|
497
497
|
*
|
|
498
|
-
* @param mediaType - The media type of the URL. Case-
|
|
498
|
+
* @param mediaType - The media type of the URL. Case-insensitive.
|
|
499
499
|
* @param url - The URL to check.
|
|
500
|
-
* @param supportedUrls - A record where keys are case-
|
|
500
|
+
* @param supportedUrls - A record where keys are case-insensitive media types (or '*')
|
|
501
501
|
* and values are arrays of RegExp patterns for URLs.
|
|
502
502
|
*
|
|
503
503
|
* @returns `true` if the URL matches a pattern under the specific media type
|
|
@@ -865,6 +865,11 @@ type ToolResultOutput = {
|
|
|
865
865
|
* URL of the file.
|
|
866
866
|
*/
|
|
867
867
|
url: string;
|
|
868
|
+
/**
|
|
869
|
+
* IANA media type.
|
|
870
|
+
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
871
|
+
*/
|
|
872
|
+
mediaType?: string;
|
|
868
873
|
/**
|
|
869
874
|
* Provider-specific options.
|
|
870
875
|
*/
|
package/dist/index.js
CHANGED
|
@@ -926,7 +926,7 @@ function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
|
|
|
926
926
|
}
|
|
927
927
|
|
|
928
928
|
// src/version.ts
|
|
929
|
-
var VERSION = true ? "4.0.
|
|
929
|
+
var VERSION = true ? "4.0.55" : "0.0.0-test";
|
|
930
930
|
|
|
931
931
|
// src/get-from-api.ts
|
|
932
932
|
var getOriginalFetch = () => globalThis.fetch;
|
|
@@ -1062,7 +1062,9 @@ function isUrlSupported({
|
|
|
1062
1062
|
return Object.entries(supportedUrls).map(([key, value]) => {
|
|
1063
1063
|
const mediaType2 = key.toLowerCase();
|
|
1064
1064
|
return mediaType2 === "*" || mediaType2 === "*/*" ? { mediaTypePrefix: "", regexes: value } : { mediaTypePrefix: mediaType2.replace(/\*/, ""), regexes: value };
|
|
1065
|
-
}).filter(
|
|
1065
|
+
}).filter(
|
|
1066
|
+
({ mediaTypePrefix }) => mediaTypePrefix === "" || mediaTypePrefix.endsWith("/") ? mediaType.startsWith(mediaTypePrefix) : mediaType === mediaTypePrefix
|
|
1067
|
+
).flatMap(({ regexes }) => regexes).some((pattern) => pattern.test(url));
|
|
1066
1068
|
}
|
|
1067
1069
|
|
|
1068
1070
|
// src/load-api-key.ts
|