Skip to content

fix: default reasoning_content to empty string for DeepSeek#3149

Merged
amitksingh1490 merged 1 commit into
mainfrom
feat/deepseek-reasoning-content-fallback
Apr 24, 2026
Merged

fix: default reasoning_content to empty string for DeepSeek#3149
amitksingh1490 merged 1 commit into
mainfrom
feat/deepseek-reasoning-content-fallback

Conversation

@amitksingh1490
Copy link
Copy Markdown
Contributor

Summary

Add a DefaultReasoningContent transformer that ensures the reasoning_content field is always present on messages sent to the DeepSeek provider, falling back to an empty string when no reasoning text exists.

Context

DeepSeek requires reasoning_content to be present on assistant messages even when there is no reasoning text. Without this field, DeepSeek rejects the request. The existing ReasoningContent transformer extracts reasoning text from reasoning_details but leaves reasoning_content as None when there are no reasoning details. This new transformer fills in the gap.

Changes

  • Added a new DefaultReasoningContent transformer that sets reasoning_content to an empty string when it is None
  • Wired it into the provider pipeline gated exclusively to the DeepSeek provider
  • Added unit tests for the transformer itself and the DeepSeek pipeline integration

Key Implementation Details

The new transformer runs after ReasoningContent in the pipeline, so it only fills in the fallback when ReasoningContent (or any earlier transformer) left the field as None. It is gated by is_deepseek_provider() and does not affect any other provider.

Pipeline ordering:

ReasoningContent → DefaultReasoningContent → ...

Testing

# Run the new transformer unit tests
cargo test --package forge_app -- dto::openai::transformers::default_reasoning_content --nocapture

# Run the DeepSeek pipeline integration test
cargo test --package forge_app -- dto::openai::transformers::pipeline::tests::test_deepseek_provider_falls_back_to_empty_reasoning_content_when_none --nocapture

# Run all transformer tests
cargo test --package forge_app -- dto::openai::transformers --nocapture
DeepSeek requires reasoning_content to be present on assistant messages
even when there is no reasoning text. Add a new DefaultReasoningContent
transformer that fills in an empty string when the field is None, gated
only to the DeepSeek provider in the pipeline.

Co-Authored-By: ForgeCode <noreply@forgecode.dev>
@github-actions github-actions Bot added the type: feature Brand new functionality, features, pages, workflows, endpoints, etc. label Apr 24, 2026
@amitksingh1490 amitksingh1490 changed the title feat: default reasoning_content to empty string for DeepSeek fix: default reasoning_content to empty string for DeepSeek Apr 24, 2026
@amitksingh1490 amitksingh1490 added type: fix Iterations on existing features or infrastructure. and removed type: feature Brand new functionality, features, pages, workflows, endpoints, etc. labels Apr 24, 2026
@amitksingh1490 amitksingh1490 merged commit 3b5ceb8 into main Apr 24, 2026
20 checks passed
@amitksingh1490 amitksingh1490 deleted the feat/deepseek-reasoning-content-fallback branch April 24, 2026 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: fix Iterations on existing features or infrastructure.

1 participant