-
Notifications
You must be signed in to change notification settings - Fork 0
/
playground.py
48 lines (41 loc) · 1.22 KB
/
playground.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
from phi.agent import Agent
import phi.api
from phi.tools.yfinance import YFinanceTools
from phi.tools.duckduckgo import DuckDuckGo
from dotenv import load_dotenv
from phi.model.groq import Groq
import os
import phi
from phi.playground import Playground, serve_playground_app
# Load environment variables from .env file
load_dotenv()
phi.api = os.getenv("PHI_API_KEY")
# web search agent
web_search_agent = Agent(
name="Web Search Agent",
role="Search the web for the information",
model=Groq(id="llama3-groq-70b-8192-tool-use-preview"),
tools=[DuckDuckGo()],
instructions=["Alway include sources"],
show_tools_calls=True,
markdown=True,
)
# Financial agent
finance_agent = Agent(
name="Finance AI Agent",
model=Groq(id="llama3-groq-70b-8192-tool-use-preview"),
tools=[
YFinanceTools(
stock_price=True,
analyst_recommendations=True,
stock_fundamentals=True,
company_news=True,
),
],
instructions=["Use tables to display the data"],
show_tool_calls=True,
markdown=True,
)
app = Playground(agents=[finance_agent, web_search_agent]).get_app()
if __name__ == "__main__":
serve_playground_app("playground:app", reload=True)