Spaces:
Build error
Build error
Delete financial_agent.py
Browse files- financial_agent.py +0 -56
financial_agent.py
DELETED
|
@@ -1,56 +0,0 @@
|
|
| 1 |
-
from phi.agent import Agent
|
| 2 |
-
from phi.model.groq import Groq
|
| 3 |
-
from phi.tools.yfinance import YFinanceTools
|
| 4 |
-
from phi.tools.duckduckgo import DuckDuckGo
|
| 5 |
-
import openai
|
| 6 |
-
|
| 7 |
-
import os
|
| 8 |
-
from dotenv import load_dotenv
|
| 9 |
-
load_dotenv()
|
| 10 |
-
groq_api_key=os.getenv("GROQ_API_KEY")
|
| 11 |
-
|
| 12 |
-
# Inside phi/some_module.py
|
| 13 |
-
DEFAULT_MODEL = "groq-llama-3.2-3b-preview" # or similar
|
| 14 |
-
|
| 15 |
-
def get_model(model_id=None):
|
| 16 |
-
if model_id is None:
|
| 17 |
-
model_id = DEFAULT_MODEL
|
| 18 |
-
|
| 19 |
-
if model_id.startswith("openai-"):
|
| 20 |
-
# Use OpenAI
|
| 21 |
-
raise ValueError("OpenAI is disabled. Use a Groq model.") #CHANGED
|
| 22 |
-
elif model_id.startswith("groq-"):
|
| 23 |
-
# Use Groq
|
| 24 |
-
pass # Groq code
|
| 25 |
-
else:
|
| 26 |
-
raise ValueError("Unsupported model")
|
| 27 |
-
#WEB SERACH AGENT
|
| 28 |
-
web_search_agent=Agent(
|
| 29 |
-
name = "Web search agent",
|
| 30 |
-
role = "search the web for the information",
|
| 31 |
-
model = Groq(id="llama-3.2-3b-preview"),
|
| 32 |
-
tools = [DuckDuckGo()],
|
| 33 |
-
instructions = ["Always include sources"],
|
| 34 |
-
show_tools_call = True,
|
| 35 |
-
markdown = True,
|
| 36 |
-
)
|
| 37 |
-
#FINANCIAL AGENT
|
| 38 |
-
finance_agent = Agent(
|
| 39 |
-
name = "Finance AI agent",
|
| 40 |
-
role = "",
|
| 41 |
-
model = Groq(id="llama-3.2-3b-preview"),
|
| 42 |
-
tools =[YFinanceTools(stock_price=True, analyst_recommendations=True, stock_fundamentals=True,
|
| 43 |
-
company_news = True)
|
| 44 |
-
],
|
| 45 |
-
instructions=["Use tables to display the data"],
|
| 46 |
-
show_tool_calls=True,
|
| 47 |
-
markdown=True,
|
| 48 |
-
)
|
| 49 |
-
multi_ai_agent = Agent(
|
| 50 |
-
team = [web_search_agent,finance_agent],
|
| 51 |
-
instructions=["always include sources","use table to display the data"],
|
| 52 |
-
show_tools_call = True,
|
| 53 |
-
markdown = True,
|
| 54 |
-
)
|
| 55 |
-
|
| 56 |
-
multi_ai_agent.print_response("Summarize analyst recommendation and share the latest news for NVDA",stream=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|