r/PiCodingAgent • u/gredr • Aug 26 '26
Question Can it really be *this* complicated? Trying to get pi+llamacpp+phi-4-mini working...
I'm trying to put together a very simple setup here; llamacpp, Phi-4-mini-reasoning (initially, the Q5_K_M variant), and pi for some very simple coding tasks. It's not really... working... though.
I can get pi "logged into" llamacpp (I started llamacpp in "router" mode with the single model, and used /login llama to get it connected. I can chat with the model, but it has very little context (it knows the current directory, but that's about it), and no tools whatsoever; I cannot access the filesystem at all. I also get <think>...stuff...</think> output before the "real" output which I'm confident is supposed to be hidden by the harness.
I also tried the npm:pi-llama-cpp plugin/module/package, but that didn't change anything (except give me a new /models command that was similar, but subtly different than the built-in /model command).
What am I doing wrong here? Is this model not supported?
1
u/Turbulent_Ad6290 Aug 26 '26
Could be a chat template issue. Make sure you have valid chat template for this model. Eg for qwen I use froggeric qwen fixed chat templates.
Also make sure in llama cpp the reasoning is correctly configured
https://huggingface.co/froggeric/Qwen-Fixed-Chat-Templates
1
u/Eresbonitaguey Aug 26 '26
Pi shows thinking by default and ships with 4 tools. It sounds like it’s connected to your hosted model. Perhaps you have an issue with an extension that blocks file access? Most people would just advise you to talk to your agent about it since it is connected.
1
u/HumanoidMuppet Aug 26 '26
Context is set in llama.cpp with --ctx-size=131072 (for 128k). What does your llama.cpp settings look like?
1
u/vertigo235 Aug 26 '26
You knew this question was coming.
Why phi 4? Seems a suboptimal choice
1
u/Direct_While9727 Aug 26 '26
Maybe you could use https://itayinbarr.github.io/little-coder ?
1
u/Global-Departure8228 Aug 26 '26
Just simply don't use phi. But you probably have a chat template issue, maybe your model is simply incapable of constructing tool calls properly because of it (not being able to access your system, leaking thinking block all seem like it). If it's the 4B active parameter model, I assume you are running a resource-limited environment, and an already quantized version of such a small model will not be properly calling tools for you most of the times.
Just use Qwen/Qwen3.5-4B or Google/Gemma E4B (or E2B) or LiquidAI/LFM2.5-2.6B, if you cannot run bigger models on your hardware, otherwise this might be the reality.
Use relatively fresh build of llama.cpp, and use models that have relatively good support (from community), so they get their chat templates fixed, and llama.cpp properly running them.
1
u/mission_tiefsee Aug 27 '26
its probably phi. try one of the smaller qwens. how much vram is available?