> ## Documentation Index
> Fetch the complete documentation index at: https://agno-v2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Ollama Set Temperature

> Set sampling temperature on an Ollama model through the options dict.

```python set_temperature.py theme={null}
"""
Ollama Set Temperature
======================

Cookbook example for `ollama/chat/set_temperature.py`.
"""

from agno.agent import Agent, RunOutput  # noqa
from agno.models.ollama import Ollama

# ---------------------------------------------------------------------------
# Create Agent
# ---------------------------------------------------------------------------

agent = Agent(model=Ollama(id="llama3.2", options={"temperature": 0.5}), markdown=True)

# Get the response in a variable
# run: RunOutput = agent.run("Share a 2 sentence horror story")
# print(run.content)

# Print the response in the terminal
agent.print_response("Share a 2 sentence horror story")

# ---------------------------------------------------------------------------
# Run Agent
# ---------------------------------------------------------------------------

if __name__ == "__main__":
    pass
```

## Run the Example

<Snippet file="create-venv-step.mdx" />

**1. Install dependencies**

```bash theme={null}
uv pip install -U agno ollama
```

**2. Prepare Ollama**

Install and start Ollama, then pull the model used by this example:

```bash theme={null}
ollama pull llama3.2
```

**3. Run the example**

Save the code above as `set_temperature.py`, then run:

```bash theme={null}
python set_temperature.py
```

Full source: [cookbook/90\_models/ollama/chat/set\_temperature.py](https://github.com/agno-agi/agno/blob/v3.0.4/cookbook/90_models/ollama/chat/set_temperature.py)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.