@agentskit/adapters 0.5.1 → 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 +47 -4
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@ Connect to any LLM provider — and swap between them — without touching your
|
|
|
7
7
|
[](https://bundlephobia.com/package/@agentskit/adapters)
|
|
8
8
|
[](../../LICENSE)
|
|
9
9
|
[](../../docs/STABILITY.md)
|
|
10
|
-
[](https://github.com/AgentsKit-io/agentskit)
|
|
11
11
|
|
|
12
12
|
**Tags:** `ai` · `agents` · `llm` · `agentskit` · `openai` · `anthropic` · `claude` · `gemini` · `chatgpt` · `ollama` · `embeddings` · `providers`
|
|
13
13
|
|
|
@@ -71,10 +71,53 @@ const rag = createRAG({
|
|
|
71
71
|
| [@agentskit/rag](https://www.npmjs.com/package/@agentskit/rag) | `createRAG` + embedders |
|
|
72
72
|
| [@agentskit/memory](https://www.npmjs.com/package/@agentskit/memory) | Vector + chat memory backends |
|
|
73
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
|
+
|
|
74
117
|
## Contributors
|
|
75
118
|
|
|
76
|
-
<a href="https://github.com/
|
|
77
|
-
<img src="https://contrib.rocks/image?repo=
|
|
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" />
|
|
78
121
|
</a>
|
|
79
122
|
|
|
80
123
|
## License
|
|
@@ -83,4 +126,4 @@ MIT — see [LICENSE](../../LICENSE).
|
|
|
83
126
|
|
|
84
127
|
## Docs
|
|
85
128
|
|
|
86
|
-
[Full documentation](https://www.agentskit.io) · [GitHub](https://github.com/
|
|
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",
|
|
@@ -39,11 +39,11 @@
|
|
|
39
39
|
"dist"
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@agentskit/core": "1.0
|
|
42
|
+
"@agentskit/core": "1.1.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@types/node": "^25.6.0",
|
|
46
|
-
"msw": "^2.13.
|
|
46
|
+
"msw": "^2.13.4",
|
|
47
47
|
"tsup": "^8.5.0",
|
|
48
48
|
"typescript": "^6.0.2",
|
|
49
49
|
"vitest": "^4.1.4"
|