@simulacra-ai/anthropic 0.0.2 → 0.0.3
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 +9 -6
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Simulacra Anthropic Provider
|
|
2
2
|
|
|
3
|
-
Anthropic Claude
|
|
3
|
+
The Anthropic provider allows Simulacra to use Claude models via the Anthropic API, with support for extended thinking and prompt caching.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -15,8 +15,9 @@ import { Conversation } from "@simulacra-ai/core";
|
|
|
15
15
|
import { AnthropicProvider } from "@simulacra-ai/anthropic";
|
|
16
16
|
import Anthropic from "@anthropic-ai/sdk";
|
|
17
17
|
|
|
18
|
+
// create a provider and conversation
|
|
18
19
|
const provider = new AnthropicProvider(new Anthropic(), { model: MODEL_NAME });
|
|
19
|
-
|
|
20
|
+
using conversation = new Conversation(provider);
|
|
20
21
|
```
|
|
21
22
|
|
|
22
23
|
### AnthropicProviderConfig
|
|
@@ -32,9 +33,11 @@ interface AnthropicProviderConfig {
|
|
|
32
33
|
|
|
33
34
|
Additional properties (`temperature`, `top_p`, etc.) spread into the API request.
|
|
34
35
|
|
|
36
|
+
If `max_tokens` is not set, it defaults to 8192.
|
|
37
|
+
|
|
35
38
|
## Extended Thinking
|
|
36
39
|
|
|
37
|
-
|
|
40
|
+
Extended thinking captures the model's chain-of-thought reasoning as `ThinkingMessageContent` blocks in the conversation history. This makes the model's reasoning process visible and accessible alongside its regular output.
|
|
38
41
|
|
|
39
42
|
```typescript
|
|
40
43
|
const provider = new AnthropicProvider(new Anthropic(), {
|
|
@@ -44,11 +47,11 @@ const provider = new AnthropicProvider(new Anthropic(), {
|
|
|
44
47
|
});
|
|
45
48
|
```
|
|
46
49
|
|
|
47
|
-
Both `thinking` and `redacted_thinking` blocks from the API are converted to Simulacra's `ThinkingMessageContent` type.
|
|
50
|
+
Both `thinking` and `redacted_thinking` blocks from the API are converted to Simulacra's `ThinkingMessageContent` type.
|
|
48
51
|
|
|
49
52
|
## Prompt Caching
|
|
50
53
|
|
|
51
|
-
Prompt caching is enabled by default. The provider adds `cache_control` markers to the system prompt and tool definitions, avoiding re-processing static content on every turn.
|
|
54
|
+
Prompt caching is enabled by default. The provider adds `cache_control` markers to the system prompt and tool definitions, avoiding re-processing static content on every turn. Multi-turn conversations benefit because subsequent turns read from the cache at a reduced rate.
|
|
52
55
|
|
|
53
56
|
```typescript
|
|
54
57
|
const provider = new AnthropicProvider(new Anthropic(), {
|
|
@@ -61,7 +64,7 @@ const provider = new AnthropicProvider(new Anthropic(), {
|
|
|
61
64
|
});
|
|
62
65
|
```
|
|
63
66
|
|
|
64
|
-
Cache writes cost slightly more per token than standard requests.
|
|
67
|
+
Cache writes cost slightly more per token than standard requests. Caching can be disabled by setting both flags to `false`.
|
|
65
68
|
|
|
66
69
|
## License
|
|
67
70
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simulacra-ai/anthropic",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "Anthropic Claude provider for the Simulacra conversation engine",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"clean": "rm -rf dist *.tsbuildinfo"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
|
-
"@simulacra-ai/core": "0.0.
|
|
20
|
+
"@simulacra-ai/core": "0.0.3",
|
|
21
21
|
"@anthropic-ai/sdk": ">=0.30.0 <1.0.0"
|
|
22
22
|
},
|
|
23
23
|
"repository": {
|