@amux.ai/adapter-anthropic 0.1.1 → 0.1.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 +95 -0
- package/package.json +8 -3
package/README.md
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# @amux.ai/adapter-anthropic
|
|
2
|
+
|
|
3
|
+
> Anthropic (Claude) adapter for Amux
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@amux.ai/adapter-anthropic)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Official Anthropic adapter for Amux, providing bidirectional conversion between Anthropic API format and Amux IR (Intermediate Representation).
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
pnpm add @amux.ai/llm-bridge @amux.ai/adapter-anthropic
|
|
16
|
+
# or
|
|
17
|
+
npm install @amux.ai/llm-bridge @amux.ai/adapter-anthropic
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
### As Inbound Adapter (Parse Anthropic format)
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
import { createBridge } from '@amux.ai/llm-bridge'
|
|
26
|
+
import { anthropicAdapter } from '@amux.ai/adapter-anthropic'
|
|
27
|
+
import { openaiAdapter } from '@amux.ai/adapter-openai'
|
|
28
|
+
|
|
29
|
+
const bridge = createBridge({
|
|
30
|
+
inbound: anthropicAdapter,
|
|
31
|
+
outbound: openaiAdapter,
|
|
32
|
+
config: {
|
|
33
|
+
apiKey: process.env.OPENAI_API_KEY
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
// Send Anthropic format, receive Anthropic format
|
|
38
|
+
const response = await bridge.chat({
|
|
39
|
+
model: 'claude-3-5-sonnet-20241022',
|
|
40
|
+
messages: [{ role: 'user', content: 'Hello!' }]
|
|
41
|
+
})
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### As Outbound Adapter (Call Anthropic API)
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
import { createBridge } from '@amux.ai/llm-bridge'
|
|
48
|
+
import { openaiAdapter } from '@amux.ai/adapter-openai'
|
|
49
|
+
import { anthropicAdapter } from '@amux.ai/adapter-anthropic'
|
|
50
|
+
|
|
51
|
+
const bridge = createBridge({
|
|
52
|
+
inbound: openaiAdapter,
|
|
53
|
+
outbound: anthropicAdapter,
|
|
54
|
+
config: {
|
|
55
|
+
apiKey: process.env.ANTHROPIC_API_KEY
|
|
56
|
+
}
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
// Send OpenAI format, receive OpenAI format
|
|
60
|
+
const response = await bridge.chat({
|
|
61
|
+
model: 'gpt-4',
|
|
62
|
+
messages: [{ role: 'user', content: 'Hello!' }]
|
|
63
|
+
})
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Supported Features
|
|
67
|
+
|
|
68
|
+
- ✅ Messages API
|
|
69
|
+
- ✅ Streaming
|
|
70
|
+
- ✅ Tool calling
|
|
71
|
+
- ✅ Vision (image inputs)
|
|
72
|
+
- ✅ System prompts
|
|
73
|
+
- ✅ Thinking/Reasoning (extended thinking)
|
|
74
|
+
|
|
75
|
+
## Supported Models
|
|
76
|
+
|
|
77
|
+
- `claude-3-5-sonnet-20241022`
|
|
78
|
+
- `claude-3-5-haiku-20241022`
|
|
79
|
+
- `claude-3-opus-20240229`
|
|
80
|
+
- `claude-3-sonnet-20240229`
|
|
81
|
+
- `claude-3-haiku-20240307`
|
|
82
|
+
|
|
83
|
+
## API Compatibility
|
|
84
|
+
|
|
85
|
+
This adapter supports the Anthropic Messages API format. For detailed API documentation, see [Anthropic API Reference](https://docs.anthropic.com/en/api/messages).
|
|
86
|
+
|
|
87
|
+
## License
|
|
88
|
+
|
|
89
|
+
MIT © [isboyjc](https://github.com/isboyjc)
|
|
90
|
+
|
|
91
|
+
## Links
|
|
92
|
+
|
|
93
|
+
- [Documentation](https://github.com/isboyjc/amux#readme)
|
|
94
|
+
- [GitHub Repository](https://github.com/isboyjc/amux)
|
|
95
|
+
- [Issue Tracker](https://github.com/isboyjc/amux/issues)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amux.ai/adapter-anthropic",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Anthropic adapter for Amux",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"amux",
|
|
@@ -14,6 +14,10 @@
|
|
|
14
14
|
"url": "https://github.com/isboyjc/amux.git",
|
|
15
15
|
"directory": "packages/adapter-anthropic"
|
|
16
16
|
},
|
|
17
|
+
"homepage": "https://github.com/isboyjc/amux#readme",
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/isboyjc/amux/issues"
|
|
20
|
+
},
|
|
17
21
|
"license": "MIT",
|
|
18
22
|
"author": "isboyjc",
|
|
19
23
|
"type": "module",
|
|
@@ -28,10 +32,11 @@
|
|
|
28
32
|
"module": "./dist/index.js",
|
|
29
33
|
"types": "./dist/index.d.ts",
|
|
30
34
|
"files": [
|
|
31
|
-
"dist"
|
|
35
|
+
"dist",
|
|
36
|
+
"README.md"
|
|
32
37
|
],
|
|
33
38
|
"dependencies": {
|
|
34
|
-
"@amux.ai/llm-bridge": "0.
|
|
39
|
+
"@amux.ai/llm-bridge": "0.3.1"
|
|
35
40
|
},
|
|
36
41
|
"devDependencies": {
|
|
37
42
|
"@types/node": "^20.11.5",
|