@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.
- package/dist/AnthropicClient.d.ts +89 -66
- package/dist/AnthropicClient.d.ts.map +1 -1
- package/dist/AnthropicClient.js +75 -17
- package/dist/AnthropicClient.js.map +1 -1
- package/dist/AnthropicConfig.d.ts +68 -10
- package/dist/AnthropicConfig.d.ts.map +1 -1
- package/dist/AnthropicConfig.js +43 -7
- package/dist/AnthropicConfig.js.map +1 -1
- package/dist/AnthropicError.d.ts +136 -37
- package/dist/AnthropicError.d.ts.map +1 -1
- package/dist/AnthropicError.js +1 -1
- package/dist/AnthropicLanguageModel.d.ts +384 -71
- package/dist/AnthropicLanguageModel.d.ts.map +1 -1
- package/dist/AnthropicLanguageModel.js +102 -16
- package/dist/AnthropicLanguageModel.js.map +1 -1
- package/dist/AnthropicTelemetry.d.ts +42 -15
- package/dist/AnthropicTelemetry.d.ts.map +1 -1
- package/dist/AnthropicTelemetry.js +44 -8
- package/dist/AnthropicTelemetry.js.map +1 -1
- package/dist/AnthropicTool.d.ts +1116 -183
- package/dist/AnthropicTool.d.ts.map +1 -1
- package/dist/AnthropicTool.js +818 -129
- package/dist/AnthropicTool.js.map +1 -1
- package/dist/Generated.d.ts +11661 -5260
- package/dist/Generated.d.ts.map +1 -1
- package/dist/Generated.js +2318 -915
- package/dist/Generated.js.map +1 -1
- package/dist/index.d.ts +8 -29
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -29
- package/dist/index.js.map +1 -1
- package/dist/internal/errors.js +7 -7
- package/dist/internal/errors.js.map +1 -1
- package/package.json +3 -3
- package/src/AnthropicClient.ts +119 -70
- package/src/AnthropicConfig.ts +69 -11
- package/src/AnthropicError.ts +138 -37
- package/src/AnthropicLanguageModel.ts +405 -38
- package/src/AnthropicTelemetry.ts +76 -20
- package/src/AnthropicTool.ts +1109 -176
- package/src/Generated.ts +3751 -1815
- package/src/index.ts +8 -29
- package/src/internal/errors.ts +9 -7
|
@@ -1,29 +1,39 @@
|
|
|
1
|
+
import * as Context from "effect/Context";
|
|
1
2
|
import * as Effect from "effect/Effect";
|
|
2
3
|
import * as Layer from "effect/Layer";
|
|
3
4
|
import * as Schema from "effect/Schema";
|
|
4
|
-
import * as ServiceMap from "effect/ServiceMap";
|
|
5
5
|
import * as LanguageModel from "effect/unstable/ai/LanguageModel";
|
|
6
6
|
import * as AiModel from "effect/unstable/ai/Model";
|
|
7
7
|
import { AnthropicClient } from "./AnthropicClient.ts";
|
|
8
8
|
import type * as Generated from "./Generated.ts";
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* Known Anthropic Claude model identifiers exposed by the generated Anthropic schema.
|
|
11
|
+
*
|
|
12
|
+
* **Details**
|
|
13
|
+
*
|
|
14
|
+
* The Anthropic language model constructors accept `Model` values and custom
|
|
15
|
+
* string model ids, so this type is best used for autocomplete and type checking
|
|
16
|
+
* of known Claude ids.
|
|
11
17
|
*
|
|
12
|
-
* @since 1.0.0
|
|
13
18
|
* @category models
|
|
19
|
+
* @since 4.0.0
|
|
14
20
|
*/
|
|
15
21
|
export type Model = typeof Generated.Model.Type;
|
|
16
|
-
declare const Config_base:
|
|
17
|
-
readonly model?: "claude-opus-4-6" | "claude-opus-4-5-20251101" | "claude-opus-4-5" | "claude-3-7-sonnet-latest" | "claude-3-7-sonnet-20250219" | "claude-3-5-haiku-latest" | "claude-3-5-haiku-20241022" | "claude-haiku-4-5" | "claude-haiku-4-5-20251001" | "claude-sonnet-4-20250514" | "claude-sonnet-4-0" | "claude-4-sonnet-20250514" | "claude-sonnet-4-5" | "claude-sonnet-4-5-20250929" | "claude-opus-4-0" | "claude-opus-4-20250514" | "claude-4-opus-20250514" | "claude-opus-4-1-20250805" | "claude-3-opus-latest" | "claude-3-opus-20240229" | "claude-3-haiku-20240307";
|
|
22
|
+
declare const Config_base: Context.ServiceClass<Config, "@effect/ai-anthropic/AnthropicLanguageModel/Config", {
|
|
23
|
+
readonly model?: "claude-opus-4-6" | "claude-sonnet-4-6" | "claude-opus-4-5-20251101" | "claude-opus-4-5" | "claude-3-7-sonnet-latest" | "claude-3-7-sonnet-20250219" | "claude-3-5-haiku-latest" | "claude-3-5-haiku-20241022" | "claude-haiku-4-5" | "claude-haiku-4-5-20251001" | "claude-sonnet-4-20250514" | "claude-sonnet-4-0" | "claude-4-sonnet-20250514" | "claude-sonnet-4-5" | "claude-sonnet-4-5-20250929" | "claude-opus-4-0" | "claude-opus-4-20250514" | "claude-4-opus-20250514" | "claude-opus-4-1-20250805" | "claude-3-opus-latest" | "claude-3-opus-20240229" | "claude-3-haiku-20240307";
|
|
18
24
|
readonly thinking?: {
|
|
19
25
|
readonly type: "adaptive";
|
|
20
26
|
} | {
|
|
21
27
|
readonly type: "disabled";
|
|
22
28
|
} | {
|
|
23
|
-
readonly type: "enabled";
|
|
24
29
|
readonly budget_tokens: number;
|
|
30
|
+
readonly type: "enabled";
|
|
25
31
|
};
|
|
26
32
|
readonly max_tokens?: number;
|
|
33
|
+
readonly cache_control?: {
|
|
34
|
+
readonly type: "ephemeral";
|
|
35
|
+
readonly ttl?: "5m" | "1h";
|
|
36
|
+
} | null;
|
|
27
37
|
readonly context_management?: {
|
|
28
38
|
readonly edits?: readonly ({
|
|
29
39
|
readonly type: "compact_20260112";
|
|
@@ -43,103 +53,103 @@ declare const Config_base: ServiceMap.ServiceClass<Config, "@effect/ai-anthropic
|
|
|
43
53
|
};
|
|
44
54
|
} | {
|
|
45
55
|
readonly type: "clear_tool_uses_20250919";
|
|
46
|
-
readonly
|
|
56
|
+
readonly clear_at_least?: {
|
|
47
57
|
readonly type: "input_tokens";
|
|
48
58
|
readonly value: number;
|
|
49
|
-
} |
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
};
|
|
59
|
+
} | null;
|
|
60
|
+
readonly clear_tool_inputs?: boolean | readonly string[] | null;
|
|
61
|
+
readonly exclude_tools?: readonly string[] | null;
|
|
53
62
|
readonly keep?: {
|
|
54
63
|
readonly type: "tool_uses";
|
|
55
64
|
readonly value: number;
|
|
56
65
|
};
|
|
57
|
-
readonly
|
|
66
|
+
readonly trigger?: {
|
|
58
67
|
readonly type: "input_tokens";
|
|
59
68
|
readonly value: number;
|
|
60
|
-
} |
|
|
61
|
-
|
|
62
|
-
|
|
69
|
+
} | {
|
|
70
|
+
readonly type: "tool_uses";
|
|
71
|
+
readonly value: number;
|
|
72
|
+
};
|
|
63
73
|
})[];
|
|
64
74
|
} | null;
|
|
65
|
-
readonly stop_sequences?: readonly string[];
|
|
66
|
-
readonly temperature?: number;
|
|
67
|
-
readonly top_p?: number;
|
|
68
|
-
readonly top_k?: number;
|
|
69
|
-
readonly metadata?: {
|
|
70
|
-
readonly user_id?: string | null;
|
|
71
|
-
};
|
|
72
75
|
readonly container?: string | {
|
|
73
76
|
readonly id?: string | null;
|
|
74
77
|
readonly skills?: readonly {
|
|
75
|
-
readonly type: "anthropic" | "custom";
|
|
76
78
|
readonly skill_id: string;
|
|
79
|
+
readonly type: "anthropic" | "custom";
|
|
77
80
|
readonly version?: string;
|
|
78
81
|
}[] | null;
|
|
79
82
|
} | null;
|
|
83
|
+
readonly stop_sequences?: readonly string[];
|
|
84
|
+
readonly temperature?: number;
|
|
85
|
+
readonly top_p?: number;
|
|
86
|
+
readonly top_k?: number;
|
|
87
|
+
readonly metadata?: {
|
|
88
|
+
readonly user_id?: string | null;
|
|
89
|
+
};
|
|
90
|
+
readonly speed?: "standard" | "fast" | null;
|
|
80
91
|
readonly inference_geo?: string | null;
|
|
81
92
|
readonly service_tier?: "auto" | "standard_only";
|
|
82
|
-
readonly
|
|
93
|
+
readonly mcp_servers?: readonly {
|
|
94
|
+
readonly name: string;
|
|
95
|
+
readonly type: "url";
|
|
96
|
+
readonly url: string;
|
|
97
|
+
readonly authorization_token?: string | null;
|
|
98
|
+
readonly tool_configuration?: {
|
|
99
|
+
readonly allowed_tools?: readonly string[] | null;
|
|
100
|
+
readonly enabled?: boolean | null;
|
|
101
|
+
} | null;
|
|
102
|
+
}[];
|
|
103
|
+
readonly output_format?: {
|
|
104
|
+
readonly schema: {
|
|
105
|
+
readonly [x: string]: Schema.Json;
|
|
106
|
+
};
|
|
107
|
+
readonly type: "json_schema";
|
|
108
|
+
} | null;
|
|
83
109
|
readonly system?: string | readonly {
|
|
84
|
-
readonly type: "text";
|
|
85
110
|
readonly text: string;
|
|
111
|
+
readonly type: "text";
|
|
86
112
|
readonly cache_control?: {
|
|
87
113
|
readonly type: "ephemeral";
|
|
88
114
|
readonly ttl?: "5m" | "1h";
|
|
89
115
|
} | null;
|
|
90
116
|
readonly citations?: readonly ({
|
|
91
|
-
readonly type: "char_location";
|
|
92
117
|
readonly cited_text: string;
|
|
93
118
|
readonly document_index: number;
|
|
94
119
|
readonly document_title: string | null;
|
|
95
120
|
readonly end_char_index: number;
|
|
96
121
|
readonly start_char_index: number;
|
|
122
|
+
readonly type: "char_location";
|
|
97
123
|
} | {
|
|
98
|
-
readonly type: "content_block_location";
|
|
99
124
|
readonly cited_text: string;
|
|
100
125
|
readonly document_index: number;
|
|
101
126
|
readonly document_title: string | null;
|
|
102
127
|
readonly end_block_index: number;
|
|
103
128
|
readonly start_block_index: number;
|
|
129
|
+
readonly type: "content_block_location";
|
|
104
130
|
} | {
|
|
105
|
-
readonly type: "page_location";
|
|
106
131
|
readonly cited_text: string;
|
|
107
132
|
readonly document_index: number;
|
|
108
133
|
readonly document_title: string | null;
|
|
109
134
|
readonly end_page_number: number;
|
|
110
135
|
readonly start_page_number: number;
|
|
136
|
+
readonly type: "page_location";
|
|
111
137
|
} | {
|
|
112
|
-
readonly title: string | null;
|
|
113
|
-
readonly type: "search_result_location";
|
|
114
|
-
readonly source: string;
|
|
115
138
|
readonly cited_text: string;
|
|
116
139
|
readonly end_block_index: number;
|
|
117
|
-
readonly start_block_index: number;
|
|
118
140
|
readonly search_result_index: number;
|
|
141
|
+
readonly source: string;
|
|
142
|
+
readonly start_block_index: number;
|
|
143
|
+
readonly title: string | null;
|
|
144
|
+
readonly type: "search_result_location";
|
|
119
145
|
} | {
|
|
146
|
+
readonly cited_text: string;
|
|
147
|
+
readonly encrypted_index: string;
|
|
120
148
|
readonly title: string | null;
|
|
121
149
|
readonly type: "web_search_result_location";
|
|
122
|
-
readonly cited_text: string;
|
|
123
150
|
readonly url: string;
|
|
124
|
-
readonly encrypted_index: string;
|
|
125
151
|
})[] | null;
|
|
126
152
|
}[];
|
|
127
|
-
readonly mcp_servers?: readonly {
|
|
128
|
-
readonly type: "url";
|
|
129
|
-
readonly name: string;
|
|
130
|
-
readonly url: string;
|
|
131
|
-
readonly authorization_token?: string | null;
|
|
132
|
-
readonly tool_configuration?: {
|
|
133
|
-
readonly enabled?: boolean | null;
|
|
134
|
-
readonly allowed_tools?: readonly string[] | null;
|
|
135
|
-
} | null;
|
|
136
|
-
}[];
|
|
137
|
-
readonly output_format?: {
|
|
138
|
-
readonly type: "json_schema";
|
|
139
|
-
readonly schema: {
|
|
140
|
-
readonly [x: string]: Schema.Json;
|
|
141
|
-
};
|
|
142
|
-
} | null;
|
|
143
153
|
readonly output_config?: {
|
|
144
154
|
readonly effort?: "low" | "medium" | "high" | null;
|
|
145
155
|
};
|
|
@@ -147,6 +157,8 @@ declare const Config_base: ServiceMap.ServiceClass<Config, "@effect/ai-anthropic
|
|
|
147
157
|
/**
|
|
148
158
|
* Whether to use strict JSON schema validation for tool calls.
|
|
149
159
|
*
|
|
160
|
+
* **Details**
|
|
161
|
+
*
|
|
150
162
|
* Only applies to models that support structured outputs. Defaults to
|
|
151
163
|
* `true` when structured outputs are supported.
|
|
152
164
|
*/
|
|
@@ -156,15 +168,33 @@ declare const Config_base: ServiceMap.ServiceClass<Config, "@effect/ai-anthropic
|
|
|
156
168
|
/**
|
|
157
169
|
* Configuration options for the Anthropic language model.
|
|
158
170
|
*
|
|
171
|
+
* **When to use**
|
|
172
|
+
*
|
|
173
|
+
* Use when you need to provide or override Anthropic model configuration on a
|
|
174
|
+
* per-request basis via `Context.Service`.
|
|
175
|
+
*
|
|
176
|
+
* **Details**
|
|
177
|
+
*
|
|
159
178
|
* This service can be used to provide default configuration values or to
|
|
160
179
|
* override configuration on a per-request basis.
|
|
161
180
|
*
|
|
162
|
-
* @since 1.0.0
|
|
163
181
|
* @category configuration
|
|
182
|
+
* @since 4.0.0
|
|
164
183
|
*/
|
|
165
184
|
export declare class Config extends Config_base {
|
|
166
185
|
}
|
|
167
186
|
declare module "effect/unstable/ai/Prompt" {
|
|
187
|
+
/**
|
|
188
|
+
* Anthropic-specific options for system messages.
|
|
189
|
+
*
|
|
190
|
+
* **Details**
|
|
191
|
+
*
|
|
192
|
+
* These options are used when translating system messages into Anthropic
|
|
193
|
+
* request content.
|
|
194
|
+
*
|
|
195
|
+
* @category request
|
|
196
|
+
* @since 4.0.0
|
|
197
|
+
*/
|
|
168
198
|
interface SystemMessageOptions extends ProviderOptions {
|
|
169
199
|
readonly anthropic?: {
|
|
170
200
|
/**
|
|
@@ -173,6 +203,17 @@ declare module "effect/unstable/ai/Prompt" {
|
|
|
173
203
|
readonly cacheControl?: typeof Generated.CacheControlEphemeral.Encoded | null;
|
|
174
204
|
} | null;
|
|
175
205
|
}
|
|
206
|
+
/**
|
|
207
|
+
* Anthropic-specific options for user messages.
|
|
208
|
+
*
|
|
209
|
+
* **Details**
|
|
210
|
+
*
|
|
211
|
+
* These options are used when translating user messages into Anthropic
|
|
212
|
+
* request content.
|
|
213
|
+
*
|
|
214
|
+
* @category request
|
|
215
|
+
* @since 4.0.0
|
|
216
|
+
*/
|
|
176
217
|
interface UserMessageOptions extends ProviderOptions {
|
|
177
218
|
readonly anthropic?: {
|
|
178
219
|
/**
|
|
@@ -181,6 +222,17 @@ declare module "effect/unstable/ai/Prompt" {
|
|
|
181
222
|
readonly cacheControl?: typeof Generated.CacheControlEphemeral.Encoded | null;
|
|
182
223
|
} | null;
|
|
183
224
|
}
|
|
225
|
+
/**
|
|
226
|
+
* Anthropic-specific options for assistant messages.
|
|
227
|
+
*
|
|
228
|
+
* **Details**
|
|
229
|
+
*
|
|
230
|
+
* These options are used when replaying assistant messages in Anthropic
|
|
231
|
+
* conversation history.
|
|
232
|
+
*
|
|
233
|
+
* @category request
|
|
234
|
+
* @since 4.0.0
|
|
235
|
+
*/
|
|
184
236
|
interface AssistantMessageOptions extends ProviderOptions {
|
|
185
237
|
readonly anthropic?: {
|
|
186
238
|
/**
|
|
@@ -189,6 +241,17 @@ declare module "effect/unstable/ai/Prompt" {
|
|
|
189
241
|
readonly cacheControl?: typeof Generated.CacheControlEphemeral.Encoded | null;
|
|
190
242
|
} | null;
|
|
191
243
|
}
|
|
244
|
+
/**
|
|
245
|
+
* Anthropic-specific options for tool messages.
|
|
246
|
+
*
|
|
247
|
+
* **Details**
|
|
248
|
+
*
|
|
249
|
+
* These options are used when converting tool results into Anthropic user
|
|
250
|
+
* content blocks.
|
|
251
|
+
*
|
|
252
|
+
* @category request
|
|
253
|
+
* @since 4.0.0
|
|
254
|
+
*/
|
|
192
255
|
interface ToolMessageOptions extends ProviderOptions {
|
|
193
256
|
readonly anthropic?: {
|
|
194
257
|
/**
|
|
@@ -197,6 +260,16 @@ declare module "effect/unstable/ai/Prompt" {
|
|
|
197
260
|
readonly cacheControl?: typeof Generated.CacheControlEphemeral.Encoded | null;
|
|
198
261
|
} | null;
|
|
199
262
|
}
|
|
263
|
+
/**
|
|
264
|
+
* Anthropic-specific options for text prompt parts.
|
|
265
|
+
*
|
|
266
|
+
* **When to use**
|
|
267
|
+
*
|
|
268
|
+
* Use when you use these options to control how text blocks are sent to Anthropic.
|
|
269
|
+
*
|
|
270
|
+
* @category request
|
|
271
|
+
* @since 4.0.0
|
|
272
|
+
*/
|
|
200
273
|
interface TextPartOptions extends ProviderOptions {
|
|
201
274
|
readonly anthropic?: {
|
|
202
275
|
/**
|
|
@@ -205,6 +278,17 @@ declare module "effect/unstable/ai/Prompt" {
|
|
|
205
278
|
readonly cacheControl?: typeof Generated.CacheControlEphemeral.Encoded | null;
|
|
206
279
|
} | null;
|
|
207
280
|
}
|
|
281
|
+
/**
|
|
282
|
+
* Anthropic-specific options for reasoning prompt parts.
|
|
283
|
+
*
|
|
284
|
+
* **Details**
|
|
285
|
+
*
|
|
286
|
+
* Preserves Claude thinking metadata when reasoning content is sent back to
|
|
287
|
+
* Anthropic in later turns.
|
|
288
|
+
*
|
|
289
|
+
* @category request
|
|
290
|
+
* @since 4.0.0
|
|
291
|
+
*/
|
|
208
292
|
interface ReasoningPartOptions extends ProviderOptions {
|
|
209
293
|
readonly anthropic?: {
|
|
210
294
|
readonly info?: {
|
|
@@ -228,6 +312,17 @@ declare module "effect/unstable/ai/Prompt" {
|
|
|
228
312
|
readonly cacheControl?: typeof Generated.CacheControlEphemeral.Encoded | null;
|
|
229
313
|
} | null;
|
|
230
314
|
}
|
|
315
|
+
/**
|
|
316
|
+
* Anthropic-specific options for file prompt parts.
|
|
317
|
+
*
|
|
318
|
+
* **Details**
|
|
319
|
+
*
|
|
320
|
+
* Controls document metadata, citations, and prompt caching for files sent to
|
|
321
|
+
* Anthropic.
|
|
322
|
+
*
|
|
323
|
+
* @category request
|
|
324
|
+
* @since 4.0.0
|
|
325
|
+
*/
|
|
231
326
|
interface FilePartOptions extends ProviderOptions {
|
|
232
327
|
readonly anthropic?: {
|
|
233
328
|
/**
|
|
@@ -247,11 +342,24 @@ declare module "effect/unstable/ai/Prompt" {
|
|
|
247
342
|
* Additional context about the document that will be forwarded to the
|
|
248
343
|
* large language model, but will not be used towards cited content.
|
|
249
344
|
*
|
|
250
|
-
*
|
|
345
|
+
* **When to use**
|
|
346
|
+
*
|
|
347
|
+
* Use when storing additional document metadata as text or stringified JSON.
|
|
251
348
|
*/
|
|
252
349
|
readonly documentContext?: string | null;
|
|
253
350
|
} | null;
|
|
254
351
|
}
|
|
352
|
+
/**
|
|
353
|
+
* Anthropic-specific options for tool call prompt parts.
|
|
354
|
+
*
|
|
355
|
+
* **Details**
|
|
356
|
+
*
|
|
357
|
+
* Carries Anthropic tool caller metadata, MCP metadata, and cache control for
|
|
358
|
+
* tool use blocks.
|
|
359
|
+
*
|
|
360
|
+
* @category request
|
|
361
|
+
* @since 4.0.0
|
|
362
|
+
*/
|
|
255
363
|
interface ToolCallPartOptions extends ProviderOptions {
|
|
256
364
|
readonly anthropic?: {
|
|
257
365
|
readonly caller?: {
|
|
@@ -273,6 +381,16 @@ declare module "effect/unstable/ai/Prompt" {
|
|
|
273
381
|
readonly cacheControl?: typeof Generated.CacheControlEphemeral.Encoded | null;
|
|
274
382
|
} | null;
|
|
275
383
|
}
|
|
384
|
+
/**
|
|
385
|
+
* Anthropic-specific options for tool result prompt parts.
|
|
386
|
+
*
|
|
387
|
+
* **Details**
|
|
388
|
+
*
|
|
389
|
+
* Controls Anthropic prompt caching for tool result content.
|
|
390
|
+
*
|
|
391
|
+
* @category request
|
|
392
|
+
* @since 4.0.0
|
|
393
|
+
*/
|
|
276
394
|
interface ToolResultPartOptions extends ProviderOptions {
|
|
277
395
|
readonly anthropic?: {
|
|
278
396
|
/**
|
|
@@ -281,6 +399,16 @@ declare module "effect/unstable/ai/Prompt" {
|
|
|
281
399
|
readonly cacheControl?: typeof Generated.CacheControlEphemeral.Encoded | null;
|
|
282
400
|
} | null;
|
|
283
401
|
}
|
|
402
|
+
/**
|
|
403
|
+
* Anthropic-specific options for tool approval request prompt parts.
|
|
404
|
+
*
|
|
405
|
+
* **Details**
|
|
406
|
+
*
|
|
407
|
+
* Controls prompt caching for human approval requests in conversations.
|
|
408
|
+
*
|
|
409
|
+
* @category request
|
|
410
|
+
* @since 4.0.0
|
|
411
|
+
*/
|
|
284
412
|
interface ToolApprovalRequestPartOptions extends ProviderOptions {
|
|
285
413
|
readonly anthropic?: {
|
|
286
414
|
/**
|
|
@@ -289,14 +417,16 @@ declare module "effect/unstable/ai/Prompt" {
|
|
|
289
417
|
readonly cacheControl?: typeof Generated.CacheControlEphemeral.Encoded | null;
|
|
290
418
|
} | null;
|
|
291
419
|
}
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
420
|
+
/**
|
|
421
|
+
* Anthropic-specific options for tool approval response prompt parts.
|
|
422
|
+
*
|
|
423
|
+
* **Details**
|
|
424
|
+
*
|
|
425
|
+
* Controls prompt caching for human approval responses in conversations.
|
|
426
|
+
*
|
|
427
|
+
* @category request
|
|
428
|
+
* @since 4.0.0
|
|
429
|
+
*/
|
|
300
430
|
interface ToolApprovalResponsePartOptions extends ProviderOptions {
|
|
301
431
|
readonly anthropic?: {
|
|
302
432
|
/**
|
|
@@ -307,6 +437,17 @@ declare module "effect/unstable/ai/Prompt" {
|
|
|
307
437
|
}
|
|
308
438
|
}
|
|
309
439
|
declare module "effect/unstable/ai/Response" {
|
|
440
|
+
/**
|
|
441
|
+
* Anthropic metadata attached when a reasoning block begins.
|
|
442
|
+
*
|
|
443
|
+
* **Details**
|
|
444
|
+
*
|
|
445
|
+
* Includes Claude thinking metadata needed to continue reasoning-aware
|
|
446
|
+
* conversations.
|
|
447
|
+
*
|
|
448
|
+
* @category response
|
|
449
|
+
* @since 4.0.0
|
|
450
|
+
*/
|
|
310
451
|
interface ReasoningStartPartMetadata extends ProviderMetadata {
|
|
311
452
|
readonly anthropic?: {
|
|
312
453
|
readonly info?: {
|
|
@@ -326,6 +467,16 @@ declare module "effect/unstable/ai/Response" {
|
|
|
326
467
|
} | null;
|
|
327
468
|
} | null;
|
|
328
469
|
}
|
|
470
|
+
/**
|
|
471
|
+
* Anthropic metadata attached to streaming reasoning deltas.
|
|
472
|
+
*
|
|
473
|
+
* **Details**
|
|
474
|
+
*
|
|
475
|
+
* Includes the signature for streamed Claude thinking content when available.
|
|
476
|
+
*
|
|
477
|
+
* @category response
|
|
478
|
+
* @since 4.0.0
|
|
479
|
+
*/
|
|
329
480
|
interface ReasoningDeltaPartMetadata extends ProviderMetadata {
|
|
330
481
|
readonly anthropic?: {
|
|
331
482
|
readonly info?: {
|
|
@@ -338,6 +489,16 @@ declare module "effect/unstable/ai/Response" {
|
|
|
338
489
|
} | null;
|
|
339
490
|
} | null;
|
|
340
491
|
}
|
|
492
|
+
/**
|
|
493
|
+
* Anthropic metadata attached to completed reasoning parts.
|
|
494
|
+
*
|
|
495
|
+
* **Details**
|
|
496
|
+
*
|
|
497
|
+
* Preserves Claude thinking or redacted thinking information for later turns.
|
|
498
|
+
*
|
|
499
|
+
* @category response
|
|
500
|
+
* @since 4.0.0
|
|
501
|
+
*/
|
|
341
502
|
interface ReasoningPartMetadata extends ProviderMetadata {
|
|
342
503
|
readonly anthropic?: {
|
|
343
504
|
readonly info?: {
|
|
@@ -357,6 +518,17 @@ declare module "effect/unstable/ai/Response" {
|
|
|
357
518
|
} | null;
|
|
358
519
|
} | null;
|
|
359
520
|
}
|
|
521
|
+
/**
|
|
522
|
+
* Anthropic metadata attached to tool call response parts.
|
|
523
|
+
*
|
|
524
|
+
* **Details**
|
|
525
|
+
*
|
|
526
|
+
* Identifies Anthropic caller details and MCP tool metadata emitted by the
|
|
527
|
+
* provider.
|
|
528
|
+
*
|
|
529
|
+
* @category response
|
|
530
|
+
* @since 4.0.0
|
|
531
|
+
*/
|
|
360
532
|
interface ToolCallPartMetadata extends ProviderMetadata {
|
|
361
533
|
readonly anthropic?: {
|
|
362
534
|
readonly caller?: {
|
|
@@ -374,6 +546,17 @@ declare module "effect/unstable/ai/Response" {
|
|
|
374
546
|
} | null;
|
|
375
547
|
} | null;
|
|
376
548
|
}
|
|
549
|
+
/**
|
|
550
|
+
* Anthropic metadata attached to tool result response parts.
|
|
551
|
+
*
|
|
552
|
+
* **Details**
|
|
553
|
+
*
|
|
554
|
+
* Identifies MCP tool metadata associated with provider-executed tool
|
|
555
|
+
* results.
|
|
556
|
+
*
|
|
557
|
+
* @category response
|
|
558
|
+
* @since 4.0.0
|
|
559
|
+
*/
|
|
377
560
|
interface ToolResultPartMetadata extends ProviderMetadata {
|
|
378
561
|
readonly anthropic?: {
|
|
379
562
|
/**
|
|
@@ -387,6 +570,16 @@ declare module "effect/unstable/ai/Response" {
|
|
|
387
570
|
} | null;
|
|
388
571
|
} | null;
|
|
389
572
|
}
|
|
573
|
+
/**
|
|
574
|
+
* Anthropic metadata for document citations in model responses.
|
|
575
|
+
*
|
|
576
|
+
* **Details**
|
|
577
|
+
*
|
|
578
|
+
* Records the cited document span by character position or page number.
|
|
579
|
+
*
|
|
580
|
+
* @category response
|
|
581
|
+
* @since 4.0.0
|
|
582
|
+
*/
|
|
390
583
|
interface DocumentSourcePartMetadata extends ProviderMetadata {
|
|
391
584
|
readonly anthropic?: {
|
|
392
585
|
readonly source: "document";
|
|
@@ -420,6 +613,16 @@ declare module "effect/unstable/ai/Response" {
|
|
|
420
613
|
readonly endPageNumber: number;
|
|
421
614
|
} | null;
|
|
422
615
|
}
|
|
616
|
+
/**
|
|
617
|
+
* Anthropic metadata for URL and web citations in model responses.
|
|
618
|
+
*
|
|
619
|
+
* **Details**
|
|
620
|
+
*
|
|
621
|
+
* Records cited URL text or web-search source freshness information.
|
|
622
|
+
*
|
|
623
|
+
* @category response
|
|
624
|
+
* @since 4.0.0
|
|
625
|
+
*/
|
|
423
626
|
interface UrlSourcePartMetadata extends ProviderMetadata {
|
|
424
627
|
readonly anthropic?: {
|
|
425
628
|
readonly source: "url";
|
|
@@ -438,6 +641,17 @@ declare module "effect/unstable/ai/Response" {
|
|
|
438
641
|
readonly pageAge: string | null;
|
|
439
642
|
} | null;
|
|
440
643
|
}
|
|
644
|
+
/**
|
|
645
|
+
* Anthropic metadata attached to the finish part of a response.
|
|
646
|
+
*
|
|
647
|
+
* **Details**
|
|
648
|
+
*
|
|
649
|
+
* Includes container state, context management information, stop details, and
|
|
650
|
+
* token usage reported by Anthropic.
|
|
651
|
+
*
|
|
652
|
+
* @category response
|
|
653
|
+
* @since 4.0.0
|
|
654
|
+
*/
|
|
441
655
|
interface FinishPartMetadata extends ProviderMetadata {
|
|
442
656
|
readonly anthropic?: {
|
|
443
657
|
readonly container: typeof Generated.BetaContainer.Encoded | null;
|
|
@@ -446,6 +660,16 @@ declare module "effect/unstable/ai/Response" {
|
|
|
446
660
|
readonly usage: typeof Generated.BetaMessage.Encoded["usage"] | null;
|
|
447
661
|
} | null;
|
|
448
662
|
}
|
|
663
|
+
/**
|
|
664
|
+
* Anthropic metadata attached to error response parts.
|
|
665
|
+
*
|
|
666
|
+
* **Details**
|
|
667
|
+
*
|
|
668
|
+
* Includes the provider request identifier when Anthropic returns one.
|
|
669
|
+
*
|
|
670
|
+
* @category response
|
|
671
|
+
* @since 4.0.0
|
|
672
|
+
*/
|
|
449
673
|
interface ErrorPartMetadata extends ProviderMetadata {
|
|
450
674
|
readonly anthropic?: {
|
|
451
675
|
requestId?: string | null;
|
|
@@ -453,17 +677,39 @@ declare module "effect/unstable/ai/Response" {
|
|
|
453
677
|
}
|
|
454
678
|
}
|
|
455
679
|
/**
|
|
456
|
-
* Creates an Anthropic
|
|
680
|
+
* Creates an Anthropic model descriptor that can be provided with `Effect.provide`.
|
|
681
|
+
*
|
|
682
|
+
* **When to use**
|
|
683
|
+
*
|
|
684
|
+
* Use when you want an Anthropic Claude model value that carries provider and
|
|
685
|
+
* model metadata and can be supplied directly to an Effect program.
|
|
686
|
+
*
|
|
687
|
+
* @see {@link layer} for creating a `LanguageModel.LanguageModel` layer directly
|
|
688
|
+
* @see {@link make} for constructing the language model service effectfully
|
|
457
689
|
*
|
|
458
|
-
* @since 1.0.0
|
|
459
690
|
* @category constructors
|
|
691
|
+
* @since 4.0.0
|
|
460
692
|
*/
|
|
461
693
|
export declare const model: (model: (string & {}) | Model, config?: Omit<typeof Config.Service, "model">) => AiModel.Model<"anthropic", LanguageModel.LanguageModel, AnthropicClient>;
|
|
462
694
|
/**
|
|
463
|
-
* Creates an Anthropic
|
|
695
|
+
* Creates an Anthropic `LanguageModel` service from a model identifier and optional request defaults.
|
|
696
|
+
*
|
|
697
|
+
* **When to use**
|
|
698
|
+
*
|
|
699
|
+
* Use when an Effect needs to construct a `LanguageModel.Service` value backed
|
|
700
|
+
* by `AnthropicClient`.
|
|
701
|
+
*
|
|
702
|
+
* **Details**
|
|
703
|
+
*
|
|
704
|
+
* The returned effect requires `AnthropicClient`. Request defaults from the
|
|
705
|
+
* `config` option are merged with any `Config` service in the context, with
|
|
706
|
+
* context values taking precedence.
|
|
707
|
+
*
|
|
708
|
+
* @see {@link layer} for providing the service as a `Layer`
|
|
709
|
+
* @see {@link model} for creating a model descriptor for `AiModel.provide`
|
|
464
710
|
*
|
|
465
|
-
* @since 1.0.0
|
|
466
711
|
* @category constructors
|
|
712
|
+
* @since 4.0.0
|
|
467
713
|
*/
|
|
468
714
|
export declare const make: (args_0: {
|
|
469
715
|
readonly model: (string & {}) | Model;
|
|
@@ -472,8 +718,17 @@ export declare const make: (args_0: {
|
|
|
472
718
|
/**
|
|
473
719
|
* Creates a layer for the Anthropic language model.
|
|
474
720
|
*
|
|
475
|
-
*
|
|
721
|
+
* **When to use**
|
|
722
|
+
*
|
|
723
|
+
* Use when composing application layers and you want Anthropic to satisfy
|
|
724
|
+
* `LanguageModel.LanguageModel` while supplying `AnthropicClient` from another
|
|
725
|
+
* layer.
|
|
726
|
+
*
|
|
727
|
+
* @see {@link make} for constructing the language model service effectfully
|
|
728
|
+
* @see {@link model} for creating a model service directly
|
|
729
|
+
*
|
|
476
730
|
* @category layers
|
|
731
|
+
* @since 4.0.0
|
|
477
732
|
*/
|
|
478
733
|
export declare const layer: (options: {
|
|
479
734
|
readonly model: (string & {}) | Model;
|
|
@@ -482,40 +737,98 @@ export declare const layer: (options: {
|
|
|
482
737
|
/**
|
|
483
738
|
* Provides config overrides for Anthropic language model operations.
|
|
484
739
|
*
|
|
485
|
-
*
|
|
740
|
+
* **When to use**
|
|
741
|
+
*
|
|
742
|
+
* Use to apply Anthropic request configuration to one effect without changing
|
|
743
|
+
* the model's default configuration.
|
|
744
|
+
*
|
|
745
|
+
* **Details**
|
|
746
|
+
*
|
|
747
|
+
* The overrides are merged with any existing `Config` service for the duration
|
|
748
|
+
* of the supplied effect. Fields in `overrides` take precedence over existing
|
|
749
|
+
* config, and the helper supports both `effect.pipe(withConfigOverride(overrides))`
|
|
750
|
+
* and `withConfigOverride(effect, overrides)`.
|
|
751
|
+
*
|
|
752
|
+
* @see {@link Config} for available Anthropic request configuration fields
|
|
753
|
+
*
|
|
486
754
|
* @category configuration
|
|
755
|
+
* @since 4.0.0
|
|
487
756
|
*/
|
|
488
757
|
export declare const withConfigOverride: {
|
|
489
758
|
/**
|
|
490
759
|
* Provides config overrides for Anthropic language model operations.
|
|
491
760
|
*
|
|
492
|
-
*
|
|
761
|
+
* **When to use**
|
|
762
|
+
*
|
|
763
|
+
* Use to apply Anthropic request configuration to one effect without changing
|
|
764
|
+
* the model's default configuration.
|
|
765
|
+
*
|
|
766
|
+
* **Details**
|
|
767
|
+
*
|
|
768
|
+
* The overrides are merged with any existing `Config` service for the duration
|
|
769
|
+
* of the supplied effect. Fields in `overrides` take precedence over existing
|
|
770
|
+
* config, and the helper supports both `effect.pipe(withConfigOverride(overrides))`
|
|
771
|
+
* and `withConfigOverride(effect, overrides)`.
|
|
772
|
+
*
|
|
773
|
+
* @see {@link Config} for available Anthropic request configuration fields
|
|
774
|
+
*
|
|
493
775
|
* @category configuration
|
|
776
|
+
* @since 4.0.0
|
|
494
777
|
*/
|
|
495
778
|
(overrides: typeof Config.Service): <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Config>>;
|
|
496
779
|
/**
|
|
497
780
|
* Provides config overrides for Anthropic language model operations.
|
|
498
781
|
*
|
|
499
|
-
*
|
|
782
|
+
* **When to use**
|
|
783
|
+
*
|
|
784
|
+
* Use to apply Anthropic request configuration to one effect without changing
|
|
785
|
+
* the model's default configuration.
|
|
786
|
+
*
|
|
787
|
+
* **Details**
|
|
788
|
+
*
|
|
789
|
+
* The overrides are merged with any existing `Config` service for the duration
|
|
790
|
+
* of the supplied effect. Fields in `overrides` take precedence over existing
|
|
791
|
+
* config, and the helper supports both `effect.pipe(withConfigOverride(overrides))`
|
|
792
|
+
* and `withConfigOverride(effect, overrides)`.
|
|
793
|
+
*
|
|
794
|
+
* @see {@link Config} for available Anthropic request configuration fields
|
|
795
|
+
*
|
|
500
796
|
* @category configuration
|
|
797
|
+
* @since 4.0.0
|
|
501
798
|
*/
|
|
502
799
|
<A, E, R>(self: Effect.Effect<A, E, R>, overrides: typeof Config.Service): Effect.Effect<A, E, Exclude<R, Config>>;
|
|
503
800
|
};
|
|
504
801
|
/**
|
|
505
|
-
*
|
|
802
|
+
* Encoded Anthropic custom tool definition that can be sent in a Messages API request.
|
|
803
|
+
*
|
|
804
|
+
* **When to use**
|
|
805
|
+
*
|
|
806
|
+
* Use when you need to type or inspect the provider-specific request payload for
|
|
807
|
+
* a custom Anthropic tool.
|
|
808
|
+
*
|
|
809
|
+
* **Details**
|
|
810
|
+
*
|
|
811
|
+
* This type aliases the encoded `Generated.BetaTool` schema used for Effect
|
|
812
|
+
* user-defined and dynamic tools after conversion. It contains the tool `name`,
|
|
813
|
+
* optional `description`, and `input_schema`, plus Anthropic-specific fields
|
|
814
|
+
* such as `strict` and `cache_control`.
|
|
815
|
+
*
|
|
816
|
+
* @see {@link AnthropicProviderDefinedTool} for the request shape used by Anthropic built-in provider tools
|
|
506
817
|
*
|
|
507
|
-
* @since 1.0.0
|
|
508
818
|
* @category tools
|
|
819
|
+
* @since 4.0.0
|
|
509
820
|
*/
|
|
510
821
|
export type AnthropicUserDefinedTool = typeof Generated.BetaTool.Encoded;
|
|
511
822
|
/**
|
|
512
823
|
* Represents a provider-defined tool that can be passed to the Anthropic API.
|
|
513
824
|
*
|
|
825
|
+
* **Details**
|
|
826
|
+
*
|
|
514
827
|
* These include Anthropic's built-in tools like computer use, code execution,
|
|
515
828
|
* web search, and text editing.
|
|
516
829
|
*
|
|
517
|
-
* @since 1.0.0
|
|
518
830
|
* @category tools
|
|
831
|
+
* @since 4.0.0
|
|
519
832
|
*/
|
|
520
833
|
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;
|
|
521
834
|
export {};
|