This project implements a LangChain agent powered by multiple LLMs (OpenAI, Groq) to help users:
- 📈 Get real-time stock prices
- 📊 Analyze and rebalance their investment portfolios
- 📉 Understand market trends over the past week
-
Install dependencies:
pip install -r requirements.txt
-
Create a
.envfile in the root directory:OPENAI_API_KEY=your_openai_key_here GROQ_API_KEY=your_groq_key_here
-
Run the test cases:
python run.py
- OpenAI: GPT-4
- Groq: LLaMA3-8B / LLaMA3-70B
| Tool Name | Purpose |
|---|---|
StockPriceLookup |
Retrieves the current price and daily change of a given stock ticker |
PortfolioRebalancer |
Analyzes stock portfolio weights and recommends rebalancing actions |
MarketTrendAnalyzer |
Summarizes recent trends for a major index like the S&P 500 (SPY) |
Portfolio 1 (OpenAI):
AAPL: SELL 16.67% to reach target weight 33.33%
TSLA: BUY 3.33% to reach target weight 33.33%
GOOGL: BUY 13.33% to reach target weight 33.33%
Portfolio 2 (Groq LLaMA3-70B):
MSFT: OK (weight = 0.25)
NVDA: OK (weight = 0.25)
AMZN: OK (weight = 0.25)
META: OK (weight = 0.25)
MIT License · CMU 94-815 · Fanxing Bu