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

Signed-off-by: baonudesifeizhai <baonudesifeizhai@gmail.com>
This commit is contained in:
baonudesifeizhai
2026-01-14 23:05:48 -05:00
committed by GitHub
parent 15422ed3f7
commit 19b251fe3d

View File

@@ -217,16 +217,13 @@ class MinimaxM2ToolParser(ToolParser):
Returns:
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
# Normalize 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)
# Priority: integer > number > boolean > object > array > string
type_priority = [