-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplayground.py
47 lines (40 loc) · 1.27 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
from phi.agent import Agent
import phi.api
from phi.model.groq import Groq
from phi.tools.yfinance import YFinanceTools
from phi.tools.duckduckgo import DuckDuckGo
from phi.tools.python import PythonTools
from dotenv import find_dotenv,load_dotenv
import os
import phi
from phi.playground import Playground,serve_playground_app
# loading enviornment variable
_ = load_dotenv()
phi.api = os.getenv("PHI_API_KEY")
# creating 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_tool_calls= True,
markdown= True
)
## create fin analysis agent
finance_agent = Agent(
name = "Fiannce 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)