Skip to content

Fix Chat Completions thinking controls and request validation - #1779

Merged
sufubao merged 1 commit into
ModelTC:mainfrom
sufubao:fix/openai-chat-request-validation
Dec 3, 2026
Merged

sufubao merged 1 commit into
ModelTC:mainfrom
sufubao:fix/openai-chat-request-validation

Conversation

@sufubao

@sufubao sufubao commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator

DeepSeek clients can send {"thinking":{"type":"disabled"}} to the Chat Completions endpoint. LightLLM previously discarded this field and could return the answer in message.reasoning. The V4.1 tokenizer also assigned minimal a higher effort than medium.

Changes

  • Resolve the top-level thinking switch and the boolean chat-template switches before rendering the prompt and parsing the response. Explicit switches take precedence over reasoning_effort. Conflicting switches return HTTP 400.
  • Map V4.1 minimal to low and medium to high, following the DeepSeek effort table.
  • Return an OpenAI-style HTTP 400 for invalid chat requests, including empty conversations, missing required message content, and missing or empty function names. When a caller omits model, report the configured model name.
  • Cover streamed and non-streamed answers, assistant tool-call history, and the choice-count boundary (n=8 succeeds, n=9 fails).

Verification

  • 232 tests passed on the rebased commit, including the HTTP request, reasoning, multi-choice, Responses API, and upstream tool-call history regressions.
  • 69 grammar and Anthropic compatibility tests passed before the rebase.
  • Compared the rendered V4.1 prompts with the vLLM encoder for disabled thinking, named efforts, and a numeric effort.
  • HTTP tests use simulated generation. Five additional vision registry tests could not load their GPU dependencies in the local containers. Live GPU inference was not exercised.

@sufubao
sufubao merged commit e5fb985 into ModelTC:main Dec 3, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant