mirror of
https://github.com/Shubhamsaboo/awesome-llm-apps.git
synced 2026-04-30 07:08:44 -05:00
Hybrid RAG Claude Chat 🤖
A powerful document Q&A application that combines Hybrid Search (RAG) with Claude's general knowledge. This is built on the RAGLite framework and Chainlit for the UI.
Features
-
Hybrid Question Answering
- RAG-based answers for document-specific queries
- Fallback to Claude for general knowledge questions
- Seamless switching between modes
-
Document Processing:
- PDF document upload and processing
- Automatic text chunking and embedding
- Hybrid search combining semantic and keyword matching
- Reranking for better context selection
-
Interactive Chat Interface:
- Real-time streaming responses
- Chat history preservation
- Error handling with retry options
- File upload validation
-
Multi-Model Integration:
- Claude for text generation
- OpenAI for embeddings
- Cohere for reranking (tried using the new Cohere 3.5 reranker)
Prerequisites
You'll need the following API keys and database setup:
-
Database: Create a free PostgreSQL database at Neon:
- Sign up/Login at Neon
- Create a new project
- Copy the connection string (looks like:
postgresql://user:pass@ep-xyz.region.aws.neon.tech/dbname)
-
API Keys:
- OpenAI API key for embeddings
- Anthropic API key for Claude
- Cohere API key for reranking
Installation
-
Clone the Repository:
git clone <repository-url> cd rag_tutorials/llm_app_hybrid_RAG_claude -
Install Dependencies:
pip install -r requirements.txt -
Install spaCy Model:
pip install https://github.com/explosion/spacy-models/releases/download/xx_sent_ud_sm-3.7.0/xx_sent_ud_sm-3.7.0-py3-none-any.whl -
Run the Application:
chainlit run main.py
Usage
- Start the application
- When prompted, enter your:
- OpenAI API key
- Anthropic API key
- Cohere API key
- Neon PostgreSQL URL
- Upload PDF documents
- Start asking questions!
- Document-specific questions will use RAG
- General questions will use Claude directly
Database Options
The application supports multiple database backends:
-
PostgreSQL (Recommended):
- Create a free serverless PostgreSQL database at Neon
- Get instant provisioning and scale-to-zero capability
- Connection string format:
postgresql://user:pass@ep-xyz.region.aws.neon.tech/dbname
-
MySQL:
mysql://user:pass@host:port/db -
SQLite (Local development):
sqlite:///path/to/db.sqlite
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.