feat(local-llm): B1b-Plumbing — tools/tool_calls durch Adapter/Bridge/Brain-Client

Traegt OpenAI-Tool-Definitionen (tools) durch den ganzen lokalen Pfad und gibt
tool_calls zurueck:
- adapter.py: tools -> llama.cpp /v1/chat/completions (tool_choice=auto),
  message.tool_calls zurueck in llm_response.
- aria_bridge.py: _local_llm + /internal/local-llm reichen tools durch, geben
  tool_calls zurueck.
- local_llm.py: local_llm_chat akzeptiert tools, result enthaelt tool_calls.

Inert bis der Brain-Tool-Loop (naechster Schritt) tools uebergibt — Verhalten
unveraendert. Tool-Set + lokale Tool-Loop + Router-Anpassung folgen.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-11 12:36:09 +02:00
co-authored by Claude Opus 4.8
parent 3a3c14fdc5
commit a58aa5594d
3 changed files with 37 additions and 13 deletions
+6 -2
View File
@@ -29,14 +29,18 @@ LOCAL_LLM_HTTP_TIMEOUT_SEC = float(os.environ.get("LOCAL_LLM_HTTP_TIMEOUT_SEC",
def local_llm_chat(messages: list, *, max_tokens: int = 512,
temperature: float = 0.7, stop=None) -> dict:
temperature: float = 0.7, stop=None, tools=None) -> dict:
"""Ein Chat-Call ans lokale LLM. messages = [{role, content}, ...].
Blockierend (urllib) — im Brain laeuft chat() ohnehin im Executor-Thread."""
tools (B1b): optionale OpenAI-Tool-Defs; das Ergebnis kann dann
result['tool_calls'] enthalten. Blockierend (urllib) — chat() laeuft
ohnehin im Executor-Thread."""
if not isinstance(messages, list) or not messages:
return {"ok": False, "error": "messages leer/ungueltig"}
req = {"messages": messages, "max_tokens": max_tokens, "temperature": temperature}
if stop:
req["stop"] = stop
if tools:
req["tools"] = tools
try:
body = json.dumps(req).encode("utf-8")
http_req = urllib.request.Request(