Local LLM adapter: tool-call loop

↗ view on GitHub · Claude · 2026-05-15 · 9fe6a8e9

Adds OpenAI-style tool support to the local Ollama adapter. The
adapter now forwards the caller's tool schemas, assembles tool_calls
from the streamed delta chunks (deltas arrive keyed by index with
arguments streaming in fragments), and runs them via the supplied
runTools callback. Tool results are appended as role=tool messages
with tool_call_id and the loop re-streams until the model produces
content with no further tool calls or maxIterations is hit.

Models that do not support tools simply never emit tool_calls, so
the loop exits after the first turn. Unparseable JSON arguments are
passed through under _raw_arguments rather than crashing the turn.
Repository cpatpa/PIP
Author Claude <noreply@anthropic.com>
Authored
Parents 99046ce8
Stats 1 file changed , +195 , -28
Part of Phases 4-8 - admin backend, local storage driver, local LLM, Docker, admin/account frontend

Capture this commit into my fork

Download a Markdown prompt that tells Claude how to port this exact commit into your working tree. Run it via claude -p < capture-commit-9fe6a8e9.md from inside the repo you want the change in.

⬇ Download capture-commit-9fe6a8e9.md