This Streamlit-based Retrieval-Augmented Generation (RAG) app processes uploaded documents, retrieves relevant content for user queries, and provides accurate responses using a Large Language Model (LLM). The app enables seamless document chunking, embedding storage in Chroma Vector Database, and dynamic prompt construction with a compression mechanism for efficient LLM interactions.
-
User-Friendly Interface: Streamlit-based app for easy interaction and intuitive design.
-
Document Upload: Supports PDF and TXT formats for document processing.
-
Chunking and Embedding: Splits documents into smaller sections and creates embeddings for storage.
-
Chroma Vector Database: Efficiently stores and retrieves embeddings for similarity-based queries.
-
Prompt Compression: Summarizes retrieved chunks to optimize token usage and ensure concise, context-aware prompts.
-
Dynamic Query Handling: Constructs personalized prompts by combining user queries with relevant document content.
-
LLM Integration: Leverages advanced LLMs to provide accurate and context-sensitive responses.
- Python 3.12.7
-
Download and install Anaconda from here
-
Create a new environment using the following command:
conda create -n Rag-app python=3.12.7
- Activate the environment:
conda activate Rag-app
pip install -r requirements.txt
Copy the example environment file and set your variables:
cp .env.example .env
Edit the .env file and configure the required environment variables, such as :
GOOGLE_API_KEY=<your-google-api-key>
1- Ensure your environment is activated:
conda activate Rag-app
2- Run FastAPI Server:
uvicorn main:app --reload
3- Run the Streamlit App:
streamlit run streamlit.py
4- Access the app in your browser:
-
Once the command is executed, the app will automatically open in your default web browser.
-
if not, copy the link provided in the terminal and paste it into your browser.
This project is licensed under the MIT License.