- Overview
- Key Features
- Project Architecture
- RAG Pipeline
- Installation
- Project Structure
- How It Works
- Results & Visualization
- Contributing
- License
This project implements a sophisticated Multimodal RAG (Retrieval-Augmented Generation) system designed for comprehensive financial analysis of corporate performance. The system can process and analyze multiple types of financial data sources, making it a versatile tool for investors, analysts, and financial professionals.
To demonstrate the system's capabilities, we've implemented a case study using Starbucks Corporation's Q3 2024 financial data, showcasing how the tool handles various data formats:
-
Earnings Call Audio (
starbucks-q3.mp3):- Quarterly earnings call recording
- Executive presentations and Q&A sessions
- Strategic discussions and market insights
- Forward-looking statements and guidance
-
Financial Report (
3Q24-Earnings-Release.pdf):- Quarterly financial statements
- Performance metrics and KPIs
- Market analysis and trends
- Supporting charts and visualizations
The system's architecture enables processing of any company's financial data through:
- Automated audio transcription of earnings calls and presentations
- Intelligent PDF processing and image extraction
- Advanced embedding techniques for multimodal data
- Semantic search across all data formats
- Context-aware information retrieval and synthesis
This creates a versatile financial analysis tool that can:
- Process multiple data formats simultaneously
- Answer complex financial queries
- Cross-reference information across different sources
- Generate comprehensive insights with supporting evidence
- Adapt to different companies and financial contexts
The implementation demonstrates how modern AI techniques can revolutionize financial analysis by making it easier to process, understand, and derive insights from complex financial information across multiple formats and sources. While demonstrated with Starbucks' data, the system is designed to be adaptable to any company's financial documentation and reporting structure.
- Audio Transcription: Converts earnings call recordings to text using Whisper
- PDF Processing: Extracts and processes financial reports and presentations
- Multimodal Embeddings: Generates embeddings for both text and images
- Semantic Search: Implements cosine similarity for relevant information retrieval
- Intelligent Response Generation: Uses GPT-4 for generating financial insights
- Visual Analysis: Processes financial charts and graphs from reports
flowchart TD
subgraph Input
A[Input Sources] --> B[Audio File]
A --> C[PDF Documents]
end
subgraph Processing
B --> D[Whisper Transcription]
C --> E[PDF to Image Conversion]
D --> F[Text Chunks]
E --> G[Image Processing]
end
subgraph Embeddings
F --> H[Text Embeddings]
G --> I[Image Embeddings]
H --> J[(Vector Store)]
I --> J
end
subgraph Query
K[User Query] --> L[Query Embedding]
L --> M{Similarity Search}
J --> M
end
subgraph Output
M --> N[Context Assembly]
N --> O[GPT-4 Response]
end
style A fill:#f9f,stroke:#333,stroke-width:2px
style J fill:#bbf,stroke:#333,stroke-width:2px
style M fill:#bfb,stroke:#333,stroke-width:2px
style O fill:#ff9,stroke:#333,stroke-width:2px
sequenceDiagram
box User Interface
participant User
end
box Backend System
participant System
participant Embeddings
end
box AI Processing
participant LLM
end
User->>+System: Submit Query
rect rgb(191, 223, 255)
System->>+Embeddings: Generate Query Embedding
Embeddings->>-System: Return Similar Content
end
rect rgb(255, 204, 204)
System->>+LLM: Send Context + Query
LLM->>-System: Generate Response
end
System->>-User: Return Answer
note over System,LLM: Multimodal Processing
git clone https://github.com/yourusername/MuliModal-Rag-for-starbucks.git
cd MuliModal-Rag-for-starbucks
pip install -r requirements.txtMuliModal-Rag-for-starbucks/
βββ _asserts/ # Visualization assets
βββ images/ # Processed PDF images
βββ transcript/ # Audio transcriptions
βββ Capstone Project - Multimodal Data.ipynb # Main notebook
βββ requirements.txt # Dependencies
βββ starbucks-q3.mp3 # Audio input
βββ 3Q24-Earnings-Release.pdf # PDF input
-
Audio Processing
- Transcribes audio using Whisper
- Splits text into manageable chunks
- Generates embeddings for each chunk
-
PDF Processing
- Converts PDF pages to images
- Processes financial charts and tables
- Creates embeddings for visual content
-
Data Preprocessing & Encoding
- Converts images to base64 format for model input
- Prepares data for CLIP model processing
- Optimizes input format for OpenAI API
-
Embedding Generation
- Uses CLIP model for image embeddings
- Employs Sentence Transformers for text
- Maintains vector consistency
-
Similarity Search
- Implements cosine similarity
- Retrieves relevant content
- Combines multimodal results
-
Response Generation
- Assembles retrieved context
- Generates comprehensive answers
- Provides financial insights
The system demonstrates impressive capabilities in analyzing Starbucks' financial performance through multimodal data processing:
-
Audio Analysis
- Successfully transcribed Q3 earnings call
- Processed 142 text chunks with 512-dimensional embeddings
- Achieved high transcription accuracy with Whisper model
-
Visual Processing
- Converted 17 PDF pages to high-quality images
- Generated consistent 512-dimensional CLIP embeddings
- Maintained visual context through document processing
-
Retrieval Performance
- Achieved cosine similarity scores > 0.90 for relevant content
- Top-5 audio chunk similarities: 0.90-0.91 range
- Effective multimodal context assembly
A crucial step in our pipeline is preparing images for the OpenAI model. This involves:
Process Highlights:
- Converting images to base64 format
- Optimizing image resolution and quality
- Preparing batch processing for multiple images
- Ensuring proper formatting for API input
- Managing memory efficiency for large documents
This preprocessing step is essential for:
- Maintaining image quality
- Optimizing API performance
- Ensuring accurate visual analysis
- Enabling efficient multimodal processing
How is the company doing financially?
The system generated a comprehensive analysis that included:
Financial Metrics:
- Q3 total company revenue: $9.1 billion (β1% YoY, β6% QoQ)
- Global comparable store sales declined 3% year over year
- Operating margins contracted by 70 basis points to 16.7%
- Earnings per share: 93 cents
Regional Performance:
- North America: -2% Comcro
- China: -14% Comcro
- Strong performance in Japan
- International challenges, particularly in China
Strategic Insights:
- Implementation of three-part action plan
- Operational improvements in US stores
- Enhanced customer experience initiatives
- Digital engagement metrics
Future Outlook:
- Planned improvements in store operations
- Strategic investments in partner hours
- Expansion plans in tier 2 and tier 3 cities
- Technology deployment roadmap
The system successfully combined information from:
- Earnings call audio transcription
- Financial statements and metrics
- Visual data from presentations
- Management commentary and guidance
This demonstrates the system's ability to:
- Process complex financial queries
- Synthesize information from multiple sources
- Present structured, comprehensive analysis
- Provide both quantitative and qualitative insights
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.








