Example 3: Using DuckDuckGo Search Tool
Step 1: Create tool_usage.py
from agno.agent import Agent
from agno.tools.duckduckgo import DuckDuckGoTools
from agno.agent import Agent
from agno.models.ollama import Ollama
from ollama import Client as OllamaClient
agent = Agent(
model=Ollama(id="llama3.2", client=OllamaClient()),
tools=[DuckDuckGoTools()],
show_tool_calls=True,
markdown=True,
)
agent.print_response("What's happening in India?", stream=True)
Step 2: Install Dependencies
pip install duckduckgo duckduckgo-search
python.exe -m pip install --upgrade pip
Expected Response
Running: duckduckgo_search(max_results=5, query=India news)
Current Events in India:
- Latest India news can be found on websites such as Times of India, Hindustan Times,
India Today, and Indian Express.
- Breaking news updates are available on various news portals and online platforms.
No comments:
Post a Comment