@aeye/anthropic 0.0.0-stage → 0.11.0
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/README.md +109 -3
- package/aeye-anthropic.md +109 -0
- package/dist/anthropic.d.ts +349 -0
- package/dist/anthropic.d.ts.map +1 -0
- package/dist/anthropic.js +726 -0
- package/dist/anthropic.js.map +1 -0
- package/dist/convert.d.ts +263 -0
- package/dist/convert.d.ts.map +1 -0
- package/dist/convert.js +808 -0
- package/dist/convert.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/models.d.ts +136 -0
- package/dist/models.d.ts.map +1 -0
- package/dist/models.js +80 -0
- package/dist/models.js.map +1 -0
- package/dist/retry.d.ts +104 -0
- package/dist/retry.d.ts.map +1 -0
- package/dist/retry.js +181 -0
- package/dist/retry.js.map +1 -0
- package/dist/types.d.ts +45 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +72 -0
- package/dist/types.js.map +1 -0
- package/package.json +74 -4
package/README.md
CHANGED
|
@@ -1,3 +1,109 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
# @aeye/anthropic
|
|
2
|
+
|
|
3
|
+
One-line purpose: Anthropic provider for the `@aeye/ai` framework — Claude through the Messages API via the official `@anthropic-ai/sdk`: chat and streaming, tool use (parallel calls, tool choice, strict tools), structured output, image and PDF/text document input, thinking (adaptive with effort, or a token budget), prompt caching, server tools (web search, web fetch, code execution, MCP servers), message batches, token counting, the Files API and the Models API.
|
|
4
|
+
|
|
5
|
+
## When to use
|
|
6
|
+
|
|
7
|
+
- You want Claude models directly from Anthropic (not through Bedrock or OpenRouter).
|
|
8
|
+
- You want each Claude model sent only the parameters it takes: the provider reads, from each model's `ModelInfo`, which thinking modes, efforts, sampling parameters, forced tool choices and request fields it accepts. `@aeye/models` carries that data (scraped from Anthropic's docs and Models API, with what the live matrix measured merged in; see `docs/plans/anthropic-measured-2026-11.md`). The provider keeps no model table of its own.
|
|
9
|
+
|
|
10
|
+
## Install / import
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install @aeye/anthropic @aeye/ai @aeye/core
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
import {
|
|
18
|
+
AnthropicProvider,
|
|
19
|
+
type AnthropicConfig,
|
|
20
|
+
type AnthropicModelOptions, // ModelInfo.providerOptions.anthropic: what one model takes
|
|
21
|
+
ANTHROPIC_MODEL_DEFAULTS, // what a model with no data is assumed to take (nothing unproven)
|
|
22
|
+
ProviderError, ProviderAuthError, RateLimitError, ProviderQuotaError, ContextWindowError,
|
|
23
|
+
} from '@aeye/anthropic';
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Requires Node >= 22. The model data is `anthropicModels` in `@aeye/models`.
|
|
27
|
+
|
|
28
|
+
## Register with an `@aeye/ai` instance
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
import { AI } from '@aeye/ai';
|
|
32
|
+
import { AnthropicProvider } from '@aeye/anthropic';
|
|
33
|
+
|
|
34
|
+
import { anthropicModels } from '@aeye/models';
|
|
35
|
+
|
|
36
|
+
const anthropic = new AnthropicProvider({ apiKey: process.env.ANTHROPIC_API_KEY });
|
|
37
|
+
const ai = AI.with().providers({ anthropic }).create({ models: anthropicModels });
|
|
38
|
+
|
|
39
|
+
const response = await ai.chat.get(
|
|
40
|
+
{ messages: [{ role: 'user', content: 'Hello!' }] },
|
|
41
|
+
{ metadata: { model: 'claude-sonnet-5-5' } },
|
|
42
|
+
);
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Everything model-specific is data on the model's `ModelInfo`: `supportedParameters` (the general parameters, which `ai.chat` and the provider both drop when unlisted), `reasoningEfforts`, `maxOutputTokens`, `schema` (the strict-schema dialect and the model's measured grammar limits) and `providerOptions.anthropic` (`AnthropicModelOptions`: `thinking` kind and `thinkingOff`, `sampling`, `forcedToolChoice`, `midConversationSystem`, `prefill`, `inferenceGeo`, `dynamicWebTools`, `fastMode`, extra `pricing`, `aliases`). The AI layer hands the provider the selected model's `ModelInfo`; called directly with a bare id, the provider looks it up in `config.models` (by id or alias), and a model found nowhere gets `ANTHROPIC_MODEL_DEFAULTS` (no sampling, forced tool choice, mid-conversation system messages, prefill, `inference_geo` or fast mode; thinking only when asked; schemas in the `anthropic` dialect, not strict).
|
|
46
|
+
|
|
47
|
+
`listModels()` reads the Models API and builds each entry from what it reports (limits, efforts, thinking types, input types, strict-schema support), with `config.models` data over it; the AI registry merges `@aeye/models` over provider listings the same way. To change what one model is sent, override its data (`modelOverrides` on the AI config, deep-merged):
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
const ai = AI.with().providers({ anthropic }).create({
|
|
51
|
+
models: anthropicModels,
|
|
52
|
+
modelOverrides: [{ provider: 'anthropic', modelId: 'claude-opus-4-8', overrides: {
|
|
53
|
+
providerOptions: { anthropic: { forcedToolChoice: false } }, // narrow tools instead of tool_choice: any
|
|
54
|
+
schema: { limits: { requestProperties: 60 } }, // a tighter grammar budget
|
|
55
|
+
} }],
|
|
56
|
+
});
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Configuration (`AnthropicConfig`)
|
|
60
|
+
|
|
61
|
+
| Field | Meaning |
|
|
62
|
+
|---|---|
|
|
63
|
+
| `apiKey` / `authToken` | Credential. Without either, the SDK's chain applies (`ANTHROPIC_API_KEY`, `ANTHROPIC_AUTH_TOKEN`, an `ant auth login` profile). |
|
|
64
|
+
| `baseURL` | Anthropic-compatible endpoint. |
|
|
65
|
+
| `apiVersion` | `'2026-10-21'` (default, the SDK's) or `'2023-06-01'`. The new version rejects `temperature`, `top_p`, `top_k` on every model; `2023-06-01` still takes them on models whose `sampling` option says so (Claude 4.6 and earlier). |
|
|
66
|
+
| `betas` | Beta headers on every Messages request. |
|
|
67
|
+
| `defaultHeaders`, `workspaceId` | Extra headers; workspace for multi-workspace credentials. |
|
|
68
|
+
| `inferenceGeo` | `inference_geo` (sent only to models whose `inferenceGeo` option says so: Claude 4.6+). |
|
|
69
|
+
| `models` | `ModelInfo[]` the provider looks a bare model id up in (e.g. `anthropicModels` from `@aeye/models`). |
|
|
70
|
+
| `fetch`, `timeout` | Custom fetch; per-attempt HTTP timeout. |
|
|
71
|
+
| `maxTokens` | Default `max_tokens` (else 16,000 non-streaming, 64,000 streaming, capped at the model's limit). |
|
|
72
|
+
| `cache` | `{ automatic?: boolean; ttl?: '5m' \| '1h' }`: top-level automatic caching, and the TTL for breakpoints. |
|
|
73
|
+
| `maxContinuations` | How often a `pause_turn` (long server tool use) is continued in one call (default 5). |
|
|
74
|
+
| `retry`, `retryEvents` | Retries (below) and their events. |
|
|
75
|
+
| `hooks` | `chat`, `countTokens`, `batch`: `beforeRequest(request, params, ctx, metadata)`, `afterRequest(...)`, `onError(...)`. |
|
|
76
|
+
| `defaultModels` | `chat`, `imageAnalyze` (default `claude-sonnet-5-5`). |
|
|
77
|
+
|
|
78
|
+
## How requests map
|
|
79
|
+
|
|
80
|
+
- **Messages**: leading system messages become `system`; later ones go in the conversation as `role: 'system'` where the model takes them (Opus 4.8+, Sonnet 5+, Haiku 5.5, Fable/Mythos) and the API allows them there, else join `system`. Tool results become `tool_result` blocks in one user turn (`failure` → `is_error`). Assistant turns replay their thinking blocks first (signature intact). A conversation that ends with the assistant gets a "Continue." user turn on models that reject prefill (4.6+).
|
|
81
|
+
- **Content**: `image` → base64, URL or Files API id (`file_...`); `file` → PDF (base64/URL/file id) or plain-text document; audio and video become a note (Claude doesn't take them). `cacheBreakpoint` → `cache_control` (the last four kept).
|
|
82
|
+
- **Tools**: schemas are planned by `@aeye/schema` from the model's `schema` data (base `anthropic`, with the model's own measured limits: 64 properties across a request on the 5.x models, 66 on Opus 4.8, 54 on 4.5–4.7): strict tools within those totals, the rest non-strict. `required` → `any`, `{ tool }` → `tool`, `none` → `none`, `{ allowed }` sends only the allowed tools, `toolsOneAtATime` → `disable_parallel_tool_use`. Models whose `forcedToolChoice` is false (Opus 5.5, Sonnet 5.5, Fable 5.1+) get only the tool(s) to call, with `auto`. `defer: true` tools load through the BM25 tool search tool.
|
|
83
|
+
- **Hosted tools**: `web_search` and `web_fetch` (the `_20260318` dynamic-filtering versions on Claude 4.6+, the basic ones before), `code_interpreter` → code execution, `mcp` → `mcp_servers` + `mcp_toolset` (beta `mcp-client-2025-11-20`). `file_search` and `image_generation` throw: Claude has none.
|
|
84
|
+
- **Output**: a schema the plan renders strict goes as `output_config.format`; otherwise it goes in the prompt. `'json'` adds a JSON-only instruction (the API has no JSON mode).
|
|
85
|
+
- **Reasoning** (`request.reason`): adaptive thinking with `output_config.effort` (clamped to the model's efforts) on Claude 4.6+; a `budget_tokens` budget on 4.5 (from `maxTokens` or the effort, `max_tokens` raised to fit). `effort: 'none'` turns thinking off where the model allows (`disabled`, or `between_tools` on Sonnet 5.5), and is the lowest effort on models that always think. `exclude` → `display: 'omitted'`, else `'summarized'`. A forced tool turn on a budget model goes without thinking.
|
|
86
|
+
- **Sampling**: `temperature` / `topP` only on `2023-06-01` and only to models whose `sampling` option says so (never both; with thinking on, no temperature and `top_p` ≥ 0.95). `listModels` lists them in `supportedParameters` only then, so `ai.chat` drops them for other models.
|
|
87
|
+
- **Every optional setting** the model's `supportedParameters` doesn't list (penalties, seed, logit bias, log probabilities, verbosity, …) is left out by the provider as well as by `ai.chat` (`supportedRequest`); `src/__tests__/wire.test.ts` checks every model in `@aeye/models`.
|
|
88
|
+
- **Other**: `stop` → `stop_sequences`, `userKey` → `metadata.user_id`, `serviceTier`: `auto`/`scale` → `service_tier: auto`, `default` → `standard_only`, `fast` → `speed: 'fast'` on models whose `fastMode` is set (`'beta'` adds the `fast-mode-2026-02-01` header). `extra` is merged into the body (`extra.betas`, `extra.headers`, `extra.retry` configure the call).
|
|
89
|
+
|
|
90
|
+
## Responses
|
|
91
|
+
|
|
92
|
+
`content`, `toolCalls`, `reasoning` (`anthropic-messages-v1` details, `provider: 'anthropic'`), `citations` (web sources, with their span in `content`), `refusal` (from `stop_details`), `serviceTier`, and `usage`: `text.input` (uncached), `text.cached` (cache reads), `text.cacheWrite`, `text.output` without thinking, `reasoning.output` (thinking tokens), `tools.web_search` / `web_fetch`, and `cost` priced from the model (1-hour cache writes, Haiku 5.5's long-prompt prices, fast mode and the batch discount included). `pause_turn` is continued; `model_context_window_exceeded` and `max_tokens` are `length`; a prompt over the context window ends as `length` (so prompts can trim) rather than throwing.
|
|
93
|
+
|
|
94
|
+
## Errors and retries
|
|
95
|
+
|
|
96
|
+
Retries follow the API: `x-should-retry` decides when present; otherwise connection errors, 408, 409, 429, 5xx and 529 retry, waiting `retry-after-ms` / `retry-after` or backing off exponentially. A spend-limit 429 never retries. After the retries: 401/403 → `ProviderAuthError`, spend limits → `ProviderQuotaError`, 429/529 → `RateLimitError` (with `retryAfter`), a rejected schema → `SchemaRejectedError` (for the prompt's schema fallbacks). Abort signals stop calls, waits between retries and streams.
|
|
97
|
+
|
|
98
|
+
## Other operations
|
|
99
|
+
|
|
100
|
+
- `countTokens(request, ctx)` — input tokens as the API counts them (free).
|
|
101
|
+
- `uploadFile(resource, { name, mimeType })`, `listFiles()`, `deleteFile(id)` — the Files API; use the id as content.
|
|
102
|
+
- `submitBatch(requests)` / `getBatch(job)` — Message Batches at half price.
|
|
103
|
+
- `analyzeImage` / `analyzeImageStream` — vision as chat.
|
|
104
|
+
|
|
105
|
+
Not offered (Claude has no such endpoints): embeddings, image generation and editing, speech, transcription, rerank, decisions.
|
|
106
|
+
|
|
107
|
+
## Live validation
|
|
108
|
+
|
|
109
|
+
`npm run live:matrix -w @aeye/anthropic -- params|dialect|schemas|features|all [--models a,b]` measures every listed model and then runs `live:measured` (`npm run models:measured -w @aeye/models -- anthropic`), which writes the results into the `measured` block of `packages/models/overrides/anthropic.ts` and regenerates `@aeye/models`' Anthropic catalog. `npm run live:report` writes `docs/plans/anthropic-measured-2026-11.md`. `src/__tests__/support-table.test.ts` replays the measured table against the request builder with the `@aeye/models` data.
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# @aeye/anthropic
|
|
2
|
+
|
|
3
|
+
One-line purpose: Anthropic provider for the `@aeye/ai` framework — Claude through the Messages API via the official `@anthropic-ai/sdk`: chat and streaming, tool use (parallel calls, tool choice, strict tools), structured output, image and PDF/text document input, thinking (adaptive with effort, or a token budget), prompt caching, server tools (web search, web fetch, code execution, MCP servers), message batches, token counting, the Files API and the Models API.
|
|
4
|
+
|
|
5
|
+
## When to use
|
|
6
|
+
|
|
7
|
+
- You want Claude models directly from Anthropic (not through Bedrock or OpenRouter).
|
|
8
|
+
- You want each Claude model sent only the parameters it takes: the provider reads, from each model's `ModelInfo`, which thinking modes, efforts, sampling parameters, forced tool choices and request fields it accepts. `@aeye/models` carries that data (scraped from Anthropic's docs and Models API, with what the live matrix measured merged in; see `docs/plans/anthropic-measured-2026-11.md`). The provider keeps no model table of its own.
|
|
9
|
+
|
|
10
|
+
## Install / import
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install @aeye/anthropic @aeye/ai @aeye/core
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
import {
|
|
18
|
+
AnthropicProvider,
|
|
19
|
+
type AnthropicConfig,
|
|
20
|
+
type AnthropicModelOptions, // ModelInfo.providerOptions.anthropic: what one model takes
|
|
21
|
+
ANTHROPIC_MODEL_DEFAULTS, // what a model with no data is assumed to take (nothing unproven)
|
|
22
|
+
ProviderError, ProviderAuthError, RateLimitError, ProviderQuotaError, ContextWindowError,
|
|
23
|
+
} from '@aeye/anthropic';
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Requires Node >= 22. The model data is `anthropicModels` in `@aeye/models`.
|
|
27
|
+
|
|
28
|
+
## Register with an `@aeye/ai` instance
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
import { AI } from '@aeye/ai';
|
|
32
|
+
import { AnthropicProvider } from '@aeye/anthropic';
|
|
33
|
+
|
|
34
|
+
import { anthropicModels } from '@aeye/models';
|
|
35
|
+
|
|
36
|
+
const anthropic = new AnthropicProvider({ apiKey: process.env.ANTHROPIC_API_KEY });
|
|
37
|
+
const ai = AI.with().providers({ anthropic }).create({ models: anthropicModels });
|
|
38
|
+
|
|
39
|
+
const response = await ai.chat.get(
|
|
40
|
+
{ messages: [{ role: 'user', content: 'Hello!' }] },
|
|
41
|
+
{ metadata: { model: 'claude-sonnet-5-5' } },
|
|
42
|
+
);
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Everything model-specific is data on the model's `ModelInfo`: `supportedParameters` (the general parameters, which `ai.chat` and the provider both drop when unlisted), `reasoningEfforts`, `maxOutputTokens`, `schema` (the strict-schema dialect and the model's measured grammar limits) and `providerOptions.anthropic` (`AnthropicModelOptions`: `thinking` kind and `thinkingOff`, `sampling`, `forcedToolChoice`, `midConversationSystem`, `prefill`, `inferenceGeo`, `dynamicWebTools`, `fastMode`, extra `pricing`, `aliases`). The AI layer hands the provider the selected model's `ModelInfo`; called directly with a bare id, the provider looks it up in `config.models` (by id or alias), and a model found nowhere gets `ANTHROPIC_MODEL_DEFAULTS` (no sampling, forced tool choice, mid-conversation system messages, prefill, `inference_geo` or fast mode; thinking only when asked; schemas in the `anthropic` dialect, not strict).
|
|
46
|
+
|
|
47
|
+
`listModels()` reads the Models API and builds each entry from what it reports (limits, efforts, thinking types, input types, strict-schema support), with `config.models` data over it; the AI registry merges `@aeye/models` over provider listings the same way. To change what one model is sent, override its data (`modelOverrides` on the AI config, deep-merged):
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
const ai = AI.with().providers({ anthropic }).create({
|
|
51
|
+
models: anthropicModels,
|
|
52
|
+
modelOverrides: [{ provider: 'anthropic', modelId: 'claude-opus-4-8', overrides: {
|
|
53
|
+
providerOptions: { anthropic: { forcedToolChoice: false } }, // narrow tools instead of tool_choice: any
|
|
54
|
+
schema: { limits: { requestProperties: 60 } }, // a tighter grammar budget
|
|
55
|
+
} }],
|
|
56
|
+
});
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Configuration (`AnthropicConfig`)
|
|
60
|
+
|
|
61
|
+
| Field | Meaning |
|
|
62
|
+
|---|---|
|
|
63
|
+
| `apiKey` / `authToken` | Credential. Without either, the SDK's chain applies (`ANTHROPIC_API_KEY`, `ANTHROPIC_AUTH_TOKEN`, an `ant auth login` profile). |
|
|
64
|
+
| `baseURL` | Anthropic-compatible endpoint. |
|
|
65
|
+
| `apiVersion` | `'2026-10-21'` (default, the SDK's) or `'2023-06-01'`. The new version rejects `temperature`, `top_p`, `top_k` on every model; `2023-06-01` still takes them on models whose `sampling` option says so (Claude 4.6 and earlier). |
|
|
66
|
+
| `betas` | Beta headers on every Messages request. |
|
|
67
|
+
| `defaultHeaders`, `workspaceId` | Extra headers; workspace for multi-workspace credentials. |
|
|
68
|
+
| `inferenceGeo` | `inference_geo` (sent only to models whose `inferenceGeo` option says so: Claude 4.6+). |
|
|
69
|
+
| `models` | `ModelInfo[]` the provider looks a bare model id up in (e.g. `anthropicModels` from `@aeye/models`). |
|
|
70
|
+
| `fetch`, `timeout` | Custom fetch; per-attempt HTTP timeout. |
|
|
71
|
+
| `maxTokens` | Default `max_tokens` (else 16,000 non-streaming, 64,000 streaming, capped at the model's limit). |
|
|
72
|
+
| `cache` | `{ automatic?: boolean; ttl?: '5m' \| '1h' }`: top-level automatic caching, and the TTL for breakpoints. |
|
|
73
|
+
| `maxContinuations` | How often a `pause_turn` (long server tool use) is continued in one call (default 5). |
|
|
74
|
+
| `retry`, `retryEvents` | Retries (below) and their events. |
|
|
75
|
+
| `hooks` | `chat`, `countTokens`, `batch`: `beforeRequest(request, params, ctx, metadata)`, `afterRequest(...)`, `onError(...)`. |
|
|
76
|
+
| `defaultModels` | `chat`, `imageAnalyze` (default `claude-sonnet-5-5`). |
|
|
77
|
+
|
|
78
|
+
## How requests map
|
|
79
|
+
|
|
80
|
+
- **Messages**: leading system messages become `system`; later ones go in the conversation as `role: 'system'` where the model takes them (Opus 4.8+, Sonnet 5+, Haiku 5.5, Fable/Mythos) and the API allows them there, else join `system`. Tool results become `tool_result` blocks in one user turn (`failure` → `is_error`). Assistant turns replay their thinking blocks first (signature intact). A conversation that ends with the assistant gets a "Continue." user turn on models that reject prefill (4.6+).
|
|
81
|
+
- **Content**: `image` → base64, URL or Files API id (`file_...`); `file` → PDF (base64/URL/file id) or plain-text document; audio and video become a note (Claude doesn't take them). `cacheBreakpoint` → `cache_control` (the last four kept).
|
|
82
|
+
- **Tools**: schemas are planned by `@aeye/schema` from the model's `schema` data (base `anthropic`, with the model's own measured limits: 64 properties across a request on the 5.x models, 66 on Opus 4.8, 54 on 4.5–4.7): strict tools within those totals, the rest non-strict. `required` → `any`, `{ tool }` → `tool`, `none` → `none`, `{ allowed }` sends only the allowed tools, `toolsOneAtATime` → `disable_parallel_tool_use`. Models whose `forcedToolChoice` is false (Opus 5.5, Sonnet 5.5, Fable 5.1+) get only the tool(s) to call, with `auto`. `defer: true` tools load through the BM25 tool search tool.
|
|
83
|
+
- **Hosted tools**: `web_search` and `web_fetch` (the `_20260318` dynamic-filtering versions on Claude 4.6+, the basic ones before), `code_interpreter` → code execution, `mcp` → `mcp_servers` + `mcp_toolset` (beta `mcp-client-2025-11-20`). `file_search` and `image_generation` throw: Claude has none.
|
|
84
|
+
- **Output**: a schema the plan renders strict goes as `output_config.format`; otherwise it goes in the prompt. `'json'` adds a JSON-only instruction (the API has no JSON mode).
|
|
85
|
+
- **Reasoning** (`request.reason`): adaptive thinking with `output_config.effort` (clamped to the model's efforts) on Claude 4.6+; a `budget_tokens` budget on 4.5 (from `maxTokens` or the effort, `max_tokens` raised to fit). `effort: 'none'` turns thinking off where the model allows (`disabled`, or `between_tools` on Sonnet 5.5), and is the lowest effort on models that always think. `exclude` → `display: 'omitted'`, else `'summarized'`. A forced tool turn on a budget model goes without thinking.
|
|
86
|
+
- **Sampling**: `temperature` / `topP` only on `2023-06-01` and only to models whose `sampling` option says so (never both; with thinking on, no temperature and `top_p` ≥ 0.95). `listModels` lists them in `supportedParameters` only then, so `ai.chat` drops them for other models.
|
|
87
|
+
- **Every optional setting** the model's `supportedParameters` doesn't list (penalties, seed, logit bias, log probabilities, verbosity, …) is left out by the provider as well as by `ai.chat` (`supportedRequest`); `src/__tests__/wire.test.ts` checks every model in `@aeye/models`.
|
|
88
|
+
- **Other**: `stop` → `stop_sequences`, `userKey` → `metadata.user_id`, `serviceTier`: `auto`/`scale` → `service_tier: auto`, `default` → `standard_only`, `fast` → `speed: 'fast'` on models whose `fastMode` is set (`'beta'` adds the `fast-mode-2026-02-01` header). `extra` is merged into the body (`extra.betas`, `extra.headers`, `extra.retry` configure the call).
|
|
89
|
+
|
|
90
|
+
## Responses
|
|
91
|
+
|
|
92
|
+
`content`, `toolCalls`, `reasoning` (`anthropic-messages-v1` details, `provider: 'anthropic'`), `citations` (web sources, with their span in `content`), `refusal` (from `stop_details`), `serviceTier`, and `usage`: `text.input` (uncached), `text.cached` (cache reads), `text.cacheWrite`, `text.output` without thinking, `reasoning.output` (thinking tokens), `tools.web_search` / `web_fetch`, and `cost` priced from the model (1-hour cache writes, Haiku 5.5's long-prompt prices, fast mode and the batch discount included). `pause_turn` is continued; `model_context_window_exceeded` and `max_tokens` are `length`; a prompt over the context window ends as `length` (so prompts can trim) rather than throwing.
|
|
93
|
+
|
|
94
|
+
## Errors and retries
|
|
95
|
+
|
|
96
|
+
Retries follow the API: `x-should-retry` decides when present; otherwise connection errors, 408, 409, 429, 5xx and 529 retry, waiting `retry-after-ms` / `retry-after` or backing off exponentially. A spend-limit 429 never retries. After the retries: 401/403 → `ProviderAuthError`, spend limits → `ProviderQuotaError`, 429/529 → `RateLimitError` (with `retryAfter`), a rejected schema → `SchemaRejectedError` (for the prompt's schema fallbacks). Abort signals stop calls, waits between retries and streams.
|
|
97
|
+
|
|
98
|
+
## Other operations
|
|
99
|
+
|
|
100
|
+
- `countTokens(request, ctx)` — input tokens as the API counts them (free).
|
|
101
|
+
- `uploadFile(resource, { name, mimeType })`, `listFiles()`, `deleteFile(id)` — the Files API; use the id as content.
|
|
102
|
+
- `submitBatch(requests)` / `getBatch(job)` — Message Batches at half price.
|
|
103
|
+
- `analyzeImage` / `analyzeImageStream` — vision as chat.
|
|
104
|
+
|
|
105
|
+
Not offered (Claude has no such endpoints): embeddings, image generation and editing, speech, transcription, rerank, decisions.
|
|
106
|
+
|
|
107
|
+
## Live validation
|
|
108
|
+
|
|
109
|
+
`npm run live:matrix -w @aeye/anthropic -- params|dialect|schemas|features|all [--models a,b]` measures every listed model and then runs `live:measured` (`npm run models:measured -w @aeye/models -- anthropic`), which writes the results into the `measured` block of `packages/models/overrides/anthropic.ts` and regenerates `@aeye/models`' Anthropic catalog. `npm run live:report` writes `docs/plans/anthropic-measured-2026-11.md`. `src/__tests__/support-table.test.ts` replays the measured table against the request builder with the `@aeye/models` data.
|
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Anthropic Provider
|
|
3
|
+
*
|
|
4
|
+
* Claude through the Anthropic Messages API: chat and streaming, tool use,
|
|
5
|
+
* structured output, image and document input, thinking, prompt caching,
|
|
6
|
+
* server tools (web search, web fetch, code execution, MCP), message
|
|
7
|
+
* batches, token counting, the Files API and the Models API.
|
|
8
|
+
*/
|
|
9
|
+
import type { AIContextAny, AIMetadataAny, BatchJob, ModelInfo, Provider } from '@aeye/ai';
|
|
10
|
+
import { type BaseRequest, type Executor, type Model, type ModelInput, type ModelLike, type Request, type Resource, type Response, type Streamer } from '@aeye/core';
|
|
11
|
+
import Anthropic from '@anthropic-ai/sdk';
|
|
12
|
+
import { type AnthropicApiVersion, type ClaudeModelTraits } from './models';
|
|
13
|
+
import { type RetryConfig, type RetryEvents } from './retry';
|
|
14
|
+
type MessageCreateParams = Anthropic.Messages.MessageCreateParamsNonStreaming;
|
|
15
|
+
type CountTokensParams = Anthropic.Messages.MessageCountTokensParams;
|
|
16
|
+
/**
|
|
17
|
+
* Hook called before a request is sent, with the parameters going out.
|
|
18
|
+
*/
|
|
19
|
+
export type PreRequestHook<TRequest, TParams> = (request: TRequest, params: TParams, ctx: AIContextAny, metadata?: AIMetadataAny) => void | Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* Hook called after a response is received.
|
|
22
|
+
*/
|
|
23
|
+
export type PostRequestHook<TRequest, TParams, TResponse> = (request: TRequest, params: TParams, response: TResponse, ctx: AIContextAny, metadata?: AIMetadataAny) => void | Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* Hook called when a request fails.
|
|
26
|
+
*/
|
|
27
|
+
export type ErrorHook<TRequest, TParams> = (request: TRequest, params: TParams, error: Error, ctx: AIContextAny, metadata?: AIMetadataAny) => void | Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Each operation's @aeye request, the parameters sent for it, and its @aeye response.
|
|
30
|
+
*/
|
|
31
|
+
export interface AnthropicOperations {
|
|
32
|
+
chat: {
|
|
33
|
+
request: Request;
|
|
34
|
+
params: MessageCreateParams;
|
|
35
|
+
response: Response;
|
|
36
|
+
};
|
|
37
|
+
countTokens: {
|
|
38
|
+
request: Request;
|
|
39
|
+
params: CountTokensParams;
|
|
40
|
+
response: number;
|
|
41
|
+
};
|
|
42
|
+
batch: {
|
|
43
|
+
request: Request[];
|
|
44
|
+
params: Anthropic.Messages.BatchCreateParams;
|
|
45
|
+
response: BatchJob;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Hooks around one operation.
|
|
50
|
+
*/
|
|
51
|
+
export interface OperationHooks<TOperation extends AnthropicOperations[keyof AnthropicOperations]> {
|
|
52
|
+
beforeRequest?: PreRequestHook<TOperation['request'], TOperation['params']>;
|
|
53
|
+
afterRequest?: PostRequestHook<TOperation['request'], TOperation['params'], TOperation['response']>;
|
|
54
|
+
onError?: ErrorHook<TOperation['request'], TOperation['params']>;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Hooks by operation. Image analysis runs as chat, so it reports through
|
|
58
|
+
* the chat hooks.
|
|
59
|
+
*/
|
|
60
|
+
export type AnthropicHooks = {
|
|
61
|
+
[K in keyof AnthropicOperations]?: OperationHooks<AnthropicOperations[K]>;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Configuration for the Anthropic provider.
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```typescript
|
|
68
|
+
* const anthropic = new AnthropicProvider({
|
|
69
|
+
* apiKey: process.env.ANTHROPIC_API_KEY!,
|
|
70
|
+
* cache: { automatic: true },
|
|
71
|
+
* retry: { maxRetries: 4 },
|
|
72
|
+
* });
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
export interface AnthropicConfig {
|
|
76
|
+
apiKey?: string;
|
|
77
|
+
authToken?: string;
|
|
78
|
+
baseURL?: string;
|
|
79
|
+
apiVersion?: AnthropicApiVersion;
|
|
80
|
+
betas?: string[];
|
|
81
|
+
defaultHeaders?: Record<string, string>;
|
|
82
|
+
workspaceId?: string;
|
|
83
|
+
inferenceGeo?: string;
|
|
84
|
+
fetch?: typeof fetch;
|
|
85
|
+
timeout?: number;
|
|
86
|
+
maxTokens?: number;
|
|
87
|
+
cache?: {
|
|
88
|
+
automatic?: boolean;
|
|
89
|
+
ttl?: '5m' | '1h';
|
|
90
|
+
};
|
|
91
|
+
maxContinuations?: number;
|
|
92
|
+
retry?: RetryConfig;
|
|
93
|
+
retryEvents?: RetryEvents;
|
|
94
|
+
hooks?: AnthropicHooks;
|
|
95
|
+
models?: ModelInfo[];
|
|
96
|
+
defaultModels?: {
|
|
97
|
+
chat?: ModelInput;
|
|
98
|
+
imageAnalyze?: ModelInput;
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Default model for each operation.
|
|
103
|
+
*/
|
|
104
|
+
export type DefaultModels = NonNullable<AnthropicConfig['defaultModels']>;
|
|
105
|
+
/**
|
|
106
|
+
* Everything one API call needs, resolved once from the request, context,
|
|
107
|
+
* and config.
|
|
108
|
+
*/
|
|
109
|
+
export interface OperationRun {
|
|
110
|
+
config: AnthropicConfig;
|
|
111
|
+
client: Anthropic;
|
|
112
|
+
ctx: AIContextAny;
|
|
113
|
+
metadata?: AIMetadataAny;
|
|
114
|
+
model: Model;
|
|
115
|
+
modelInfo?: ModelInfo;
|
|
116
|
+
traits: ClaudeModelTraits;
|
|
117
|
+
apiVersion: AnthropicApiVersion;
|
|
118
|
+
signal?: AbortSignal;
|
|
119
|
+
retry<R>(call: (signal?: AbortSignal) => Promise<R>): Promise<R>;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* The parameters of one Messages request, and what goes with them.
|
|
123
|
+
*/
|
|
124
|
+
export interface BuiltParams {
|
|
125
|
+
params: MessageCreateParams;
|
|
126
|
+
sent: Request;
|
|
127
|
+
betas: string[];
|
|
128
|
+
headers: Record<string, string>;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Anthropic provider for the @aeye framework: Claude through the Messages
|
|
132
|
+
* API.
|
|
133
|
+
*
|
|
134
|
+
* - Chat and streaming, with tool use (parallel calls, tool choice, strict
|
|
135
|
+
* tools), structured output, and image, PDF and text document input
|
|
136
|
+
* - Thinking: adaptive with effort, or a token budget on older models,
|
|
137
|
+
* returned as signed reasoning that is replayed on later turns
|
|
138
|
+
* - Prompt caching (`cacheBreakpoint`, or automatic), with cache reads and
|
|
139
|
+
* writes in usage and cost
|
|
140
|
+
* - Server tools: web search, web fetch, code execution, MCP servers
|
|
141
|
+
* - Message batches, token counting, the Files API, and the Models API
|
|
142
|
+
*
|
|
143
|
+
* Claude has no embeddings, image generation, speech or transcription, so
|
|
144
|
+
* the provider offers none of them.
|
|
145
|
+
*
|
|
146
|
+
* @example
|
|
147
|
+
* ```typescript
|
|
148
|
+
* import { AnthropicProvider } from '@aeye/anthropic';
|
|
149
|
+
*
|
|
150
|
+
* const anthropic = new AnthropicProvider({ apiKey: process.env.ANTHROPIC_API_KEY! });
|
|
151
|
+
* const response = await anthropic.createExecutor()(
|
|
152
|
+
* { messages: [{ role: 'user', content: 'Hello!' }] },
|
|
153
|
+
* {},
|
|
154
|
+
* { model: 'claude-haiku-5-5' },
|
|
155
|
+
* );
|
|
156
|
+
* ```
|
|
157
|
+
*/
|
|
158
|
+
export declare class AnthropicProvider implements Provider<AnthropicConfig> {
|
|
159
|
+
readonly name: string;
|
|
160
|
+
readonly config: AnthropicConfig;
|
|
161
|
+
defaultMetadata?: Provider['defaultMetadata'];
|
|
162
|
+
protected readonly defaults: DefaultModels;
|
|
163
|
+
constructor(config?: AnthropicConfig);
|
|
164
|
+
/**
|
|
165
|
+
* The SDK client for a config. Its own retries are off: `withRetry` does
|
|
166
|
+
* them, so retry events fire.
|
|
167
|
+
*/
|
|
168
|
+
protected createClient(config: AnthropicConfig): Anthropic;
|
|
169
|
+
/**
|
|
170
|
+
* Resolve what one API call needs: the effective config and its client,
|
|
171
|
+
* the model (request, then context, then metadata, then defaults), what
|
|
172
|
+
* the model takes, and retries.
|
|
173
|
+
*/
|
|
174
|
+
protected prepare(operation: string, request: BaseRequest, ctx: AIContextAny, metadata: AIMetadataAny | undefined, config: AnthropicConfig | undefined, signal: AbortSignal | undefined, defaultModel: keyof DefaultModels): OperationRun;
|
|
175
|
+
/**
|
|
176
|
+
* The model a call's schemas are planned for: its `ModelInfo`, or its id
|
|
177
|
+
* alone (then planned with {@link ANTHROPIC_SCHEMA_DEFAULTS} and no strict
|
|
178
|
+
* capabilities, so nothing is sent strict that isn't known to be taken).
|
|
179
|
+
*/
|
|
180
|
+
protected schemaModel(run: OperationRun): ModelLike;
|
|
181
|
+
/**
|
|
182
|
+
* The schema families this provider sends on the wire.
|
|
183
|
+
*/
|
|
184
|
+
protected supportedStrictFamilies: ReadonlySet<string>;
|
|
185
|
+
/**
|
|
186
|
+
* How a request's schemas are planned: the families the provider speaks,
|
|
187
|
+
* and the rules of a model whose `ModelInfo` has no `schema`.
|
|
188
|
+
*/
|
|
189
|
+
protected planOptions(): {
|
|
190
|
+
speaks: ReadonlySet<string>;
|
|
191
|
+
defaults: import("@aeye/schema").ModelSchema;
|
|
192
|
+
};
|
|
193
|
+
/**
|
|
194
|
+
* A Models API entry as `ModelInfo`, from what the API reports alone:
|
|
195
|
+
* limits, effort levels, thinking modes (`always` when thinking can't be
|
|
196
|
+
* turned off, `budget` without adaptive thinking, `adaptive` otherwise,
|
|
197
|
+
* which only thinks when asked), input types and strict-schema support.
|
|
198
|
+
* Everything the API doesn't report (prices, sampling, forced tool choice,
|
|
199
|
+
* mid-conversation system messages, prefill, fast mode, measured schema
|
|
200
|
+
* limits) is left to the model's data: the AI registry merges
|
|
201
|
+
* `@aeye/models` over these entries, and `config.models` entries are used
|
|
202
|
+
* as they are.
|
|
203
|
+
*/
|
|
204
|
+
protected convertModel(model: Anthropic.Models.ModelInfo, apiVersion: AnthropicApiVersion): ModelInfo;
|
|
205
|
+
/**
|
|
206
|
+
* List the models the account can use (the Models API), from what the API
|
|
207
|
+
* reports (see `convertModel`) and `config.models`.
|
|
208
|
+
*/
|
|
209
|
+
listModels(config?: AnthropicConfig): Promise<ModelInfo[]>;
|
|
210
|
+
/**
|
|
211
|
+
* Whether the API answers with these credentials.
|
|
212
|
+
*/
|
|
213
|
+
checkHealth(config?: AnthropicConfig): Promise<boolean>;
|
|
214
|
+
/**
|
|
215
|
+
* A request without the optional settings the model's data says it
|
|
216
|
+
* doesn't take (`supportedRequest` over its `supportedParameters`, with
|
|
217
|
+
* `temperature` and `top_p` on API version 2023-06-01 for a model whose
|
|
218
|
+
* `sampling` option says so). A model with no `supportedParameters` keeps
|
|
219
|
+
* them; the options decide the rest.
|
|
220
|
+
*/
|
|
221
|
+
protected supported(request: Request, run: OperationRun): Request;
|
|
222
|
+
/**
|
|
223
|
+
* The Messages parameters for a request (prepared by `prepareRequest`):
|
|
224
|
+
*
|
|
225
|
+
* - only the allowed tools, and forced tool use as the model takes it;
|
|
226
|
+
* - structured output when the plan rendered the schema strict, otherwise
|
|
227
|
+
* the schema in the prompt; JSON without a schema as an instruction;
|
|
228
|
+
* - thinking and effort for the model (`toThinking`), sampling only where
|
|
229
|
+
* the model and API version take it, and never `temperature` (or a
|
|
230
|
+
* `top_p` under 0.95) with thinking on;
|
|
231
|
+
* - cache breakpoints, at most four, automatic caching, service tier and
|
|
232
|
+
* fast mode, `metadata.user_id` from `userKey`;
|
|
233
|
+
* - `request.extra` on top (but `retry`, `retryEvents`, `betas` and
|
|
234
|
+
* `headers`, which configure the call).
|
|
235
|
+
*
|
|
236
|
+
* @param streaming - Whether the response streams, which sets the default `max_tokens`.
|
|
237
|
+
*/
|
|
238
|
+
protected buildParams(planned: Request, run: OperationRun, streaming: boolean): Promise<BuiltParams>;
|
|
239
|
+
/**
|
|
240
|
+
* An API error as the provider reports it: a context-window overflow, a
|
|
241
|
+
* rejected schema, bad credentials, a reached spend limit, or a rate limit
|
|
242
|
+
* that outlasted the retries. Other errors pass through unchanged.
|
|
243
|
+
*/
|
|
244
|
+
protected mapError(error: unknown, request?: Request): unknown;
|
|
245
|
+
/**
|
|
246
|
+
* Send one call with retries, around the operation's before and error hooks.
|
|
247
|
+
*/
|
|
248
|
+
protected send<K extends keyof AnthropicOperations, R>(op: K, run: OperationRun, request: AnthropicOperations[K]['request'], params: AnthropicOperations[K]['params'], call: (signal?: AbortSignal) => Promise<R>): Promise<R>;
|
|
249
|
+
/**
|
|
250
|
+
* Report a response to the operation's after hook and return it.
|
|
251
|
+
*/
|
|
252
|
+
protected finish<K extends keyof AnthropicOperations>(op: K, run: OperationRun, request: AnthropicOperations[K]['request'], params: AnthropicOperations[K]['params'], response: AnthropicOperations[K]['response']): Promise<AnthropicOperations[K]['response']>;
|
|
253
|
+
/**
|
|
254
|
+
* Chunks of a complete message, its usage priced.
|
|
255
|
+
*/
|
|
256
|
+
private priced;
|
|
257
|
+
/**
|
|
258
|
+
* Run a chat request without streaming. A turn the API pauses (long
|
|
259
|
+
* server tool use) is continued with what it produced so far, up to
|
|
260
|
+
* `maxContinuations` times. A request too long for a plain call streams
|
|
261
|
+
* underneath. A prompt that overflows the context window ends as `length`,
|
|
262
|
+
* so the prompt loop can trim and retry.
|
|
263
|
+
*/
|
|
264
|
+
private complete;
|
|
265
|
+
/**
|
|
266
|
+
* A stream's response.
|
|
267
|
+
*/
|
|
268
|
+
private drain;
|
|
269
|
+
/**
|
|
270
|
+
* Stream a built request, continuing paused turns, reporting the
|
|
271
|
+
* assembled response to the after hook (even when the stream fails part
|
|
272
|
+
* way) and returning it.
|
|
273
|
+
*/
|
|
274
|
+
private streamBuilt;
|
|
275
|
+
/**
|
|
276
|
+
* Plan a request's schemas for the model and resolve the call.
|
|
277
|
+
*/
|
|
278
|
+
private start;
|
|
279
|
+
/**
|
|
280
|
+
* Create an executor for chat requests.
|
|
281
|
+
*/
|
|
282
|
+
createExecutor(config?: AnthropicConfig): Executor<AIContextAny, AIMetadataAny>;
|
|
283
|
+
/**
|
|
284
|
+
* Create a streamer for chat requests.
|
|
285
|
+
*/
|
|
286
|
+
createStreamer(config?: AnthropicConfig): Streamer<AIContextAny, AIMetadataAny>;
|
|
287
|
+
/**
|
|
288
|
+
* Count the input tokens a chat request would take on a model, as the API
|
|
289
|
+
* counts them (system prompt, tools, images and documents included),
|
|
290
|
+
* without running it. Free, and rate limited apart from requests.
|
|
291
|
+
*
|
|
292
|
+
* @param request - The chat request.
|
|
293
|
+
* @param ctx - Context; its `metadata.model` names the model when the request doesn't.
|
|
294
|
+
* @param config - Per-call config override.
|
|
295
|
+
* @returns The input tokens.
|
|
296
|
+
*/
|
|
297
|
+
countTokens(request: Request, ctx?: AIContextAny, config?: AnthropicConfig): Promise<number>;
|
|
298
|
+
/**
|
|
299
|
+
* Upload a file to the Files API. Its id (`file_...`) can then stand in
|
|
300
|
+
* for the file as image or file content in any later request, without
|
|
301
|
+
* sending the bytes again.
|
|
302
|
+
*
|
|
303
|
+
* @param file - The file's content.
|
|
304
|
+
* @param options - Its name and type, when the content doesn't carry them.
|
|
305
|
+
*/
|
|
306
|
+
uploadFile(file: Resource, options?: {
|
|
307
|
+
name?: string;
|
|
308
|
+
mimeType?: string;
|
|
309
|
+
config?: AnthropicConfig;
|
|
310
|
+
}): Promise<Anthropic.Files.FileMetadata>;
|
|
311
|
+
/**
|
|
312
|
+
* The files uploaded to the Files API.
|
|
313
|
+
*/
|
|
314
|
+
listFiles(config?: AnthropicConfig): Promise<Anthropic.Files.FileMetadata[]>;
|
|
315
|
+
/**
|
|
316
|
+
* Delete an uploaded file.
|
|
317
|
+
*/
|
|
318
|
+
deleteFile(id: string, config?: AnthropicConfig): Promise<void>;
|
|
319
|
+
/**
|
|
320
|
+
* Run chat requests as one Message Batch, at half price, on one model.
|
|
321
|
+
* Each request becomes the call a direct request would make.
|
|
322
|
+
*
|
|
323
|
+
* @param requests - Chat requests, whose results come back in this order.
|
|
324
|
+
*/
|
|
325
|
+
submitBatch: Provider['submitBatch'];
|
|
326
|
+
/**
|
|
327
|
+
* A batch as it stands now, with its results once it has ended.
|
|
328
|
+
*/
|
|
329
|
+
getBatch: Provider['getBatch'];
|
|
330
|
+
/**
|
|
331
|
+
* A batch as @aeye reports it.
|
|
332
|
+
*/
|
|
333
|
+
private batchJob;
|
|
334
|
+
/**
|
|
335
|
+
* An image analysis request as a chat request, and the metadata naming
|
|
336
|
+
* the configured analysis model as the fallback.
|
|
337
|
+
*/
|
|
338
|
+
private analysisChat;
|
|
339
|
+
/**
|
|
340
|
+
* Analyze images with a vision model, as a chat request.
|
|
341
|
+
*/
|
|
342
|
+
analyzeImage: Provider['analyzeImage'];
|
|
343
|
+
/**
|
|
344
|
+
* Analyze images with a vision model, streaming the answer.
|
|
345
|
+
*/
|
|
346
|
+
analyzeImageStream: Provider['analyzeImageStream'];
|
|
347
|
+
}
|
|
348
|
+
export {};
|
|
349
|
+
//# sourceMappingURL=anthropic.d.ts.map
|
|
@@ -0,0 +1 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