├── requirements.txt ├── __pycache__ └── xai_finance_agent.cpython-313.pyc └── xai_finance_agent.py /requirements.txt: -------------------------------------------------------------------------------- 1 | phidata 2 | duckduckgo-search 3 | yfinance 4 | fastapi[standard] 5 | openai -------------------------------------------------------------------------------- /__pycache__/xai_finance_agent.cpython-313.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/balance/finance_agent/master/__pycache__/xai_finance_agent.cpython-313.pyc -------------------------------------------------------------------------------- /xai_finance_agent.py: -------------------------------------------------------------------------------- 1 | # import necessary python libraries 2 | from phi.agent import Agent 3 | from phi.model.xai import xAI 4 | from phi.tools.yfinance import YFinanceTools 5 | from phi.tools.duckduckgo import DuckDuckGo 6 | from phi.playground import Playground, serve_playground_app 7 | 8 | # create the AI finance agent 9 | agent = Agent( 10 | name="xAI Finance Agent", 11 | model = xAI(id="grok-beta"), 12 | tools=[DuckDuckGo(), YFinanceTools(stock_price=True, analyst_recommendations=True, stock_fundamentals=True)], 13 | instructions = ["Always use tables to display financial/numerical data. For text data use bullet points and small paragrpahs."], 14 | show_tool_calls = True, 15 | markdown = True, 16 | ) 17 | 18 | # UI for finance agent 19 | app = Playground(agents=[agent]).get_app() 20 | 21 | if __name__ == "__main__": 22 | serve_playground_app("xai_finance_agent:app", reload=True) --------------------------------------------------------------------------------