Example

from phi.agent import Agent
from phi.tools.duckduckgo import DuckDuckGo
from phi.llm.cohere import CohereChat

agent = Agent(
    llm=CohereChat(model="command-r"),
    tools=[DuckDuckGo()],
    show_tool_calls=True,
)
agent.print_response("Whats happening in France?", markdown=True)

Usage

1

Create a virtual environment

Open the Terminal and create a python virtual environment.

2

Install libraries

pip install -U cohere duckduckgo-search phidata
3

Export `CO_API_KEY`

export CO_API_KEY=xxx
4

Run Cohere Agent

python cookbook/llms/cohere/agent.py

Information