Cookies

With your permission, we use Google Analytics cookies to measure visits and improve the site. Necessary cookies are always on. You can change your choice or withdraw consent anytime in the footer, under Cookie settings. Cookie Policy

Skip to content

RAG and Knowledge ·Intermediate

RAG App with Hybrid Search

About this app

A powerful document Q&A application that leverages Hybrid Search (RAG) and Claude's advanced language capabilities to provide comprehensive answers. Built with RAGLite for robust document processing and retrieval, and Streamlit for an intuitive chat interface, this system seamlessly combines document-specific knowledge with Claude's general intelligence to deliver accurate and contextual responses.

  • Complete open-source code
  • Step-by-step tutorial

Technical sheet

Category
RAG and Knowledge
Difficulty
Intermediate
Models
OpenAI, Claude
Frameworks
-
Runs locally?
Needs cloud APIs
Required keys
ANTHROPIC_API_KEYCOHERE_API_KEYOPENAI_API_KEY

License Apache-2.0 · content curated and maintained by Doutor AI.

Full tutorial

A powerful document Q&A application that leverages Hybrid Search (RAG) and Claude's advanced language capabilities to provide comprehensive answers. Built with RAGLite for robust document processing and retrieval, and Streamlit for an intuitive chat interface, this system seamlessly combines document-specific knowledge with Claude's general intelligence to deliver accurate and contextual responses.

Features

  • Hybrid Search Question Answering
  • RAG-based answers for document-specific queries
  • Fallback to Claude for general knowledge questions
  • Document Processing:
  • PDF document upload and processing
  • Automatic text chunking and embedding
  • Hybrid search combining semantic and keyword matching
  • Reranking for better context selection
  • Multi-Model Integration:
  • Claude for text generation - tested with Claude 3 Opus
  • OpenAI for embeddings - tested with text-embedding-3-large
  • Cohere for reranking - tested with Cohere 3.5 reranker

Prerequisites

You'll need the following API keys and database setup:

  1. 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)
  1. API Keys:

How to get Started?

  1. Clone the Repository:
git clone https://github.com/Shubhamsaboo/awesome-llm-apps.git
cd awesome-llm-apps/rag_tutorials/hybrid_search_rag
  1. Install Dependencies:
pip install -r requirements.txt
  1. 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
  1. Run the Application:
streamlit run main.py

Usage

  1. Start the application
  2. Enter your API keys in the sidebar:
  • OpenAI API key
  • Anthropic API key
  • Cohere API key
  • Database URL (optional, defaults to SQLite)
  1. Click "Save Configuration"
  2. Upload PDF documents
  3. 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.

From the same category

RAG and KnowledgeIntermediate

Agentic RAG Embedding Gemma

This Streamlit app demonstrates an agentic Retrieval-Augmented Generation (RAG) Agent using Google's EmbeddingGemma for embeddings and Llama 3.2 as th…

  • Llama
  • local
RAG and KnowledgeIntermediate

Agentic RAG with GPT-5

An agentic RAG application built with the Agno framework, featuring GPT-5 and LanceDB for efficient knowledge retrieval and question answering.

  • OpenAI

Need a tailor-made solution?

Not sure where to start with AI in your business? Get a free assessment and a tailored plan - no commitment.

Save hours every week with AI, no hassle

Doutor AI gives you 1,859 ready-to-copy AI prompts, by industry and in plain English - plus a complete technical library for those who want to go further.

See plans