@agentskit/adapters 0.5.0 → 0.5.2
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 +70 -6
- package/package.json +14 -4
package/README.md
CHANGED
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
# @agentskit/adapters
|
|
2
2
|
|
|
3
|
-

|
|
4
|
-
|
|
5
3
|
Connect to any LLM provider — and swap between them — without touching your app code.
|
|
6
4
|
|
|
7
|
-
|
|
5
|
+
[](https://www.npmjs.com/package/@agentskit/adapters)
|
|
6
|
+
[](https://www.npmjs.com/package/@agentskit/adapters)
|
|
7
|
+
[](https://bundlephobia.com/package/@agentskit/adapters)
|
|
8
|
+
[](../../LICENSE)
|
|
9
|
+
[](../../docs/STABILITY.md)
|
|
10
|
+
[](https://github.com/AgentsKit-io/agentskit)
|
|
11
|
+
|
|
12
|
+
**Tags:** `ai` · `agents` · `llm` · `agentskit` · `openai` · `anthropic` · `claude` · `gemini` · `chatgpt` · `ollama` · `embeddings` · `providers`
|
|
13
|
+
|
|
14
|
+
## Why adapters
|
|
8
15
|
|
|
9
16
|
- **Vendor independence** — switch from OpenAI to Anthropic to a local Ollama model by changing one line; your hooks, runtime, and tools stay untouched
|
|
10
17
|
- **10+ providers included** — Anthropic, OpenAI, Gemini, Ollama, DeepSeek, Grok, Kimi, LangChain, Vercel AI SDK, and any raw `ReadableStream`
|
|
11
18
|
- **Embedder functions built in** — the same adapter pattern covers text embeddings, so you can reuse provider config for both chat and RAG
|
|
19
|
+
- **One-line local AI** — `ollama({ model: 'llama3.1' })` for fully offline agents with no API key required
|
|
12
20
|
|
|
13
21
|
## Install
|
|
14
22
|
|
|
@@ -47,9 +55,12 @@ const rag = createRAG({
|
|
|
47
55
|
})
|
|
48
56
|
```
|
|
49
57
|
|
|
50
|
-
##
|
|
58
|
+
## Features
|
|
51
59
|
|
|
52
|
-
-
|
|
60
|
+
- Providers: Anthropic, OpenAI, Gemini, Ollama, DeepSeek, Grok, Kimi, LangChain, LangGraph, Vercel AI SDK, generic `ReadableStream`
|
|
61
|
+
- Embedders: `openaiEmbedder`, `geminiEmbedder`, `ollamaEmbedder`
|
|
62
|
+
- All adapters satisfy `Adapter` contract v1 (ADR 0001) — substitutable anywhere in the ecosystem
|
|
63
|
+
- Custom adapter authoring via `createAdapter()`
|
|
53
64
|
|
|
54
65
|
## Ecosystem
|
|
55
66
|
|
|
@@ -60,6 +71,59 @@ const rag = createRAG({
|
|
|
60
71
|
| [@agentskit/rag](https://www.npmjs.com/package/@agentskit/rag) | `createRAG` + embedders |
|
|
61
72
|
| [@agentskit/memory](https://www.npmjs.com/package/@agentskit/memory) | Vector + chat memory backends |
|
|
62
73
|
|
|
74
|
+
## Testing Adapters
|
|
75
|
+
|
|
76
|
+
Three built-in utilities let you test agents without hitting a real LLM.
|
|
77
|
+
|
|
78
|
+
### `mockAdapter` — deterministic responses
|
|
79
|
+
|
|
80
|
+
```ts
|
|
81
|
+
import { mockAdapter } from '@agentskit/adapters'
|
|
82
|
+
|
|
83
|
+
const adapter = mockAdapter({
|
|
84
|
+
response: [
|
|
85
|
+
{ type: 'text', content: 'Hello!' },
|
|
86
|
+
{ type: 'done' },
|
|
87
|
+
],
|
|
88
|
+
})
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Pass a function to make responses request-aware, or pass an array of arrays to return different chunks on each call (sequenced mode). Use the optional `history` array to capture every request for assertions.
|
|
92
|
+
|
|
93
|
+
### `recordingAdapter` + `inMemorySink` — capture real calls
|
|
94
|
+
|
|
95
|
+
```ts
|
|
96
|
+
import { recordingAdapter, inMemorySink, anthropic } from '@agentskit/adapters'
|
|
97
|
+
|
|
98
|
+
const sink = inMemorySink()
|
|
99
|
+
const adapter = recordingAdapter(
|
|
100
|
+
anthropic({ apiKey: process.env.ANTHROPIC_API_KEY!, model: 'claude-sonnet-4-6' }),
|
|
101
|
+
sink,
|
|
102
|
+
)
|
|
103
|
+
// Runs the real LLM and captures every chunk to sink.fixture
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### `replayAdapter` — replay captured fixtures
|
|
107
|
+
|
|
108
|
+
```ts
|
|
109
|
+
import { replayAdapter } from '@agentskit/adapters'
|
|
110
|
+
import fixture from './fixture.json'
|
|
111
|
+
|
|
112
|
+
const adapter = replayAdapter(fixture) // no network calls
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Typical workflow: record once in dev → commit JSON fixture → replay in CI.
|
|
116
|
+
|
|
117
|
+
## Contributors
|
|
118
|
+
|
|
119
|
+
<a href="https://github.com/AgentsKit-io/agentskit/graphs/contributors">
|
|
120
|
+
<img src="https://contrib.rocks/image?repo=AgentsKit-io/agentskit" alt="AgentsKit contributors" />
|
|
121
|
+
</a>
|
|
122
|
+
|
|
123
|
+
## License
|
|
124
|
+
|
|
125
|
+
MIT — see [LICENSE](../../LICENSE).
|
|
126
|
+
|
|
63
127
|
## Docs
|
|
64
128
|
|
|
65
|
-
[Full documentation](https://
|
|
129
|
+
[Full documentation](https://www.agentskit.io) · [GitHub](https://github.com/AgentsKit-io/agentskit)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentskit/adapters",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"description": "Provider adapters for AgentsKit.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agentskit",
|
|
@@ -11,8 +11,18 @@
|
|
|
11
11
|
"typescript",
|
|
12
12
|
"openai",
|
|
13
13
|
"anthropic",
|
|
14
|
+
"claude",
|
|
15
|
+
"gemini",
|
|
16
|
+
"chatgpt",
|
|
14
17
|
"embeddings",
|
|
15
|
-
"providers"
|
|
18
|
+
"providers",
|
|
19
|
+
"ai-agents",
|
|
20
|
+
"ollama",
|
|
21
|
+
"deepseek",
|
|
22
|
+
"grok",
|
|
23
|
+
"langchain",
|
|
24
|
+
"vercel-ai-sdk",
|
|
25
|
+
"provider-adapter"
|
|
16
26
|
],
|
|
17
27
|
"type": "module",
|
|
18
28
|
"main": "./dist/index.cjs",
|
|
@@ -29,11 +39,11 @@
|
|
|
29
39
|
"dist"
|
|
30
40
|
],
|
|
31
41
|
"dependencies": {
|
|
32
|
-
"@agentskit/core": "1.
|
|
42
|
+
"@agentskit/core": "1.1.0"
|
|
33
43
|
},
|
|
34
44
|
"devDependencies": {
|
|
35
45
|
"@types/node": "^25.6.0",
|
|
36
|
-
"msw": "^2.13.
|
|
46
|
+
"msw": "^2.13.4",
|
|
37
47
|
"tsup": "^8.5.0",
|
|
38
48
|
"typescript": "^6.0.2",
|
|
39
49
|
"vitest": "^4.1.4"
|