Document Q&A using RAG with OpenAI API, Docling, and LanceDB.
RAG Bot is a Streamlit-based application that allows users to ask questions about uploaded documents. It uses Retrieval Augmented Generation (RAG) using the OpenAI API, Docling, and LanceDB to provide accurate and contextually relevant answers.
Note: An OpenAI API key is required for this tool to function. Without a valid API key, the tool will not be able to connect to the OpenAI services.
- Upload documents in PDF or DOCX format.
- Process and store documents in a LanceDB database.
- Ask questions about the uploaded documents.
- Retrieve relevant context from the documents.
- Generate responses using the OpenAI API.
-
Clone the repository:
git clone https://github.com/rj-price/ragbot.git cd ragbot -
Install the required dependencies:
pip install -r requirements.txt
-
Set up your
.envfile with your OpenAI API key and model of choice:cp .example.env .env
-
Run the Streamlit application:
streamlit run ragbot.py
-
Open your web browser and navigate to
http://localhost:8501. -
Use the sidebar to upload a document and select a database.
-
Ask questions about the document using the chat input.
ragbot.py: Main application file.utils/: Directory containing utility functions for processing documents, retrieving context, and generating chat responses.data/: Directory where document databases are stored.