docs(Ollama): Update Ollama docs (#9234)
The Ollama docs where very out of date and needed updating so I have updated them and added some screenshots so its easier to follow. I have also added a new Ollama model to the platform, "llama3.2" as that is what i based the tutorial off and its name is easy to find in the list of models I also added a new folder in the "imgs" dir to store the Ollama related photo just to keep things tidypull/9229/head^2
|
@ -109,6 +109,7 @@ class LlmModel(str, Enum, metaclass=LlmModelMeta):
|
|||
LLAMA3_1_70B = "llama-3.1-70b-versatile"
|
||||
LLAMA3_1_8B = "llama-3.1-8b-instant"
|
||||
# Ollama models
|
||||
OLLAMA_LLAMA3_2 = "llama3.2"
|
||||
OLLAMA_LLAMA3_8B = "llama3"
|
||||
OLLAMA_LLAMA3_405B = "llama3.1:405b"
|
||||
OLLAMA_DOLPHIN = "dolphin-mistral:latest"
|
||||
|
@ -163,6 +164,7 @@ MODEL_METADATA = {
|
|||
# Limited to 16k during preview
|
||||
LlmModel.LLAMA3_1_70B: ModelMetadata("groq", 131072),
|
||||
LlmModel.LLAMA3_1_8B: ModelMetadata("groq", 131072),
|
||||
LlmModel.OLLAMA_LLAMA3_2: ModelMetadata("ollama", 8192),
|
||||
LlmModel.OLLAMA_LLAMA3_8B: ModelMetadata("ollama", 8192),
|
||||
LlmModel.OLLAMA_LLAMA3_405B: ModelMetadata("ollama", 8192),
|
||||
LlmModel.OLLAMA_DOLPHIN: ModelMetadata("ollama", 32768),
|
||||
|
|
|
@ -51,6 +51,7 @@ MODEL_COST: dict[LlmModel, int] = {
|
|||
LlmModel.LLAMA3_1_405B: 1,
|
||||
LlmModel.LLAMA3_1_70B: 1,
|
||||
LlmModel.LLAMA3_1_8B: 1,
|
||||
LlmModel.OLLAMA_LLAMA3_2: 1,
|
||||
LlmModel.OLLAMA_LLAMA3_8B: 1,
|
||||
LlmModel.OLLAMA_LLAMA3_405B: 1,
|
||||
LlmModel.OLLAMA_DOLPHIN: 1,
|
||||
|
|
After Width: | Height: | Size: 115 KiB |
After Width: | Height: | Size: 88 KiB |
After Width: | Height: | Size: 105 KiB |
After Width: | Height: | Size: 29 KiB |
After Width: | Height: | Size: 6.0 KiB |
After Width: | Height: | Size: 105 KiB |
After Width: | Height: | Size: 116 KiB |
|
@ -1,37 +1,78 @@
|
|||
# Running Ollama with AutoGPT
|
||||
|
||||
Follow these steps to set up and run Ollama and your AutoGPT project:
|
||||
> **Important**: Ollama integration is only available when self-hosting the AutoGPT platform. It cannot be used with the cloud-hosted version.
|
||||
|
||||
1. **Run Ollama**
|
||||
- Open a terminal
|
||||
- Execute the following command:
|
||||
```
|
||||
ollama run llama3
|
||||
```
|
||||
- Leave this terminal running
|
||||
Follow these steps to set up and run Ollama with the AutoGPT platform.
|
||||
|
||||
2. **Run the Backend**
|
||||
- Open a new terminal
|
||||
- Navigate to the backend directory in the AutoGPT project:
|
||||
```
|
||||
cd autogpt_platform/backend/
|
||||
```
|
||||
- Start the backend using Poetry:
|
||||
```
|
||||
poetry run app
|
||||
```
|
||||
## Prerequisites
|
||||
|
||||
3. **Run the Frontend**
|
||||
- Open another terminal
|
||||
- Navigate to the frontend directory in the AutoGPT project:
|
||||
```
|
||||
cd autogpt_platform/frontend/
|
||||
```
|
||||
- Start the frontend development server:
|
||||
```
|
||||
npm run dev
|
||||
```
|
||||
1. Make sure you have gone through and completed the [AutoGPT Setup](/platform/getting-started) steps, if not please do so before continuing with this guide.
|
||||
2. Before starting, ensure you have [Ollama installed](https://ollama.com/download) on your machine.
|
||||
|
||||
4. **Choose the Ollama Model**
|
||||
- Add LLMBlock in the UI
|
||||
- Choose the last option in the model selection dropdown
|
||||
## Setup Steps
|
||||
|
||||
### 1. Launch Ollama
|
||||
Open a new terminal and execute:
|
||||
```bash
|
||||
ollama run llama3.2
|
||||
```
|
||||
|
||||
> **Note**: This will download the [llama3.2](https://ollama.com/library/llama3.2) model and start the service. Keep this terminal running in the background.
|
||||
|
||||
### 2. Start the Backend
|
||||
Open a new terminal and navigate to the autogpt_platform directory:
|
||||
```bash
|
||||
cd autogpt_platform
|
||||
docker compose up -d --build
|
||||
```
|
||||
|
||||
### 3. Start the Frontend
|
||||
Open a new terminal and navigate to the frontend directory:
|
||||
```bash
|
||||
cd autogpt_platform/frontend
|
||||
npm run dev
|
||||
```
|
||||
|
||||
Then visit [http://localhost:3000](http://localhost:3000) to see the frontend running, after registering an account/logging in, navigate to the build page at [http://localhost:3000/build](http://localhost:3000/build)
|
||||
|
||||
### 4. Using Ollama with AutoGPT
|
||||
|
||||
Now that both Ollama and the AutoGPT platform are running we can move onto using Ollama with AutoGPT:
|
||||
|
||||
1. Add an AI Text Generator block to your workspace (it can work with any AI LLM block but for this example will be using the AI Text Generator block):
|
||||
![Add AI Text Generator Block](../imgs/ollama/Select-AI-block.png)
|
||||
|
||||
2. In the "LLM Model" dropdown, select "llama3.2" (This is the model we downloaded earlier)
|
||||
![Select Ollama Model](../imgs/ollama/Ollama-Select-Llama32.png)
|
||||
|
||||
3. You will see it ask for "Ollama Credentials", simply press "Enter API key"
|
||||
![Ollama Credentials](../imgs/ollama/Ollama-Enter-API-key.png)
|
||||
|
||||
And you will see "Add new API key for Ollama", In the API key field you can enter anything you want as Ollama does not require an API key, I usually just enter a space, for the Name call it "Ollama" then press "Save & use this API key"
|
||||
![Ollama Credentials](../imgs/ollama/Ollama-Credentials.png)
|
||||
|
||||
4. After that you will now see the block again, add your prompts then save and then run the graph:
|
||||
![Add Prompt](../imgs/ollama/Ollama-Add-Prompts.png)
|
||||
|
||||
That's it! You've successfully setup the AutoGPT platform and made a LLM call to Ollama.
|
||||
![Ollama Output](../imgs/ollama/Ollama-Output.png)
|
||||
|
||||
|
||||
### Using Ollama on a Remote Server with AutoGPT
|
||||
For running Ollama on a remote server, simply make sure the Ollama server is running and is accessible from other devices on your network/remotely through the port 11434, then you can use the same steps above but you need to add the Ollama servers IP address to the "Ollama Host" field in the block settings like so:
|
||||
|
||||
![Ollama Remote Host](../imgs/ollama/Ollama-Remote-Host.png)
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
If you encounter any issues, verify that:
|
||||
|
||||
- Ollama is properly installed and running
|
||||
- All terminals remain open during operation
|
||||
- Docker is running before starting the backend
|
||||
|
||||
For common errors:
|
||||
|
||||
1. **Connection Refused**: Make sure Ollama is running and the host address is correct (also make sure the port is correct, its default is 11434)
|
||||
2. **Model Not Found**: Try running `ollama pull llama3.2` manually first
|
||||
3. **Docker Issues**: Ensure Docker daemon is running with `docker ps`
|