# ollama: Add tool call support \(\#29563\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 769ec59162b316318233c90165dfeca173a716a3

Requested commit: 769ec59162b316318233c90165dfeca173a716a3

Commit: 769ec59162b316318233c90165dfeca173a716a3

Tree: a2a0a876527136a3eb77a98c6359e1285ebd1b96

Author: tidely

Committer: GitHub

## Message

```
ollama: Add tool call support (#29563)

The goal of this PR is to support tool calls using ollama. A lot of the
serialization work was done in
https://github.com/zed-industries/zed/pull/15803 however the abstraction
over language models always disables tools.

## Changelog:

- Use `serde_json::Value` inside `OllamaFunctionCall` just as it's used
in `OllamaFunctionCall`. This fixes deserialization of ollama tool
calls.
- Added deserialization tests using json from official ollama api docs.
- Fetch model capabilities during model enumeration from ollama provider
- Added `supports_tools` setting to manually configure if a model
supports tools

## TODO:

- [x] Fix tool call serialization/deserialization
- [x] Fetch model capabilities from ollama api
- [x] Add tests for parsing model capabilities 
- [ ] Documentation for `supports_tools` field for ollama language model
config
- [ ] Convert between generic language model types
- [x] Pass tools to ollama

Release Notes:

- N/A

---------

Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: Nathan Sobo <nathan@zed.dev>
```

## Parents

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

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