Unverified Commit 2092ce8c authored by sfbemerk's avatar sfbemerk Committed by GitHub
Browse files

Tool Call Parser logs should not contain user input / model output except on DEBUG (#29160)


Signed-off-by: default avatarBenjamin Merkel <benjamin.merkel@tngtech.com>
Co-authored-by: default avatarBenjamin Merkel <benjamin.merkel@tngtech.com>
Co-authored-by: default avatarChauncey <chaunceyjiang@gmail.com>
parent fc9f821d
...@@ -78,7 +78,7 @@ class Glm4MoeModelToolParser(ToolParser): ...@@ -78,7 +78,7 @@ class Glm4MoeModelToolParser(ToolParser):
.get("type", None) .get("type", None)
) )
return arg_type == "string" return arg_type == "string"
logger.warning("No tool named '%s'.", tool_name) logger.debug("No tool named '%s'.", tool_name)
return False return False
def _deserialize(value: str) -> Any: def _deserialize(value: str) -> Any:
......
...@@ -128,7 +128,7 @@ class Qwen3CoderToolParser(ToolParser): ...@@ -128,7 +128,7 @@ class Qwen3CoderToolParser(ToolParser):
return params return params
else: else:
return {} return {}
logger.warning("Tool '%s' is not defined in the tools list.", func_name) logger.debug("Tool '%s' is not defined in the tools list.", func_name)
return {} return {}
def _convert_param_value( def _convert_param_value(
...@@ -141,7 +141,7 @@ class Qwen3CoderToolParser(ToolParser): ...@@ -141,7 +141,7 @@ class Qwen3CoderToolParser(ToolParser):
if param_name not in param_config: if param_name not in param_config:
if param_config != {}: if param_config != {}:
logger.warning( logger.debug(
"Parsed parameter '%s' is not defined in the tool " "Parsed parameter '%s' is not defined in the tool "
"parameters for tool '%s', directly returning the " "parameters for tool '%s', directly returning the "
"string value.", "string value.",
...@@ -169,7 +169,7 @@ class Qwen3CoderToolParser(ToolParser): ...@@ -169,7 +169,7 @@ class Qwen3CoderToolParser(ToolParser):
try: try:
return int(param_value) return int(param_value)
except (ValueError, TypeError): except (ValueError, TypeError):
logger.warning( logger.debug(
"Parsed value '%s' of parameter '%s' is not an " "Parsed value '%s' of parameter '%s' is not an "
"integer in tool '%s', degenerating to string.", "integer in tool '%s', degenerating to string.",
param_value, param_value,
...@@ -186,7 +186,7 @@ class Qwen3CoderToolParser(ToolParser): ...@@ -186,7 +186,7 @@ class Qwen3CoderToolParser(ToolParser):
else int(float_param_value) else int(float_param_value)
) )
except (ValueError, TypeError): except (ValueError, TypeError):
logger.warning( logger.debug(
"Parsed value '%s' of parameter '%s' is not a float " "Parsed value '%s' of parameter '%s' is not a float "
"in tool '%s', degenerating to string.", "in tool '%s', degenerating to string.",
param_value, param_value,
...@@ -197,7 +197,7 @@ class Qwen3CoderToolParser(ToolParser): ...@@ -197,7 +197,7 @@ class Qwen3CoderToolParser(ToolParser):
elif param_type in ["boolean", "bool", "binary"]: elif param_type in ["boolean", "bool", "binary"]:
param_value = param_value.lower() param_value = param_value.lower()
if param_value not in ["true", "false"]: if param_value not in ["true", "false"]:
logger.warning( logger.debug(
"Parsed value '%s' of parameter '%s' is not a boolean " "Parsed value '%s' of parameter '%s' is not a boolean "
"(`true` or `false`) in tool '%s', degenerating to " "(`true` or `false`) in tool '%s', degenerating to "
"false.", "false.",
...@@ -216,7 +216,7 @@ class Qwen3CoderToolParser(ToolParser): ...@@ -216,7 +216,7 @@ class Qwen3CoderToolParser(ToolParser):
param_value = json.loads(param_value) param_value = json.loads(param_value)
return param_value return param_value
except (json.JSONDecodeError, TypeError, ValueError): except (json.JSONDecodeError, TypeError, ValueError):
logger.warning( logger.debug(
"Parsed value '%s' of parameter '%s' cannot be " "Parsed value '%s' of parameter '%s' cannot be "
"parsed with json.loads in tool '%s', will try " "parsed with json.loads in tool '%s', will try "
"other methods to parse it.", "other methods to parse it.",
...@@ -227,7 +227,7 @@ class Qwen3CoderToolParser(ToolParser): ...@@ -227,7 +227,7 @@ class Qwen3CoderToolParser(ToolParser):
try: try:
param_value = ast.literal_eval(param_value) # safer param_value = ast.literal_eval(param_value) # safer
except (ValueError, SyntaxError, TypeError): except (ValueError, SyntaxError, TypeError):
logger.warning( logger.debug(
"Parsed value '%s' of parameter '%s' cannot be " "Parsed value '%s' of parameter '%s' cannot be "
"converted via Python `ast.literal_eval()` in tool " "converted via Python `ast.literal_eval()` in tool "
"'%s', degenerating to string.", "'%s', degenerating to string.",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment