Chapter 8½: inside llm/src
lib.rsopens with the limits (MAX_CALLS,MAX_OPTIONS,SCORE_LEVELS,MAX_TOKENS), thenSYSTEM, the whole system prompt, andtools(), the three tool definitions. Read those two first: they are the behaviour. Thensettledandsettled_system(narrowing the tools to what the rules asked for),takes,request, and finally the reading side:Draft,ToolCall,Usage,Replyandparse.models.rsis the price list: every candidate under Haiku's price, cheapest first, each with its price in neurons per million tokens in and out, from Cloudflare's pricing page on 2026-10-02; andModel::neuronsandModel::worst_case_neurons.tests.rsfeedsparsereal replies, including the double-encoded arguments one model sent, and checksrequestgives only the tools asked for.
Try it.
cargo test -p llm.
| File | What |
|---|---|
| lib.rs | The prompt, the tools, request, takes and parse. |
| models.rs | The candidate models and their prices. |
| tests.rs | Replies parsed and requests built. |
← Previous: Chapter 8, llm/ · Up: llm · Next: Chapter 9, archive/ →