|
| 1 | +# Finance Transcripts Bot |
| 2 | + |
| 3 | +A Streamlit-based chat application that uses Retrieval Augmented Generation (RAG) to analyze financial transcripts and provide intelligent responses. The application includes tools for stock trading simulation and observability through Galileo. |
| 4 | + |
| 5 | +## Key Features |
| 6 | + |
| 7 | +- RAG-powered question answering over financial transcripts |
| 8 | +- Stock trading simulation with purchase/sell functionality |
| 9 | +- Galileo observability integration |
| 10 | +- Configurable AI models (GPT-4 or GPT-3.5 Turbo) |
| 11 | +- Experiment runner for batch processing |
| 12 | +- Streamlit web interface with real-time chat |
| 13 | + |
| 14 | +## Project Structure |
| 15 | + |
| 16 | +``` |
| 17 | +. |
| 18 | +├── app.py # Main Streamlit application |
| 19 | +├── experiment_runner.py # (Unused) Script for experiment runner |
| 20 | +├── generate_env.py # (Unused) Script to convert secrets.toml to .env |
| 21 | +├── galileo_api_helper.py # Helper functions for Galileo API |
| 22 | +├── pages/ # Streamlit page components |
| 23 | +│ └── 2_run_experiment.py |
| 24 | +├── tools/ # Financial tools |
| 25 | +│ ├── purchase_stocks.py |
| 26 | +│ ├── sell_stocks.py |
| 27 | +│ └── get_stock_price.py |
| 28 | +│ └── get_ticker_symbol.py |
| 29 | +└── log_hallucination.py # Hallucination logging utility |
| 30 | +``` |
| 31 | + |
| 32 | +## Installation |
| 33 | + |
| 34 | +1. Clone the repository |
| 35 | +2. Install dependencies: |
| 36 | + |
| 37 | +```bash |
| 38 | +pip install -r requirements.txt |
| 39 | +``` |
| 40 | + |
| 41 | +3. Set up secrets in .streamlit/secrets.toml |
| 42 | + |
| 43 | +```env |
| 44 | +openai_api_key = "your_openai_api_key" |
| 45 | +pinecone_api_key = "your_pinecone_api_key" |
| 46 | +galileo_console_url = "your_galileo_console_url" |
| 47 | +pinecone_index_name = "galileo-demo" |
| 48 | +pinecone_namespace = "sp500-qa-demo" |
| 49 | +galileo_api_key = "your_galileo_api_key" |
| 50 | +galileo_project = "your_galileo_project" |
| 51 | +galileo_log_stream = "your_galileo_log_stream" |
| 52 | +ALPHA_VANTAGE_API_KEY= "your_alpha_vantage_key" |
| 53 | +``` |
| 54 | + |
| 55 | +## Running the Application |
| 56 | +### Streamlit UI |
| 57 | + |
| 58 | +```bash |
| 59 | +streamlit run app.py |
| 60 | +``` |
| 61 | + |
| 62 | +The application will be available at http://localhost:8501 |
| 63 | + |
| 64 | +## Usage |
| 65 | + |
| 66 | +The application provides: |
| 67 | + |
| 68 | +1. Interactive chat interface for financial queries |
| 69 | +2. Stock trading simulation tools |
| 70 | +3. Batch experiment processing |
| 71 | +4. Galileo observability for monitoring and debugging |
| 72 | + |
| 73 | +## Tools |
| 74 | + |
| 75 | +- Stock Purchase Simulation: Simulates buying stocks with specified ticker, quantity, and price |
| 76 | +- Stock Sale Simulation: Simulates selling stocks with specified ticker, quantity, and price |
| 77 | +- Ticker symbol lookup: Using the company name (uses AlphaVantage API key or mocks the data if over API limit) |
| 78 | +- Get Stock price: Using the ticker symbol (uses AlphaVantage API key or mocks the data if over API limit) |
| 79 | +- RAG System: Uses Pinecone vector store for semantic search over financial transcripts |
| 80 | + |
| 81 | +## Observability |
| 82 | + |
| 83 | +The application uses Galileo for: |
| 84 | +- Logging chat interactions |
| 85 | +- Tracking tool usage |
| 86 | +- Monitoring RAG performance |
| 87 | +- Debugging and error tracking |
0 commit comments