@falai/agent 2.2.1 → 2.2.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.
@@ -11,7 +11,7 @@ order: 10
11
11
 
12
12
  Providers are the strategy plug between an `Agent` and a model vendor. Every provider implements the same `AiProvider` interface, so the Agent itself stays vendor-agnostic. Pass an instance to `createAgent({ provider })` and the agent talks to that vendor for every turn (and for compaction, if you wire it in).
13
13
 
14
- `@falai/agent` ships four built-in providers. All four accept an `apiKey` and a required `model`, support `backupModels` for automatic failover on overload or 5xx, and accept a vendor-typed `config` object that flows through to the underlying SDK.
14
+ `@falai/agent` ships five built-in providers. All five accept an `apiKey` and a required `model`, support `backupModels` for automatic failover on overload or 5xx, and accept a vendor-typed `config` object that flows through to the underlying SDK.
15
15
 
16
16
  | Provider | Class | Options | SDK |
17
17
  |----------|-------|---------|-----|
@@ -19,6 +19,7 @@ Providers are the strategy plug between an `Agent` and a model vendor. Every pro
19
19
  | OpenAI | `OpenAIProvider` | `OpenAIProviderOptions` | `openai` |
20
20
  | Anthropic Claude | `AnthropicProvider` | `AnthropicProviderOptions` | `@anthropic-ai/sdk` |
21
21
  | OpenRouter | `OpenRouterProvider` | `OpenRouterProviderOptions` | `openai` (compat) |
22
+ | DeepSeek | `DeepSeekProvider` | `DeepSeekProviderOptions` | `openai` (compat) |
22
23
 
23
24
  ## Use with createAgent
24
25
 
@@ -31,6 +32,7 @@ import {
31
32
  OpenAIProvider,
32
33
  AnthropicProvider,
33
34
  OpenRouterProvider,
35
+ DeepSeekProvider,
34
36
  } from "@falai/agent";
35
37
 
36
38
  const provider =
@@ -40,6 +42,8 @@ const provider =
40
42
  ? new AnthropicProvider({ apiKey: process.env.ANTHROPIC_API_KEY!, model: "claude-sonnet-4-6" })
41
43
  : process.env.PROVIDER === "openrouter"
42
44
  ? new OpenRouterProvider({ apiKey: process.env.OPENROUTER_API_KEY!, model: "anthropic/claude-sonnet-4.6" })
45
+ : process.env.PROVIDER === "deepseek"
46
+ ? new DeepSeekProvider({ apiKey: process.env.DEEPSEEK_API_KEY!, model: "deepseek-chat" })
43
47
  : new GeminiProvider({ apiKey: process.env.GEMINI_API_KEY!, model: "gemini-3.1-pro-preview" });
44
48
 
45
49
  const agent = createAgent({ provider, schema, flows });
@@ -204,9 +208,51 @@ const openrouter = new OpenRouterProvider({
204
208
  });
205
209
  ```
206
210
 
211
+ ## DeepSeekProvider
212
+
213
+ DeepSeek is OpenAI-compatible and offers powerful reasoning models. The `deepseek-reasoner` model streams thinking/reasoning content via `reasoning_content` on the delta, which is logged at debug level.
214
+
215
+ ### Signature
216
+
217
+ ```typescript
218
+ new DeepSeekProvider(options: DeepSeekProviderOptions)
219
+
220
+ interface DeepSeekProviderOptions {
221
+ apiKey: string;
222
+ model: string;
223
+ backupModels?: string[];
224
+ baseURL?: string;
225
+ config?: Partial<Omit<ChatCompletionCreateParamsNonStreaming, "model" | "messages">>;
226
+ retryConfig?: { timeout?: number; retries?: number };
227
+ }
228
+ ```
229
+
230
+ ### Fields
231
+
232
+ | Field | Type | Required | Default | Notes |
233
+ |-------|------|----------|---------|-------|
234
+ | `apiKey` | `string` | yes | — | Throws if empty. |
235
+ | `model` | `string` | yes | — | e.g. `"deepseek-chat"`, `"deepseek-reasoner"`. |
236
+ | `backupModels` | `string[]` | no | `[]` | Tried in order on overload/rate-limit errors. |
237
+ | `baseURL` | `string` | no | `"https://api.deepseek.com"` | Custom endpoint for self-hosted or proxy deployments. |
238
+ | `config` | OpenAI params | no | — | OpenAI-shaped defaults (forwarded to DeepSeek). |
239
+ | `retryConfig.timeout` | `number` | no | `60000` | Per-attempt timeout in ms. |
240
+ | `retryConfig.retries` | `number` | no | `3` | Total attempts. |
241
+
242
+ ### Example
243
+
244
+ ```typescript
245
+ const deepseek = new DeepSeekProvider({
246
+ apiKey: process.env.DEEPSEEK_API_KEY!,
247
+ model: "deepseek-chat",
248
+ backupModels: ["deepseek-reasoner"],
249
+ config: { temperature: 0.3 },
250
+ });
251
+ ```
252
+
207
253
  ## Errors
208
254
 
209
- All four providers share the same construction-time guards and runtime failure modes.
255
+ All five providers share the same construction-time guards and runtime failure modes.
210
256
 
211
257
  | When | Error | Why |
212
258
  |------|-------|-----|
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@falai/agent",
3
- "version": "2.2.1",
3
+ "version": "2.2.2",
4
4
  "description": "Conversational state engine for TypeScript where the AI understands, but the code is in control",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/index.js",
@@ -66,6 +66,7 @@
66
66
  "gemini",
67
67
  "openai",
68
68
  "anthropic",
69
+ "deepseek",
69
70
  "llm",
70
71
  "chatbot",
71
72
  "framework",
package/src/index.ts CHANGED
@@ -31,6 +31,8 @@ export { OpenRouterProvider } from "./providers/OpenRouterProvider";
31
31
  export type { OpenRouterProviderOptions } from "./providers/OpenRouterProvider";
32
32
  export { AnthropicProvider } from "./providers/AnthropicProvider";
33
33
  export type { AnthropicProviderOptions } from "./providers/AnthropicProvider";
34
+ export { DeepSeekProvider } from "./providers/DeepSeekProvider";
35
+ export type { DeepSeekProviderOptions } from "./providers/DeepSeekProvider";
34
36
 
35
37
  // Adapters
36
38
  export { PrismaAdapter } from "./adapters/PrismaAdapter";