Skip to content

amathur2k/rag-chatbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

RAG Document Chatbot

A simple Retrieval Augmented Generation (RAG) chatbot that allows users to upload multiple documents and chat with them. The application uses Gradio for the frontend interface and Pinecone as the vector database.

Features

  • Upload multiple documents (PDF, TXT, DOCX)
  • Extract text from documents and store as vector embeddings
  • Chat with your documents using natural language
  • Responses include source information

Prerequisites

  • Docker installed on your machine
  • OpenAI API key
  • Pinecone API key

Setup

  1. Clone this repository:

    git clone <repository-url>
    cd <repository-directory>
    
  2. Create a .env file by copying the example:

    cp .env.example .env
    
  3. Edit the .env file and fill in your API keys:

    OPENAI_API_KEY=your_openai_api_key_here
    PINECONE_API_KEY=your_pinecone_api_key_here
    PINECONE_ENVIRONMENT=your_pinecone_environment_here
    PINECONE_INDEX_NAME=your_pinecone_index_name_here
    

Running with Docker

Option 1: Using Docker Compose (Recommended)

docker-compose up -d

This will build the image and start the container in the background. You can view the logs with:

docker-compose logs -f

Option 2: Using Docker directly

  1. Build the Docker image:

    docker build -t rag-document-chatbot .
    
  2. Run the container:

    docker run -p 7860:7860 --env-file .env rag-document-chatbot
    
  3. Access the application in your browser at:

    http://localhost:7860
    

Usage

  1. Go to the "Upload Documents" tab.
  2. Upload one or more documents (PDF, TXT, DOCX).
  3. Click "Process Documents" and wait for confirmation.
  4. Switch to the "Chat" tab.
  5. Ask questions about your documents.

How It Works

  1. Document Processing: Uploaded documents are processed, chunked, and embedded.
  2. Vector Storage: Document chunks are stored in Pinecone as vector embeddings.
  3. Retrieval: When you ask a question, the system finds the most relevant document chunks.
  4. Generation: The language model generates a response based on the retrieved context.

Technical Stack

  • Python
  • Gradio (Frontend)
  • LangChain (RAG framework)
  • OpenAI (Embeddings and LLM)
  • Pinecone (Vector Database)
  • Docker (Containerization)

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages