From 2ef375a7faf5f1b6819036f6c1e70f3708a102f0 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 27 Mar 2026 13:33:56 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- studio/backend/core/inference/llama_cpp.py | 2 +- studio/backend/routes/inference.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/studio/backend/core/inference/llama_cpp.py b/studio/backend/core/inference/llama_cpp.py index 6798d43145..b0746a55a9 100644 --- a/studio/backend/core/inference/llama_cpp.py +++ b/studio/backend/core/inference/llama_cpp.py @@ -2493,7 +2493,7 @@ class LlamaCppBackend: # iterations so they are not silently dropped. yield {"type": "status", "text": ""} if content_accum: - _safe = _strip_tool_markup(content_accum, final=True) + _safe = _strip_tool_markup(content_accum, final = True) if _safe.strip(): yield {"type": "content", "text": _safe} _fu = _iter_usage or {} diff --git a/studio/backend/routes/inference.py b/studio/backend/routes/inference.py index 0c0f0929cf..99910808f8 100644 --- a/studio/backend/routes/inference.py +++ b/studio/backend/routes/inference.py @@ -1055,8 +1055,8 @@ async def openai_chat_completions( # No format instructions -- each model's chat template handles # that. Keeps tool use optional ("prefer", not "must"). tool_names = {t["function"]["name"] for t in tools_to_use} - has_web = "web_search" in tool_names - has_code = "python" in tool_names or "terminal" in tool_names + has_web = "web_search" in tool_names + has_code = "python" in tool_names or "terminal" in tool_names nudge_parts = ["You are a helpful assistant with access to tools."] if has_code and has_web: @@ -1092,6 +1092,7 @@ async def openai_chat_completions( # (the frontend may include prior assistant text # in follow-up user messages). import re as _re + _tool_xml_strip = [ _re.compile(r".*?", _re.DOTALL), _re.compile(r".*$", _re.DOTALL), @@ -1117,6 +1118,7 @@ async def openai_chat_completions( created = int(time.time()) if use_tools: + def gguf_generate_with_tools(): return llama_backend.generate_chat_completion_with_tools( messages = gguf_messages,