ai 4.0.0-canary.1 → 4.0.0-canary.3

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/dist/index.mjs CHANGED
@@ -46,24 +46,6 @@ var RetryError = class extends AISDKError {
46
46
  static isInstance(error) {
47
47
  return AISDKError.hasMarker(error, marker);
48
48
  }
49
- /**
50
- * @deprecated use `isInstance` instead
51
- */
52
- static isRetryError(error) {
53
- return error instanceof Error && error.name === name && typeof error.reason === "string" && Array.isArray(error.errors);
54
- }
55
- /**
56
- * @deprecated Do not use this method. It will be removed in the next major version.
57
- */
58
- toJSON() {
59
- return {
60
- name: this.name,
61
- message: this.message,
62
- reason: this.reason,
63
- lastError: this.lastError,
64
- errors: this.errors
65
- };
66
- }
67
49
  };
68
50
  _a = symbol;
69
51
 
@@ -101,7 +83,7 @@ async function _retryWithExponentialBackoff(f, {
101
83
  errors: newErrors
102
84
  });
103
85
  }
104
- if (error instanceof Error && APICallError.isAPICallError(error) && error.isRetryable === true && tryNumber <= maxRetries) {
86
+ if (error instanceof Error && APICallError.isInstance(error) && error.isRetryable === true && tryNumber <= maxRetries) {
105
87
  await delay(delayInMs);
106
88
  return _retryWithExponentialBackoff(
107
89
  f,
@@ -616,25 +598,6 @@ var DownloadError = class extends AISDKError2 {
616
598
  static isInstance(error) {
617
599
  return AISDKError2.hasMarker(error, marker2);
618
600
  }
619
- /**
620
- * @deprecated use `isInstance` instead
621
- */
622
- static isDownloadError(error) {
623
- return error instanceof Error && error.name === name2 && typeof error.url === "string" && (error.statusCode == null || typeof error.statusCode === "number") && (error.statusText == null || typeof error.statusText === "string");
624
- }
625
- /**
626
- * @deprecated Do not use this method. It will be removed in the next major version.
627
- */
628
- toJSON() {
629
- return {
630
- name: this.name,
631
- message: this.message,
632
- url: this.url,
633
- statusCode: this.statusCode,
634
- statusText: this.statusText,
635
- cause: this.cause
636
- };
637
- }
638
601
  };
639
602
  _a2 = symbol2;
640
603
 
@@ -707,24 +670,6 @@ var InvalidDataContentError = class extends AISDKError3 {
707
670
  static isInstance(error) {
708
671
  return AISDKError3.hasMarker(error, marker3);
709
672
  }
710
- /**
711
- * @deprecated use `isInstance` instead
712
- */
713
- static isInvalidDataContentError(error) {
714
- return error instanceof Error && error.name === name3 && error.content != null;
715
- }
716
- /**
717
- * @deprecated Do not use this method. It will be removed in the next major version.
718
- */
719
- toJSON() {
720
- return {
721
- name: this.name,
722
- message: this.message,
723
- stack: this.stack,
724
- cause: this.cause,
725
- content: this.content
726
- };
727
- }
728
673
  };
729
674
  _a3 = symbol3;
730
675
 
@@ -798,23 +743,6 @@ var InvalidMessageRoleError = class extends AISDKError4 {
798
743
  static isInstance(error) {
799
744
  return AISDKError4.hasMarker(error, marker4);
800
745
  }
801
- /**
802
- * @deprecated use `isInstance` instead
803
- */
804
- static isInvalidMessageRoleError(error) {
805
- return error instanceof Error && error.name === name4 && typeof error.role === "string";
806
- }
807
- /**
808
- * @deprecated Do not use this method. It will be removed in the next major version.
809
- */
810
- toJSON() {
811
- return {
812
- name: this.name,
813
- message: this.message,
814
- stack: this.stack,
815
- role: this.role
816
- };
817
- }
818
746
  };
819
747
  _a4 = symbol4;
820
748
 
@@ -1042,21 +970,6 @@ var InvalidArgumentError = class extends AISDKError5 {
1042
970
  static isInstance(error) {
1043
971
  return AISDKError5.hasMarker(error, marker5);
1044
972
  }
1045
- /**
1046
- * @deprecated use `isInstance` instead
1047
- */
1048
- static isInvalidArgumentError(error) {
1049
- return error instanceof Error && error.name === name5 && typeof error.parameter === "string" && typeof error.value === "string";
1050
- }
1051
- toJSON() {
1052
- return {
1053
- name: this.name,
1054
- message: this.message,
1055
- stack: this.stack,
1056
- parameter: this.parameter,
1057
- value: this.value
1058
- };
1059
- }
1060
973
  };
1061
974
  _a5 = symbol5;
1062
975
 
@@ -1489,9 +1402,7 @@ function convertToCoreMessages(messages, options) {
1489
1402
  });
1490
1403
  break;
1491
1404
  }
1492
- case "function":
1493
- case "data":
1494
- case "tool": {
1405
+ case "data": {
1495
1406
  break;
1496
1407
  }
1497
1408
  default: {
@@ -1638,23 +1549,6 @@ var NoObjectGeneratedError = class extends AISDKError7 {
1638
1549
  static isInstance(error) {
1639
1550
  return AISDKError7.hasMarker(error, marker7);
1640
1551
  }
1641
- /**
1642
- * @deprecated Use isInstance instead.
1643
- */
1644
- static isNoObjectGeneratedError(error) {
1645
- return error instanceof Error && error.name === name7;
1646
- }
1647
- /**
1648
- * @deprecated Do not use this method. It will be removed in the next major version.
1649
- */
1650
- toJSON() {
1651
- return {
1652
- name: this.name,
1653
- cause: this.cause,
1654
- message: this.message,
1655
- stack: this.stack
1656
- };
1657
- }
1658
1552
  };
1659
1553
  _a7 = symbol7;
1660
1554
 
@@ -3075,19 +2969,6 @@ var InvalidToolArgumentsError = class extends AISDKError8 {
3075
2969
  static isInvalidToolArgumentsError(error) {
3076
2970
  return error instanceof Error && error.name === name8 && typeof error.toolName === "string" && typeof error.toolArgs === "string";
3077
2971
  }
3078
- /**
3079
- * @deprecated Do not use this method. It will be removed in the next major version.
3080
- */
3081
- toJSON() {
3082
- return {
3083
- name: this.name,
3084
- message: this.message,
3085
- cause: this.cause,
3086
- stack: this.stack,
3087
- toolName: this.toolName,
3088
- toolArgs: this.toolArgs
3089
- };
3090
- }
3091
2972
  };
3092
2973
  _a8 = symbol8;
3093
2974
 
@@ -3111,24 +2992,6 @@ var NoSuchToolError = class extends AISDKError9 {
3111
2992
  static isInstance(error) {
3112
2993
  return AISDKError9.hasMarker(error, marker9);
3113
2994
  }
3114
- /**
3115
- * @deprecated use `isInstance` instead
3116
- */
3117
- static isNoSuchToolError(error) {
3118
- return error instanceof Error && error.name === name9 && "toolName" in error && error.toolName != void 0 && typeof error.name === "string";
3119
- }
3120
- /**
3121
- * @deprecated Do not use this method. It will be removed in the next major version.
3122
- */
3123
- toJSON() {
3124
- return {
3125
- name: this.name,
3126
- message: this.message,
3127
- stack: this.stack,
3128
- toolName: this.toolName,
3129
- availableTools: this.availableTools
3130
- };
3131
- }
3132
2995
  };
3133
2996
  _a9 = symbol9;
3134
2997
 
@@ -4948,26 +4811,6 @@ var NoSuchProviderError = class extends NoSuchModelError3 {
4948
4811
  static isInstance(error) {
4949
4812
  return AISDKError11.hasMarker(error, marker10);
4950
4813
  }
4951
- /**
4952
- * @deprecated use `isInstance` instead
4953
- */
4954
- static isNoSuchProviderError(error) {
4955
- return error instanceof Error && error.name === name10 && typeof error.providerId === "string" && Array.isArray(error.availableProviders);
4956
- }
4957
- /**
4958
- * @deprecated Do not use this method. It will be removed in the next major version.
4959
- */
4960
- toJSON() {
4961
- return {
4962
- name: this.name,
4963
- message: this.message,
4964
- stack: this.stack,
4965
- modelId: this.modelId,
4966
- modelType: this.modelType,
4967
- providerId: this.providerId,
4968
- availableProviders: this.availableProviders
4969
- };
4970
- }
4971
4814
  };
4972
4815
  _a10 = symbol10;
4973
4816