diff --git a/ai_agent_tutorials/xai_finance_agent/README.md b/ai_agent_tutorials/xai_finance_agent/README.md new file mode 100644 index 0000000..10b07e6 --- /dev/null +++ b/ai_agent_tutorials/xai_finance_agent/README.md @@ -0,0 +1,39 @@ +## 📊 AI Finance Agent with xAI Grok +This application creates a financial analysis agent powered by xAI's Grok model, combining real-time stock data with web search capabilities. It provides structured financial insights through an interactive playground interface. + +### Features + +- Powered by xAI's Grok-beta model +- Real-time stock data analysis via YFinance +- Web search capabilities through DuckDuckGo +- Formatted output with tables for financial data +- Interactive playground interface + +### How to get Started? + +1. Clone the GitHub repository +```bash +git clone https://github.com/Shubhamsaboo/awesome-llm-apps.git +``` + +2. Install the required dependencies: + +```bash +cd ai_agent_tutorials/xai_finance_agent +pip install -r requirements.txt +``` + +3. Get your OpenAI API Key + +- Sign up for an [xAI API account](https://console.x.ai/) +- Set your XAI_API_KEY environment variable. +```bash +export XAI_API_KEY='your-api-key-here' +``` + +4. Run the team of AI Agents +```bash +python xai_finance_agent.py +``` + +5. Open your web browser and navigate to the URL provided in the console output to interact with the AI financial agent through the playground interface. diff --git a/ai_agent_tutorials/xai_finance_agent/requirements.txt b/ai_agent_tutorials/xai_finance_agent/requirements.txt new file mode 100644 index 0000000..a391d95 --- /dev/null +++ b/ai_agent_tutorials/xai_finance_agent/requirements.txt @@ -0,0 +1,5 @@ +phidata +duckduckgo-search +yfinance +fastapi[standard] +openai \ No newline at end of file diff --git a/ai_agent_tutorials/xai_finance_agent/xai_finance_agent.py b/ai_agent_tutorials/xai_finance_agent/xai_finance_agent.py new file mode 100644 index 0000000..ac03077 --- /dev/null +++ b/ai_agent_tutorials/xai_finance_agent/xai_finance_agent.py @@ -0,0 +1,22 @@ +# import necessary python libraries +from phi.agent import Agent +from phi.model.xai import xAI +from phi.tools.yfinance import YFinanceTools +from phi.tools.duckduckgo import DuckDuckGo +from phi.playground import Playground, serve_playground_app + +# create the AI finance agent +agent = Agent( + name="xAI Finance Agent", + model = xAI(id="grok-beta"), + tools=[DuckDuckGo(), YFinanceTools(stock_price=True, analyst_recommendations=True, stock_fundamentals=True)], + instructions = ["Always use tables to display financial/numerical data. For text data use bullet points and small paragrpahs."], + show_tool_calls = True, + markdown = True, + ) + +# UI for finance agent +app = Playground(agents=[agent]).get_app() + +if __name__ == "__main__": + serve_playground_app("xai_finance_agent:app", reload=True) \ No newline at end of file