@effect/ai-anthropic 4.0.0-beta.7 → 4.0.0-beta.70

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.
Files changed (43) hide show
  1. package/dist/AnthropicClient.d.ts +40 -66
  2. package/dist/AnthropicClient.d.ts.map +1 -1
  3. package/dist/AnthropicClient.js +12 -14
  4. package/dist/AnthropicClient.js.map +1 -1
  5. package/dist/AnthropicConfig.d.ts +46 -10
  6. package/dist/AnthropicConfig.d.ts.map +1 -1
  7. package/dist/AnthropicConfig.js +31 -7
  8. package/dist/AnthropicConfig.js.map +1 -1
  9. package/dist/AnthropicError.d.ts +128 -37
  10. package/dist/AnthropicError.d.ts.map +1 -1
  11. package/dist/AnthropicError.js +1 -1
  12. package/dist/AnthropicLanguageModel.d.ts +281 -66
  13. package/dist/AnthropicLanguageModel.d.ts.map +1 -1
  14. package/dist/AnthropicLanguageModel.js +50 -14
  15. package/dist/AnthropicLanguageModel.js.map +1 -1
  16. package/dist/AnthropicTelemetry.d.ts +23 -16
  17. package/dist/AnthropicTelemetry.d.ts.map +1 -1
  18. package/dist/AnthropicTelemetry.js +6 -4
  19. package/dist/AnthropicTelemetry.js.map +1 -1
  20. package/dist/AnthropicTool.d.ts +298 -138
  21. package/dist/AnthropicTool.d.ts.map +1 -1
  22. package/dist/AnthropicTool.js +141 -87
  23. package/dist/AnthropicTool.js.map +1 -1
  24. package/dist/Generated.d.ts +11661 -5260
  25. package/dist/Generated.d.ts.map +1 -1
  26. package/dist/Generated.js +2318 -915
  27. package/dist/Generated.js.map +1 -1
  28. package/dist/index.d.ts +52 -8
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js +52 -8
  31. package/dist/index.js.map +1 -1
  32. package/dist/internal/errors.js +7 -7
  33. package/dist/internal/errors.js.map +1 -1
  34. package/package.json +3 -3
  35. package/src/AnthropicClient.ts +41 -67
  36. package/src/AnthropicConfig.ts +47 -11
  37. package/src/AnthropicError.ts +130 -37
  38. package/src/AnthropicLanguageModel.ts +274 -33
  39. package/src/AnthropicTelemetry.ts +24 -17
  40. package/src/AnthropicTool.ts +293 -133
  41. package/src/Generated.ts +3751 -1815
  42. package/src/index.ts +52 -8
  43. package/src/internal/errors.ts +9 -7
@@ -4,13 +4,13 @@
4
4
  * Provides Anthropic-specific metadata fields for AI error types through module
5
5
  * augmentation, enabling typed access to Anthropic error details.
6
6
  *
7
- * @since 1.0.0
7
+ * @since 4.0.0
8
8
  */
9
9
  /**
10
10
  * Anthropic-specific error metadata fields.
11
11
  *
12
- * @since 1.0.0
13
12
  * @category models
13
+ * @since 4.0.0
14
14
  */
15
15
  export type AnthropicErrorMetadata = {
16
16
  /**
@@ -25,11 +25,12 @@ export type AnthropicErrorMetadata = {
25
25
  /**
26
26
  * Anthropic-specific rate limit metadata fields.
27
27
  *
28
- * Extends base error metadata with rate limit specific information from
29
- * Anthropic's rate limit headers.
28
+ * **Details**
29
+ *
30
+ * Extends base error metadata with rate limit-specific information from Anthropic's rate limit headers.
30
31
  *
31
- * @since 1.0.0
32
32
  * @category models
33
+ * @since 4.0.0
33
34
  */
34
35
  export type AnthropicRateLimitMetadata = AnthropicErrorMetadata & {
35
36
  /**
@@ -58,45 +59,135 @@ export type AnthropicRateLimitMetadata = AnthropicErrorMetadata & {
58
59
  readonly tokensReset: string | null;
59
60
  };
60
61
  declare module "effect/unstable/ai/AiError" {
61
- interface RateLimitError {
62
- readonly metadata: {
63
- readonly anthropic?: AnthropicRateLimitMetadata | null;
64
- };
62
+ /**
63
+ * Anthropic metadata attached to `RateLimitError` values.
64
+ *
65
+ * **Details**
66
+ *
67
+ * Includes request identifiers, Anthropic error types, and parsed request or token limit headers when the provider rejects a request due to rate limits.
68
+ *
69
+ * @category configuration
70
+ * @since 4.0.0
71
+ */
72
+ interface RateLimitErrorMetadata {
73
+ readonly anthropic?: AnthropicRateLimitMetadata | null;
65
74
  }
66
- interface QuotaExhaustedError {
67
- readonly metadata: {
68
- readonly anthropic?: AnthropicErrorMetadata | null;
69
- };
75
+ /**
76
+ * Anthropic metadata attached to `QuotaExhaustedError` values.
77
+ *
78
+ * **Details**
79
+ *
80
+ * Captures the Anthropic error type and request identifier for failures where the account or workspace has exhausted its available quota.
81
+ *
82
+ * @category configuration
83
+ * @since 4.0.0
84
+ */
85
+ interface QuotaExhaustedErrorMetadata {
86
+ readonly anthropic?: AnthropicErrorMetadata | null;
70
87
  }
71
- interface AuthenticationError {
72
- readonly metadata: {
73
- readonly anthropic?: AnthropicErrorMetadata | null;
74
- };
88
+ /**
89
+ * Anthropic metadata attached to `AuthenticationError` values.
90
+ *
91
+ * **Details**
92
+ *
93
+ * Preserves Anthropic error details for missing, invalid, or unauthorized API credentials while keeping the error in the shared AI error model.
94
+ *
95
+ * @category configuration
96
+ * @since 4.0.0
97
+ */
98
+ interface AuthenticationErrorMetadata {
99
+ readonly anthropic?: AnthropicErrorMetadata | null;
75
100
  }
76
- interface ContentPolicyError {
77
- readonly metadata: {
78
- readonly anthropic?: AnthropicErrorMetadata | null;
79
- };
101
+ /**
102
+ * Anthropic metadata attached to `ContentPolicyError` values.
103
+ *
104
+ * **Details**
105
+ *
106
+ * Records Anthropic error details returned when a request or response is rejected by Anthropic safety or content policy enforcement.
107
+ *
108
+ * @category configuration
109
+ * @since 4.0.0
110
+ */
111
+ interface ContentPolicyErrorMetadata {
112
+ readonly anthropic?: AnthropicErrorMetadata | null;
80
113
  }
81
- interface InvalidRequestError {
82
- readonly metadata: {
83
- readonly anthropic?: AnthropicErrorMetadata | null;
84
- };
114
+ /**
115
+ * Anthropic metadata attached to `InvalidRequestError` values.
116
+ *
117
+ * **Details**
118
+ *
119
+ * Provides the Anthropic error type and request identifier for malformed or unsupported requests rejected before model execution.
120
+ *
121
+ * @category configuration
122
+ * @since 4.0.0
123
+ */
124
+ interface InvalidRequestErrorMetadata {
125
+ readonly anthropic?: AnthropicErrorMetadata | null;
85
126
  }
86
- interface InternalProviderError {
87
- readonly metadata: {
88
- readonly anthropic?: AnthropicErrorMetadata | null;
89
- };
127
+ /**
128
+ * Anthropic metadata attached to `InternalProviderError` values.
129
+ *
130
+ * **Details**
131
+ *
132
+ * Preserves Anthropic request correlation data for provider-side failures that should be reported or investigated with Anthropic support.
133
+ *
134
+ * @category configuration
135
+ * @since 4.0.0
136
+ */
137
+ interface InternalProviderErrorMetadata {
138
+ readonly anthropic?: AnthropicErrorMetadata | null;
139
+ }
140
+ /**
141
+ * Anthropic metadata attached to `InvalidOutputError` values.
142
+ *
143
+ * **Details**
144
+ *
145
+ * Describes Anthropic-specific context for responses that could not be decoded or interpreted as valid AI output.
146
+ *
147
+ * @category configuration
148
+ * @since 4.0.0
149
+ */
150
+ interface InvalidOutputErrorMetadata {
151
+ readonly anthropic?: AnthropicErrorMetadata | null;
90
152
  }
91
- interface InvalidOutputError {
92
- readonly metadata: {
93
- readonly anthropic?: AnthropicErrorMetadata | null;
94
- };
153
+ /**
154
+ * Anthropic metadata attached to `StructuredOutputError` values.
155
+ *
156
+ * **Details**
157
+ *
158
+ * Captures Anthropic error details for structured-output failures, including request correlation data useful when diagnosing schema-related responses.
159
+ *
160
+ * @category configuration
161
+ * @since 4.0.0
162
+ */
163
+ interface StructuredOutputErrorMetadata {
164
+ readonly anthropic?: AnthropicErrorMetadata | null;
95
165
  }
96
- interface UnknownError {
97
- readonly metadata: {
98
- readonly anthropic?: AnthropicErrorMetadata | null;
99
- };
166
+ /**
167
+ * Anthropic metadata attached to `UnsupportedSchemaError` values.
168
+ *
169
+ * **Details**
170
+ *
171
+ * Provides Anthropic error details for schemas that cannot be represented by or submitted to the Anthropic API.
172
+ *
173
+ * @category configuration
174
+ * @since 4.0.0
175
+ */
176
+ interface UnsupportedSchemaErrorMetadata {
177
+ readonly anthropic?: AnthropicErrorMetadata | null;
178
+ }
179
+ /**
180
+ * Anthropic metadata attached to `UnknownError` values.
181
+ *
182
+ * **Details**
183
+ *
184
+ * Retains the Anthropic error type and request identifier when a provider response cannot be classified as a more specific AI error.
185
+ *
186
+ * @category configuration
187
+ * @since 4.0.0
188
+ */
189
+ interface UnknownErrorMetadata {
190
+ readonly anthropic?: AnthropicErrorMetadata | null;
100
191
  }
101
192
  }
102
193
  //# sourceMappingURL=AnthropicError.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AnthropicError.d.ts","sourceRoot":"","sources":["../src/AnthropicError.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;GAKG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACjC;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;CAClC,CAAA;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,0BAA0B,GAAG,sBAAsB,GAAG;IAChE;;OAEG;IACH,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IACrC;;OAEG;IACH,QAAQ,CAAC,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAA;IACzC;;OAEG;IACH,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IACrC;;OAEG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IACnC;;OAEG;IACH,QAAQ,CAAC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAA;IACvC;;OAEG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;CACpC,CAAA;AAED,OAAO,QAAQ,4BAA4B,CAAC;IAC1C,UAAiB,cAAc;QAC7B,QAAQ,CAAC,QAAQ,EAAE;YACjB,QAAQ,CAAC,SAAS,CAAC,EAAE,0BAA0B,GAAG,IAAI,CAAA;SACvD,CAAA;KACF;IAED,UAAiB,mBAAmB;QAClC,QAAQ,CAAC,QAAQ,EAAE;YACjB,QAAQ,CAAC,SAAS,CAAC,EAAE,sBAAsB,GAAG,IAAI,CAAA;SACnD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S,CAAC,EAAE,sBAAsB,GAAG,IAAI,CAAA;KACnD;IAED;;;;;;;;;OASG;IACH,UAAiB,8BAA8B;QAC7C,QAAQ,CAAC,SAAS,CAAC,EAAE,sBAAsB,GAAG,IAAI,CAAA;KACnD;IAED;;;;;;;;;OASG;IACH,UAAiB,oBAAoB;QACnC,QAAQ,CAAC,SAAS,CAAC,EAAE,sBAAsB,GAAG,IAAI,CAAA;KACnD;CACF"}
@@ -4,7 +4,7 @@
4
4
  * Provides Anthropic-specific metadata fields for AI error types through module
5
5
  * augmentation, enabling typed access to Anthropic error details.
6
6
  *
7
- * @since 1.0.0
7
+ * @since 4.0.0
8
8
  */
9
9
  export {};
10
10
  //# sourceMappingURL=AnthropicError.js.map