# Ollama Provider for Assistant \(\#12902\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 4cb8d6f40ed1427353dcba5a10fcc4b22da1a365

Requested commit: 4cb8d6f40ed1427353dcba5a10fcc4b22da1a365

Commit: 4cb8d6f40ed1427353dcba5a10fcc4b22da1a365

Tree: f08add63e6ec83294e3afab3a3793d1158c9b224

Author: Kyle Kelley

Committer: GitHub

## Message

````
Ollama Provider for Assistant (#12902)

Closes #4424.

A few design decisions that may need some rethinking or later PRs:

* Other providers have a check for authentication. I use this
opportunity to fetch the models which doubles as a way of finding out if
the Ollama server is running.
* Ollama has _no_ API for getting the max tokens per model
* Ollama has _no_ API for getting the current token count
https://github.com/ollama/ollama/issues/1716
* Ollama does allow setting the `num_ctx` so I've defaulted this to
4096. It can be overridden in settings.
* Ollama models will be "slow" to start inference because they're
loading the model into memory. It's faster after that. There's no UI
affordance to show that the model is being loaded.

Release Notes:

- Added an Ollama Provider for the assistant. If you have
[Ollama](https://ollama.com/) running locally on your machine, you can
enable it in your settings under:

```jsonc
"assistant": {
    "version": "1",
    "provider": {
      "name": "ollama",
      // Recommended setting to allow for model startup
      "low_speed_timeout_in_seconds": 30,
    }
}
```

Chat like usual

<img width="1840" alt="image"
src="https://github.com/zed-industries/zed/assets/836375/4e0af266-4c4f-4d9e-9d74-1a91f76a12fe">

Interact with any model from the [Ollama
Library](https://ollama.com/library)

<img width="587" alt="image"
src="https://github.com/zed-industries/zed/assets/836375/87433ac6-bf87-4a99-89e1-96a93bf8de8a">

Open up the terminal to download new models via `ollama pull`:


![image](https://github.com/zed-industries/zed/assets/836375/af7ec411-76bf-41c7-ba81-64bbaeea98a8)
````

## Parents

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

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