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

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 +89 -66
  2. package/dist/AnthropicClient.d.ts.map +1 -1
  3. package/dist/AnthropicClient.js +75 -17
  4. package/dist/AnthropicClient.js.map +1 -1
  5. package/dist/AnthropicConfig.d.ts +68 -10
  6. package/dist/AnthropicConfig.d.ts.map +1 -1
  7. package/dist/AnthropicConfig.js +43 -7
  8. package/dist/AnthropicConfig.js.map +1 -1
  9. package/dist/AnthropicError.d.ts +136 -37
  10. package/dist/AnthropicError.d.ts.map +1 -1
  11. package/dist/AnthropicError.js +1 -1
  12. package/dist/AnthropicLanguageModel.d.ts +384 -71
  13. package/dist/AnthropicLanguageModel.d.ts.map +1 -1
  14. package/dist/AnthropicLanguageModel.js +102 -16
  15. package/dist/AnthropicLanguageModel.js.map +1 -1
  16. package/dist/AnthropicTelemetry.d.ts +42 -15
  17. package/dist/AnthropicTelemetry.d.ts.map +1 -1
  18. package/dist/AnthropicTelemetry.js +44 -8
  19. package/dist/AnthropicTelemetry.js.map +1 -1
  20. package/dist/AnthropicTool.d.ts +1116 -183
  21. package/dist/AnthropicTool.d.ts.map +1 -1
  22. package/dist/AnthropicTool.js +818 -129
  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 +8 -29
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js +8 -29
  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 +119 -70
  36. package/src/AnthropicConfig.ts +69 -11
  37. package/src/AnthropicError.ts +138 -37
  38. package/src/AnthropicLanguageModel.ts +405 -38
  39. package/src/AnthropicTelemetry.ts +76 -20
  40. package/src/AnthropicTool.ts +1109 -176
  41. package/src/Generated.ts +3751 -1815
  42. package/src/index.ts +8 -29
  43. package/src/internal/errors.ts +9 -7
@@ -1,9 +1,9 @@
1
1
  import type * as Config from "effect/Config";
2
+ import * as Context from "effect/Context";
2
3
  import * as Effect from "effect/Effect";
3
4
  import * as Layer from "effect/Layer";
4
5
  import * as Redacted from "effect/Redacted";
5
6
  import * as Schema from "effect/Schema";
6
- import * as ServiceMap from "effect/ServiceMap";
7
7
  import * as Stream from "effect/Stream";
8
8
  import type * as AiError from "effect/unstable/ai/AiError";
9
9
  import * as Sse from "effect/unstable/encoding/Sse";
@@ -13,25 +13,19 @@ import * as HttpClientRequest from "effect/unstable/http/HttpClientRequest";
13
13
  import type * as HttpClientResponse from "effect/unstable/http/HttpClientResponse";
14
14
  import * as Generated from "./Generated.ts";
15
15
  /**
16
- * The Anthropic client service interface.
16
+ * Represents the Anthropic client service with methods for the Messages API, including regular and streaming message
17
+ * creation.
17
18
  *
18
- * Provides methods for interacting with Anthropic's Messages API, including
19
- * both synchronous and streaming message creation.
20
- *
21
- * @since 1.0.0
22
19
  * @category models
20
+ * @since 4.0.0
23
21
  */
24
22
  export interface Service {
25
23
  /**
26
- * The underlying generated Anthropic client providing access to all API
27
- * endpoints.
24
+ * The underlying generated Anthropic client that exposes all API endpoints.
28
25
  */
29
26
  readonly client: Generated.AnthropicClient;
30
27
  /**
31
- * Low-level streaming request helper for custom SSE endpoints.
32
- *
33
- * Executes an HTTP request and decodes the Server-Sent Events response
34
- * using the provided schema.
28
+ * Executes a low-level streaming HTTP request and decodes the Server-Sent Events response using the provided schema.
35
29
  */
36
30
  readonly streamRequest: <Type extends {
37
31
  readonly id?: string | undefined;
@@ -39,10 +33,7 @@ export interface Service {
39
33
  readonly data: string;
40
34
  }, DecodingServices>(schema: Schema.Decoder<Type, DecodingServices>) => (request: HttpClientRequest.HttpClientRequest) => Stream.Stream<Type, HttpClientError.HttpClientError | Schema.SchemaError | Sse.Retry, DecodingServices>;
41
35
  /**
42
- * Creates a message using the Anthropic Messages API.
43
- *
44
- * Sends a structured list of input messages and returns the model's
45
- * generated response. All errors are mapped to the unified `AiError` type.
36
+ * Creates a message using the Anthropic Messages API and maps all errors to the unified `AiError` type.
46
37
  */
47
38
  readonly createMessage: (options: {
48
39
  readonly payload: typeof Generated.BetaCreateMessageParams.Encoded;
@@ -52,12 +43,12 @@ export interface Service {
52
43
  response: HttpClientResponse.HttpClientResponse
53
44
  ], AiError.AiError>;
54
45
  /**
55
- * Creates a streaming message using the Anthropic Messages API.
46
+ * Creates a streaming message using the Anthropic Messages API and maps all errors to the unified `AiError` type.
47
+ *
48
+ * **Details**
56
49
  *
57
- * Returns an Effect that yields the HTTP response and a stream of events
58
- * as the model generates its response. The stream automatically terminates
59
- * when a `message_stop` event is received. All errors are mapped to the
60
- * unified `AiError` type.
50
+ * The returned Effect yields the HTTP response and a stream of events as the model generates its response. The stream
51
+ * automatically terminates when a `message_stop` event is received.
61
52
  */
62
53
  readonly createMessageStream: (options: {
63
54
  readonly payload: Omit<typeof Generated.BetaCreateMessageParams.Encoded, "stream">;
@@ -68,8 +59,9 @@ export interface Service {
68
59
  ], AiError.AiError>;
69
60
  }
70
61
  /**
71
- * Represents an event received from the Anthropic Messages API during a
72
- * streaming request.
62
+ * Represents an event received from the Anthropic Messages API during a streaming request.
63
+ *
64
+ * **Details**
73
65
  *
74
66
  * Events include:
75
67
  * - `message_start`: Initial event containing message metadata
@@ -80,115 +72,146 @@ export interface Service {
80
72
  * - `content_block_stop`: End of a content block
81
73
  * - `error`: Error events with type and message
82
74
  *
83
- * @since 1.0.0
84
75
  * @category models
76
+ * @since 4.0.0
85
77
  */
86
78
  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
- declare const AnthropicClient_base: ServiceMap.ServiceClass<AnthropicClient, "@effect/ai-anthropic/AnthropicClient", Service>;
79
+ declare const AnthropicClient_base: Context.ServiceClass<AnthropicClient, "@effect/ai-anthropic/AnthropicClient", Service>;
88
80
  /**
89
81
  * Service identifier for the Anthropic client.
90
82
  *
91
- * @since 1.0.0
92
- * @category service
83
+ * **When to use**
84
+ *
85
+ * Use when accessing or providing the Anthropic client service through Effect's
86
+ * context.
87
+ *
88
+ * @see {@link make} for constructing an Anthropic client effectfully
89
+ * @see {@link layer} for providing a client from explicit options
90
+ * @see {@link layerConfig} for providing a client from `Config`
91
+ *
92
+ * @category services
93
+ * @since 4.0.0
93
94
  */
94
95
  export declare class AnthropicClient extends AnthropicClient_base {
95
96
  }
96
97
  /**
97
98
  * Configuration options for creating an Anthropic client.
98
99
  *
99
- * @since 1.0.0
100
+ * **When to use**
101
+ *
102
+ * Use when the Anthropic client settings are already available as values and
103
+ * should be passed directly to `make` or `layer`.
104
+ *
105
+ * **Details**
106
+ *
107
+ * These options configure the base Anthropic URL, the `x-api-key`
108
+ * authentication header, the `anthropic-version` header, and an optional
109
+ * transformation of the underlying `HttpClient`.
110
+ *
111
+ * @see {@link make} for constructing an Anthropic client from explicit options
112
+ * @see {@link layer} for providing an Anthropic client from explicit options
113
+ * @see {@link layerConfig} for loading Anthropic client settings from `Config`
114
+ *
100
115
  * @category models
116
+ * @since 4.0.0
101
117
  */
102
118
  export type Options = {
103
119
  /**
104
- * The Anthropic API key for authentication.
105
- *
106
- * If not provided, requests will be made without authentication (useful for
107
- * proxied setups or testing).
120
+ * The Anthropic API key for authentication. Requests are made without authentication when this is omitted, which is
121
+ * useful for proxied setups or testing.
108
122
  */
109
123
  readonly apiKey?: Redacted.Redacted<string> | undefined;
110
124
  /**
111
- * The base URL for the Anthropic API.
112
- *
113
- * Override this to use a proxy or a different API-compatible endpoint.
125
+ * The base URL for the Anthropic API. Override this to use a proxy or a different API-compatible endpoint.
114
126
  *
115
127
  * @default "https://api.anthropic.com"
116
128
  */
117
129
  readonly apiUrl?: string | undefined;
118
130
  /**
119
- * The Anthropic API version header value.
120
- *
121
- * Controls which version of the API to use. See Anthropic's versioning
122
- * documentation for available versions and their features.
131
+ * The Anthropic API version header value. This controls which version of the API to use.
123
132
  *
124
133
  * @default "2023-06-01"
125
134
  */
126
135
  readonly apiVersion?: string | undefined;
127
136
  /**
128
- * Optional transformer for the underlying HTTP client.
129
- *
130
- * Use this to add middleware, logging, or custom request/response handling.
137
+ * Optional transformer for the underlying HTTP client, such as middleware, logging, or custom request/response
138
+ * handling.
131
139
  */
132
140
  readonly transformClient?: ((client: HttpClient.HttpClient) => HttpClient.HttpClient) | undefined;
133
141
  };
134
142
  /**
135
143
  * Creates an Anthropic client service with the given options.
136
144
  *
137
- * The client automatically handles:
138
- * - API key authentication via the `x-api-key` header
139
- * - API versioning via the `anthropic-version` header
140
- * - Error mapping to the unified `AiError` type
141
- * - Request/response transformations via `AnthropicConfig`
145
+ * **When to use**
146
+ *
147
+ * Use when you have explicit configuration values and need an `Effect` that
148
+ * constructs the Anthropic client service, rather than providing it as a `Layer`.
149
+ *
150
+ * **Details**
142
151
  *
143
- * Requires an `HttpClient` in the context.
152
+ * The client handles API key authentication via the `x-api-key` header, API versioning via the `anthropic-version`
153
+ * header, error mapping to the unified `AiError` type, and request/response transformations via `AnthropicConfig`. It
154
+ * requires an `HttpClient` in the context.
155
+ *
156
+ * @see {@link layer} for providing the client as a `Layer` from explicit options
157
+ * @see {@link layerConfig} for providing the client as a `Layer` with `Config`-based settings
144
158
  *
145
- * @since 1.0.0
146
159
  * @category constructors
160
+ * @since 4.0.0
147
161
  */
148
162
  export declare const make: (options: Options) => Effect.Effect<Service, never, HttpClient.HttpClient>;
149
163
  /**
150
164
  * Creates a layer for the Anthropic client with the given options.
151
165
  *
152
- * @since 1.0.0
166
+ * **When to use**
167
+ *
168
+ * Use when you already have explicit `Options` values, such as an API key or
169
+ * custom API URL, and want to provide `AnthropicClient` as a `Layer`.
170
+ *
171
+ * @see {@link make} for constructing the client service effectfully
172
+ * @see {@link layerConfig} for loading client settings from `Config`
173
+ *
153
174
  * @category layers
175
+ * @since 4.0.0
154
176
  */
155
177
  export declare const layer: (options: Options) => Layer.Layer<AnthropicClient, never, HttpClient.HttpClient>;
156
178
  /**
157
179
  * Creates a layer for the Anthropic client, loading the requisite configuration
158
180
  * via Effect's `Config` module.
159
181
  *
160
- * @since 1.0.0
182
+ * **When to use**
183
+ *
184
+ * Use when you want to provide the Anthropic client as a `Layer` with
185
+ * configuration loaded from Effect's `Config` module, such as from environment
186
+ * variables or a secrets provider.
187
+ *
188
+ * @see {@link layer} for providing the client from explicit options instead of `Config`
189
+ * @see {@link make} for constructing the client service effectfully
190
+ *
161
191
  * @category layers
192
+ * @since 4.0.0
162
193
  */
163
194
  export declare const layerConfig: (options?: {
164
195
  /**
165
- * The Anthropic API key for authentication.
166
- *
167
- * If not provided, requests will be made without authentication (useful for
168
- * proxied setups or testing).
196
+ * The Anthropic API key for authentication. Requests are made without authentication when this is omitted, which is
197
+ * useful for proxied setups or testing.
169
198
  */
170
- readonly apiKey?: Config.Config<Redacted.Redacted<string>> | undefined;
199
+ readonly apiKey?: Config.Config<Redacted.Redacted<string> | undefined> | undefined;
171
200
  /**
172
- * The base URL for the Anthropic API.
173
- *
174
- * Override this to use a proxy or a different API-compatible endpoint.
201
+ * The base URL for the Anthropic API. Override this to use a proxy or a different API-compatible endpoint.
175
202
  *
176
203
  * @default "https://api.anthropic.com"
177
204
  */
178
205
  readonly apiUrl?: Config.Config<string> | undefined;
179
206
  /**
180
- * The Anthropic API version header value.
181
- *
182
- * Controls which version of the API to use. See Anthropic's versioning
183
- * documentation for available versions and their features.
207
+ * The Anthropic API version header value. This controls which version of the API to use.
184
208
  *
185
209
  * @default "2023-06-01"
186
210
  */
187
211
  readonly apiVersion?: Config.Config<string> | undefined;
188
212
  /**
189
- * Optional transformer for the underlying HTTP client.
190
- *
191
- * Use this to add middleware, logging, or custom request/response handling.
213
+ * Optional transformer for the underlying HTTP client, such as middleware, logging, or custom request/response
214
+ * handling.
192
215
  */
193
216
  readonly transformClient?: ((client: HttpClient.HttpClient) => HttpClient.HttpClient) | undefined;
194
217
  }) => Layer.Layer<AnthropicClient, Config.ConfigError, HttpClient.HttpClient>;
@@ -1 +1 @@
1
- {"version":3,"file":"AnthropicClient.d.ts","sourceRoot":"","sources":["../src/AnthropicClient.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAA;AAC5C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAErC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAA;AAC3C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,UAAU,MAAM,mBAAmB,CAAA;AAC/C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,KAAK,OAAO,MAAM,4BAA4B,CAAA;AAC1D,OAAO,KAAK,GAAG,MAAM,8BAA8B,CAAA;AAGnD,OAAO,KAAK,UAAU,MAAM,iCAAiC,CAAA;AAC7D,OAAO,KAAK,KAAK,eAAe,MAAM,sCAAsC,CAAA;AAC5E,OAAO,KAAK,iBAAiB,MAAM,wCAAwC,CAAA;AAC3E,OAAO,KAAK,KAAK,kBAAkB,MAAM,yCAAyC,CAAA;AAElF,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAA;AAO3C;;;;;;;;GAQG;AACH,MAAM,WAAW,OAAO;IACtB;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC,eAAe,CAAA;IAE1C;;;;;OAKG;IACH,QAAQ,CAAC,aAAa,EAAE,CACtB,IAAI,SAAS;QACX,QAAQ,CAAC,E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UAAU,CAAC,GAAG,SAAS,CAAA;CAClG,CAAA;AAUD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,IAAI,4EAwIhB,CAAA;AAMD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,KAAK,GAAI,SAAS,OAAO,KAAG,KAAK,CAAC,KAAK,CAAC,eAAe,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,CACpD,CAAA;AAE9C;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,WAAW,GAAI,UAAU;IACpC;;;OAGG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC,GAAG,SAAS,CAAA;IAElF;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,SAAS,CAAA;IAEnD;;;;OAIG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,SAAS,CAAA;IAEvD;;;OAGG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,UAAU,CAAC,UAAU,KAAK,UAAU,CAAC,UAAU,CAAC,GAAG,SAAS,CAAA;CAClG,KAAG,KAAK,CAAC,KAAK,CAAC,eAAe,EAAE,MAAM,CAAC,WAAW,EAAE,UAAU,CAAC,UAAU,CAoBvE,CAAA"}
@@ -1,19 +1,45 @@
1
1
  /**
2
- * Anthropic Client module for interacting with Anthropic's API.
2
+ * The `AnthropicClient` module defines the low-level Effect service used to
3
+ * call Anthropic's API. It wraps the generated Anthropic HTTP client with
4
+ * Effect layers, request defaults, authentication headers, API versioning,
5
+ * response decoding, and error mapping for Messages API calls.
3
6
  *
4
- * Provides a type-safe, Effect-based client for Anthropic operations including
5
- * messages and streaming responses.
7
+ * **Mental model**
6
8
  *
7
- * @since 1.0.0
9
+ * `HttpClient.HttpClient` provides the transport. {@link make} turns explicit
10
+ * {@link Options} into an {@link AnthropicClient} service, while {@link layer}
11
+ * and {@link layerConfig} provide that service as a layer. The service exposes
12
+ * the generated client for direct endpoint access plus handwritten helpers for
13
+ * regular and streaming message creation.
14
+ *
15
+ * **Common tasks**
16
+ *
17
+ * - Provide an authenticated Anthropic client from an API key and optional base
18
+ * URL
19
+ * - Load client settings from Effect `Config` with {@link layerConfig}
20
+ * - Apply HTTP client transformations for proxying, retries, instrumentation,
21
+ * or tests
22
+ * - Decode Anthropic server-sent event streams into typed message events
23
+ *
24
+ * **Gotchas**
25
+ *
26
+ * - `apiKey` is optional so proxied and test clients can provide
27
+ * authentication elsewhere.
28
+ * - `createMessageStream` filters Anthropic ping events and terminates the
29
+ * stream when a `message_stop` event is received.
30
+ * - The message helpers map transport, schema, and provider failures to the
31
+ * unified Effect AI error type.
32
+ *
33
+ * @since 4.0.0
8
34
  */
9
35
  import * as Array from "effect/Array";
36
+ import * as Context from "effect/Context";
10
37
  import * as Effect from "effect/Effect";
11
38
  import { identity } from "effect/Function";
12
39
  import * as Layer from "effect/Layer";
13
40
  import * as Predicate from "effect/Predicate";
14
41
  import * as Redacted from "effect/Redacted";
15
42
  import * as Schema from "effect/Schema";
16
- import * as ServiceMap from "effect/ServiceMap";
17
43
  import * as Stream from "effect/Stream";
18
44
  import * as Sse from "effect/unstable/encoding/Sse";
19
45
  import * as Headers from "effect/unstable/http/Headers";
@@ -29,10 +55,19 @@ import * as Errors from "./internal/errors.js";
29
55
  /**
30
56
  * Service identifier for the Anthropic client.
31
57
  *
32
- * @since 1.0.0
33
- * @category service
58
+ * **When to use**
59
+ *
60
+ * Use when accessing or providing the Anthropic client service through Effect's
61
+ * context.
62
+ *
63
+ * @see {@link make} for constructing an Anthropic client effectfully
64
+ * @see {@link layer} for providing a client from explicit options
65
+ * @see {@link layerConfig} for providing a client from `Config`
66
+ *
67
+ * @category services
68
+ * @since 4.0.0
34
69
  */
35
- export class AnthropicClient extends /*#__PURE__*/ServiceMap.Service()("@effect/ai-anthropic/AnthropicClient") {}
70
+ export class AnthropicClient extends /*#__PURE__*/Context.Service()("@effect/ai-anthropic/AnthropicClient") {}
36
71
  // =============================================================================
37
72
  // Constructor
38
73
  // =============================================================================
@@ -42,16 +77,22 @@ const RedactedAnthropicHeaders = {
42
77
  /**
43
78
  * Creates an Anthropic client service with the given options.
44
79
  *
45
- * The client automatically handles:
46
- * - API key authentication via the `x-api-key` header
47
- * - API versioning via the `anthropic-version` header
48
- * - Error mapping to the unified `AiError` type
49
- * - Request/response transformations via `AnthropicConfig`
80
+ * **When to use**
81
+ *
82
+ * Use when you have explicit configuration values and need an `Effect` that
83
+ * constructs the Anthropic client service, rather than providing it as a `Layer`.
50
84
  *
51
- * Requires an `HttpClient` in the context.
85
+ * **Details**
86
+ *
87
+ * The client handles API key authentication via the `x-api-key` header, API versioning via the `anthropic-version`
88
+ * header, error mapping to the unified `AiError` type, and request/response transformations via `AnthropicConfig`. It
89
+ * requires an `HttpClient` in the context.
90
+ *
91
+ * @see {@link layer} for providing the client as a `Layer` from explicit options
92
+ * @see {@link layerConfig} for providing the client as a `Layer` with `Config`-based settings
52
93
  *
53
- * @since 1.0.0
54
94
  * @category constructors
95
+ * @since 4.0.0
55
96
  */
56
97
  export const make = /*#__PURE__*/Effect.fnUntraced(function* (options) {
57
98
  const baseClient = yield* HttpClient.HttpClient;
@@ -117,16 +158,33 @@ export const make = /*#__PURE__*/Effect.fnUntraced(function* (options) {
117
158
  /**
118
159
  * Creates a layer for the Anthropic client with the given options.
119
160
  *
120
- * @since 1.0.0
161
+ * **When to use**
162
+ *
163
+ * Use when you already have explicit `Options` values, such as an API key or
164
+ * custom API URL, and want to provide `AnthropicClient` as a `Layer`.
165
+ *
166
+ * @see {@link make} for constructing the client service effectfully
167
+ * @see {@link layerConfig} for loading client settings from `Config`
168
+ *
121
169
  * @category layers
170
+ * @since 4.0.0
122
171
  */
123
172
  export const layer = options => Layer.effect(AnthropicClient, make(options));
124
173
  /**
125
174
  * Creates a layer for the Anthropic client, loading the requisite configuration
126
175
  * via Effect's `Config` module.
127
176
  *
128
- * @since 1.0.0
177
+ * **When to use**
178
+ *
179
+ * Use when you want to provide the Anthropic client as a `Layer` with
180
+ * configuration loaded from Effect's `Config` module, such as from environment
181
+ * variables or a secrets provider.
182
+ *
183
+ * @see {@link layer} for providing the client from explicit options instead of `Config`
184
+ * @see {@link make} for constructing the client service effectfully
185
+ *
129
186
  * @category layers
187
+ * @since 4.0.0
130
188
  */
131
189
  export const layerConfig = options => Layer.effect(AnthropicClient, Effect.gen(function* () {
132
190
  const apiKey = Predicate.isNotUndefined(options?.apiKey) ? yield* options.apiKey : undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"AnthropicClient.js","names":["Array","Effect","identity","Layer","Predicate","Redacted","Schema","ServiceMap","Stream","Sse","Headers","HttpBody","HttpClient","HttpClientRequest","AnthropicConfig","Generated","Errors","AnthropicClient","Service","RedactedAnthropicHeaders","AnthropicApiKey","make","fnUntraced","options","baseClient","apiVersion","httpClient","pipe","mapRequest","request","prependUrl","apiUrl","isNotUndefined","apiKey","setHeader","value","acceptJson","transformClient","client","config","getOrUndefined","httpClientOk","filterStatusOk","streamRequest","schema","execute","map","response","stream","unwrap","decodeText","pipeThroughChannel","decodeSchema","createMessage","betaMessagesPost","includeResponse","catchTags","BetaMessagesPost4XX","error","fail","mapClientError","HttpClientError","mapHttpClientError","SchemaError","mapSchemaError","PingEvent","Struct","type","Literal","MessageEvent","Union","BetaMessageStartEvent","BetaMessageDeltaEvent","BetaMessageStopEvent","BetaContentBlockStartEvent","BetaContentBlockDeltaEvent","BetaContentBlockStopEvent","BetaErrorResponse","buildMessageStream","decodeDataSchema","takeUntil","event","data","filter","Retry","die","fromEffect","createMessageStream","post","headers","fromInput","params","undefined","body","jsonUnsafe","payload","catchTag","of","updateService","CurrentRedactedNames","appendAll","Object","values","layer","effect","layerConfig","gen"],"sources":["../src/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C,MAAM,CAAC8C,kBAAkB,CAACJ,KAAK,EAAE,qBAAqB,CAAC,CACnE,CACF;EACH,CAAC;EAED,OAAOzC,eAAe,CAACgF,EAAE,CAAC;IACxB3D,MAAM;IACNK,aAAa;IACbU,aAAa;IACbkC;GACD,CAAC;AACJ,CAAC,eACDtF,MAAM,CAACiG,aAAa,CAClBxF,OAAO,CAACyF,oBAAoB,eAC5BnG,KAAK,CAACoG,SAAS,cAACC,MAAM,CAACC,MAAM,CAACnF,wBAAwB,CAAC,CAAC,CACzD,CACF;AAED;AACA;AACA;AAEA;;;;;;AAMA,OAAO,MAAMoF,KAAK,GAAIhF,OAAgB,IACpCpB,KAAK,CAACqG,MAAM,CAACvF,eAAe,EAAEI,IAAI,CAACE,OAAO,CAAC,CAAC;AAE9C;;;;;;;AAOA,OAAO,MAAMkF,WAAW,GAAIlF,OAkC3B,IACCpB,KAAK,CAACqG,MAAM,CACVvF,eAAe,EACfhB,MAAM,CAACyG,GAAG,CAAC,aAAS;EAClB,MAAMzE,MAAM,GAAG7B,SAAS,CAAC4B,cAAc,CAACT,OAAO,EAAEU,MAAM,CAAC,GACpD,OAAOV,OAAO,CAACU,MAAM,GACvB2D,SAAS;EACX,MAAM7D,MAAM,GAAG3B,SAAS,CAAC4B,cAAc,CAACT,OAAO,EAAEQ,MAAM,CAAC,GACpD,OAAOR,OAAO,CAACQ,MAAM,GACvB6D,SAAS;EACX,MAAMnE,UAAU,GAAGrB,SAAS,CAAC4B,cAAc,CAACT,OAAO,EAAEE,UAAU,CAAC,GAC5D,OAAOF,OAAO,CAACE,UAAU,GAC3BmE,SAAS;EACX,OAAO,OAAOvE,IAAI,CAAC;IACjBY,MAAM;IACNF,MAAM;IACNN,UAAU;IACVY,eAAe,EAAEd,OAAO,EAAEc;GAC3B,CAAC;AACJ,CAAC,CAAC,CACH","ignoreList":[]}
1
+ {"version":3,"file":"AnthropicClient.js","names":["Array","Context","Effect","identity","Layer","Predicate","Redacted","Schema","Stream","Sse","Headers","HttpBody","HttpClient","HttpClientRequest","AnthropicConfig","Generated","Errors","AnthropicClient","Service","RedactedAnthropicHeaders","AnthropicApiKey","make","fnUntraced","options","baseClient","apiVersion","httpClient","pipe","mapRequest","request","prependUrl","apiUrl","isNotUndefined","apiKey","setHeader","value","acceptJson","transformClient","client","config","getOrUndefined","httpClientOk","filterStatusOk","streamRequest","schema","execute","map","response","stream","unwrap","decodeText","pipeThroughChannel","decodeSchema","createMessage","betaMessagesPost","includeResponse","catchTags","BetaMessagesPost4XX","error","fail","mapClientError","HttpClientError","mapHttpClientError","SchemaError","mapSchemaError","PingEvent","Struct","type","Literal","MessageEvent","Union","BetaMessageStartEvent","BetaMessageDeltaEvent","BetaMessageStopEvent","BetaContentBlockStartEvent","BetaContentBlockDeltaEvent","BetaContentBlockStopEvent","BetaErrorResponse","buildMessageStream","decodeDataSchema","takeUntil","event","data","filter","Retry","die","fromEffect","createMessageStream","post","headers","fromInput","params","undefined","body","jsonUnsafe","payload","catchTag","of","updateService","CurrentRedactedNames","appendAll","Object","values","layer","effect","layerConfig","gen"],"sources":["../src/AnthropicClient.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,OAAO,KAAKA,KAAK,MAAM,cAAc;AAErC,OAAO,KAAKC,OAAO,MAAM,gBAAgB;AACzC,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,SAASC,QAAQ,QAAQ,iBAAiB;AAC1C,OAAO,KAAKC,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,SAAS,MAAM,kBAAkB;AAC7C,OAAO,KAAKC,QAAQ,MAAM,iBAAiB;AAC3C,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,MAAM,MAAM,eAAe;AAEvC,OAAO,KAAKC,GAAG,MAAM,8BAA8B;AACnD,OAAO,KAAKC,OAAO,MAAM,8BAA8B;AACvD,OAAO,KAAKC,QAAQ,MAAM,+BAA+B;AACzD,OA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;;;;;;;;;;AAgBA,OAAO,MAAMkF,WAAW,GAAIlF,OA0B3B,IACCnB,KAAK,CAACoG,MAAM,CACVvF,eAAe,EACff,MAAM,CAACwG,GAAG,CAAC,aAAS;EAClB,MAAMzE,MAAM,GAAG5B,SAAS,CAAC2B,cAAc,CAACT,OAAO,EAAEU,MAAM,CAAC,GACpD,OAAOV,OAAO,CAACU,MAAM,GACvB2D,SAAS;EACX,MAAM7D,MAAM,GAAG1B,SAAS,CAAC2B,cAAc,CAACT,OAAO,EAAEQ,MAAM,CAAC,GACpD,OAAOR,OAAO,CAACQ,MAAM,GACvB6D,SAAS;EACX,MAAMnE,UAAU,GAAGpB,SAAS,CAAC2B,cAAc,CAACT,OAAO,EAAEE,UAAU,CAAC,GAC5D,OAAOF,OAAO,CAACE,UAAU,GAC3BmE,SAAS;EACX,OAAO,OAAOvE,IAAI,CAAC;IACjBY,MAAM;IACNF,MAAM;IACNN,UAAU;IACVY,eAAe,EAAEd,OAAO,EAAEc;GAC3B,CAAC;AACJ,CAAC,CAAC,CACH","ignoreList":[]}
@@ -1,45 +1,103 @@
1
1
  /**
2
- * @since 1.0.0
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
  */
22
+ import * as Context from "effect/Context";
4
23
  import * as Effect from "effect/Effect";
5
- import * as ServiceMap from "effect/ServiceMap";
6
24
  import type { HttpClient } from "effect/unstable/http/HttpClient";
7
- declare const AnthropicConfig_base: ServiceMap.ServiceClass<AnthropicConfig, "@effect/ai-anthropic/AnthropicConfig", AnthropicConfig.Service>;
25
+ declare const AnthropicConfig_base: Context.ServiceClass<AnthropicConfig, "@effect/ai-anthropic/AnthropicConfig", AnthropicConfig.Service>;
8
26
  /**
9
- * @since 1.0.0
27
+ * Service tag for Anthropic client configuration overrides, such as transformations applied to the generated HTTP client.
28
+ *
29
+ * **When to use**
30
+ *
31
+ * Use when a layer or integration needs to provide or read Anthropic client
32
+ * configuration through Effect's context.
33
+ *
34
+ * @see {@link withClientTransform} for scoping an HTTP client transformation
35
+ *
10
36
  * @category services
37
+ * @since 4.0.0
11
38
  */
12
39
  export declare class AnthropicConfig extends AnthropicConfig_base {
13
40
  /**
14
- * @since 1.0.0
41
+ * Gets the configured Anthropic service from the current context when present.
42
+ *
43
+ * @since 4.0.0
15
44
  */
16
45
  static readonly getOrUndefined: Effect.Effect<typeof AnthropicConfig.Service | undefined>;
17
46
  }
18
47
  /**
19
- * @since 1.0.0
48
+ * Namespace containing types associated with the `AnthropicConfig` service.
49
+ *
50
+ * @since 4.0.0
20
51
  */
21
52
  export declare namespace AnthropicConfig {
22
53
  /**
23
- * @since 1.0.0
54
+ * Configuration provided through `AnthropicConfig`.
55
+ *
56
+ * **Details**
57
+ *
58
+ * Use `transformClient` to wrap or replace the `HttpClient` used by generated Anthropic API requests.
59
+ *
24
60
  * @category models
61
+ * @since 4.0.0
25
62
  */
26
63
  interface Service {
27
64
  readonly transformClient?: ((client: HttpClient) => HttpClient) | undefined;
28
65
  }
29
66
  }
30
67
  /**
31
- * @since 1.0.0
68
+ * Runs an effect with an `AnthropicConfig` override that transforms the underlying `HttpClient` used by generated Anthropic requests.
69
+ *
70
+ * **When to use**
71
+ *
72
+ * Use when you need to apply a temporary `HttpClient` transformation, such as adding middleware or logging, to a
73
+ * specific scope of an effectful program.
74
+ *
32
75
  * @category configuration
76
+ * @since 4.0.0
33
77
  */
34
78
  export declare const withClientTransform: {
35
79
  /**
36
- * @since 1.0.0
80
+ * Runs an effect with an `AnthropicConfig` override that transforms the underlying `HttpClient` used by generated Anthropic requests.
81
+ *
82
+ * **When to use**
83
+ *
84
+ * Use when you need to apply a temporary `HttpClient` transformation, such as adding middleware or logging, to a
85
+ * specific scope of an effectful program.
86
+ *
37
87
  * @category configuration
88
+ * @since 4.0.0
38
89
  */
39
90
  (transform: (client: HttpClient) => HttpClient): <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
40
91
  /**
41
- * @since 1.0.0
92
+ * Runs an effect with an `AnthropicConfig` override that transforms the underlying `HttpClient` used by generated Anthropic requests.
93
+ *
94
+ * **When to use**
95
+ *
96
+ * Use when you need to apply a temporary `HttpClient` transformation, such as adding middleware or logging, to a
97
+ * specific scope of an effectful program.
98
+ *
42
99
  * @category configuration
100
+ * @since 4.0.0
43
101
  */
44
102
  <A, E, R>(self: Effect.Effect<A, E, R>, transform: (client: HttpClient) => HttpClient): Effect.Effect<A, E, R>;
45
103
  };
@@ -1 +1 @@
1
- {"version":3,"file":"AnthropicConfig.d.ts","sourceRoot":"","sources":["../src/AnthropicConfig.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,OAAO,KAAK,UAAU,MAAM,mBAAmB,CAAA;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAA;;AAEjE;;;GAGG;AACH,qBAAa,eAAgB,SAAQ,oBAGM;IACzC;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,eAAe,CAAC,OAAO,GAAG,SAAS,CAAC,CAGxF;CACF;AAED;;GAEG;AACH,MAAM,CAAC,OAAO,WAAW,eAAe,CAAC;IACvC;;;OAGG;IACH,UAAiB,OAAO;QACtB,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,MAA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