Upload files
Browse files- .env +2 -0
- app.py +60 -0
- requirements.txt +8 -0
.env
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
PHI_API_KEY = "phi-onG2tVEmCrcm8nhMA-kZgSGgtANzGN6IPKTLqRXnqio"
|
2 |
+
GOOGLE_API_KEY="AIzaSyBllIaoCcbkC7G4Dv4Vem6cmuwhJ81qtgI"
|
app.py
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from dotenv import load_dotenv
|
3 |
+
from phi.agent import Agent
|
4 |
+
from phi.model.google import Gemini
|
5 |
+
from phi.tools.yfinance import YFinanceTools
|
6 |
+
from phi.tools.duckduckgo import DuckDuckGo
|
7 |
+
|
8 |
+
load_dotenv()
|
9 |
+
|
10 |
+
#model_name=Groq(id="llama-3.3-70b-versatile")
|
11 |
+
model_name=Gemini(id="gemini-2.0-flash-exp")
|
12 |
+
|
13 |
+
finance_agent = Agent(
|
14 |
+
name="Finance Agent",
|
15 |
+
model=model_name,
|
16 |
+
tools=[YFinanceTools(stock_price=True, analyst_recommendations=True, stock_fundamentals=True)],
|
17 |
+
instructions=["Use table to display data."],
|
18 |
+
show_tool_calls=True,
|
19 |
+
markdowon=True,
|
20 |
+
debug_mode=True
|
21 |
+
)
|
22 |
+
|
23 |
+
web_agent = Agent(
|
24 |
+
name="Web Agent",
|
25 |
+
model=model_name,
|
26 |
+
tools=[DuckDuckGo()],
|
27 |
+
instructions=["Always include sources"],
|
28 |
+
show_tool_calls=True,
|
29 |
+
markdown=True
|
30 |
+
)
|
31 |
+
|
32 |
+
agent_team=Agent(
|
33 |
+
name="Agent Team",
|
34 |
+
model=model_name,
|
35 |
+
team=[web_agent,finance_agent],
|
36 |
+
instructions=["Always include sources","Use table to display data."],
|
37 |
+
show_tool_calls=True,
|
38 |
+
markdown=True,
|
39 |
+
debug_mode=True
|
40 |
+
|
41 |
+
)
|
42 |
+
|
43 |
+
# Streamlit App
|
44 |
+
def main():
|
45 |
+
st.set_page_config(page_title="StockIntel AI", page_icon=":bar_chart:", layout="wide")
|
46 |
+
st.markdown("""
|
47 |
+
<h1 style="text-align: center; color: #4CAF50;">StockIntel AI</h1>
|
48 |
+
<p style="text-align: center; font-size: 20px; color: #777;">AI-powered assistant for analyzing your stocks.</p>
|
49 |
+
""", unsafe_allow_html=True)
|
50 |
+
|
51 |
+
user_input = st.text_input("Enter your query (e.g., 'Tell me about Apple stock')")
|
52 |
+
submit = st.button("Get Stock Data")
|
53 |
+
|
54 |
+
if submit and user_input.strip():
|
55 |
+
# Extract the stock ticker using LLM
|
56 |
+
result = agent_team.run(user_input)
|
57 |
+
st.markdown(result.content, unsafe_allow_html=True)
|
58 |
+
|
59 |
+
if __name__ == "__main__":
|
60 |
+
main()
|
requirements.txt
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
phi-data
|
2 |
+
python-dotenv
|
3 |
+
yfinance
|
4 |
+
packaging
|
5 |
+
duckduckgo-search
|
6 |
+
fastapi
|
7 |
+
uvicorn
|
8 |
+
google-generativeai
|