You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Poolside v1 tool parser raises on numeric arguments like 1e999 and on deeply nested JSON arguments #20991
TensorRT-LLM main at 687359e (tensorrt_llm/serve/tool_parser/poolside_v1_parser.py), pure Python. A CPU is enough to reproduce.
Python 3.12
Serving path: trtllm-serve <Laguna model> --tool_parser poolside_v1, chat completions with tools, streaming and non-streaming
Who can help?
@NVIDIA/trt-llm-runtime-devs (CODEOWNERS for tensorrt_llm/serve)
Reproduction
fromtensorrt_llm.serve.openai_protocolimportChatCompletionToolsParamfromtensorrt_llm.serve.tool_parser.poolside_v1_parserimportPoolsideV1ToolParserdeftools(arg_type):
return [ChatCompletionToolsParam(function={
"name": "f", "parameters": {"type": "object", "properties": {"v": {"type": arg_type}}}})]
defcall(raw):
returnf"<tool_call>f\n<arg_key>v</arg_key>\n<arg_value>{raw}</arg_value>\n</tool_call>"PoolsideV1ToolParser().detect_and_parse(call("1e999"), tools("integer"))
# OverflowError: cannot convert float infinity to integerPoolsideV1ToolParser().detect_and_parse(call("9"*400), tools("number"))
# OverflowError: int too large to convert to floatPoolsideV1ToolParser().detect_and_parse(call("["*100000+"]"*100000), tools("array"))
# RecursionError: maximum recursion depth exceeded while decoding a JSON arrayPoolsideV1ToolParser().detect_and_parse(call("NaN"), tools("number")).calls[0].parameters# '{"v": NaN}'
parse_streaming_increment raises the same exceptions when the tool call closes.
Expected behavior
The parser returns the tool call for any model output. A value that has no strict JSON form keeps its raw text, the same way glm4_parser.parse_arguments already handles 1e309 and NaN for the same <arg_key>/<arg_value> format.
actual behavior
value
declared type
result on main
1e999, Infinity, -Infinity
integer
OverflowError at poolside_v1_parser.py:76
400 digits
number
OverflowError at poolside_v1_parser.py:81
100000 nested [
any non-string
RecursionError at poolside_v1_parser.py:70
NaN, 1e999, [1e999]
number, array
returns a call whose arguments string holds NaN or Infinity, which strict JSON parsers reject
The exception leaves the parser. On the non-streaming path openai_chat turns it into an HTTP 400 error that carries the Python message, so the whole generation is lost. On the streaming path chat_stream_generator logs it and re-raises, so the event stream stops without a final chunk or data: [DONE]. /v1/responses calls the same parser without a guard.
additional notes
_parse_argument_value catches (json.JSONDecodeError, ValueError) around json.loads and (TypeError, ValueError) around int(parsed) and float(parsed). json.loads returns float("inf") for 1e999 and Infinity, and int(inf) raises OverflowError. float() of an integer with more than 308 digits raises OverflowError. Deep nesting makes json.loads raise RecursionError. I have a fix with tests ready and will open a PR that references this issue.
Activity
[NVIDIA#20991][fix] Poolside v1 tool parser: keep argument text that …