Controlling and Tuning Model Behavior at Runtime
39%
Using the API to Control the Model
The REPL's /set is just a friendly wrapper. Over the API, the same controls live in 2 places: top-level fields (system, format) and the options object (everything /set parameter touches).
| REPL command | API equivalent |
|---|---|
/set system "..." | "system": "..." (top-level on /api/generate) or first message with role: "system" on /api/chat |
/set parameter temperature 1.5 | "options": {"temperature": 1.5} |
/set parameter num_ctx 16384 | "options": {"num_ctx": 16384} |
/set parameter num_predict 500 | "options": {"num_predict": 500} |
/set parameter stop "11. " | "options": {"stop": ["11. "]} |
/set format json | "format": "json" |
/set verbose | Read *_duration and *_count fields from every response (always returned) |
/set nothink | "think": false (only on models that support it) |
Local AI Engineering with Ollama
Run, understand, customize, fine-tune, and build agentic apps on your own hardwareEnroll now to unlock all content and receive all future updates for free.
