Skip to content

Commit 42547c9

Browse files
Add missing Architecture 1 content in model selection chapter
Co-authored-by: Ona <no-reply@ona.com>
1 parent b06d1db commit 42547c9

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

src/content/chapters/31-model-selection.mdx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,29 @@ because the simple tasks don’t benefit from the more expensive model.
5252

5353
The simplest approach. Define rules based on task type:
5454

55+
```python
56+
ROUTING_RULES = {
57+
"code_generation": "claude-sonnet-4.6",
58+
"code_review": "claude-sonnet-4.6",
59+
"summarization": "gpt-5.2-mini",
60+
"translation": "gpt-5.2-mini",
61+
"data_extraction": "gpt-5.2-mini",
62+
"complex_reasoning":"claude-opus-4.6",
63+
"math_proof": "claude-opus-4.6",
64+
}
65+
66+
def route(task_type: str, fallback: str = "claude-sonnet-4.6") -> str:
67+
return ROUTING_RULES.get(task_type, fallback)
68+
```
69+
70+
Rule-based routing works when you know your task types upfront and can
71+
measure which model performs best for each. The mapping is explicit,
72+
auditable, and cheap to evaluate. The downside: every new task type
73+
requires a manual decision. If your task taxonomy changes often, you
74+
spend more time maintaining rules than saving on inference.
75+
76+
Start here. Most teams never need anything more complex.
77+
5578
**Architecture 2: Cascade Routing**
5679

5780
Cascade routing is the most cost-effective routing strategy. Instead of

0 commit comments

Comments
 (0)