Skip to content

Conversation

@Abhinavexists
Copy link
Contributor

@Abhinavexists Abhinavexists commented Nov 24, 2025

Fixes: #34082

Description

This change restores DeepSeek-specific reasoning that is lost when LangChain routes messages through the OpenAI-style tool-calling pipeline. When tools are bound, the OpenAI tools parser rewrites the model response schema and drops non-OpenAI fields such as reasoning_content and _deepseek_reasoning. This patch re-attaches these fields inside ChatDeepSeek._create_chat_result()

Dependencies

None.

Expected output after fix

(AIMessageChunk(content='', additional_kwargs={}, response_metadata={'finish_reason': 'stop', 'model_name': 'deepseek-chat', 'system_fingerprint': 'fp_ffc7281d48_prod0820_fp8_kvcache', 'model_provider': 'deepseek'}, id='lc_run--1cfb846c-0626-4b96-a078-b1baa8e8b5c9', usage_metadata={'input_tokens': 153, 'output_tokens': 38, 'total_tokens': 191, 'input_token_details': {'cache_read': 128}, 'output_token_details': {}}, chunk_position='last'), {'langgraph_step': 1, 'langgraph_node': 'model', 'langgraph_triggers': ('branch:to:model',), 'langgraph_path': ('__pregel_pull', 'model'), 'langgraph_checkpoint_ns': 'model:2c51adc2-5aba-d990-71f7-325ab7aa624c', 'checkpoint_ns': 'model:2c51adc2-5aba-d990-71f7-325ab7aa624c', 'ls_provider': 'deepseek', 'ls_model_name': 'deepseek-reasoner', 'ls_model_type': 'chat', 'ls_temperature': None})

@github-actions github-actions bot added integration Related to a provider partner package integration core Related to the package `langchain-core` deepseek fix and removed fix labels Nov 24, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented Nov 24, 2025

CodSpeed Performance Report

Merging #34092 will not alter performance

Comparing Abhinavexists:deepseek-reasoning_content-fix (afa4999) with master (880652b)1

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

Summary

✅ 13 untouched
⏩ 21 skipped2

Footnotes

  1. No successful run was found on master (9c21f83) during the generation of this report, so 880652b was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

  2. 21 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Related to the package `langchain-core` deepseek fix integration Related to a provider partner package integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

When tools are bound in the create_agent function, the deepseek-reasoner model cannot return reasoning_content.

1 participant