Skip to content

Instantly share code, notes, and snippets.

@amosgyamfi
Created November 9, 2024 00:59
Show Gist options
  • Save amosgyamfi/7c137dd45791893cc34da9461f4a86d5 to your computer and use it in GitHub Desktop.
Save amosgyamfi/7c137dd45791893cc34da9461f4a86d5 to your computer and use it in GitHub Desktop.
from phi.agent import Agent
from phi.model.openai import OpenAIChat
from phi.tools.duckduckgo import DuckDuckGo
from phi.tools.yfinance import YFinanceTools
web_search_agent = Agent(
name="Web Search Agent",
role="Search the web for information",
model=OpenAIChat(id="gpt-4o"),
tools=[DuckDuckGo()],
instructions=["Always include sources"],
show_tool_calls=True,
markdown=True,
)
finance_agent = Agent(
name="Finance Agent",
role="Get financial data",
model=OpenAIChat(id="gpt-4o"),
tools=[
YFinanceTools(stock_price=True, analyst_recommendations=True, company_info=True)
],
instructions=["Use tables to display data"],
show_tool_calls=True,
markdown=True,
)
multi_ai_agent = Agent(
team=[web_search_agent, finance_agent],
instructions=["Always include sources", "Use tables to display data"],
show_tool_calls=True,
markdown=True,
)
multi_ai_agent.print_response(
"Summarize analyst recommendations and share the latest news for NVDA", stream=True
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment