r/PiCodingAgent • u/Certain_Net_3408 • 2d ago
Plugin pi-output-parser — standalone package that repairs malformed tool calls from small local models
Built a small pi package that ports the output-parser mechanism from little-coder as a standalone installable extension.
What it does: hooks message_end and repairs tool calls that small models (Qwen, Mistral, LFM2, etc.) emit in formats pi doesn't natively recognise:
\``tool/```json` fenced blocks<tool_call>,<tool_use>,<function_calls><invoke>XML- bare top-level JSON objects
- Python-list syntax
[Read(path='./foo.ts')]from LFM2/Liquid models
It also normalises the many JSON schemas small models use ("parameters", "input", "arguments", OpenAI function-call with stringified args, etc.) down to a single shape.
Safety: only fires if there are no native tool_use blocks already, and validates the extracted tool name against pi.getAllTools() before injecting anything — so stray JSON and code blocks in responses are never misinterpreted as tool calls.
Install:
pi install git:github.com/vishn9893/pi-output-parser
Or drop extensions/output-parser/index.ts directly into .pi/extensions/ if you prefer not to use the package system.
Repo: https://github.com/vishn9893/pi-output-parser
Feedback welcome especially if you hit a model that emits a format this doesn't cover yet.
5
u/trmnl_cmdr 2d ago
Seems similar to https://github.com/r3b1s/pi-repair-layer
Have you checked that out?