A powerful, multi-modal Retrieval-Augmented Generation (RAG) application built with Oracle Database 23ai Vector Search, OpenAI GPT, and Streamlit. Features secure user authentication, document processing across multiple formats, and intelligent chat capabilities.
Watch the complete walkthrough: MultiModal RAG Assistant Demo
This screencast demonstrates:
- π User authentication and system setup
- π Multi-format document upload and processing
- π§ AI-powered chat with document context
- π± Mobile-responsive interface
- β‘ Oracle 23ai vector search in action
- β User registration and login with secure password hashing (PBKDF2)
- β Session-based authentication with automatic expiration
- β User data isolation and multi-tenant architecture
- β Admin configuration interface for system setup
- β PDF Documents: Text and table extraction with pdfplumber
- β Word Documents: Full DOCX processing with python-docx
- β PowerPoint: PPTX slide content extraction with python-pptx
- β Excel/CSV: Spreadsheet processing with pandas
- β Images: OCR text extraction with Pillow + pytesseract
- β Text Files: Plain text and markdown support
- β Vector Search: Oracle 23ai vector similarity search
- β Smart Chunking: Intelligent content segmentation with sentence boundaries
- β Embedding Generation: Sentence-transformers for semantic search
- β GPT Integration: OpenAI GPT-3.5-turbo for contextual responses
- β Source Citations: Automatic page and document references
- β Responsive UI optimized for desktop and mobile devices
- β Touch-friendly interface with intuitive navigation
- β Progressive web app capabilities
- β Adaptive chunking and search for mobile performance
- β Oracle Database 23ai with vector search capabilities
- β Scalable multi-user architecture
- β Comprehensive error handling and logging
- β Real-time processing with progress indicators
- Python 3.8 or higher
- Oracle Database 23ai instance with Vector Search enabled
- OpenAI API key
- Oracle Autonomous Database wallet (for cloud deployment)
git clone https://github.com/ancur4u/MultiModal_RAG_Oracle23ai.git
cd MultiModal_RAG_Oracle23ai# Install core dependencies
pip install streamlit sentence-transformers openai oracledb python-dotenv pdfplumber numpy pandas
# Install optional dependencies for full multi-modal support
pip install python-docx python-pptx openpyxl Pillow pytesseract beautifulsoup4 markdown
# For advanced table extraction (optional)
pip install camelot-py tabula-pymacOS:
brew install tesseract poppler ghostscriptUbuntu/Debian:
sudo apt-get update
sudo apt-get install tesseract-ocr poppler-utils ghostscriptWindows:
- Install Tesseract OCR
- Install Poppler
Create a .env file in the project root:
# OpenAI Configuration
OPENAI_API_KEY=your_openai_api_key_here
# Oracle Database Configuration (optional - can be configured via UI)
ORACLE_USERNAME=admin
ORACLE_PASSWORD=your_db_password
ORACLE_SERVICE_NAME=your_service_name_high
ORACLE_WALLET_PATH=/path/to/wallet
# Security
SECRET_KEY=your_secret_key_herestreamlit run RAG_Oracle23ai_Final.pyThe application will open in your browser at http://localhost:8501
1. Landing Page (Login/Signup)
β
2. Admin Setup (System Configuration)
β
3. Database Initialization
β
4. Full RAG Application
Document Upload β Multi-Modal Processing β Smart Chunking β
Vector Embeddings β Oracle 23ai Storage β Vector Search β
GPT Response Generation β User Interface
CREATE TABLE users (
user_id VARCHAR2(50) PRIMARY KEY,
username VARCHAR2(50) UNIQUE NOT NULL,
email VARCHAR2(255),
password_hash VARCHAR2(255) NOT NULL,
salt VARCHAR2(255) NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
last_login TIMESTAMP,
is_active NUMBER(1) DEFAULT 1
);CREATE TABLE documents (
document_id VARCHAR2(50) PRIMARY KEY,
user_id VARCHAR2(50) NOT NULL,
filename VARCHAR2(500) NOT NULL,
file_type VARCHAR2(50) DEFAULT 'pdf',
upload_timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
total_chunks NUMBER DEFAULT 0,
file_size NUMBER,
CONSTRAINT fk_documents_user_id
FOREIGN KEY (user_id) REFERENCES users(user_id) ON DELETE CASCADE
);CREATE TABLE document_chunks (
chunk_id VARCHAR2(50) PRIMARY KEY,
document_id VARCHAR2(50) NOT NULL,
user_id VARCHAR2(50) NOT NULL,
chunk_text CLOB NOT NULL,
chunk_index NUMBER NOT NULL,
page_number NUMBER DEFAULT 1,
content_type VARCHAR2(50) DEFAULT 'text',
metadata CLOB,
embedding VECTOR(384, FLOAT32),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);- Embedding Model:
all-MiniLM-L6-v2(384 dimensions) - Chunk Size: 1000 characters (500 for mobile)
- Overlap: 200 characters
- Top K Results: 5 (3 for mobile)
- Vector Distance: COSINE similarity
- Session Timeout: 24 hours (configurable)
- Password Requirements: Minimum 6 characters (configurable)
- Token Generation: Cryptographically secure random tokens
- Access the application URL
- Click "Configure System"
- Enter OpenAI API key
- Configure Oracle Database credentials
- Test connections and initialize system
- Click "Sign Up" on the landing page
- Choose username and password
- Optional: provide email address
- Create account and sign in
- Upload supported file formats (PDF, DOCX, XLSX, etc.)
- Wait for multi-modal processing to complete
- View processing results and chunk statistics
- Ask questions about uploaded documents
- Receive contextual responses with source citations
- View similarity scores and page references
- Clear chat history as needed
# Run basic functionality tests
python -m pytest tests/ -v# Test database connectivity
python test_db_connection.py
# Test OpenAI integration
python test_openai_connection.py# Test with multiple concurrent users
locust -f locustfile.py --host=http://localhost:8501streamlit run RAG_Oracle23ai_Final.py --server.port 8501FROM python:3.9-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
EXPOSE 8501
CMD ["streamlit", "run", "RAG_Oracle23ai_Final.py", "--server.address", "0.0.0.0"]- Connect your GitHub repository
- Set environment variables in Streamlit Cloud dashboard
- Deploy directly from GitHub
- Create compute instance with Python 3.8+
- Configure Oracle Autonomous Database
- Set up reverse proxy with SSL/TLS
- Use container services (ECS, Container Instances, Cloud Run)
- Configure managed databases or use Oracle Cloud
- Set up load balancers and auto-scaling
# Check TNS_ADMIN environment variable
echo $TNS_ADMIN
# Verify wallet files
ls -la /path/to/wallet/
# Test connection manually
python -c "import oracledb; print('Oracle client OK')"# Verify API key
curl -H "Authorization: Bearer $OPENAI_API_KEY" \
https://api.openai.com/v1/models- Reduce chunk size in configuration
- Process documents in smaller batches
- Use streaming for large file uploads
- Ensure mobile-specific configurations are active
- Test on actual mobile devices
- Monitor network usage and optimize
# View Streamlit logs
tail -f ~/.streamlit/logs/streamlit.log
# Application logs
tail -f app.log- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Install development dependencies:
pip install -r requirements-dev.txt - Make changes and add tests
- Submit a pull request
- Follow PEP 8 guidelines
- Use type hints where appropriate
- Add docstrings for all functions and classes
- Maintain test coverage above 80%
- Update README.md with details of changes
- Update version numbers following semver
- Ensure all tests pass
- Request review from maintainers
This project is licensed under the MIT License - see the LICENSE file for details.
- Oracle: For Oracle Database 23ai and vector search capabilities
- OpenAI: For GPT models and embedding technologies
- Streamlit: For the amazing web application framework
- Sentence Transformers: For state-of-the-art embedding models
- Community: For testing, feedback, and contributions
- πΉ Video Tutorial: YouTube Demo
- π Issues: GitHub Issues
- π¬ Discussions: GitHub Discussions
- π§ Email: Contact Author
- Advanced OCR with layout detection
- Multi-language support
- Real-time collaboration features
- API endpoints for integration
- Advanced analytics dashboard
- Voice input and output
- Integration with more LLM providers
- Advanced document versioning
- Export capabilities (PDF, Word)
- Custom embedding models
β Star this repository if you find it helpful!
π Share it with others who might benefit from this RAG solution!
πΉ Watch the demo video: https://youtu.be/FRPM9zABVVg
