@effect/ai-anthropic 4.0.0-beta.66 → 4.0.0-beta.67
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/AnthropicClient.d.ts +7 -7
- package/dist/AnthropicClient.js +5 -5
- package/dist/AnthropicConfig.d.ts +43 -8
- package/dist/AnthropicConfig.d.ts.map +1 -1
- package/dist/AnthropicConfig.js +28 -4
- package/dist/AnthropicConfig.js.map +1 -1
- package/dist/AnthropicError.d.ts +93 -3
- package/dist/AnthropicError.d.ts.map +1 -1
- package/dist/AnthropicError.js +1 -1
- package/dist/AnthropicLanguageModel.d.ts +121 -10
- package/dist/AnthropicLanguageModel.d.ts.map +1 -1
- package/dist/AnthropicLanguageModel.js +32 -6
- package/dist/AnthropicLanguageModel.js.map +1 -1
- package/dist/AnthropicTelemetry.d.ts +10 -8
- package/dist/AnthropicTelemetry.d.ts.map +1 -1
- package/dist/AnthropicTelemetry.js +2 -2
- package/dist/AnthropicTelemetry.js.map +1 -1
- package/dist/AnthropicTool.d.ts +224 -118
- package/dist/AnthropicTool.d.ts.map +1 -1
- package/dist/AnthropicTool.js +76 -72
- package/dist/AnthropicTool.js.map +1 -1
- package/dist/Generated.d.ts +1 -1
- package/dist/Generated.js +1 -1
- package/dist/index.d.ts +8 -8
- package/dist/index.js +8 -8
- package/package.json +3 -3
- package/src/AnthropicClient.ts +8 -8
- package/src/AnthropicConfig.ts +43 -8
- package/src/AnthropicError.ts +93 -3
- package/src/AnthropicLanguageModel.ts +150 -13
- package/src/AnthropicTelemetry.ts +11 -9
- package/src/AnthropicTool.ts +224 -118
- package/src/Generated.ts +1 -1
- package/src/index.ts +8 -8
|
@@ -18,8 +18,8 @@ import * as Generated from "./Generated.ts";
|
|
|
18
18
|
* Provides methods for interacting with Anthropic's Messages API, including
|
|
19
19
|
* both synchronous and streaming message creation.
|
|
20
20
|
*
|
|
21
|
-
* @since 1.0.0
|
|
22
21
|
* @category models
|
|
22
|
+
* @since 4.0.0
|
|
23
23
|
*/
|
|
24
24
|
export interface Service {
|
|
25
25
|
/**
|
|
@@ -80,24 +80,24 @@ export interface Service {
|
|
|
80
80
|
* - `content_block_stop`: End of a content block
|
|
81
81
|
* - `error`: Error events with type and message
|
|
82
82
|
*
|
|
83
|
-
* @since 1.0.0
|
|
84
83
|
* @category models
|
|
84
|
+
* @since 4.0.0
|
|
85
85
|
*/
|
|
86
86
|
export type MessageStreamEvent = typeof Generated.BetaMessageStartEvent.Type | typeof Generated.BetaMessageDeltaEvent.Type | typeof Generated.BetaMessageStopEvent.Type | typeof Generated.BetaContentBlockStartEvent.Type | typeof Generated.BetaContentBlockDeltaEvent.Type | typeof Generated.BetaContentBlockStopEvent.Type | typeof Generated.BetaErrorResponse.Type;
|
|
87
87
|
declare const AnthropicClient_base: Context.ServiceClass<AnthropicClient, "@effect/ai-anthropic/AnthropicClient", Service>;
|
|
88
88
|
/**
|
|
89
89
|
* Service identifier for the Anthropic client.
|
|
90
90
|
*
|
|
91
|
-
* @since 1.0.0
|
|
92
91
|
* @category service
|
|
92
|
+
* @since 4.0.0
|
|
93
93
|
*/
|
|
94
94
|
export declare class AnthropicClient extends AnthropicClient_base {
|
|
95
95
|
}
|
|
96
96
|
/**
|
|
97
97
|
* Configuration options for creating an Anthropic client.
|
|
98
98
|
*
|
|
99
|
-
* @since 1.0.0
|
|
100
99
|
* @category models
|
|
100
|
+
* @since 4.0.0
|
|
101
101
|
*/
|
|
102
102
|
export type Options = {
|
|
103
103
|
/**
|
|
@@ -142,23 +142,23 @@ export type Options = {
|
|
|
142
142
|
*
|
|
143
143
|
* Requires an `HttpClient` in the context.
|
|
144
144
|
*
|
|
145
|
-
* @since 1.0.0
|
|
146
145
|
* @category constructors
|
|
146
|
+
* @since 4.0.0
|
|
147
147
|
*/
|
|
148
148
|
export declare const make: (options: Options) => Effect.Effect<Service, never, HttpClient.HttpClient>;
|
|
149
149
|
/**
|
|
150
150
|
* Creates a layer for the Anthropic client with the given options.
|
|
151
151
|
*
|
|
152
|
-
* @since 1.0.0
|
|
153
152
|
* @category layers
|
|
153
|
+
* @since 4.0.0
|
|
154
154
|
*/
|
|
155
155
|
export declare const layer: (options: Options) => Layer.Layer<AnthropicClient, never, HttpClient.HttpClient>;
|
|
156
156
|
/**
|
|
157
157
|
* Creates a layer for the Anthropic client, loading the requisite configuration
|
|
158
158
|
* via Effect's `Config` module.
|
|
159
159
|
*
|
|
160
|
-
* @since 1.0.0
|
|
161
160
|
* @category layers
|
|
161
|
+
* @since 4.0.0
|
|
162
162
|
*/
|
|
163
163
|
export declare const layerConfig: (options?: {
|
|
164
164
|
/**
|
package/dist/AnthropicClient.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Provides a type-safe, Effect-based client for Anthropic operations including
|
|
5
5
|
* messages and streaming responses.
|
|
6
6
|
*
|
|
7
|
-
* @since
|
|
7
|
+
* @since 4.0.0
|
|
8
8
|
*/
|
|
9
9
|
import * as Array from "effect/Array";
|
|
10
10
|
import * as Context from "effect/Context";
|
|
@@ -29,8 +29,8 @@ import * as Errors from "./internal/errors.js";
|
|
|
29
29
|
/**
|
|
30
30
|
* Service identifier for the Anthropic client.
|
|
31
31
|
*
|
|
32
|
-
* @since 1.0.0
|
|
33
32
|
* @category service
|
|
33
|
+
* @since 4.0.0
|
|
34
34
|
*/
|
|
35
35
|
export class AnthropicClient extends /*#__PURE__*/Context.Service()("@effect/ai-anthropic/AnthropicClient") {}
|
|
36
36
|
// =============================================================================
|
|
@@ -50,8 +50,8 @@ const RedactedAnthropicHeaders = {
|
|
|
50
50
|
*
|
|
51
51
|
* Requires an `HttpClient` in the context.
|
|
52
52
|
*
|
|
53
|
-
* @since 1.0.0
|
|
54
53
|
* @category constructors
|
|
54
|
+
* @since 4.0.0
|
|
55
55
|
*/
|
|
56
56
|
export const make = /*#__PURE__*/Effect.fnUntraced(function* (options) {
|
|
57
57
|
const baseClient = yield* HttpClient.HttpClient;
|
|
@@ -117,16 +117,16 @@ export const make = /*#__PURE__*/Effect.fnUntraced(function* (options) {
|
|
|
117
117
|
/**
|
|
118
118
|
* Creates a layer for the Anthropic client with the given options.
|
|
119
119
|
*
|
|
120
|
-
* @since 1.0.0
|
|
121
120
|
* @category layers
|
|
121
|
+
* @since 4.0.0
|
|
122
122
|
*/
|
|
123
123
|
export const layer = options => Layer.effect(AnthropicClient, make(options));
|
|
124
124
|
/**
|
|
125
125
|
* Creates a layer for the Anthropic client, loading the requisite configuration
|
|
126
126
|
* via Effect's `Config` module.
|
|
127
127
|
*
|
|
128
|
-
* @since 1.0.0
|
|
129
128
|
* @category layers
|
|
129
|
+
* @since 4.0.0
|
|
130
130
|
*/
|
|
131
131
|
export const layerConfig = options => Layer.effect(AnthropicClient, Effect.gen(function* () {
|
|
132
132
|
const apiKey = Predicate.isNotUndefined(options?.apiKey) ? yield* options.apiKey : undefined;
|
|
@@ -1,45 +1,80 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* The `AnthropicConfig` module provides contextual configuration for the
|
|
3
|
+
* Anthropic AI provider integration. It is used to customize the generated
|
|
4
|
+
* Anthropic HTTP client without changing individual request code.
|
|
5
|
+
*
|
|
6
|
+
* **Common tasks**
|
|
7
|
+
*
|
|
8
|
+
* - Provide a shared `HttpClient` transformation for Anthropic requests
|
|
9
|
+
* - Add provider-specific concerns such as request instrumentation, proxying,
|
|
10
|
+
* retries, or header manipulation
|
|
11
|
+
* - Scope a client transformation to a single effect with {@link withClientTransform}
|
|
12
|
+
*
|
|
13
|
+
* **Gotchas**
|
|
14
|
+
*
|
|
15
|
+
* - Configuration is read from the Effect context, so overrides only apply to
|
|
16
|
+
* effects run inside the configured scope
|
|
17
|
+
* - `withClientTransform` replaces the current `transformClient` value while
|
|
18
|
+
* preserving any other Anthropic configuration fields
|
|
19
|
+
*
|
|
20
|
+
* @since 4.0.0
|
|
3
21
|
*/
|
|
4
22
|
import * as Context from "effect/Context";
|
|
5
23
|
import * as Effect from "effect/Effect";
|
|
6
24
|
import type { HttpClient } from "effect/unstable/http/HttpClient";
|
|
7
25
|
declare const AnthropicConfig_base: Context.ServiceClass<AnthropicConfig, "@effect/ai-anthropic/AnthropicConfig", AnthropicConfig.Service>;
|
|
8
26
|
/**
|
|
9
|
-
*
|
|
27
|
+
* Service tag for Anthropic client configuration overrides, such as transformations applied to the generated HTTP client.
|
|
28
|
+
*
|
|
10
29
|
* @category services
|
|
30
|
+
* @since 4.0.0
|
|
11
31
|
*/
|
|
12
32
|
export declare class AnthropicConfig extends AnthropicConfig_base {
|
|
13
33
|
/**
|
|
14
|
-
*
|
|
34
|
+
* Gets the configured Anthropic service from the current context when present.
|
|
35
|
+
*
|
|
36
|
+
* @since 4.0.0
|
|
15
37
|
*/
|
|
16
38
|
static readonly getOrUndefined: Effect.Effect<typeof AnthropicConfig.Service | undefined>;
|
|
17
39
|
}
|
|
18
40
|
/**
|
|
19
|
-
*
|
|
41
|
+
* Namespace containing types associated with the `AnthropicConfig` service.
|
|
42
|
+
*
|
|
43
|
+
* @since 4.0.0
|
|
20
44
|
*/
|
|
21
45
|
export declare namespace AnthropicConfig {
|
|
22
46
|
/**
|
|
23
|
-
*
|
|
47
|
+
* Configuration provided through `AnthropicConfig`.
|
|
48
|
+
*
|
|
49
|
+
* **Details**
|
|
50
|
+
* Use `transformClient` to wrap or replace the `HttpClient` used by generated Anthropic API requests.
|
|
51
|
+
*
|
|
24
52
|
* @category models
|
|
53
|
+
* @since 4.0.0
|
|
25
54
|
*/
|
|
26
55
|
interface Service {
|
|
27
56
|
readonly transformClient?: ((client: HttpClient) => HttpClient) | undefined;
|
|
28
57
|
}
|
|
29
58
|
}
|
|
30
59
|
/**
|
|
31
|
-
*
|
|
60
|
+
* Runs an effect with an `AnthropicConfig` override that transforms the underlying `HttpClient` used by generated Anthropic requests.
|
|
61
|
+
*
|
|
32
62
|
* @category configuration
|
|
63
|
+
* @since 4.0.0
|
|
33
64
|
*/
|
|
34
65
|
export declare const withClientTransform: {
|
|
35
66
|
/**
|
|
36
|
-
*
|
|
67
|
+
* Runs an effect with an `AnthropicConfig` override that transforms the underlying `HttpClient` used by generated Anthropic requests.
|
|
68
|
+
*
|
|
37
69
|
* @category configuration
|
|
70
|
+
* @since 4.0.0
|
|
38
71
|
*/
|
|
39
72
|
(transform: (client: HttpClient) => HttpClient): <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
|
|
40
73
|
/**
|
|
41
|
-
*
|
|
74
|
+
* Runs an effect with an `AnthropicConfig` override that transforms the underlying `HttpClient` used by generated Anthropic requests.
|
|
75
|
+
*
|
|
42
76
|
* @category configuration
|
|
77
|
+
* @since 4.0.0
|
|
43
78
|
*/
|
|
44
79
|
<A, E, R>(self: Effect.Effect<A, E, R>, transform: (client: HttpClient) => HttpClient): Effect.Effect<A, E, R>;
|
|
45
80
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnthropicConfig.d.ts","sourceRoot":"","sources":["../src/AnthropicConfig.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"AnthropicConfig.d.ts","sourceRoot":"","sources":["../src/AnthropicConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAA;;AAEjE;;;;;GAKG;AACH,qBAAa,eAAgB,SAAQ,oBAGM;IACzC;;;;OAIG;IACH,MAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,eAAe,CAAC,OAAO,GAAG,SAAS,CAAC,CAGxF;CACF;AAED;;;;GAIG;AACH,MAAM,CAAC,OAAO,WAAW,eAAe,CAAC;IACvC;;;;;;;;OAQG;IACH,UAAiB,OAAO;QACtB,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,UAAU,KAAK,UAAU,CAAC,GAAG,SAAS,CAAA;KAC5E;CACF;AAED;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,EAAE;IAChC;;;;;OAKG;IACH,CAAC,SAAS,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,UAAU,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;IAClH;;;;;OAKG;IACH,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EACN,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAC5B,SAAS,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,UAAU,GAC5C,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;CAQvB,CAAA"}
|
package/dist/AnthropicConfig.js
CHANGED
|
@@ -1,22 +1,46 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* The `AnthropicConfig` module provides contextual configuration for the
|
|
3
|
+
* Anthropic AI provider integration. It is used to customize the generated
|
|
4
|
+
* Anthropic HTTP client without changing individual request code.
|
|
5
|
+
*
|
|
6
|
+
* **Common tasks**
|
|
7
|
+
*
|
|
8
|
+
* - Provide a shared `HttpClient` transformation for Anthropic requests
|
|
9
|
+
* - Add provider-specific concerns such as request instrumentation, proxying,
|
|
10
|
+
* retries, or header manipulation
|
|
11
|
+
* - Scope a client transformation to a single effect with {@link withClientTransform}
|
|
12
|
+
*
|
|
13
|
+
* **Gotchas**
|
|
14
|
+
*
|
|
15
|
+
* - Configuration is read from the Effect context, so overrides only apply to
|
|
16
|
+
* effects run inside the configured scope
|
|
17
|
+
* - `withClientTransform` replaces the current `transformClient` value while
|
|
18
|
+
* preserving any other Anthropic configuration fields
|
|
19
|
+
*
|
|
20
|
+
* @since 4.0.0
|
|
3
21
|
*/
|
|
4
22
|
import * as Context from "effect/Context";
|
|
5
23
|
import * as Effect from "effect/Effect";
|
|
6
24
|
import { dual } from "effect/Function";
|
|
7
25
|
/**
|
|
8
|
-
*
|
|
26
|
+
* Service tag for Anthropic client configuration overrides, such as transformations applied to the generated HTTP client.
|
|
27
|
+
*
|
|
9
28
|
* @category services
|
|
29
|
+
* @since 4.0.0
|
|
10
30
|
*/
|
|
11
31
|
export class AnthropicConfig extends /*#__PURE__*/Context.Service()("@effect/ai-anthropic/AnthropicConfig") {
|
|
12
32
|
/**
|
|
13
|
-
*
|
|
33
|
+
* Gets the configured Anthropic service from the current context when present.
|
|
34
|
+
*
|
|
35
|
+
* @since 4.0.0
|
|
14
36
|
*/
|
|
15
37
|
static getOrUndefined = /*#__PURE__*/Effect.map(/*#__PURE__*/Effect.context(), services => services.mapUnsafe.get(AnthropicConfig.key));
|
|
16
38
|
}
|
|
17
39
|
/**
|
|
18
|
-
*
|
|
40
|
+
* Runs an effect with an `AnthropicConfig` override that transforms the underlying `HttpClient` used by generated Anthropic requests.
|
|
41
|
+
*
|
|
19
42
|
* @category configuration
|
|
43
|
+
* @since 4.0.0
|
|
20
44
|
*/
|
|
21
45
|
export const withClientTransform = /*#__PURE__*/dual(2, (self, transformClient) => Effect.flatMap(AnthropicConfig.getOrUndefined, config => Effect.provideService(self, AnthropicConfig, {
|
|
22
46
|
...config,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnthropicConfig.js","names":["Context","Effect","dual","AnthropicConfig","Service","getOrUndefined","map","context","services","mapUnsafe","get","key","withClientTransform","self","transformClient","flatMap","config","provideService"],"sources":["../src/AnthropicConfig.ts"],"sourcesContent":[null],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"AnthropicConfig.js","names":["Context","Effect","dual","AnthropicConfig","Service","getOrUndefined","map","context","services","mapUnsafe","get","key","withClientTransform","self","transformClient","flatMap","config","provideService"],"sources":["../src/AnthropicConfig.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;AAqBA,OAAO,KAAKA,OAAO,MAAM,gBAAgB;AACzC,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,SAASC,IAAI,QAAQ,iBAAiB;AAGtC;;;;;;AAMA,OAAM,MAAOC,eAAgB,sBAAQH,OAAO,CAACI,OAAO,EAGjD,CAAC,sCAAsC,CAAC;EACzC;;;;;EAKA,OAAgBC,cAAc,gBAA8DJ,MAAM,CAACK,GAAG,cACpGL,MAAM,CAACM,OAAO,EAAS,EACtBC,QAAQ,IAAKA,QAAQ,CAACC,SAAS,CAACC,GAAG,CAACP,eAAe,CAACQ,GAAG,CAAC,CAC1D;;AAuBH;;;;;;AAMA,OAAO,MAAMC,mBAAmB,gBAkB5BV,IAAI,CAAC,CAAC,EAAE,CACVW,IAA4B,EAC5BC,eAAmD,KAEnDb,MAAM,CAACc,OAAO,CACZZ,eAAe,CAACE,cAAc,EAC7BW,MAAM,IAAKf,MAAM,CAACgB,cAAc,CAACJ,IAAI,EAAEV,eAAe,EAAE;EAAE,GAAGa,MAAM;EAAEF;AAAe,CAAE,CAAC,CACzF,CAAC","ignoreList":[]}
|
package/dist/AnthropicError.d.ts
CHANGED
|
@@ -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
|
|
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
|
/**
|
|
@@ -28,8 +28,8 @@ export type AnthropicErrorMetadata = {
|
|
|
28
28
|
* Extends base error metadata with rate limit specific information from
|
|
29
29
|
* Anthropic's rate limit headers.
|
|
30
30
|
*
|
|
31
|
-
* @since 1.0.0
|
|
32
31
|
* @category models
|
|
32
|
+
* @since 4.0.0
|
|
33
33
|
*/
|
|
34
34
|
export type AnthropicRateLimitMetadata = AnthropicErrorMetadata & {
|
|
35
35
|
/**
|
|
@@ -58,33 +58,123 @@ export type AnthropicRateLimitMetadata = AnthropicErrorMetadata & {
|
|
|
58
58
|
readonly tokensReset: string | null;
|
|
59
59
|
};
|
|
60
60
|
declare module "effect/unstable/ai/AiError" {
|
|
61
|
+
/**
|
|
62
|
+
* Anthropic metadata attached to `RateLimitError` values.
|
|
63
|
+
*
|
|
64
|
+
* Includes request identifiers, Anthropic error types, and parsed request or
|
|
65
|
+
* token limit headers when the provider rejects a request due to rate limits.
|
|
66
|
+
*
|
|
67
|
+
* @category provider options
|
|
68
|
+
* @since 4.0.0
|
|
69
|
+
*/
|
|
61
70
|
interface RateLimitErrorMetadata {
|
|
62
71
|
readonly anthropic?: AnthropicRateLimitMetadata | null;
|
|
63
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Anthropic metadata attached to `QuotaExhaustedError` values.
|
|
75
|
+
*
|
|
76
|
+
* Captures the Anthropic error type and request identifier for failures where
|
|
77
|
+
* the account or workspace has exhausted its available quota.
|
|
78
|
+
*
|
|
79
|
+
* @category provider options
|
|
80
|
+
* @since 4.0.0
|
|
81
|
+
*/
|
|
64
82
|
interface QuotaExhaustedErrorMetadata {
|
|
65
83
|
readonly anthropic?: AnthropicErrorMetadata | null;
|
|
66
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* Anthropic metadata attached to `AuthenticationError` values.
|
|
87
|
+
*
|
|
88
|
+
* Preserves Anthropic error details for missing, invalid, or unauthorized API
|
|
89
|
+
* credentials while keeping the error in the shared AI error model.
|
|
90
|
+
*
|
|
91
|
+
* @category provider options
|
|
92
|
+
* @since 4.0.0
|
|
93
|
+
*/
|
|
67
94
|
interface AuthenticationErrorMetadata {
|
|
68
95
|
readonly anthropic?: AnthropicErrorMetadata | null;
|
|
69
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* Anthropic metadata attached to `ContentPolicyError` values.
|
|
99
|
+
*
|
|
100
|
+
* Records Anthropic error details returned when a request or response is
|
|
101
|
+
* rejected by Anthropic safety or content policy enforcement.
|
|
102
|
+
*
|
|
103
|
+
* @category provider options
|
|
104
|
+
* @since 4.0.0
|
|
105
|
+
*/
|
|
70
106
|
interface ContentPolicyErrorMetadata {
|
|
71
107
|
readonly anthropic?: AnthropicErrorMetadata | null;
|
|
72
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* Anthropic metadata attached to `InvalidRequestError` values.
|
|
111
|
+
*
|
|
112
|
+
* Provides the Anthropic error type and request identifier for malformed or
|
|
113
|
+
* unsupported requests rejected before model execution.
|
|
114
|
+
*
|
|
115
|
+
* @category provider options
|
|
116
|
+
* @since 4.0.0
|
|
117
|
+
*/
|
|
73
118
|
interface InvalidRequestErrorMetadata {
|
|
74
119
|
readonly anthropic?: AnthropicErrorMetadata | null;
|
|
75
120
|
}
|
|
121
|
+
/**
|
|
122
|
+
* Anthropic metadata attached to `InternalProviderError` values.
|
|
123
|
+
*
|
|
124
|
+
* Preserves Anthropic request correlation data for provider-side failures
|
|
125
|
+
* that should be reported or investigated with Anthropic support.
|
|
126
|
+
*
|
|
127
|
+
* @category provider options
|
|
128
|
+
* @since 4.0.0
|
|
129
|
+
*/
|
|
76
130
|
interface InternalProviderErrorMetadata {
|
|
77
131
|
readonly anthropic?: AnthropicErrorMetadata | null;
|
|
78
132
|
}
|
|
133
|
+
/**
|
|
134
|
+
* Anthropic metadata attached to `InvalidOutputError` values.
|
|
135
|
+
*
|
|
136
|
+
* Describes Anthropic-specific context for responses that could not be
|
|
137
|
+
* decoded or interpreted as valid AI output.
|
|
138
|
+
*
|
|
139
|
+
* @category provider options
|
|
140
|
+
* @since 4.0.0
|
|
141
|
+
*/
|
|
79
142
|
interface InvalidOutputErrorMetadata {
|
|
80
143
|
readonly anthropic?: AnthropicErrorMetadata | null;
|
|
81
144
|
}
|
|
145
|
+
/**
|
|
146
|
+
* Anthropic metadata attached to `StructuredOutputError` values.
|
|
147
|
+
*
|
|
148
|
+
* Captures Anthropic error details for structured-output failures, including
|
|
149
|
+
* request correlation data useful when diagnosing schema-related responses.
|
|
150
|
+
*
|
|
151
|
+
* @category provider options
|
|
152
|
+
* @since 4.0.0
|
|
153
|
+
*/
|
|
82
154
|
interface StructuredOutputErrorMetadata {
|
|
83
155
|
readonly anthropic?: AnthropicErrorMetadata | null;
|
|
84
156
|
}
|
|
157
|
+
/**
|
|
158
|
+
* Anthropic metadata attached to `UnsupportedSchemaError` values.
|
|
159
|
+
*
|
|
160
|
+
* Provides Anthropic error details for schemas that cannot be represented by
|
|
161
|
+
* or submitted to the Anthropic API.
|
|
162
|
+
*
|
|
163
|
+
* @category provider options
|
|
164
|
+
* @since 4.0.0
|
|
165
|
+
*/
|
|
85
166
|
interface UnsupportedSchemaErrorMetadata {
|
|
86
167
|
readonly anthropic?: AnthropicErrorMetadata | null;
|
|
87
168
|
}
|
|
169
|
+
/**
|
|
170
|
+
* Anthropic metadata attached to `UnknownError` values.
|
|
171
|
+
*
|
|
172
|
+
* Retains the Anthropic error type and request identifier when a provider
|
|
173
|
+
* response cannot be classified as a more specific AI error.
|
|
174
|
+
*
|
|
175
|
+
* @category provider options
|
|
176
|
+
* @since 4.0.0
|
|
177
|
+
*/
|
|
88
178
|
interface UnknownErrorMetadata {
|
|
89
179
|
readonly anthropic?: AnthropicErrorMetadata | null;
|
|
90
180
|
}
|
|
@@ -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;I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