Added new tutorial
This commit is contained in:
parent
07ddd9d837
commit
d0b3ec7691
3 changed files with 66 additions and 0 deletions
39
ai_agent_tutorials/xai_finance_agent/README.md
Normal file
39
ai_agent_tutorials/xai_finance_agent/README.md
Normal file
|
|
@ -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.
|
||||
5
ai_agent_tutorials/xai_finance_agent/requirements.txt
Normal file
5
ai_agent_tutorials/xai_finance_agent/requirements.txt
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
phidata
|
||||
duckduckgo-search
|
||||
yfinance
|
||||
fastapi[standard]
|
||||
openai
|
||||
22
ai_agent_tutorials/xai_finance_agent/xai_finance_agent.py
Normal file
22
ai_agent_tutorials/xai_finance_agent/xai_finance_agent.py
Normal file
|
|
@ -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)
|
||||
Loading…
Reference in a new issue