# ollama: Fix thinking being also sent as content \(\#55540\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 65107c90b10d2719b4739277ed5c06612d3180a4

Requested commit: 65107c90b10d2719b4739277ed5c06612d3180a4

Commit: 65107c90b10d2719b4739277ed5c06612d3180a4

Tree: b95673c1172bbe762e4d106007a003a6d4870972

Author: marius851000

Committer: GitHub

## Message

```
ollama: Fix thinking being also sent as content (#55540)

"msg.string_contents();" return more than just content. It also return
tool result (which need special handling, and should be emitted from the
tool role) and thinking (which need already implemented special
handling).

This resulted in thinking being sent as content, which apparently
ollama’s gemma4 parser didn’t handled well, and caused a number of issue
that manifested by 1. outputting end of though token where unappropriate
and 2. repeating things endlessly

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [ ] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
(no UI/UX impact)
- [ ] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable (a quick
review, without benchmark, show that this should be at least as fast as
the previous code. This is called only exceptionally anyway.)

Closes #55537

Release Notes:

- Fixed "thinking" text being badly formatted when sent to Ollama
```

## Parents

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

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