Files
sglang/python
leavelet 2212963a6c Harden OpenAI tool-call/chat-template + reasoning parsing
serving_chat:
- Tolerate a malformed historical tool_call `arguments` string (a valid JSON
  document followed by trailing content) instead of 400-ing the whole
  multi-turn request: salvage the leading JSON document via raw_decode, else
  keep the raw string. (A 112-message tool-history request was rejected with
  orjson "unexpected content after document".)
- Catch TypeError (not only jinja2.TemplateError) from the chat-template
  render so a `tojson` filter on a Jinja Undefined becomes a clean 400 instead
  of a 500 (upstream #20700 / 5e9bd21979).

reasoning_parser:
- Strip only LEADING think-start marker tokens; a global replace would delete a
  `<think>` token that legitimately appears inside reasoning content. Preserve
  model-generated whitespace in reasoning/normal text (drop .strip()/.rstrip())
  (upstream #24251 / dac78768f0).
- Add Glm45 detector tests: leading-only strip, token-inside-content preserved,
  repeated leading markers, streaming trailing whitespace.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 19:58:42 +00:00
..
2026-06-10 05:54:43 +08:00