This project utilizes the Phi framework to create a multi-agent system that interacts with web search and financial data. The system contains two main agents: a Web Search agent and a Finance AI agent. These agents collaborate to gather comprehensive information about stocks, news, and market analysis.
- Python 3.x
- Phi Framework (
phi) yfinancepackage for financial dataduckduckgopackage for web searches
You can install the necessary dependencies using:
pip install phi yfinance duckduckgo
The Web Search Agent is designed to search the web for in-depth information using DuckDuckGo. It provides detailed search results and includes sources in the output.
websearch_agent = Agent(
name="Web Search agent",
role="Search the web for the Complete indepth information",
add_chat_history_to_messages=True,
model=Groq(id="llama3-70b-8192"),
tools=[DuckDuckGo()],
instructions=["Always include sources"],
show_tool_calls=True,
markdown=True
)
- Role: Searches the web and provides sources.
- Tools: DuckDuckGo search engine.
- Instructions: Always include sources in responses.
The Finance AI Agent specializes in gathering financial information, such as stock prices, analyst recommendations, company info, and news using Yahoo Finance and DuckDuckGo.
finance_agent = Agent(
name="Finance AI Agent",
tools=[YFinanceTools(stock_price=True, analyst_recommendations=True, company_info=True, company_news=True), DuckDuckGo()],
model=Groq(id="llama3-70b-8192"),
instructions=['Give me information about NVIDIA stocks and its 5 latest news'],
show_tool_calls=True,
markdown=True
)
- Role: Provides stock and financial information about companies.
- Tools: Yahoo Finance (for stock-related data) and DuckDuckGo (for supplementary search).
- Instructions: Fetch information about NVIDIA stocks and the latest news.
The Multi-Agent System brings together the Web Search agent and the Finance AI agent to work collaboratively. It is instructed to always include sources and display data in a table format.
multi_ai_agent = Agent(
team=[websearch_agent, finance_agent],
instructions=["Always include sources", "use Table to display the data"],
markdown=True,
show_tool_calls=True
)
Team: Combines the Web Search agent and Finance AI agent. Instructions: Always include sources and use tables for data presentation.
This project is licensed under the MIT License - see the LICENSE file for details.