-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplayground.py
More file actions
66 lines (59 loc) · 1.95 KB
/
playground.py
File metadata and controls
66 lines (59 loc) · 1.95 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
from phi.agent import Agent
from phi.model.openai import OpenAIChat
from phi.tools.yfinance import YFinanceTools
from phi.tools.duckduckgo import DuckDuckGo
from dotenv import load_dotenv
from phi.playground import Playground, serve_playground_app
load_dotenv()
BASE_FORMATTING = [
"Use clear Markdown formatting",
"Headings: # Main, ## Section, ### Subsection",
"Lists: Use bullet points for multiple items",
"Tables: | Column 1 | Column 2 |",
"Links: [Display Text](URL)",
"Code: ```python code blocks ```",
"Separate major sections with ---"
]
web_agent = Agent(
name="Web Agent",
model = OpenAIChat(id="gpt-4o-mini"),
tools=[DuckDuckGo()],
instructions=[
*BASE_FORMATTING,
"Present sources as:",
"• [Source Name](URL) - Brief summary",
"Use > for quoted content",
"Group related findings under ### subheadings"
],
markdown=True
)
finance_agent = Agent(
name="Finance Agent",
role = "Get financial data of listed companies.",
model = OpenAIChat(id = "gpt-4o-mini"),
tools=[YFinanceTools(stock_price = True, analyst_recommendations = True, company_info = True, historical_prices = True)],
instructions=[
*BASE_FORMATTING,
"Display the data in tabular format."
],
markdown=True
)
agent_team = Agent(
name="Agent Team",
team=[web_agent, finance_agent],
model = OpenAIChat(id="gpt-4o-mini"),
instructions=[
*BASE_FORMATTING,
"Report structure:",
"# Summary (2-3 sentences)",
"## Financial Data (tables)",
"## Market Insights (bullets)",
"## Sources ([links](URL))",
"Keep lines under 80 characters",
"Bold **key takeaways**"
],
markdown=True
)
app = Playground(agents=[finance_agent, web_agent, agent_team]).get_app()
if __name__ == "__main__":
serve_playground_app("playground:app", reload=True)