Ollama: Difference between revisions

From Open Source Ecology
Jump to navigation Jump to search
(Created page with "# Ollama Ollama is an open-source tool that allows users to run large language models (LLMs) locally on their machines. It provides a simple interface to download, run, and interact with state-of-the-art language models like LLaMA, Mistral, and others. --- ## Table of Contents 1. [What is Ollama?](#what-is-ollama) 2. [Key Features](#key-features) 3. [How Ollama Works](#how-ollama-works) 4. [Installation](#installation) 5. [Usage](#usage) 6. [Supported Models](#supp...")
 
No edit summary
Line 1: Line 1:
# Ollama
Ollama is an open-source tool that allows users to run large language models (LLMs)  
Ollama is an open-source tool that allows users to run large language models (LLMs)  
locally on their machines. It provides a simple interface to download, run, and interact  
locally on their machines. It provides a simple interface to download, run, and interact  
Line 7: Line 5:
---
---


## Table of Contents
== Table of Contents ==


1. [What is Ollama?](#what-is-ollama)
1. [What is Ollama?](#what-is-ollama)
Line 22: Line 20:
---
---


## What is Ollama?
== What is Ollama? ==


Ollama is a tool designed to bring large language models to everyone. It enables users  
Ollama is a tool designed to bring large language models to everyone. It enables users  
to:
to:


- Run powerful AI models locally on their devices.
Run powerful AI models locally on their devices.
- Interact with models through a simple command-line interface (CLI) or API.
Interact with models through a simple command-line interface (CLI) or API.
- Avoid dependency on cloud services for processing.
Avoid dependency on cloud services for processing.


Ollama supports models such as LLaMA, Mistral, Phi, GPT-J, GPT-NeoX, and more. It is  
Ollama supports models such as LLaMA, Mistral, Phi, GPT-J, GPT-NeoX, and more. It is  
Line 36: Line 34:
---
---


## Key Features
== Key Features ==


- **Local Execution**: Models run entirely on your machine.
*   [[Local Execution]]: Models run entirely on your machine.
- **Simple CLI**: Easy-to-use commands for model interaction.
*   [[Simple CLI]]: Easy-to-use commands for model interaction.
- **Model Management**: Download, update, and manage models seamlessly.
*   [[Model Management]]: Download, update, and manage models seamlessly.
- **API Integration**: Expose model capabilities via a REST API.
*   [[API Integration]]: Expose model capabilities via a REST API.
- **Cross-Platform**: Works on Windows, macOS, and Linux.
*   [[Cross-Platform]]: Works on Windows, macOS, and Linux.
- **Privacy-Focused**: No data sent to external servers.
*   [[Privacy-Focused]]: No data sent to external servers.


---
---


## How Ollama Works
== How Ollama Works ==


Ollama operates by:
1. [[Model Downloading]]: Users can pull models from repositories like Hugging Face or  
 
1. **Model Downloading**: Users can pull models from repositories like Hugging Face or  
the Ollama Hub.
the Ollama Hub.
2. **Containerization**: Models are run in containers for isolation and ease of use.
2. [[Containerization]]: Models are run in containers for isolation and ease of use.
3. **Inference**: Users can query models via the CLI or API.
3. [[Inference]]: Users can query models via the CLI or API.
4. **Quantization**: Ollama supports quantized models for faster performance on  
4. [[Quantization]]: Ollama supports quantized models for faster performance on  
lower-end hardware.
lower-end hardware.


---
---


## Installation
== Installation ==


### For Linux/macOS
=== For Linux/macOS ===


```bash
<pre>
curl -fsSL https://ollama.com/install.sh | sh
curl -fsSL https://ollama.com/install.sh | sh
```
</pre>


### For Windows
=== For Windows ===


Download the installer from the [Ollama website](https://ollama.com/download) and run  
Download the installer from the [[Ollama website]] and run it.
it.


---
---


## Usage
== Usage ==


### List Available Models
=== List Available Models ===


```bash
<pre>
ollama list
ollama list
```
</pre>


### Start a Model
=== Start a Model ===


```bash
<pre>
ollama serve  # Starts the API server
ollama serve  # Starts the API server
ollama pull llama2  # Downloads the LLaMA 2 model
ollama pull llama2  # Downloads the LLaMA 2 model
```
</pre>


### Interact with a Model
=== Interact with a Model ===


```bash
<pre>
ollama run llama2
ollama run llama2
```
</pre>


### Use the API
=== Use the API ===


Send HTTP requests to `http://localhost:11434/api/generate`.
Send HTTP requests to `http://localhost:11434/api/generate`.
Line 102: Line 97:
---
---


## Supported Models
== Supported Models ==


Ollama supports a wide range of models, including:
Ollama supports a wide range of models, including:


- LLaMA (Meta)
LLaMA (Meta)
- Mistral (Sideline)
Mistral (Sideline)
- Phi (Microsoft)
Phi (Microsoft)
- GPT-J
GPT-J
- GPT-NeoX
GPT-NeoX
- Falcon (Tiihs)
Falcon (Tiihs)
- and many more.
and many more.


Check the [Ollang Hub](https://ollama.com/library) for the latest list.
Check the [[Ollama Hub]] for the latest list.


---
---


## Examples
== Examples ==


### Generate Text
=== Generate Text ===


```bash
<pre>
ollama run llama2 "Write a poem about artificial intelligence."
ollama run llama2 "Write a poem about artificial intelligence."
```
</pre>


### Stream Output
=== Stream Output ===


```bash
<pre>
ollama generate llama2 -p "Explain quantum computing in simple terms."
ollama generate llama2 -p "Explain quantum computing in simple terms."
```
</pre>


### Use with Python
=== Use with Python ===


```python
```python
Line 148: Line 143:
print(response.json()["response"])
print(response.json()["response"])
```
```
<!-- Note: In MediaWiki, Python code blocks are typically displayed without syntax
highlighting by default. For better formatting, you might need to use a different
approach or install extensions. -->


---
---


## Community and Resources
== Community and Resources ==


- **GitHub**: [https://github.com/jmorganca/ollama](https://github.com/jmorganca/ollama)
*   [[GitHub]]:  
- **Documentation**: [https://ollama.com/docs](https://ollama.com/docs)
[https://github.com/jmorganca/ollama](https://github.com/jmorganca/ollama)
- **Community**: Join discussions on the [Ollama Forum](https://forum.ollama.com)
*   [[Documentation]]: [https://ollama.com/docs](https://ollama.com/docs)
*   [[Community]]: Join discussions on the [[Ollama Forum]] (https://forum.ollama.com)


---
---


## Contributing
== Contributing ==


Contributions are welcome! Check the [GitHub  
Contributions are welcome! Check the [[GitHub repository]] for guidelines.
repository](https://github.com/jmorganca/ollama) for guidelines.


---
---


## License
== License ==


Ollama is released under the MIT License. See the  
Ollama is released under the [[MIT License]]. See the  
[LICENSE](https://github.com/jmorganca/ollama/blob/main/LICENSE) file for details.
[LICENSE](https://github.com/jmorganca/ollama/blob/main/LICENSE) file for details.


---  
---


This page was last updated on 2025-04-08.
This page was last updated on 2025-04-08.

Revision as of 00:07, 17 November 2025

Ollama is an open-source tool that allows users to run large language models (LLMs) locally on their machines. It provides a simple interface to download, run, and interact with state-of-the-art language models like LLaMA, Mistral, and others.

---

Table of Contents

1. [What is Ollama?](#what-is-ollama) 2. [Key Features](#key-features) 3. [How Ollama Works](#how-ollama-works) 4. [Installation](#installation) 5. [Usage](#usage) 6. [Supported Models](#supported-models) 7. [Examples](#examples) 8. [Community and Resources](#community-and-resources) 9. [Contributing](#contributing) 10. [License](#license)

---

What is Ollama?

Ollama is a tool designed to bring large language models to everyone. It enables users to:

  • Run powerful AI models locally on their devices.
  • Interact with models through a simple command-line interface (CLI) or API.
  • Avoid dependency on cloud services for processing.

Ollama supports models such as LLaMA, Mistral, Phi, GPT-J, GPT-NeoX, and more. It is particularly useful for users who prioritize privacy, control, or offline use.

---

Key Features

---

How Ollama Works

1. Model Downloading: Users can pull models from repositories like Hugging Face or the Ollama Hub. 2. Containerization: Models are run in containers for isolation and ease of use. 3. Inference: Users can query models via the CLI or API. 4. Quantization: Ollama supports quantized models for faster performance on lower-end hardware.

---

Installation

For Linux/macOS

curl -fsSL https://ollama.com/install.sh | sh

For Windows

Download the installer from the Ollama website and run it.

---

Usage

List Available Models

ollama list

Start a Model

ollama serve  # Starts the API server
ollama pull llama2  # Downloads the LLaMA 2 model

Interact with a Model

ollama run llama2

Use the API

Send HTTP requests to `http://localhost:11434/api/generate`.

---

Supported Models

Ollama supports a wide range of models, including:

  • LLaMA (Meta)
  • Mistral (Sideline)
  • Phi (Microsoft)
  • GPT-J
  • GPT-NeoX
  • Falcon (Tiihs)
  • and many more.

Check the Ollama Hub for the latest list.

---

Examples

Generate Text

ollama run llama2 "Write a poem about artificial intelligence."

Stream Output

ollama generate llama2 -p "Explain quantum computing in simple terms."

Use with Python

```python import requests

response = requests.post(

   "http://localhost:11434/api/generate",
   json={
       "model": "llama2",
       "prompt": "What is the meaning of life?",
       "stream": False
   }

)

print(response.json()["response"]) ```

---

Community and Resources

[1](https://github.com/jmorganca/ollama)

---

Contributing

Contributions are welcome! Check the GitHub repository for guidelines.

---

License

Ollama is released under the MIT License. See the [LICENSE](https://github.com/jmorganca/ollama/blob/main/LICENSE) file for details.

---

This page was last updated on 2025-04-08.