Open-source AI penetration testing tool to find and fix your app’s vulnerabilities.
Python agentsai-hackingai-penetration-testingai-pentestingai-securityartificial-intelligencebug-bountycode-qualityctf-toolscybersecuritycybersecurity-toolsethical-hackinghackingllm-securityoffensive-securitypenetration-testingpentesting-toolsred-teamingsecuritysecurity-automation
fix: Strip quotes from parameter/function names in tool calls
0xallam7614fcc512d9
diff --git a/strix/llm/utils.py b/strix/llm/utils.pyindex 56caa348..b1c244ff 100644--- a/strix/llm/utils.py+++ b/strix/llm/utils.py@@ -6,24 +6,29 @@ from typing import Any_INVOKE_OPEN = re.compile(r'<invoke\s+name="([^"]+)"\s*>')_PARAM_NAME_ATTR = re.compile(r'<parameter\s+name="([^"]+)"\s*>')_FUNCTION_CALLS_TAG = re.compile(r"</?function_calls>")+_QUOTED_FUNCTION = re.compile(r'<function="([^"]+)">')+_QUOTED_PARAMETER = re.compile(r'<parameter="([^"]+)">')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:<function_calls>...</function_calls> → stripped<invoke name="X"> → <function=X><parameter name="X"> → <parameter=X></invoke> → </function>+ <function="X"> → <function=X>+ <parameter="X"> → <parameter=X>"""- if "<invoke" not in content and "<function_calls" not in content:- return content-- content = _FUNCTION_CALLS_TAG.sub("", content)- content = _INVOKE_OPEN.sub(r"<function=\1>", content)- content = _PARAM_NAME_ATTR.sub(r"<parameter=\1>", content)- return content.replace("</invoke>", "</function>")+ if "<invoke" in content or "<function_calls" in content:+ content = _FUNCTION_CALLS_TAG.sub("", content)+ content = _INVOKE_OPEN.sub(r"<function=\1>", content)+ content = _PARAM_NAME_ATTR.sub(r"<parameter=\1>", content)+ content = content.replace("</invoke>", "</function>")++ content = _QUOTED_FUNCTION.sub(r"<function=\1>", content)+ return _QUOTED_PARAMETER.sub(r"<parameter=\1>", content)STRIX_MODEL_MAP: dict[str, str] = {