> ## Documentation Index
> Fetch the complete documentation index at: https://agno-v2-docs-scavio-google-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

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

  <Step title="Install dependencies">
    ```bash theme={null}
    uv pip install -U agno ollama
    ```
  </Step>

  <Step title="Prepare Ollama">
    Install and start Ollama, then pull the model used by this example:

    ```bash theme={null}
    ollama pull llama3.2
    ```
  </Step>

  <Step title="Run the example">
    Save the code above as `set_temperature.py`, then run:

    ```bash theme={null}
    python set_temperature.py
    ```
  </Step>
</Steps>

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