Fix DeepSeek Reasoner tool-call handling and add reasoning_content support (#44301) (cherry-pick to preview) (#44497)
zed-zippy[bot]
,
Peter König
, and
Ben Brandt
created
Cherry-pick of #44301 to preview
----
## Closes #43887
## Release Notes:
### Problem
DeepSeek's reasoning mode API requires `reasoning_content` to be
included in assistant messages that precede tool calls. Without it, the
API returns a 400 error:
```
Missing `reasoning_content` field in the assistant message at message index 2
```
### Added/Fixed/Improved
- Add `reasoning_content` field to `RequestMessage::Assistant` in
`crates/deepseek/src/deepseek.rs`
- Accumulate thinking content from `MessageContent::Thinking` and attach
it to the next assistant/tool-call message
- Wire reasoning content through the language model provider in
`crates/language_models/src/provider/deepseek.rs`
### Testing
- Verified with DeepSeek Reasoner model using tool calls
- Confirmed reasoning content is properly included in API requests
Fixes tool-call errors when using DeepSeek's reasoning mode.
---------
Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
Co-authored-by: Peter König <pek-github@nospam.scanea.de>
Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>