Skip to content

cenesdeveloper/RagSearch

Repository files navigation

RAG Document Search

An AI-powered document search application that allows users to upload files and ask natural language questions about their content.

The system uses Retrieval-Augmented Generation (RAG) with semantic search to find relevant information and generate accurate answers.

Features

  • Upload PDF, DOCX, and TXT files
  • Automatic text extraction and chunking
  • Semantic search using vector embeddings (pgvector)
  • AI-generated answers based on document content
  • Source referencing for retrieved information
  • Document management (view, download, delete)
  • PDF preview and full-text viewer

Tech Stack

  • Frontend: Next.js, React, Tailwind CSS
  • Backend: Next.js API Routes
  • Database: Supabase (PostgreSQL + pgvector)
  • AI: OpenAI (embeddings + LLM)
  • Storage: Supabase Storage

How It Works

  1. Upload

    • Files are uploaded and stored in Supabase Storage
    • Text is extracted and split into chunks
  2. Embedding

    • Each chunk is converted into a vector using OpenAI embeddings
  3. Storage

    • Chunks + embeddings are stored in PostgreSQL (pgvector)
  4. Search

    • User query is embedded
    • Similar chunks are retrieved using vector similarity
  5. Generation

    • Retrieved context is passed to an LLM
    • Final answer is generated

Setup

1. Clone the repo

git clone <your-repo-url>
cd <your-project>

2. Install dependencies

npm install

3. Add environment variables

Create a .env.local file in the root directory:

NEXT_PUBLIC_SUPABASE_URL=your_supabase_url
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_DEFAULT_KEY=your_supabase_anon_key
SUPABASE_SERVICE_ROLE_KEY=your_service_role_key
OPENAI_API_KEY=your_openai_api_key

4. Run the app locally

npm run dev

About

Document searching application using RAG with semantic search over uploaded files

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors