Unverified Commit 19b251fe authored by baonudesifeizhai's avatar baonudesifeizhai Committed by GitHub
Browse files

Fix optional parameter parsing in MiniMax M2 tool parser #32278 (#32342)


Signed-off-by: default avatarbaonudesifeizhai <baonudesifeizhai@gmail.com>
parent 15422ed3
...@@ -217,16 +217,13 @@ class MinimaxM2ToolParser(ToolParser): ...@@ -217,16 +217,13 @@ class MinimaxM2ToolParser(ToolParser):
Returns: Returns:
The converted value The converted value
""" """
if value.lower() == "null": # Check if the VALUE itself indicates null (not just if null is allowed)
if value.lower() in ("null", "none", "nil"):
return None return None
# Normalize types # Normalize types
normalized_types = [t.lower() for t in param_types] normalized_types = [t.lower() for t in param_types]
# Try null first if it's in the list
if "null" in normalized_types or value.lower() in ("null", "none", "nil"):
return None
# Try each type in order of preference (most specific first, string as fallback) # Try each type in order of preference (most specific first, string as fallback)
# Priority: integer > number > boolean > object > array > string # Priority: integer > number > boolean > object > array > string
type_priority = [ type_priority = [
......
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