Example

from phi.agent import Agent
from phi.llm.ollama import Ollama

agent = Agent(
    llm=Ollama(model="openhermes"),
    description="You help people with their health and fitness goals.",
)
agent.print_response("Share a 2 sentence quick and healthy breakfast recipe.", markdown=True)

Usage

1

Run your chat model

ollama run openhermes

Message /bye to exit the chat model

2

Create a virtual environment

Open the Terminal and create a python virtual environment.

3

Install libraries

pip install -U ollama phidata
4

Run Ollama Agent

python cookbook/llms/ollama/agent.py

Information