Skip to content

Instantly share code, notes, and snippets.

@bbrowning
Created May 13, 2025 20:41
Show Gist options
  • Save bbrowning/4f94f4a6db09672bf8c960631778982c to your computer and use it in GitHub Desktop.
Save bbrowning/4f94f4a6db09672bf8c960631778982c to your computer and use it in GitHub Desktop.
diff --git a/vllm/entrypoints/openai/tool_parsers/pythonic_tool_parser.py b/vllm/entrypoints/openai/tool_parsers/pythonic_tool_parser.py
index bb91a35af..2947bc8db 100644
--- a/vllm/entrypoints/openai/tool_parsers/pythonic_tool_parser.py
+++ b/vllm/entrypoints/openai/tool_parsers/pythonic_tool_parser.py
@@ -189,6 +189,8 @@ def _get_parameter_value(val: ast.expr) -> Any:
}
elif isinstance(val, ast.List):
return [_get_parameter_value(v) for v in val.elts]
+ elif isinstance(val, ast.Name) and val.id in ["true", "false"]:
+ return True if val.id == "true" else False
else:
raise _UnexpectedAstError("Tool call arguments must be literals")
@bbrowning
Copy link
Author

The function call output it's trying to parse is get_boiling_point(liquid_name='polyjuice', celcius=true). It's the true that messes things up, as it was getting treated as a variable name (because it's lowercase) instead of as the Python boolean True value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment