A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 5, 04:45 UTC
[Bugfix] Fix Gemma4 tool parser converting bare `null` to string `"null"` (#39679)
Signed-off-by: KimuGenie <baby11686@naver.com> Signed-off-by: Chauncey <chaunceyjiang@gmail.com> Co-authored-by: Chauncey <chaunceyjiang@gmail.com>
김의진 committed
Apr 14, 2026 at 13:44 UTC
b075604da10a9e8ff23d23f63d5113d43f0e4208
2 files changed
+12
tests/tool_parsers/test_gemma4_tool_parser.py
+8
@@ -85,6 +85,14 @@ class TestParseGemma4Args:
85
result = _parse_gemma4_args("flag:false")
86
assert result == {"flag": False}
87
88
+ def test_null_value(self):
89
+ # Bare `null` must parse as None (Python), not the string "null".
90
+ # Without this, tool_choice=auto would emit `{"param": "null"}`
91
+ # instead of `{"param": null}` for nullable tool parameters.
92
+ result = _parse_gemma4_args("param:null")
93
+ assert result == {"param": None}
94
+ assert json.dumps(result) == '{"param": null}'
95
+
96
def test_mixed_types(self):
97
result = _parse_gemma4_args(
98
'name:<|"|>test<|"|>,count:42,active:true,score:3.14'
vllm/tool_parsers/gemma4_tool_parser.py
+4
@@ -66,6 +66,10 @@ def _parse_gemma4_value(value_str: str) -> object:
66
if value_str == "false":
67
return False
68
69
+ # Null
70
+ if value_str.lower() in ("null", "none", "nil"):
71
+ return None
72
+
73
# Number (int or float)
74
try:
75
if "." in value_str: