@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/provider-utils",
3
- "version": "4.0.54",
3
+ "version": "4.0.55",
4
4
  "license": "Apache-2.0",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/index.js",
@@ -36,7 +36,7 @@
36
36
  "@standard-schema/spec": "^1.1.0",
37
37
  "eventsource-parser": "^3.0.8",
38
38
  "undici": "^6.28.0",
39
- "@ai-sdk/provider": "3.0.17"
39
+ "@ai-sdk/provider": "3.0.18"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/node": "20.17.24",
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * Checks if the given URL is supported natively by the model.
3
3
  *
4
- * @param mediaType - The media type of the URL. Case-sensitive.
4
+ * @param mediaType - The media type of the URL. Case-insensitive.
5
5
  * @param url - The URL to check.
6
- * @param supportedUrls - A record where keys are case-sensitive media types (or '*')
6
+ * @param supportedUrls - A record where keys are case-insensitive media types (or '*')
7
7
  * and values are arrays of RegExp patterns for URLs.
8
8
  *
9
9
  * @returns `true` if the URL matches a pattern under the specific media type
@@ -32,7 +32,11 @@ export function isUrlSupported({
32
32
  : { mediaTypePrefix: mediaType.replace(/\*/, ''), regexes: value };
33
33
  })
34
34
  // gather all regexp pattern from matched media type prefixes:
35
- .filter(({ mediaTypePrefix }) => mediaType.startsWith(mediaTypePrefix))
35
+ .filter(({ mediaTypePrefix }) =>
36
+ mediaTypePrefix === '' || mediaTypePrefix.endsWith('/')
37
+ ? mediaType.startsWith(mediaTypePrefix)
38
+ : mediaType === mediaTypePrefix,
39
+ )
36
40
  .flatMap(({ regexes }) => regexes)
37
41
  // check if any pattern matches the url:
38
42
  .some(pattern => pattern.test(url))
@@ -281,6 +281,12 @@ export type ToolResultOutput =
281
281
  */
282
282
  url: string;
283
283
 
284
+ /**
285
+ * IANA media type.
286
+ * @see https://www.iana.org/assignments/media-types/media-types.xhtml
287
+ */
288
+ mediaType?: string;
289
+
284
290
  /**
285
291
  * Provider-specific options.
286
292
  */