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

# Ollama DeepSeek R1

## 代码

```python cookbook/reasoning/models/ollama/reasoning_model_deepseek.py theme={null}
from agno.agent import Agent
from agno.models.ollama.chat import Ollama

agent = Agent(
    model=Ollama(id="llama3.2:latest"),
    reasoning_model=Ollama(id="deepseek-r1:14b", max_tokens=4096),
)
agent.print_response(
    "解决电车难题。评估多种伦理框架。包含一个解决此问题的 ASCII 图。",
    stream=True,
)

```

## 用法

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

  <Step title="安装 Ollama">
    遵循 [安装指南](https://github.com/ollama/ollama?tab=readme-ov-file#macos)，然后运行：

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

  <Step title="安装库">
    ```bash theme={null}
    pip install -U ollama agno
    ```
  </Step>

  <Step title="运行 Agent">
    <CodeGroup>
      ```bash Mac theme={null}
      python cookbook/reasoning/models/ollama/reasoning_model_deepseek.py
      ```

      ```bash Windows theme={null}
      python cookbook/reasoning/models/ollama/reasoning_model_deepseek.py
      ```
    </CodeGroup>
  </Step>
</Steps>
