@agentskit/adapters 0.7.1 → 0.10.0

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 CHANGED
@@ -4,8 +4,8 @@ Connect to any LLM provider — and swap between them — without touching your
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/@agentskit/adapters?color=blue)](https://www.npmjs.com/package/@agentskit/adapters)
6
6
  [![npm downloads](https://img.shields.io/npm/dm/@agentskit/adapters)](https://www.npmjs.com/package/@agentskit/adapters)
7
- [![bundle size](https://img.shields.io/bundlephobia/minzip/@agentskit/adapters)](https://bundlephobia.com/package/@agentskit/adapters)
8
- [![license](https://img.shields.io/npm/l/@agentskit/adapters)](../../LICENSE)
7
+ [![bundle size](https://img.shields.io/bundlejs/size/@agentskit/adapters?label=bundle)](https://bundlejs.com/?q=@agentskit/adapters)
8
+ [![license](https://img.shields.io/badge/license-MIT-blue.svg)](../../LICENSE)
9
9
  [![stability](https://img.shields.io/badge/stability-stable-brightgreen)](../../docs/STABILITY.md)
10
10
  [![GitHub stars](https://img.shields.io/github/stars/AgentsKit-io/agentskit?style=social)](https://github.com/AgentsKit-io/agentskit)
11
11
 
@@ -14,7 +14,7 @@ Connect to any LLM provider — and swap between them — without touching your
14
14
  ## Why adapters
15
15
 
16
16
  - **Vendor independence** — switch from OpenAI to Anthropic to a local Ollama model by changing one line; your hooks, runtime, and tools stay untouched
17
- - **10+ providers included** — Anthropic, OpenAI, Gemini, Ollama, DeepSeek, Grok, Kimi, LangChain, Vercel AI SDK, and any raw `ReadableStream`
17
+ - **20+ providers included** — Anthropic, OpenAI, Gemini, Ollama, DeepSeek, Grok, Kimi, Mistral, Cohere, Together, Groq, Fireworks, OpenRouter, Hugging Face, LM Studio, vLLM, llama.cpp, LangChain, Vercel AI SDK, and any raw `ReadableStream`
18
18
  - **Embedder functions built in** — the same adapter pattern covers text embeddings, so you can reuse provider config for both chat and RAG
19
19
  - **One-line local AI** — `ollama({ model: 'llama3.1' })` for fully offline agents with no API key required
20
20
 
@@ -57,10 +57,28 @@ const rag = createRAG({
57
57
 
58
58
  ## Features
59
59
 
60
- - Providers: Anthropic, OpenAI, Gemini, Ollama, DeepSeek, Grok, Kimi, LangChain, LangGraph, Vercel AI SDK, generic `ReadableStream`
61
- - Embedders: `openaiEmbedder`, `geminiEmbedder`, `ollamaEmbedder`
60
+ - Providers: Anthropic, OpenAI, Gemini, Ollama, DeepSeek, Grok, Kimi, Mistral, Cohere, Together, Groq, Fireworks, OpenRouter, Hugging Face, LM Studio, vLLM, llama.cpp, LangChain, LangGraph, Vercel AI SDK, generic `ReadableStream`
61
+ - Embedders: `openaiEmbedder`, `geminiEmbedder`, `ollamaEmbedder`, `deepseekEmbedder`, `grokEmbedder`, `kimiEmbedder`, `createOpenAICompatibleEmbedder`
62
62
  - All adapters satisfy `Adapter` contract v1 (ADR 0001) — substitutable anywhere in the ecosystem
63
63
  - Custom adapter authoring via `createAdapter()`
64
+ - Higher-order adapters: `createRouter` (cost/latency/classifier), `createEnsembleAdapter` (fan-out + merge), `createFallbackAdapter` (ordered try-next)
65
+
66
+ ## Higher-order adapters
67
+
68
+ ```ts
69
+ import { createRouter, anthropic, openai } from '@agentskit/adapters'
70
+
71
+ // Auto-pick cheapest capable candidate per request.
72
+ const router = createRouter({
73
+ candidates: [
74
+ { id: 'haiku', adapter: anthropic({ model: 'claude-haiku-4-5' }), cost: 0.25 },
75
+ { id: 'sonnet', adapter: anthropic({ model: 'claude-sonnet-4-6' }), cost: 3 },
76
+ { id: 'gpt-mini', adapter: openai({ model: 'gpt-4o-mini' }), cost: 0.15 },
77
+ ],
78
+ })
79
+ ```
80
+
81
+ See [Adapter router](https://www.agentskit.io/docs/recipes/adapter-router), [Ensemble](https://www.agentskit.io/docs/recipes/adapter-ensemble), and [Fallback chain](https://www.agentskit.io/docs/recipes/fallback-chain).
64
82
 
65
83
  ## Ecosystem
66
84