lmjtfy.git / packages / llm / src / README.md
1# Chapter 8½: inside llm/src
2
31. **`lib.rs`** opens with the limits (`MAX_CALLS`, `MAX_OPTIONS`,
4   `SCORE_LEVELS`, `MAX_TOKENS`), then `SYSTEM`, the whole system prompt, and
5   `tools()`, the three tool definitions. Read those two first: they are the
6   behaviour. Then `settled` and `settled_system` (narrowing the tools to
7   what the rules asked for), `takes`, `request`, and finally the reading
8   side: `Draft`, `ToolCall`, `Usage`, `Reply` and `parse`.
92. **`models.rs`** is the price list: every candidate under Haiku's price,
10   cheapest first, each with its price in neurons per million tokens in and
11   out, from Cloudflare's pricing page on 2026-10-02; and
12   `Model::neurons` and `Model::worst_case_neurons`.
133. **`tests.rs`** feeds `parse` real replies, including the double-encoded
14   arguments one model sent, and checks `request` gives only the tools asked
15   for.
16
17> **Try it.** `cargo test -p llm`.
18
19| File | What |
20| --- | --- |
21| [lib.rs](lib.rs) | The prompt, the tools, `request`, `takes` and `parse`. |
22| [models.rs](models.rs) | The candidate models and their prices. |
23| [tests.rs](tests.rs) | Replies parsed and requests built. |
24
25← Previous: [Chapter 8, llm/](../) · Up: [llm](../) · Next: [Chapter 9, archive/](../../archive/) →