Skip to content

fix(openai): preserve reasoning_content for DeepSeek thinking mode#39

Open
icn5381 wants to merge 1 commit intoMagicCube:mainfrom
icn5381:fix/deepseek-top-p-range
Open

fix(openai): preserve reasoning_content for DeepSeek thinking mode#39
icn5381 wants to merge 1 commit intoMagicCube:mainfrom
icn5381:fix/deepseek-top-p-range

Conversation

@icn5381
Copy link
Copy Markdown

@icn5381 icn5381 commented Apr 26, 2026

Summary

  • DeepSeek API requires reasoning_content to be passed back in conversation history, but convertToOpenAIMessages() was explicitly skipping ThinkingContent with continue
  • This caused a 400 error on the second+ turn: The reasoning_content in the thinking mode must be passed back to the API
  • Fix: map ThinkingContent back to reasoning_content on the assistant message param
  • Also includes the prior top_p default fix (0 → 1) for DeepSeek compatibility

Test plan

  • Added unit tests for convertToOpenAIMessages covering thinking content preservation
  • bun run check passes (types, lint, 68 tests)

DeepSeek (and other thinking-mode providers) require reasoning_content
to be passed back in subsequent API calls. Previously, ThinkingContent
was explicitly skipped during message conversion, causing a 400 error
on the second turn of any conversation using thinking mode.
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.

2 participants