2023-10-30 22:53:39 +03:00
---
2023-12-29 13:01:02 +03:00
title: Ollama
2023-10-30 22:53:39 +03:00
---
2023-11-29 21:17:16 +03:00
The guide was put together in collaboration with members of the Quivr Discord, **Using Quivr fully locally** thread. That is a good place to discuss it. https://discord.com/invite/HUpRgp2HG8
2023-10-30 22:53:39 +03:00
2023-11-29 21:17:16 +03:00
## Ollama
2023-10-30 22:53:39 +03:00
2023-11-29 21:17:16 +03:00
Ollama is a tool that allows you to run LLMs locally. We are using it to run Llama2, MistralAI and others locally.
2023-10-30 22:53:39 +03:00
2023-11-29 21:17:16 +03:00
### Install Ollama
2023-10-30 22:53:39 +03:00
2023-11-29 21:17:16 +03:00
Install Ollama from their [website](https://ollama.ai/).
2023-10-30 22:53:39 +03:00
2023-11-29 21:17:16 +03:00
Then run the following command to run Ollama in the background:
2023-10-30 22:53:39 +03:00
2023-11-29 21:17:16 +03:00
```bash
ollama run llama2
2023-10-30 22:53:39 +03:00
```
2023-10-31 20:16:51 +03:00
2023-11-29 21:17:16 +03:00
## Add Ollama Model to Quivr
Now that you have your model running locally, you need to add it to Quivr.
2023-12-02 17:43:05 +03:00
In order to allow the user to choose between the Ollama, we need to add a new model to the Quivr backend.
2023-11-29 21:17:16 +03:00
Go to supabase and in the table `user_settings` either add by default or to your user the following value to the `models` column:
```json
[
2023-12-02 17:43:05 +03:00
"ollama/llama2",
"ollama/mistral",
2023-11-29 21:17:16 +03:00
]
2023-10-30 22:53:39 +03:00
```
2023-11-29 21:17:16 +03:00
This will add the Ollama model to the list of models that the user can choose from.
2023-10-30 22:53:39 +03:00
2023-11-29 21:17:16 +03:00
By adding this as default, it means that all new users will have this model by default. If you want to add it to your user only, you can add it to the `models` column in the `user_settings` table. In order for the change to take effect if you put as default your need to drop the entire table with the following command:
2023-10-30 22:53:39 +03:00
2023-11-29 21:17:16 +03:00
```sql
2023-12-02 17:15:09 +03:00
DELETE TABLE user_settings;
2023-10-30 22:53:39 +03:00
```