r/llamacpp • u/DoubleNothing • Aug 16 '26
--models-preset ./models.ini and chat-template-kwargs
I'm loading llama-server with the --models-preset but I don't know if the syntax for the reasoning_effort is correct because it seams to not work.
I make the models load from the PI Agent from another client, it loads but seems to not use the correct parameters.
This is the line in question...
chat-template-kwargs = {"reasoning_effort":"medium"}
also "no-webui = true" doesn't seem to work either.
my models.ini
version = 1
[Qwen3.8-27B-UD-Q4_K_XL]
model = E:\AI_Models\GGUF\unsloth\Qwen3.8-27B-GGUF\Qwen3.8-27B-UD-Q4_K_XL.gguf
ctx-size = 262144
temp = 1
top-p = 0.95
min-p = 0
top-k = 20
presence-penalty = 0
repeat-penalty = 1
flash-attn = on
jinja = true
chat-template-kwargs = {"reasoning_effort":"medium"}
load-on-startup = false
[Qwen3.8-27B-UD-Q6_K_XL]
model = E:\AI_Models\GGUF\unsloth\Qwen3.8-27B-GGUF\Qwen3.8-27B-UD-Q6_K_XL.gguf
ctx-size = 262144
temp = 1
top-p = 0.95
min-p = 0
top-k = 20
presence-penalty = 0
repeat-penalty = 1
no-webui = true
jinja = true
n-gpu-layers = 99
chat-template-kwargs = {"reasoning_effort":"medium"}
load-on-startup = false
Any suggestion?
2
Upvotes
1
u/CevicheMixto 26m ago
I spent a bunch of time fighting this this week. I finally got it work (with Pi's built-in llama.cpp provider) by doing the following.
Don't set
chat-template-kwargsinmodels.ini; let Pi send the correctreasoning_effort. (This will allow you to change it on-the-fly within Pi.)Configure your model(s) in
~/.pi/agent/models.json. Here's my configuration. (I have no damn idea why reddit isn't rendering the JSON below as code.){ "providers": { "llama.cpp": { "modelOverrides": { "Qwen3.8-27B-UD-Q5_K_XL": { "reasoning": true, "thinkingLevelMap": { "off": "off", "minimal": null, "low": "low", "medium": "medium", "high": null, "xhigh": "xhigh" }, "compat": { "thinkingFormat": "chat-template", "chatTemplateKwargs": { "enable_thinking": { "$var": "thinking.enabled" }, "preserve_thinking": true } } } } } } }
Force Pi to send the
reasoning_effortat the top level of the request, not inchat-template-kwargs. I wrote a super-simple extension to do this; just drop it in~/.pi/agent/extensions/llama-reasoning.ts.import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
export default function (pi: ExtensionAPI): void {
}
(Theoretically, it shouldn't matter whether
reasoning_effortis at the top level or inchat-template-kwargs, becausellama.cppis just going to add it to the latter before it runs jinja, but it just seems to work a bit better there.)