ai 7.0.98 → 7.0.99

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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # ai
2
2
 
3
+ ## 7.0.99
4
+
5
+ ### Patch Changes
6
+
7
+ - 615ac89: feat(ai): use InvalidArgumentError for utility input validation
8
+ - Updated dependencies [7f76d83]
9
+ - @ai-sdk/gateway@4.0.80
10
+
3
11
  ## 7.0.98
4
12
 
5
13
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -7052,7 +7052,9 @@ interface EmbedManyResult {
7052
7052
  * @param abortSignal - An optional abort signal that can be used to cancel the call.
7053
7053
  * @param headers - Additional HTTP headers to be sent with the request. Only applicable for HTTP-based providers.
7054
7054
  *
7055
- * @param maxParallelCalls - Maximum number of concurrent requests. Default: Infinity.
7055
+ * @param maxParallelCalls - Maximum number of concurrent requests when a request is split into
7056
+ * multiple model calls. Must be greater than 0 when the model supports parallel calls.
7057
+ * Default: Infinity.
7056
7058
  *
7057
7059
  * @param telemetry - Optional telemetry configuration.
7058
7060
  * @param runtimeContext - User-defined runtime context passed to callbacks and, when explicitly included, telemetry.
@@ -7108,7 +7110,8 @@ declare function embedMany<RUNTIME_CONTEXT extends Context = Context>({ model: m
7108
7110
  */
7109
7111
  providerOptions?: ProviderOptions;
7110
7112
  /**
7111
- * Maximum number of concurrent requests.
7113
+ * Maximum number of concurrent requests when a request is split into multiple model calls.
7114
+ * Must be greater than 0 when the model supports parallel calls.
7112
7115
  *
7113
7116
  * @default Infinity
7114
7117
  */
@@ -7887,6 +7890,8 @@ declare function createDownload(options?: {
7887
7890
 
7888
7891
  /**
7889
7892
  * Converts a data URL of type text/* to a text string.
7893
+ *
7894
+ * @throws {InvalidArgumentError} If the data URL is malformed or cannot be decoded.
7890
7895
  */
7891
7896
  declare function getTextFromDataUrl(dataUrl: string): string;
7892
7897
 
package/dist/index.js CHANGED
@@ -1178,7 +1178,7 @@ import {
1178
1178
  } from "@ai-sdk/provider-utils";
1179
1179
 
1180
1180
  // src/version.ts
1181
- var VERSION = true ? "7.0.98" : "0.0.0-test";
1181
+ var VERSION = true ? "7.0.99" : "0.0.0-test";
1182
1182
 
1183
1183
  // src/util/download/download.ts
1184
1184
  var download = async ({
@@ -13639,7 +13639,11 @@ function getEmbeddingModelMaxInputBytesPerCall(model) {
13639
13639
  // src/util/split-array.ts
13640
13640
  function splitArray(array3, chunkSize) {
13641
13641
  if (chunkSize <= 0) {
13642
- throw new Error("chunkSize must be greater than 0");
13642
+ throw new InvalidArgumentError({
13643
+ parameter: "chunkSize",
13644
+ value: chunkSize,
13645
+ message: "chunkSize must be greater than 0"
13646
+ });
13643
13647
  }
13644
13648
  const result = [];
13645
13649
  for (let i = 0; i < array3.length; i += chunkSize) {
@@ -14737,12 +14741,20 @@ function getTextFromDataUrl(dataUrl) {
14737
14741
  const [header, base64Content] = dataUrl.split(",");
14738
14742
  const mediaType = header.split(";")[0].split(":")[1];
14739
14743
  if (mediaType == null || base64Content == null) {
14740
- throw new Error("Invalid data URL format");
14744
+ throw new InvalidArgumentError({
14745
+ parameter: "dataUrl",
14746
+ value: dataUrl,
14747
+ message: "Invalid data URL format"
14748
+ });
14741
14749
  }
14742
14750
  try {
14743
14751
  return atob2(base64Content);
14744
14752
  } catch (e) {
14745
- throw new Error(`Error decoding data URL`);
14753
+ throw new InvalidArgumentError({
14754
+ parameter: "dataUrl",
14755
+ value: dataUrl,
14756
+ message: "Error decoding data URL"
14757
+ });
14746
14758
  }
14747
14759
  }
14748
14760