2023-07-19 03:45:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								< div  align = "center" >  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  < picture > 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-20 23:55:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    < source  media = "(prefers-color-scheme: dark)"  height = "200px"  srcset = "https://github.com/jmorganca/ollama/assets/3325447/56ea1849-1284-4645-8970-956de6e51c3c" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    < img  alt = "logo"  height = "200px"  src = "https://github.com/jmorganca/ollama/assets/3325447/0d0b44e2-8f4a-4e99-9b52-a5c1c741c8f7" > 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-19 03:45:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  < / picture > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								< / div >  
						 
					
						
							
								
									
										
										
										
											2023-07-06 03:37:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-06-28 00:08:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# Ollama
  
						 
					
						
							
								
									
										
										
										
											2023-06-23 00:45:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-07-20 03:31:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								[](https://discord.gg/ollama)
							 
						 
					
						
							
								
									
										
										
										
											2023-07-20 03:28:50 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-26 14:44:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Get up and running with large language models locally.
							 
						 
					
						
							
								
									
										
										
										
											2023-07-20 23:33:28 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-26 14:44:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### macOS
  
						 
					
						
							
								
									
										
										
										
											2023-08-09 06:50:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-10-12 07:24:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								[Download ](https://ollama.ai/download/Ollama-darwin.zip )
							 
						 
					
						
							
								
									
										
										
										
											2023-07-19 04:31:25 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-10-15 14:23:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### Windows
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Coming soon!
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-26 14:44:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### Linux & WSL2
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								curl https://ollama.ai/install.sh | sh
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								[Manual install instructions ](https://github.com/jmorganca/ollama/blob/main/docs/linux.md )
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-10-15 14:23:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### Docker
  
						 
					
						
							
								
									
										
										
										
											2023-09-26 14:44:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-11-05 03:24:24 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								The official [Ollama Docker image ](https://hub.docker.com/r/ollama/ollama ) `ollama/ollama`  is available on Docker Hub.
							 
						 
					
						
							
								
									
										
										
										
											2023-07-19 04:31:25 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-07-20 03:28:50 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								## Quickstart
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-26 14:44:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								To run and chat with [Llama 2 ](https://ollama.ai/library/llama2 ):
							 
						 
					
						
							
								
									
										
										
										
											2023-07-20 03:28:50 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								ollama run llama2
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								## Model library
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-10-12 07:24:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Ollama supports a list of open-source models available on [ollama.ai/library ](https://ollama.ai/library 'ollama model library' )
							 
						 
					
						
							
								
									
										
										
										
											2023-08-17 10:53:27 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-26 11:44:26 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Here are some example open-source models that can be downloaded:
							 
						 
					
						
							
								
									
										
										
										
											2023-07-20 03:28:50 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-26 14:44:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								| Model              | Parameters | Size  | Download                       |
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								| ------------------ | ---------- | ----- | ------------------------------ |
							 
						 
					
						
							
								
									
										
										
										
											2023-09-29 00:06:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								| Mistral            | 7B         | 4.1GB | `ollama run mistral`            |
							 
						 
					
						
							
								
									
										
										
										
											2023-09-26 14:44:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								| Llama 2            | 7B         | 3.8GB | `ollama run llama2`             |
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								| Code Llama         | 7B         | 3.8GB | `ollama run codellama`          |
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								| Llama 2 Uncensored | 7B         | 3.8GB | `ollama run llama2-uncensored`  |
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								| Llama 2 13B        | 13B        | 7.3GB | `ollama run llama2:13b`         |
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								| Llama 2 70B        | 70B        | 39GB  | `ollama run llama2:70b`         |
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								| Orca Mini          | 3B         | 1.9GB | `ollama run orca-mini`          |
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								| Vicuna             | 7B         | 3.8GB | `ollama run vicuna`             |
							 
						 
					
						
							
								
									
										
										
										
											2023-07-20 03:28:50 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-07-21 03:21:29 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								>  Note: You should have at least 8 GB of RAM to run the 3B models, 16 GB to run the 7B models, and 32 GB to run the 13B models.
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-26 14:44:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								## Customize your own model
  
						 
					
						
							
								
									
										
										
										
											2023-06-28 05:13:07 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-10-15 14:23:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### Import from GGUF
  
						 
					
						
							
								
									
										
										
										
											2023-09-01 22:54:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-10-15 14:23:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Ollama supports importing GGUF models in the Modelfile:
							 
						 
					
						
							
								
									
										
										
										
											2023-09-01 22:54:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-10-15 14:23:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								1.  Create a file named `Modelfile` , with a `FROM`  instruction with the local filepath to the model you want to import. 
						 
					
						
							
								
									
										
										
										
											2023-09-01 22:54:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-26 14:44:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								   ```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   FROM ./vicuna-33b.Q4_0.gguf
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   ```
							 
						 
					
						
							
								
									
										
										
										
											2023-07-01 00:39:25 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-10-12 07:24:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								2.  Create the model in Ollama 
						 
					
						
							
								
									
										
										
										
											2023-06-23 00:45:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-26 14:44:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								   ```
							 
						 
					
						
							
								
									
										
										
										
											2023-10-15 14:23:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								   ollama create example -f Modelfile
							 
						 
					
						
							
								
									
										
										
										
											2023-09-26 14:44:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								   ```
							 
						 
					
						
							
								
									
										
										
										
											2023-08-10 23:22:28 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-10-12 07:24:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								3.  Run the model 
						 
					
						
							
								
									
										
										
										
											2023-09-02 04:44:14 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-26 14:44:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								   ```
							 
						 
					
						
							
								
									
										
										
										
											2023-10-15 14:23:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								   ollama run example
							 
						 
					
						
							
								
									
										
										
										
											2023-09-26 14:44:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								   ```
							 
						 
					
						
							
								
									
										
										
										
											2023-09-02 04:44:14 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-10-15 14:23:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### Import from PyTorch or Safetensors
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								See the [guide ](docs/import.md ) on importing models for more information.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-26 14:44:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### Customize a prompt
  
						 
					
						
							
								
									
										
										
										
											2023-09-02 04:44:14 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-10-26 07:19:21 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Models from the Ollama library can be customized with a prompt. For example, to customize the `llama2`  model:
							 
						 
					
						
							
								
									
										
										
										
											2023-07-20 03:28:50 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
									
										
										
										
											2023-07-20 17:21:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								ollama pull llama2
							 
						 
					
						
							
								
									
										
										
										
											2023-07-20 03:28:50 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
									
										
										
										
											2023-08-09 06:41:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-07-19 04:22:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Create a `Modelfile` :
							 
						 
					
						
							
								
									
										
										
										
											2023-07-06 03:37:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-07-01 00:31:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
									
										
										
										
											2023-07-20 17:21:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								FROM llama2
							 
						 
					
						
							
								
									
										
										
										
											2023-07-20 23:17:09 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# set the temperature to 1 [higher is more creative, lower is more coherent]
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								PARAMETER temperature 1
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# set the system prompt
  
						 
					
						
							
								
									
										
										
										
											2023-07-20 17:21:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								SYSTEM """
							 
						 
					
						
							
								
									
										
										
										
											2023-07-19 04:32:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								You are Mario from Super Mario Bros. Answer as Mario, the assistant, only.
							 
						 
					
						
							
								
									
										
										
										
											2023-07-19 04:22:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								"""
							 
						 
					
						
							
								
									
										
										
										
											2023-06-30 06:25:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
									
										
										
										
											2023-07-08 04:14:58 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-07-19 04:22:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Next, create and run the model:
							 
						 
					
						
							
								
									
										
										
										
											2023-07-08 04:14:58 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
									
										
										
										
											2023-07-19 04:22:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								ollama create mario -f ./Modelfile
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								ollama run mario
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								>>> hi
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Hello! It's your friend Mario.
							 
						 
					
						
							
								
									
										
										
										
											2023-07-08 04:14:58 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-10-12 07:24:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								For more examples, see the [examples ](examples ) directory. For more information on working with a Modelfile, see the [Modelfile ](docs/modelfile.md ) documentation.
							 
						 
					
						
							
								
									
										
										
										
											2023-09-26 14:44:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								## CLI Reference
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								### Create a model
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								`ollama create`  is used to create a model from a Modelfile. 
						 
					
						
							
								
									
										
										
										
											2023-07-20 03:28:50 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-26 14:44:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### Pull a model
  
						 
					
						
							
								
									
										
										
										
											2023-07-07 04:21:01 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-07-20 03:28:50 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
									
										
										
										
											2023-09-26 14:44:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								ollama pull llama2
							 
						 
					
						
							
								
									
										
										
										
											2023-07-20 03:28:50 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
									
										
										
										
											2023-06-28 21:57:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-26 14:44:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								>  This command can also be used to update a local model. Only the diff will be pulled.
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								### Remove a model
  
						 
					
						
							
								
									
										
										
										
											2023-07-21 03:21:29 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
									
										
										
										
											2023-09-01 22:54:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								ollama rm llama2
							 
						 
					
						
							
								
									
										
										
										
											2023-07-21 03:21:29 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-26 14:44:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### Copy a model
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								ollama cp llama2 my-llama2
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								### Multiline input
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								For multiline input, you can wrap text with `"""` :
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								>>> """Hello,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								... world!
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								... """
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								I'm a basic program that prints the famous "Hello, world!" message to the console.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								### Pass in prompt as arguments
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
									
										
										
										
											2023-11-08 15:52:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								$ ollama run llama2 "Summarize this file: $(cat README.md)"
							 
						 
					
						
							
								
									
										
										
										
											2023-09-26 14:44:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								 Ollama is a lightweight, extensible framework for building and running language models on the local machine. It provides a simple API for creating, running, and managing models, as well as a library of pre-built models that can be easily used in a variety of applications.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								### List models on your computer
  
						 
					
						
							
								
									
										
										
										
											2023-07-21 03:21:29 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-26 14:44:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								ollama list
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
									
										
										
										
											2023-07-21 03:21:29 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-26 14:44:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### Start Ollama
  
						 
					
						
							
								
									
										
										
										
											2023-07-21 03:21:29 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-26 14:44:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								`ollama serve`  is used when you want to start ollama without running the desktop application. 
						 
					
						
							
								
									
										
										
										
											2023-07-21 03:21:29 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-07-04 04:32:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								## Building
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-07 18:43:26 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Install `cmake`  and `go` :
							 
						 
					
						
							
								
									
										
										
										
											2023-08-26 02:44:25 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-07-04 04:32:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
									
										
										
										
											2023-10-27 15:10:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								brew install cmake go
							 
						 
					
						
							
								
									
										
										
										
											2023-08-31 05:54:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Then generate dependencies and build:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								go generate ./...
							 
						 
					
						
							
								
									
										
										
										
											2023-07-12 00:50:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								go build .
							 
						 
					
						
							
								
									
										
										
										
											2023-07-04 04:32:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-31 05:54:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Next, start the server:
							 
						 
					
						
							
								
									
										
										
										
											2023-06-28 01:46:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-07-06 03:37:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
									
										
										
										
											2023-08-31 05:54:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								./ollama serve
							 
						 
					
						
							
								
									
										
										
										
											2023-07-06 03:37:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-01 22:54:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Finally, in a separate shell, run a model:
							 
						 
					
						
							
								
									
										
										
										
											2023-07-06 03:37:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
									
										
										
										
											2023-07-19 04:22:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								./ollama run llama2
							 
						 
					
						
							
								
									
										
										
										
											2023-07-06 03:37:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
									
										
										
										
											2023-07-21 15:47:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								## REST API
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-10-27 15:10:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Ollama has a REST API for running and managing models.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								For example, to generate text from a model:
							 
						 
					
						
							
								
									
										
										
										
											2023-07-21 15:47:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
									
										
										
										
											2023-08-09 06:48:47 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								curl -X POST http://localhost:11434/api/generate -d '{
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  "model": "llama2",
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  "prompt":"Why is the sky blue?"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}'
							 
						 
					
						
							
								
									
										
										
										
											2023-07-24 06:01:05 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
									
										
										
										
											2023-08-01 04:59:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-10-27 15:10:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								See the [API documentation ](./docs/api.md ) for all endpoints.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-26 14:44:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								## Community Integrations
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-11-08 16:03:29 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### Web & Desktop
  
						 
					
						
							
								
									
										
										
										
											2023-11-08 15:52:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-10-29 05:02:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								-  [HTML UI ](https://github.com/rtcfirefly/ollama-ui ) 
						 
					
						
							
								
									
										
										
										
											2023-10-29 05:18:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								-  [Chatbot UI ](https://github.com/ivanfioravanti/chatbot-ollama ) 
						 
					
						
							
								
									
										
										
										
											2023-10-29 05:02:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								-  [Typescript UI ](https://github.com/ollama-interface/Ollama-Gui?tab=readme-ov-file ) 
						 
					
						
							
								
									
										
										
										
											2023-10-29 05:18:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								-  [Minimalistic React UI for Ollama Models ](https://github.com/richawo/minimal-llm-ui ) 
						 
					
						
							
								
									
										
										
										
											2023-10-29 05:02:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								-  [Web UI ](https://github.com/ollama-webui/ollama-webui ) 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-11-08 16:03:29 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### Terminal
  
						 
					
						
							
								
									
										
										
										
											2023-11-08 15:52:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-10-29 05:02:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								-  [oterm ](https://github.com/ggozad/oterm ) 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								-  [Ellama Emacs client ](https://github.com/s-kostyaev/ellama ) 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								-  [Emacs client ](https://github.com/zweifisch/ollama ) 
						 
					
						
							
								
									
										
										
										
											2023-11-07 03:27:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								-  [gen.nvim ](https://github.com/David-Kunz/gen.nvim ) 
						 
					
						
							
								
									
										
										
										
											2023-10-29 05:02:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								### Libraries
  
						 
					
						
							
								
									
										
										
										
											2023-11-08 15:52:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-26 14:44:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								-  [LangChain ](https://python.langchain.com/docs/integrations/llms/ollama ) and [LangChain.js ](https://js.langchain.com/docs/modules/model_io/models/llms/integrations/ollama ) with [example ](https://js.langchain.com/docs/use_cases/question_answering/local_retrieval_qa ) 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								-  [LlamaIndex ](https://gpt-index.readthedocs.io/en/stable/examples/llm/ollama.html ) 
						 
					
						
							
								
									
										
										
										
											2023-10-29 05:02:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								-  [LiteLLM ](https://github.com/BerriAI/litellm ) 
						 
					
						
							
								
									
										
										
										
											2023-10-29 05:18:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								-  [OllamaSharp for .NET ](https://github.com/awaescher/OllamaSharp ) 
						 
					
						
							
								
									
										
										
										
											2023-11-05 08:12:18 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								-  [Ollama-rs for Rust ](https://github.com/pepperoni21/ollama-rs ) 
						 
					
						
							
								
									
										
										
										
											2023-11-07 03:27:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								-  [ModelFusion Typescript Library ](https://modelfusion.dev/integration/model-provider/ollama ) 
						 
					
						
							
								
									
										
										
										
											2023-10-29 05:02:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-11-08 15:52:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### Extensions & Plugins
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-26 14:44:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								-  [Raycast extension ](https://github.com/MassimilianoPasquini97/raycast_ollama ) 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								-  [Discollama ](https://github.com/mxyng/discollama ) (Discord bot inside the Ollama discord channel) 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								-  [Continue ](https://github.com/continuedev/continue ) 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								-  [Obsidian Ollama plugin ](https://github.com/hinterdupfinger/obsidian-ollama ) 
						 
					
						
							
								
									
										
										
										
											2023-11-08 01:58:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								-  [Logseq Ollama plugin ](https://github.com/omagdy7/ollama-logseq ) 
						 
					
						
							
								
									
										
										
										
											2023-09-26 14:44:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								-  [Dagger Chatbot ](https://github.com/samalba/dagger-chatbot ) 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								-  [Discord AI Bot ](https://github.com/mekb-turtle/discord-ai-bot ) 
						 
					
						
							
								
									
										
										
										
											2023-11-08 01:58:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								-  [Hass Ollama Conversation ](https://github.com/ej52/hass-ollama-conversation )