Pull requests / #1362
#1362 serve: preserve Markdown state across skipped tool-call newlines
open · @hawkli-1994 · 0 comentários · No GitHub
Descrição
Summary After a real tool call, OutputParser discards leading newlines without advancing its Markdown state. When prose precedes the call, the next code fence is tracked as part of that stale line. A tilde-fenced example can then become an extra tool call, while a backtick fence can hide a later real call. Track the skipped newlines before discarding them so fenced examples stay text and subsequent real calls still parse. What changed - serve/frontend.py: pass the skipped newlines through the existing _track() helper, preserving the existing fence and call-detection rules. - serve/test_reasoning_rescue.py: add regression coverage for both fence delimiters, one or two newlines, whole input, character-by-character input, every two-way split, and stream_tools off/on. Verify content, reasoning, call order, arguments, and streamed call IDs. Extend the existing HTTP test for all three APIs. Extra Notes Validation on the original base 82f46a8 with this patch, using Python 3.12.14 on Linux: - All 2,588 new parser regression subcases fail with the original parser and pass with the patch. - python -m unittest serve.test_reasoning_rescue serve.test_reasoning_tools -v: 37 tests pass. - python -m unittest discover -s serve -p 'test_*.py' -t . -v: 445 pass, 8 skipped (5 require a pack tokenizer; 3 are Windows-only). - Additional loopback HTTP checks: 12/12 pass across OpenAI Chat Completions, Anthropic Messages, and Responses, streamed and non-streamed, with both fence delimiters. HTTP checks use MockEngine and ByteTokenizer. GPU execution, model-backed generation, and a real pack tokenizer were not tested. The passing full-suite run used an isolated environment without psutil. A separate run with psutil hit an existing AmdTelemetry.test_readings error when the container returned None for disk I/O counters; this also reproduced with unchanged upstream telemetry code.
No site
Links install, modelos, releases.