2023-07-05 15:37:33 -04:00
|
|
|
![ollama](https://github.com/jmorganca/ollama/assets/251292/961f99bb-251a-4eec-897d-1ba99997ad0f)
|
|
|
|
|
2023-06-27 12:08:52 -04:00
|
|
|
# Ollama
|
2023-06-22 12:45:31 -04:00
|
|
|
|
2023-07-05 15:37:33 -04:00
|
|
|
Run large language models with `llama.cpp`.
|
|
|
|
|
2023-07-07 23:54:50 -04:00
|
|
|
> Note: certain models that can be run with Ollama are intended for research and/or non-commercial use only.
|
2023-07-05 15:37:33 -04:00
|
|
|
|
|
|
|
### Features
|
2023-06-27 17:13:07 -04:00
|
|
|
|
2023-07-05 15:37:33 -04:00
|
|
|
- Download and run popular large language models
|
|
|
|
- Switch between multiple models on the fly
|
|
|
|
- Hardware acceleration where available (Metal, CUDA)
|
2023-07-05 16:32:49 -04:00
|
|
|
- Fast inference server written in Go, powered by [llama.cpp](https://github.com/ggerganov/llama.cpp)
|
2023-07-05 15:37:33 -04:00
|
|
|
- REST API to use with your application (python, typescript SDKs coming soon)
|
2023-06-28 09:57:36 -04:00
|
|
|
|
|
|
|
## Install
|
2023-06-22 12:45:31 -04:00
|
|
|
|
2023-07-17 11:22:22 -07:00
|
|
|
- [Download](https://ollama.ai/download) for macOS with Apple Silicon (Intel coming soon)
|
2023-07-05 15:37:33 -04:00
|
|
|
- Download for Windows (coming soon)
|
|
|
|
|
|
|
|
You can also build the [binary from source](#building).
|
|
|
|
|
|
|
|
## Quickstart
|
|
|
|
|
2023-07-07 15:33:50 -04:00
|
|
|
Run a fast and simple model.
|
2023-06-30 12:39:25 -04:00
|
|
|
|
2023-06-22 12:45:31 -04:00
|
|
|
```
|
2023-07-07 15:33:50 -04:00
|
|
|
ollama run orca
|
2023-06-22 12:45:31 -04:00
|
|
|
```
|
|
|
|
|
2023-07-05 15:37:33 -04:00
|
|
|
## Example models
|
|
|
|
|
|
|
|
### 💬 Chat
|
|
|
|
|
|
|
|
Have a conversation.
|
2023-06-30 12:39:25 -04:00
|
|
|
|
2023-06-30 12:31:00 -04:00
|
|
|
```
|
2023-07-05 15:37:33 -04:00
|
|
|
ollama run vicuna "Why is the sky blue?"
|
2023-06-30 12:31:00 -04:00
|
|
|
```
|
|
|
|
|
2023-07-05 15:37:33 -04:00
|
|
|
### 🗺️ Instructions
|
2023-06-25 13:08:03 -04:00
|
|
|
|
2023-07-08 19:19:31 -04:00
|
|
|
Get a helping hand.
|
2023-06-29 18:25:02 -04:00
|
|
|
|
|
|
|
```
|
2023-07-05 15:37:33 -04:00
|
|
|
ollama run orca "Write an email to my boss."
|
2023-06-25 13:08:03 -04:00
|
|
|
```
|
|
|
|
|
2023-07-07 16:14:58 -04:00
|
|
|
### 🔎 Ask questions about documents
|
|
|
|
|
|
|
|
Send the contents of a document and ask questions about it.
|
|
|
|
|
|
|
|
```
|
|
|
|
ollama run nous-hermes "$(cat input.txt)", please summarize this story
|
|
|
|
```
|
|
|
|
|
2023-07-05 15:37:33 -04:00
|
|
|
### 📖 Storytelling
|
|
|
|
|
|
|
|
Venture into the unknown.
|
2023-06-29 18:25:02 -04:00
|
|
|
|
|
|
|
```
|
2023-07-06 16:21:01 -04:00
|
|
|
ollama run nous-hermes "Once upon a time"
|
|
|
|
```
|
|
|
|
|
|
|
|
## Advanced usage
|
|
|
|
|
|
|
|
### Run a local model
|
|
|
|
|
|
|
|
```
|
|
|
|
ollama run ~/Downloads/vicuna-7b-v1.3.ggmlv3.q4_1.bin
|
2023-06-28 09:57:36 -04:00
|
|
|
```
|
|
|
|
|
2023-07-03 16:32:48 -04:00
|
|
|
## Building
|
|
|
|
|
|
|
|
```
|
2023-07-11 09:50:02 -07:00
|
|
|
go build .
|
2023-07-03 16:32:48 -04:00
|
|
|
```
|
|
|
|
|
2023-07-05 15:37:33 -04:00
|
|
|
To run it start the server:
|
2023-06-27 13:46:46 -04:00
|
|
|
|
2023-07-05 15:37:33 -04:00
|
|
|
```
|
|
|
|
./ollama server &
|
|
|
|
```
|
|
|
|
|
|
|
|
Finally, run a model!
|
|
|
|
|
|
|
|
```
|
|
|
|
./ollama run ~/Downloads/vicuna-7b-v1.3.ggmlv3.q4_1.bin
|
|
|
|
```
|
|
|
|
|
|
|
|
## API Reference
|
|
|
|
|
2023-07-06 16:46:05 -04:00
|
|
|
### `POST /api/pull`
|
|
|
|
|
|
|
|
Download a model
|
|
|
|
|
|
|
|
```
|
|
|
|
curl -X POST http://localhost:11343/api/pull -d '{"model": "orca"}'
|
|
|
|
```
|
|
|
|
|
|
|
|
### `POST /api/generate`
|
2023-07-05 15:37:33 -04:00
|
|
|
|
|
|
|
Complete a prompt
|
|
|
|
|
|
|
|
```
|
2023-07-12 19:16:28 -07:00
|
|
|
curl -X POST http://localhost:11434/api/generate -d '{"model": "orca", "prompt": "hello!"}'
|
2023-07-05 15:37:33 -04:00
|
|
|
```
|