From ac04ad1df6258a5f5f692197591dbbda895a99b0 Mon Sep 17 00:00:00 2001 From: serversdown Date: Wed, 17 Jun 2026 20:52:47 +0000 Subject: [PATCH] fix: only send tools to backends that support them (cloud) The MI50 llama.cpp server 500s on the `tools` param unless launched with --jinja, so sending tools to mi50 broke chat on that backend. Gate tools to TOOL_BACKENDS={"cloud"} for now; mi50 chat works again (just without tools). Add "mi50" once its server runs with --jinja. Co-Authored-By: Claude Opus 4.8 (1M context) --- lyra/chat.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lyra/chat.py b/lyra/chat.py index d5454d0..02a987b 100644 --- a/lyra/chat.py +++ b/lyra/chat.py @@ -18,6 +18,10 @@ RECALL_K = 3 # raw cross-session "sharp detail" hits RECENT_N = 10 # raw turns of the current session SUMMARY_K = 3 # other-session gists MAX_TOOL_ROUNDS = 5 # cap tool-call iterations per turn +# Backends that support function-calling. The MI50's llama.cpp server only does +# tools when launched with --jinja; until it is, keep tools to cloud so MI50 chat +# doesn't 500 on the tools param. Add "mi50" here once that flag is set. +TOOL_BACKENDS = {"cloud"} def _summary_note(summaries: list[memory.Summary]) -> Message: @@ -126,7 +130,7 @@ def respond(session_id: str, user_msg: str, backend: Backend = "cloud") -> str: # Tool loop: offer Lyra her tools; if she calls one, run it and feed the # result back so she can continue, until she returns a normal text reply. - tool_specs = toolkit.specs() if backend in ("cloud", "mi50") else None + tool_specs = toolkit.specs() if backend in TOOL_BACKENDS else None ctx = {"session_id": session_id, "backend": backend} reply = "" for _ in range(MAX_TOOL_ROUNDS):