# Fix DeepSeek Reasoner tool-call handling and add reasoning_content support \(\#44301\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/5dd8561b06c8af4ee46f3aa8bcf839f208b8c7bf)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 5dd8561b06c8af4ee46f3aa8bcf839f208b8c7bf

Requested commit: 5dd8561b06c8af4ee46f3aa8bcf839f208b8c7bf

Commit: 5dd8561b06c8af4ee46f3aa8bcf839f208b8c7bf

Tree: a20386248a84f4c7bd6164034e4aab8353a7a5c4

Author: Peter König

Committer: GitHub

## Message

````
Fix DeepSeek Reasoner tool-call handling and add reasoning_content support (#44301)

## 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>
````

## Parents

- [bfab0b71e0a92cd75d309909fd247aadc3a8a7e0](https://git.cafe/gitcafe/zed/commit/bfab0b71e0a92cd75d309909fd247aadc3a8a7e0?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/5dd8561b06c8af4ee46f3aa8bcf839f208b8c7bf?format=markdown)
