@continum/sdk 0.0.4 → 0.0.6
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 +66 -2
- package/dist/drivers/anthropic.driver.js +10 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
> Governed Execution Framework for LLM Applications
|
|
4
4
|
|
|
5
|
+
**Current Version**: 0.0.5
|
|
6
|
+
|
|
7
|
+
**Latest Changes**:
|
|
8
|
+
- Fixed `max_tokens` validation for Anthropic thinking models
|
|
9
|
+
- Default `max_tokens` increased to 16000 for thinking models (Opus, Sonnet 4)
|
|
10
|
+
- Better error messages when `max_tokens` is too low for thinking budget
|
|
11
|
+
|
|
5
12
|
## Quick Start
|
|
6
13
|
|
|
7
14
|
### Installation
|
|
@@ -24,20 +31,77 @@ import { Continum } from '@continum/sdk';
|
|
|
24
31
|
const continum = new Continum({
|
|
25
32
|
continumKey: process.env.CONTINUM_KEY!,
|
|
26
33
|
apiKeys: {
|
|
27
|
-
openai: process.env.OPENAI_API_KEY
|
|
34
|
+
openai: process.env.OPENAI_API_KEY,
|
|
35
|
+
anthropic: process.env.ANTHROPIC_API_KEY,
|
|
36
|
+
gemini: process.env.GEMINI_API_KEY
|
|
28
37
|
},
|
|
29
38
|
defaultSandbox: 'pii_protection'
|
|
30
39
|
});
|
|
31
40
|
|
|
32
|
-
//
|
|
41
|
+
// OpenAI - use snake_case model names
|
|
33
42
|
const response = await continum.llm.openai.gpt_4o.chat({
|
|
34
43
|
messages: [{ role: 'user', content: 'Hello world' }]
|
|
35
44
|
});
|
|
45
|
+
|
|
46
|
+
// Anthropic - use model family names (opus, sonnet, haiku)
|
|
47
|
+
const response2 = await continum.llm.anthropic.opus_4_6.chat({
|
|
48
|
+
messages: [{ role: 'user', content: 'Review this code' }]
|
|
49
|
+
});
|
|
50
|
+
// Also supports: sonnet_4_6, sonnet_4, haiku_4_5, haiku_3_5, sonnet_3_7
|
|
51
|
+
// Legacy format also works: claude_3_5_sonnet
|
|
52
|
+
|
|
53
|
+
// Gemini - use snake_case with underscores
|
|
54
|
+
const response3 = await continum.llm.gemini.gemini_2_5_pro.chat({
|
|
55
|
+
messages: [{ role: 'user', content: 'Summarize this' }]
|
|
56
|
+
});
|
|
57
|
+
|
|
36
58
|
// ✅ Guardian checks for PII (pre-execution)
|
|
37
59
|
// ✅ User gets response instantly
|
|
38
60
|
// ✅ Shadow Audit runs in background (post-execution)
|
|
39
61
|
```
|
|
40
62
|
|
|
63
|
+
## Model Name Format
|
|
64
|
+
|
|
65
|
+
The SDK uses snake_case model names that get automatically transformed to the correct API format:
|
|
66
|
+
|
|
67
|
+
### Anthropic Models
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
// Recommended format - use model family names
|
|
71
|
+
continum.llm.anthropic.opus_4_6.chat() // → claude-opus-4-6
|
|
72
|
+
continum.llm.anthropic.sonnet_4_6.chat() // → claude-sonnet-4-6
|
|
73
|
+
continum.llm.anthropic.sonnet_4.chat() // → claude-sonnet-4-5
|
|
74
|
+
continum.llm.anthropic.haiku_4_5.chat() // → claude-haiku-4-5-20251001
|
|
75
|
+
continum.llm.anthropic.haiku_3_5.chat() // → claude-haiku-3-5-20241022
|
|
76
|
+
continum.llm.anthropic.sonnet_3_7.chat() // → claude-sonnet-3-7-20250219
|
|
77
|
+
|
|
78
|
+
// Legacy format also supported (v0.0.4+)
|
|
79
|
+
continum.llm.anthropic.claude_3_5_sonnet.chat() // → claude-3-5-sonnet-20241022
|
|
80
|
+
|
|
81
|
+
// Alias: claude and anthropic are interchangeable
|
|
82
|
+
continum.llm.claude.opus_4_6.chat() // Same as anthropic.opus_4_6
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### OpenAI Models
|
|
86
|
+
|
|
87
|
+
```typescript
|
|
88
|
+
continum.llm.openai.gpt_5.chat() // → gpt-5
|
|
89
|
+
continum.llm.openai.gpt_4o.chat() // → gpt-4o
|
|
90
|
+
continum.llm.openai.gpt_4_turbo.chat() // → gpt-4-turbo
|
|
91
|
+
continum.llm.openai.o3.chat() // → o3
|
|
92
|
+
continum.llm.openai.o3_mini.chat() // → o3-mini
|
|
93
|
+
continum.llm.openai.o1.chat() // → o1
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Gemini Models
|
|
97
|
+
|
|
98
|
+
```typescript
|
|
99
|
+
continum.llm.gemini.gemini_2_5_pro.chat() // → gemini-2.5-pro
|
|
100
|
+
continum.llm.gemini.gemini_2_5_flash.chat() // → gemini-2.5-flash
|
|
101
|
+
continum.llm.gemini.gemini_2_0_flash.chat() // → gemini-2.0-flash
|
|
102
|
+
continum.llm.gemini.gemini_1_5_pro.chat() // → gemini-1.5-pro
|
|
103
|
+
```
|
|
104
|
+
|
|
41
105
|
## Architecture
|
|
42
106
|
|
|
43
107
|
### Two-Tier Protection System
|
|
@@ -7,9 +7,17 @@ class AnthropicDriver {
|
|
|
7
7
|
}
|
|
8
8
|
async call(model, params) {
|
|
9
9
|
const isThinkingModel = model.includes('opus') || model.includes('sonnet-4') || model.includes('claude-4');
|
|
10
|
+
const thinkingBudget = 8000;
|
|
11
|
+
const defaultMaxTokens = isThinkingModel ? 16000 : 4096;
|
|
12
|
+
const maxTokens = params.maxTokens ?? defaultMaxTokens;
|
|
13
|
+
// Ensure max_tokens is greater than thinking budget
|
|
14
|
+
if (isThinkingModel && maxTokens <= thinkingBudget) {
|
|
15
|
+
throw new Error(`max_tokens (${maxTokens}) must be greater than thinking.budget_tokens (${thinkingBudget}). ` +
|
|
16
|
+
`Please set maxTokens to at least ${thinkingBudget + 1} or use the default.`);
|
|
17
|
+
}
|
|
10
18
|
const body = {
|
|
11
19
|
model,
|
|
12
|
-
max_tokens:
|
|
20
|
+
max_tokens: maxTokens,
|
|
13
21
|
messages: params.messages.map(m => ({ role: m.role, content: m.content })),
|
|
14
22
|
};
|
|
15
23
|
if (params.systemPrompt) {
|
|
@@ -17,7 +25,7 @@ class AnthropicDriver {
|
|
|
17
25
|
}
|
|
18
26
|
// Enable extended thinking for capable models
|
|
19
27
|
if (isThinkingModel) {
|
|
20
|
-
body.thinking = { type: 'enabled', budget_tokens:
|
|
28
|
+
body.thinking = { type: 'enabled', budget_tokens: thinkingBudget };
|
|
21
29
|
}
|
|
22
30
|
else {
|
|
23
31
|
body.temperature = params.temperature ?? 0.7;
|