Skip to content

Commit 1cbcf69

Browse files
committed
docs: fix generateText example — honest about auto-detection (env var priority, not LLM-chosen)
1 parent e9e615c commit 1cbcf69

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

README.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -66,32 +66,33 @@ export OPENAI_API_KEY=sk-... # or ANTHROPIC_API_KEY, GEMINI_API_KEY, GROQ
6666

6767
### 1. Generate Text
6868

69-
By default, AgentOS auto-detects the best available provider from your environment and selects the optimal model for the task:
69+
AgentOS auto-detects which provider to use from your environment variables and maps each provider to a sensible default model (see [Default Models Per Provider](#default-models-per-provider) below):
7070

7171
```typescript
7272
import { generateText } from '@framers/agentos';
7373

74-
// Zero config -- auto-detects provider from env vars, picks the best model
74+
// Zero config -- auto-detects provider from env vars, uses its default model
75+
// Priority: OPENAI_API_KEY → ANTHROPIC_API_KEY → OPENROUTER_API_KEY → GEMINI → ...
7576
const result = await generateText({
7677
prompt: 'Explain how TCP handshakes work in 3 bullets.',
7778
});
7879
console.log(result.text);
7980

80-
// Pin a specific provider -- AgentOS still picks the best model for it
81+
// Pin a provider -- uses that provider's default model (e.g. anthropic → claude-sonnet-4)
8182
const pinned = await generateText({
82-
provider: 'anthropic', // uses claude-sonnet-4 by default
83+
provider: 'anthropic',
8384
prompt: 'Compare TCP and UDP.',
8485
});
8586

86-
// Full control -- explicit provider + model when you need it
87-
// const custom = await generateText({
88-
// provider: 'openai',
89-
// model: 'gpt-4o-mini', // override default model
90-
// prompt: 'What is the capital of France?',
91-
// });
87+
// Full control -- explicit provider + model override
88+
const custom = await generateText({
89+
provider: 'openai',
90+
model: 'gpt-4o-mini', // override the default (gpt-4o)
91+
prompt: 'What is the capital of France?',
92+
});
9293
```
9394

94-
16 providers supported. Auto-fallback on 402/429/5xx errors — if your primary provider fails, AgentOS retries on the next available key automatically.
95+
16 providers supported. Auto-fallback on 402/429/5xx — if the primary provider fails, the next available provider is tried automatically.
9596

9697
### 2. Streaming
9798

0 commit comments

Comments
 (0)