Skip to content

Commit ff28f48

Browse files
committed
docs: generateText example — auto-detect best provider+model by default, show override as comment
1 parent 9a3dc33 commit ff28f48

1 file changed

Lines changed: 14 additions & 8 deletions

File tree

README.md

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

6767
### 1. Generate Text
6868

69-
No model strings needed -- AgentOS picks the best default for each provider:
69+
By default, AgentOS auto-detects the best available provider from your environment and selects the optimal model for the task:
7070

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

74-
// Provider-first: just pick a provider, AgentOS resolves the default model
74+
// Zero config -- auto-detects provider from env vars, picks the best model
7575
const result = await generateText({
76-
provider: 'anthropic',
7776
prompt: 'Explain how TCP handshakes work in 3 bullets.',
7877
});
7978
console.log(result.text);
8079

81-
// Or omit provider entirely -- auto-detects from env vars
82-
const auto = await generateText({
83-
prompt: 'What is the capital of France?',
80+
// Pin a specific provider -- AgentOS still picks the best model for it
81+
const pinned = await generateText({
82+
provider: 'anthropic', // uses claude-sonnet-4 by default
83+
prompt: 'Compare TCP and UDP.',
8484
});
85-
console.log(auto.text);
85+
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+
// });
8692
```
8793

88-
16 providers supported with automatic fallback (402/429/5xx errors retry on the next available key).
94+
16 providers supported. Auto-fallback on 402/429/5xx errors — if your primary provider fails, AgentOS retries on the next available key automatically.
8995

9096
### 2. Streaming
9197

0 commit comments

Comments
 (0)