From 7614fcc512d96bcc0a41c660a2fe7affe36e8242 Mon Sep 17 00:00:00 2001 From: 0xallam Date: Fri, 20 Feb 2026 07:47:08 -0800 Subject: [PATCH] fix: Strip quotes from parameter/function names in tool calls --- strix/llm/utils.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/strix/llm/utils.py b/strix/llm/utils.py index 56caa34..b1c244f 100644 --- a/strix/llm/utils.py +++ b/strix/llm/utils.py @@ -6,24 +6,29 @@ from typing import Any _INVOKE_OPEN = re.compile(r'') _PARAM_NAME_ATTR = re.compile(r'') _FUNCTION_CALLS_TAG = re.compile(r"") +_QUOTED_FUNCTION = re.compile(r'') +_QUOTED_PARAMETER = re.compile(r'') def normalize_tool_format(content: str) -> str: - """Convert alternative tool-call XML format to the expected one. + """Convert alternative tool-call XML formats to the expected one. Handles: ... → stripped → + + """ - if "", content) + content = _PARAM_NAME_ATTR.sub(r"", content) + content = content.replace("", "") - content = _FUNCTION_CALLS_TAG.sub("", content) - content = _INVOKE_OPEN.sub(r"", content) - content = _PARAM_NAME_ATTR.sub(r"", content) - return content.replace("", "") + content = _QUOTED_FUNCTION.sub(r"", content) + return _QUOTED_PARAMETER.sub(r"", content) STRIX_MODEL_MAP: dict[str, str] = {