@effect/ai-anthropic 4.0.0-beta.65 → 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 +145 -34
- 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 +229 -123
- 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
|
@@ -9,8 +9,8 @@ import type * as Generated from "./Generated.ts";
|
|
|
9
9
|
/**
|
|
10
10
|
* The available Anthropic Claude model identifiers.
|
|
11
11
|
*
|
|
12
|
-
* @since 1.0.0
|
|
13
12
|
* @category models
|
|
13
|
+
* @since 4.0.0
|
|
14
14
|
*/
|
|
15
15
|
export type Model = typeof Generated.Model.Type;
|
|
16
16
|
declare const Config_base: Context.ServiceClass<Config, "@effect/ai-anthropic/AnthropicLanguageModel/Config", {
|
|
@@ -20,8 +20,8 @@ declare const Config_base: Context.ServiceClass<Config, "@effect/ai-anthropic/An
|
|
|
20
20
|
} | {
|
|
21
21
|
readonly type: "disabled";
|
|
22
22
|
} | {
|
|
23
|
-
readonly type: "enabled";
|
|
24
23
|
readonly budget_tokens: number;
|
|
24
|
+
readonly type: "enabled";
|
|
25
25
|
};
|
|
26
26
|
readonly max_tokens?: number;
|
|
27
27
|
readonly cache_control?: {
|
|
@@ -47,30 +47,30 @@ declare const Config_base: Context.ServiceClass<Config, "@effect/ai-anthropic/An
|
|
|
47
47
|
};
|
|
48
48
|
} | {
|
|
49
49
|
readonly type: "clear_tool_uses_20250919";
|
|
50
|
-
readonly
|
|
50
|
+
readonly clear_at_least?: {
|
|
51
51
|
readonly type: "input_tokens";
|
|
52
52
|
readonly value: number;
|
|
53
|
-
} |
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
};
|
|
53
|
+
} | null;
|
|
54
|
+
readonly clear_tool_inputs?: boolean | readonly string[] | null;
|
|
55
|
+
readonly exclude_tools?: readonly string[] | null;
|
|
57
56
|
readonly keep?: {
|
|
58
57
|
readonly type: "tool_uses";
|
|
59
58
|
readonly value: number;
|
|
60
59
|
};
|
|
61
|
-
readonly
|
|
60
|
+
readonly trigger?: {
|
|
62
61
|
readonly type: "input_tokens";
|
|
63
62
|
readonly value: number;
|
|
64
|
-
} |
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
} | {
|
|
64
|
+
readonly type: "tool_uses";
|
|
65
|
+
readonly value: number;
|
|
66
|
+
};
|
|
67
67
|
})[];
|
|
68
68
|
} | null;
|
|
69
69
|
readonly container?: string | {
|
|
70
70
|
readonly id?: string | null;
|
|
71
71
|
readonly skills?: readonly {
|
|
72
|
-
readonly type: "anthropic" | "custom";
|
|
73
72
|
readonly skill_id: string;
|
|
73
|
+
readonly type: "anthropic" | "custom";
|
|
74
74
|
readonly version?: string;
|
|
75
75
|
}[] | null;
|
|
76
76
|
} | null;
|
|
@@ -85,63 +85,63 @@ declare const Config_base: Context.ServiceClass<Config, "@effect/ai-anthropic/An
|
|
|
85
85
|
readonly inference_geo?: string | null;
|
|
86
86
|
readonly service_tier?: "auto" | "standard_only";
|
|
87
87
|
readonly mcp_servers?: readonly {
|
|
88
|
-
readonly type: "url";
|
|
89
88
|
readonly name: string;
|
|
89
|
+
readonly type: "url";
|
|
90
90
|
readonly url: string;
|
|
91
91
|
readonly authorization_token?: string | null;
|
|
92
92
|
readonly tool_configuration?: {
|
|
93
|
-
readonly enabled?: boolean | null;
|
|
94
93
|
readonly allowed_tools?: readonly string[] | null;
|
|
94
|
+
readonly enabled?: boolean | null;
|
|
95
95
|
} | null;
|
|
96
96
|
}[];
|
|
97
97
|
readonly output_format?: {
|
|
98
|
-
readonly type: "json_schema";
|
|
99
98
|
readonly schema: {
|
|
100
99
|
readonly [x: string]: Schema.Json;
|
|
101
100
|
};
|
|
101
|
+
readonly type: "json_schema";
|
|
102
102
|
} | null;
|
|
103
103
|
readonly system?: string | readonly {
|
|
104
|
-
readonly type: "text";
|
|
105
104
|
readonly text: string;
|
|
105
|
+
readonly type: "text";
|
|
106
106
|
readonly cache_control?: {
|
|
107
107
|
readonly type: "ephemeral";
|
|
108
108
|
readonly ttl?: "5m" | "1h";
|
|
109
109
|
} | null;
|
|
110
110
|
readonly citations?: readonly ({
|
|
111
|
-
readonly type: "char_location";
|
|
112
111
|
readonly cited_text: string;
|
|
113
112
|
readonly document_index: number;
|
|
114
113
|
readonly document_title: string | null;
|
|
115
114
|
readonly end_char_index: number;
|
|
116
115
|
readonly start_char_index: number;
|
|
116
|
+
readonly type: "char_location";
|
|
117
117
|
} | {
|
|
118
|
-
readonly type: "content_block_location";
|
|
119
118
|
readonly cited_text: string;
|
|
120
119
|
readonly document_index: number;
|
|
121
120
|
readonly document_title: string | null;
|
|
122
121
|
readonly end_block_index: number;
|
|
123
122
|
readonly start_block_index: number;
|
|
123
|
+
readonly type: "content_block_location";
|
|
124
124
|
} | {
|
|
125
|
-
readonly type: "page_location";
|
|
126
125
|
readonly cited_text: string;
|
|
127
126
|
readonly document_index: number;
|
|
128
127
|
readonly document_title: string | null;
|
|
129
128
|
readonly end_page_number: number;
|
|
130
129
|
readonly start_page_number: number;
|
|
130
|
+
readonly type: "page_location";
|
|
131
131
|
} | {
|
|
132
|
-
readonly title: string | null;
|
|
133
|
-
readonly type: "search_result_location";
|
|
134
|
-
readonly source: string;
|
|
135
132
|
readonly cited_text: string;
|
|
136
133
|
readonly end_block_index: number;
|
|
137
|
-
readonly start_block_index: number;
|
|
138
134
|
readonly search_result_index: number;
|
|
135
|
+
readonly source: string;
|
|
136
|
+
readonly start_block_index: number;
|
|
137
|
+
readonly title: string | null;
|
|
138
|
+
readonly type: "search_result_location";
|
|
139
139
|
} | {
|
|
140
|
+
readonly cited_text: string;
|
|
141
|
+
readonly encrypted_index: string;
|
|
140
142
|
readonly title: string | null;
|
|
141
143
|
readonly type: "web_search_result_location";
|
|
142
|
-
readonly cited_text: string;
|
|
143
144
|
readonly url: string;
|
|
144
|
-
readonly encrypted_index: string;
|
|
145
145
|
})[] | null;
|
|
146
146
|
}[];
|
|
147
147
|
readonly output_config?: {
|
|
@@ -163,12 +163,18 @@ declare const Config_base: Context.ServiceClass<Config, "@effect/ai-anthropic/An
|
|
|
163
163
|
* This service can be used to provide default configuration values or to
|
|
164
164
|
* override configuration on a per-request basis.
|
|
165
165
|
*
|
|
166
|
-
* @since 1.0.0
|
|
167
166
|
* @category configuration
|
|
167
|
+
* @since 4.0.0
|
|
168
168
|
*/
|
|
169
169
|
export declare class Config extends Config_base {
|
|
170
170
|
}
|
|
171
171
|
declare module "effect/unstable/ai/Prompt" {
|
|
172
|
+
/**
|
|
173
|
+
* Anthropic-specific options for system messages.
|
|
174
|
+
*
|
|
175
|
+
* These options are used when translating system messages into Anthropic
|
|
176
|
+
* request content.
|
|
177
|
+
*/
|
|
172
178
|
interface SystemMessageOptions extends ProviderOptions {
|
|
173
179
|
readonly anthropic?: {
|
|
174
180
|
/**
|
|
@@ -177,6 +183,12 @@ declare module "effect/unstable/ai/Prompt" {
|
|
|
177
183
|
readonly cacheControl?: typeof Generated.CacheControlEphemeral.Encoded | null;
|
|
178
184
|
} | null;
|
|
179
185
|
}
|
|
186
|
+
/**
|
|
187
|
+
* Anthropic-specific options for user messages.
|
|
188
|
+
*
|
|
189
|
+
* These options are used when translating user messages into Anthropic
|
|
190
|
+
* request content.
|
|
191
|
+
*/
|
|
180
192
|
interface UserMessageOptions extends ProviderOptions {
|
|
181
193
|
readonly anthropic?: {
|
|
182
194
|
/**
|
|
@@ -185,6 +197,12 @@ declare module "effect/unstable/ai/Prompt" {
|
|
|
185
197
|
readonly cacheControl?: typeof Generated.CacheControlEphemeral.Encoded | null;
|
|
186
198
|
} | null;
|
|
187
199
|
}
|
|
200
|
+
/**
|
|
201
|
+
* Anthropic-specific options for assistant messages.
|
|
202
|
+
*
|
|
203
|
+
* These options are used when replaying assistant messages in Anthropic
|
|
204
|
+
* conversation history.
|
|
205
|
+
*/
|
|
188
206
|
interface AssistantMessageOptions extends ProviderOptions {
|
|
189
207
|
readonly anthropic?: {
|
|
190
208
|
/**
|
|
@@ -193,6 +211,12 @@ declare module "effect/unstable/ai/Prompt" {
|
|
|
193
211
|
readonly cacheControl?: typeof Generated.CacheControlEphemeral.Encoded | null;
|
|
194
212
|
} | null;
|
|
195
213
|
}
|
|
214
|
+
/**
|
|
215
|
+
* Anthropic-specific options for tool messages.
|
|
216
|
+
*
|
|
217
|
+
* These options are used when converting tool results into Anthropic user
|
|
218
|
+
* content blocks.
|
|
219
|
+
*/
|
|
196
220
|
interface ToolMessageOptions extends ProviderOptions {
|
|
197
221
|
readonly anthropic?: {
|
|
198
222
|
/**
|
|
@@ -201,6 +225,11 @@ declare module "effect/unstable/ai/Prompt" {
|
|
|
201
225
|
readonly cacheControl?: typeof Generated.CacheControlEphemeral.Encoded | null;
|
|
202
226
|
} | null;
|
|
203
227
|
}
|
|
228
|
+
/**
|
|
229
|
+
* Anthropic-specific options for text prompt parts.
|
|
230
|
+
*
|
|
231
|
+
* Use these options to control how text blocks are sent to Anthropic.
|
|
232
|
+
*/
|
|
204
233
|
interface TextPartOptions extends ProviderOptions {
|
|
205
234
|
readonly anthropic?: {
|
|
206
235
|
/**
|
|
@@ -209,6 +238,12 @@ declare module "effect/unstable/ai/Prompt" {
|
|
|
209
238
|
readonly cacheControl?: typeof Generated.CacheControlEphemeral.Encoded | null;
|
|
210
239
|
} | null;
|
|
211
240
|
}
|
|
241
|
+
/**
|
|
242
|
+
* Anthropic-specific options for reasoning prompt parts.
|
|
243
|
+
*
|
|
244
|
+
* Preserves Claude thinking metadata when reasoning content is sent back to
|
|
245
|
+
* Anthropic in later turns.
|
|
246
|
+
*/
|
|
212
247
|
interface ReasoningPartOptions extends ProviderOptions {
|
|
213
248
|
readonly anthropic?: {
|
|
214
249
|
readonly info?: {
|
|
@@ -232,6 +267,12 @@ declare module "effect/unstable/ai/Prompt" {
|
|
|
232
267
|
readonly cacheControl?: typeof Generated.CacheControlEphemeral.Encoded | null;
|
|
233
268
|
} | null;
|
|
234
269
|
}
|
|
270
|
+
/**
|
|
271
|
+
* Anthropic-specific options for file prompt parts.
|
|
272
|
+
*
|
|
273
|
+
* Controls document metadata, citations, and prompt caching for files sent to
|
|
274
|
+
* Anthropic.
|
|
275
|
+
*/
|
|
235
276
|
interface FilePartOptions extends ProviderOptions {
|
|
236
277
|
readonly anthropic?: {
|
|
237
278
|
/**
|
|
@@ -256,6 +297,12 @@ declare module "effect/unstable/ai/Prompt" {
|
|
|
256
297
|
readonly documentContext?: string | null;
|
|
257
298
|
} | null;
|
|
258
299
|
}
|
|
300
|
+
/**
|
|
301
|
+
* Anthropic-specific options for tool call prompt parts.
|
|
302
|
+
*
|
|
303
|
+
* Carries Anthropic tool caller metadata, MCP metadata, and cache control for
|
|
304
|
+
* tool use blocks.
|
|
305
|
+
*/
|
|
259
306
|
interface ToolCallPartOptions extends ProviderOptions {
|
|
260
307
|
readonly anthropic?: {
|
|
261
308
|
readonly caller?: {
|
|
@@ -277,6 +324,11 @@ declare module "effect/unstable/ai/Prompt" {
|
|
|
277
324
|
readonly cacheControl?: typeof Generated.CacheControlEphemeral.Encoded | null;
|
|
278
325
|
} | null;
|
|
279
326
|
}
|
|
327
|
+
/**
|
|
328
|
+
* Anthropic-specific options for tool result prompt parts.
|
|
329
|
+
*
|
|
330
|
+
* Controls Anthropic prompt caching for tool result content.
|
|
331
|
+
*/
|
|
280
332
|
interface ToolResultPartOptions extends ProviderOptions {
|
|
281
333
|
readonly anthropic?: {
|
|
282
334
|
/**
|
|
@@ -285,6 +337,11 @@ declare module "effect/unstable/ai/Prompt" {
|
|
|
285
337
|
readonly cacheControl?: typeof Generated.CacheControlEphemeral.Encoded | null;
|
|
286
338
|
} | null;
|
|
287
339
|
}
|
|
340
|
+
/**
|
|
341
|
+
* Anthropic-specific options for tool approval request prompt parts.
|
|
342
|
+
*
|
|
343
|
+
* Controls prompt caching for human approval requests in conversations.
|
|
344
|
+
*/
|
|
288
345
|
interface ToolApprovalRequestPartOptions extends ProviderOptions {
|
|
289
346
|
readonly anthropic?: {
|
|
290
347
|
/**
|
|
@@ -293,6 +350,11 @@ declare module "effect/unstable/ai/Prompt" {
|
|
|
293
350
|
readonly cacheControl?: typeof Generated.CacheControlEphemeral.Encoded | null;
|
|
294
351
|
} | null;
|
|
295
352
|
}
|
|
353
|
+
/**
|
|
354
|
+
* Anthropic-specific options for tool approval response prompt parts.
|
|
355
|
+
*
|
|
356
|
+
* Controls prompt caching for human approval responses in conversations.
|
|
357
|
+
*/
|
|
296
358
|
interface ToolApprovalResponsePartOptions extends ProviderOptions {
|
|
297
359
|
readonly anthropic?: {
|
|
298
360
|
/**
|
|
@@ -303,6 +365,12 @@ declare module "effect/unstable/ai/Prompt" {
|
|
|
303
365
|
}
|
|
304
366
|
}
|
|
305
367
|
declare module "effect/unstable/ai/Response" {
|
|
368
|
+
/**
|
|
369
|
+
* Anthropic metadata attached when a reasoning block begins.
|
|
370
|
+
*
|
|
371
|
+
* Includes Claude thinking metadata needed to continue reasoning-aware
|
|
372
|
+
* conversations.
|
|
373
|
+
*/
|
|
306
374
|
interface ReasoningStartPartMetadata extends ProviderMetadata {
|
|
307
375
|
readonly anthropic?: {
|
|
308
376
|
readonly info?: {
|
|
@@ -322,6 +390,11 @@ declare module "effect/unstable/ai/Response" {
|
|
|
322
390
|
} | null;
|
|
323
391
|
} | null;
|
|
324
392
|
}
|
|
393
|
+
/**
|
|
394
|
+
* Anthropic metadata attached to streaming reasoning deltas.
|
|
395
|
+
*
|
|
396
|
+
* Includes the signature for streamed Claude thinking content when available.
|
|
397
|
+
*/
|
|
325
398
|
interface ReasoningDeltaPartMetadata extends ProviderMetadata {
|
|
326
399
|
readonly anthropic?: {
|
|
327
400
|
readonly info?: {
|
|
@@ -334,6 +407,11 @@ declare module "effect/unstable/ai/Response" {
|
|
|
334
407
|
} | null;
|
|
335
408
|
} | null;
|
|
336
409
|
}
|
|
410
|
+
/**
|
|
411
|
+
* Anthropic metadata attached to completed reasoning parts.
|
|
412
|
+
*
|
|
413
|
+
* Preserves Claude thinking or redacted thinking information for later turns.
|
|
414
|
+
*/
|
|
337
415
|
interface ReasoningPartMetadata extends ProviderMetadata {
|
|
338
416
|
readonly anthropic?: {
|
|
339
417
|
readonly info?: {
|
|
@@ -353,6 +431,12 @@ declare module "effect/unstable/ai/Response" {
|
|
|
353
431
|
} | null;
|
|
354
432
|
} | null;
|
|
355
433
|
}
|
|
434
|
+
/**
|
|
435
|
+
* Anthropic metadata attached to tool call response parts.
|
|
436
|
+
*
|
|
437
|
+
* Identifies Anthropic caller details and MCP tool metadata emitted by the
|
|
438
|
+
* provider.
|
|
439
|
+
*/
|
|
356
440
|
interface ToolCallPartMetadata extends ProviderMetadata {
|
|
357
441
|
readonly anthropic?: {
|
|
358
442
|
readonly caller?: {
|
|
@@ -370,6 +454,12 @@ declare module "effect/unstable/ai/Response" {
|
|
|
370
454
|
} | null;
|
|
371
455
|
} | null;
|
|
372
456
|
}
|
|
457
|
+
/**
|
|
458
|
+
* Anthropic metadata attached to tool result response parts.
|
|
459
|
+
*
|
|
460
|
+
* Identifies MCP tool metadata associated with provider-executed tool
|
|
461
|
+
* results.
|
|
462
|
+
*/
|
|
373
463
|
interface ToolResultPartMetadata extends ProviderMetadata {
|
|
374
464
|
readonly anthropic?: {
|
|
375
465
|
/**
|
|
@@ -383,6 +473,11 @@ declare module "effect/unstable/ai/Response" {
|
|
|
383
473
|
} | null;
|
|
384
474
|
} | null;
|
|
385
475
|
}
|
|
476
|
+
/**
|
|
477
|
+
* Anthropic metadata for document citations in model responses.
|
|
478
|
+
*
|
|
479
|
+
* Records the cited document span by character position or page number.
|
|
480
|
+
*/
|
|
386
481
|
interface DocumentSourcePartMetadata extends ProviderMetadata {
|
|
387
482
|
readonly anthropic?: {
|
|
388
483
|
readonly source: "document";
|
|
@@ -416,6 +511,11 @@ declare module "effect/unstable/ai/Response" {
|
|
|
416
511
|
readonly endPageNumber: number;
|
|
417
512
|
} | null;
|
|
418
513
|
}
|
|
514
|
+
/**
|
|
515
|
+
* Anthropic metadata for URL and web citations in model responses.
|
|
516
|
+
*
|
|
517
|
+
* Records cited URL text or web-search source freshness information.
|
|
518
|
+
*/
|
|
419
519
|
interface UrlSourcePartMetadata extends ProviderMetadata {
|
|
420
520
|
readonly anthropic?: {
|
|
421
521
|
readonly source: "url";
|
|
@@ -434,6 +534,12 @@ declare module "effect/unstable/ai/Response" {
|
|
|
434
534
|
readonly pageAge: string | null;
|
|
435
535
|
} | null;
|
|
436
536
|
}
|
|
537
|
+
/**
|
|
538
|
+
* Anthropic metadata attached to the finish part of a response.
|
|
539
|
+
*
|
|
540
|
+
* Includes container state, context management information, stop details, and
|
|
541
|
+
* token usage reported by Anthropic.
|
|
542
|
+
*/
|
|
437
543
|
interface FinishPartMetadata extends ProviderMetadata {
|
|
438
544
|
readonly anthropic?: {
|
|
439
545
|
readonly container: typeof Generated.BetaContainer.Encoded | null;
|
|
@@ -442,6 +548,11 @@ declare module "effect/unstable/ai/Response" {
|
|
|
442
548
|
readonly usage: typeof Generated.BetaMessage.Encoded["usage"] | null;
|
|
443
549
|
} | null;
|
|
444
550
|
}
|
|
551
|
+
/**
|
|
552
|
+
* Anthropic metadata attached to error response parts.
|
|
553
|
+
*
|
|
554
|
+
* Includes the provider request identifier when Anthropic returns one.
|
|
555
|
+
*/
|
|
445
556
|
interface ErrorPartMetadata extends ProviderMetadata {
|
|
446
557
|
readonly anthropic?: {
|
|
447
558
|
requestId?: string | null;
|
|
@@ -451,15 +562,15 @@ declare module "effect/unstable/ai/Response" {
|
|
|
451
562
|
/**
|
|
452
563
|
* Creates an Anthropic language model that can be used with `AiModel.provide`.
|
|
453
564
|
*
|
|
454
|
-
* @since 1.0.0
|
|
455
565
|
* @category constructors
|
|
566
|
+
* @since 4.0.0
|
|
456
567
|
*/
|
|
457
568
|
export declare const model: (model: (string & {}) | Model, config?: Omit<typeof Config.Service, "model">) => AiModel.Model<"anthropic", LanguageModel.LanguageModel, AnthropicClient>;
|
|
458
569
|
/**
|
|
459
570
|
* Creates an Anthropic language model service.
|
|
460
571
|
*
|
|
461
|
-
* @since 1.0.0
|
|
462
572
|
* @category constructors
|
|
573
|
+
* @since 4.0.0
|
|
463
574
|
*/
|
|
464
575
|
export declare const make: (args_0: {
|
|
465
576
|
readonly model: (string & {}) | Model;
|
|
@@ -468,8 +579,8 @@ export declare const make: (args_0: {
|
|
|
468
579
|
/**
|
|
469
580
|
* Creates a layer for the Anthropic language model.
|
|
470
581
|
*
|
|
471
|
-
* @since 1.0.0
|
|
472
582
|
* @category layers
|
|
583
|
+
* @since 4.0.0
|
|
473
584
|
*/
|
|
474
585
|
export declare const layer: (options: {
|
|
475
586
|
readonly model: (string & {}) | Model;
|
|
@@ -478,30 +589,30 @@ export declare const layer: (options: {
|
|
|
478
589
|
/**
|
|
479
590
|
* Provides config overrides for Anthropic language model operations.
|
|
480
591
|
*
|
|
481
|
-
* @since 1.0.0
|
|
482
592
|
* @category configuration
|
|
593
|
+
* @since 4.0.0
|
|
483
594
|
*/
|
|
484
595
|
export declare const withConfigOverride: {
|
|
485
596
|
/**
|
|
486
597
|
* Provides config overrides for Anthropic language model operations.
|
|
487
598
|
*
|
|
488
|
-
* @since 1.0.0
|
|
489
599
|
* @category configuration
|
|
600
|
+
* @since 4.0.0
|
|
490
601
|
*/
|
|
491
602
|
(overrides: typeof Config.Service): <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Config>>;
|
|
492
603
|
/**
|
|
493
604
|
* Provides config overrides for Anthropic language model operations.
|
|
494
605
|
*
|
|
495
|
-
* @since 1.0.0
|
|
496
606
|
* @category configuration
|
|
607
|
+
* @since 4.0.0
|
|
497
608
|
*/
|
|
498
609
|
<A, E, R>(self: Effect.Effect<A, E, R>, overrides: typeof Config.Service): Effect.Effect<A, E, Exclude<R, Config>>;
|
|
499
610
|
};
|
|
500
611
|
/**
|
|
501
612
|
* Represents a user-defined tool that can be passed to the Anthropic API.
|
|
502
613
|
*
|
|
503
|
-
* @since 1.0.0
|
|
504
614
|
* @category tools
|
|
615
|
+
* @since 4.0.0
|
|
505
616
|
*/
|
|
506
617
|
export type AnthropicUserDefinedTool = typeof Generated.BetaTool.Encoded;
|
|
507
618
|
/**
|
|
@@ -510,8 +621,8 @@ export type AnthropicUserDefinedTool = typeof Generated.BetaTool.Encoded;
|
|
|
510
621
|
* These include Anthropic's built-in tools like computer use, code execution,
|
|
511
622
|
* web search, and text editing.
|
|
512
623
|
*
|
|
513
|
-
* @since 1.0.0
|
|
514
624
|
* @category tools
|
|
625
|
+
* @since 4.0.0
|
|
515
626
|
*/
|
|
516
627
|
export type AnthropicProviderDefinedTool = typeof Generated.BetaBashTool_20241022.Encoded | typeof Generated.BetaBashTool_20250124.Encoded | typeof Generated.BetaCodeExecutionTool_20250522.Encoded | typeof Generated.BetaCodeExecutionTool_20250825.Encoded | typeof Generated.BetaComputerUseTool_20241022.Encoded | typeof Generated.BetaComputerUseTool_20250124.Encoded | typeof Generated.BetaComputerUseTool_20251124.Encoded | typeof Generated.BetaMemoryTool_20250818.Encoded | typeof Generated.BetaTextEditor_20241022.Encoded | typeof Generated.BetaTextEditor_20250124.Encoded | typeof Generated.BetaTextEditor_20250429.Encoded | typeof Generated.BetaTextEditor_20250728.Encoded | typeof Generated.BetaToolSearchToolBM25_20251119.Encoded | typeof Generated.BetaToolSearchToolRegex_20251119.Encoded | typeof Generated.BetaWebFetchTool_20250910.Encoded | typeof Generated.BetaWebSearchTool_20250305.Encoded;
|
|
517
628
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnthropicLanguageModel.d.ts","sourceRoot":"","sources":["../src/AnthropicLanguageModel.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AnthropicLanguageModel.d.ts","sourceRoot":"","sources":["../src/AnthropicLanguageModel.ts"],"names":[],"mappings":"AA+BA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AAEzC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAGvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAIrC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAQvC,OAAO,KAAK,aAAa,MAAM,kCAAkC,CAAA;AACjE,OAAO,KAAK,OAAO,MAAM,0BAA0B,CAAA;AAMnD,OAAO,EAAE,eAAe,EAA2B,MAAM,sBAAsB,CAAA;AAG/E,OAAO,KAAK,KAAK,SAAS,MAAM,gBAAgB,CAAA;AAGhD;;;;;GAKG;AACH,MAAM,MAAM,KAAK,GAAG,OAAO,SAAS,CAAC,KAAK,CAAC,IAAI,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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ropic implementation of
|
|
3
|
+
* Effect AI's `LanguageModel` service. It turns Effect AI prompts, tools, files,
|
|
4
|
+
* reasoning parts, and provider options into Anthropic Messages API requests,
|
|
5
|
+
* and converts Anthropic responses and streams back into Effect AI response
|
|
6
|
+
* parts with Anthropic-specific metadata.
|
|
7
|
+
*
|
|
8
|
+
* **Common tasks**
|
|
9
|
+
*
|
|
10
|
+
* - Create an Anthropic-backed model with {@link model}
|
|
11
|
+
* - Build or provide a `LanguageModel.LanguageModel` layer with {@link layer}
|
|
12
|
+
* or {@link make}
|
|
13
|
+
* - Supply default request options through {@link Config}
|
|
14
|
+
* - Override configuration for a scoped operation with {@link withConfigOverride}
|
|
15
|
+
* - Attach Anthropic provider options for prompt caching, document citations,
|
|
16
|
+
* reasoning signatures, MCP metadata, and server-side tools
|
|
17
|
+
*
|
|
18
|
+
* **Gotchas**
|
|
19
|
+
*
|
|
20
|
+
* - Prompt files are translated to Anthropic image or document blocks; only the
|
|
21
|
+
* supported media types can be sent to the provider.
|
|
22
|
+
* - Structured output support depends on the selected Claude model, so this
|
|
23
|
+
* module may use Anthropic's native structured output or fall back to a JSON
|
|
24
|
+
* response tool.
|
|
25
|
+
* - Some features require Anthropic beta headers, which are added
|
|
26
|
+
* automatically from the selected tools, files, and model capabilities.
|
|
27
|
+
*
|
|
28
|
+
* @since 4.0.0
|
|
3
29
|
*/
|
|
4
30
|
/** @effect-diagnostics preferSchemaOverJson:skip-file */
|
|
5
31
|
import * as Arr from "effect/Array";
|
|
@@ -33,8 +59,8 @@ import * as InternalUtilities from "./internal/utilities.js";
|
|
|
33
59
|
* This service can be used to provide default configuration values or to
|
|
34
60
|
* override configuration on a per-request basis.
|
|
35
61
|
*
|
|
36
|
-
* @since 1.0.0
|
|
37
62
|
* @category configuration
|
|
63
|
+
* @since 4.0.0
|
|
38
64
|
*/
|
|
39
65
|
export class Config extends /*#__PURE__*/Context.Service()("@effect/ai-anthropic/AnthropicLanguageModel/Config") {}
|
|
40
66
|
// =============================================================================
|
|
@@ -43,8 +69,8 @@ export class Config extends /*#__PURE__*/Context.Service()("@effect/ai-anthropic
|
|
|
43
69
|
/**
|
|
44
70
|
* Creates an Anthropic language model that can be used with `AiModel.provide`.
|
|
45
71
|
*
|
|
46
|
-
* @since 1.0.0
|
|
47
72
|
* @category constructors
|
|
73
|
+
* @since 4.0.0
|
|
48
74
|
*/
|
|
49
75
|
export const model = (model, config) => AiModel.make("anthropic", model, layer({
|
|
50
76
|
model,
|
|
@@ -53,8 +79,8 @@ export const model = (model, config) => AiModel.make("anthropic", model, layer({
|
|
|
53
79
|
/**
|
|
54
80
|
* Creates an Anthropic language model service.
|
|
55
81
|
*
|
|
56
|
-
* @since 1.0.0
|
|
57
82
|
* @category constructors
|
|
83
|
+
* @since 4.0.0
|
|
58
84
|
*/
|
|
59
85
|
export const make = /*#__PURE__*/Effect.fnUntraced(function* ({
|
|
60
86
|
model,
|
|
@@ -180,15 +206,15 @@ export const make = /*#__PURE__*/Effect.fnUntraced(function* ({
|
|
|
180
206
|
/**
|
|
181
207
|
* Creates a layer for the Anthropic language model.
|
|
182
208
|
*
|
|
183
|
-
* @since 1.0.0
|
|
184
209
|
* @category layers
|
|
210
|
+
* @since 4.0.0
|
|
185
211
|
*/
|
|
186
212
|
export const layer = options => Layer.effect(LanguageModel.LanguageModel, make(options));
|
|
187
213
|
/**
|
|
188
214
|
* Provides config overrides for Anthropic language model operations.
|
|
189
215
|
*
|
|
190
|
-
* @since 1.0.0
|
|
191
216
|
* @category configuration
|
|
217
|
+
* @since 4.0.0
|
|
192
218
|
*/
|
|
193
219
|
export const withConfigOverride = /*#__PURE__*/dual(2, (self, overrides) => Effect.flatMap(Effect.serviceOption(Config), config => Effect.provideService(self, Config, {
|
|
194
220
|
...(config._tag === "Some" ? config.value : {}),
|