Skip to content

TashonBraganca/RAG.Question-Answer-Bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

RAG Q&A Bot

This project is a Retrieval-Augmented Generation (RAG) Q&A bot built in a Jupyter Notebook. It allows users to upload a custom document, which is then processed and stored in a Pinecone vector database using OpenAI embeddings. Users can ask questions about the document's content and receive accurate, context-aware answers generated by an OpenAI language model.

Features

  • Dynamic Document Upload: Users can upload their own text-based documents (.txt, .md, etc.) to be used as the knowledge base.
  • Vector-Based Retrieval: Utilizes Pinecone's vector database for efficient similarity search and retrieval of relevant document passages.
  • AI-Powered Answers: Leverages OpenAI's language models to generate human-like answers based on the retrieved context.
  • Interactive Q&A: Provides a simple input prompt for users to ask questions and receive answers directly within the notebook.

How It Works

The application follows a RAG architecture:

  1. Upload: The user uploads a document.
  2. Load & Chunk: The document is loaded and split into smaller, manageable chunks of text.
  3. Embed & Store: Each text chunk is converted into a numerical vector representation (embedding) using OpenAI's models. These embeddings are then stored in a Pinecone vector index.
  4. Query: When a user asks a question, their query is also converted into an embedding.
  5. Retrieve: Pinecone searches the index for the text chunks with embeddings most similar to the user's query embedding.
  6. Generate: The retrieved text chunks and the original user query are passed to an OpenAI language model, which generates a final, coherent answer.

Getting Started

Prerequisites

  • Python 3.x
  • Jupyter Notebook or JupyterLab
  • An OpenAI API key
  • A Pinecone API key

Installation

  1. Clone the repository:

    git clone https://github.com/TashonBraganca/RAG-Q-A-.git
    cd RAG-Q-A-
  2. Open the notebook: Open the RAG_Q_A_Bot.ipynb file in Jupyter Notebook or JupyterLab.

Configuration and Usage

  1. Run the first cell to install the required Python libraries.
  2. Run the API key cell. You will be prompted to enter your OpenAI and Pinecone API keys securely.
  3. Run the file upload cell. You will be prompted to upload your own document.
  4. Run the remaining cells in order to process your document, set up the Pinecone index, and initialize the Q&A chain.
  5. Ask a question! In the final cell, enter your question into the input box and run the cell to receive an answer.

Technologies Used

  • LangChain: The primary framework for building the RAG pipeline.
  • OpenAI: Used for generating text embeddings and for the final answer generation.
  • Pinecone: The vector database used for storing and retrieving document embeddings.
  • Jupyter Notebook: The environment for running the interactive Q&A bot.

About

This project is a RAG Q&A bot built in a jupyter notebook. It allows users to upload a custom document, which is then processed and stored in a Pinecone vector database using OpenAI embeddings. Users can ask questions about the document's content and receive accurate, context-aware answers generated by an OpenAI language model.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors