Built with LLAMA 2 (via Ollama), ChromaDB, Docker, Flask, React, and Redux
QueryPal is a Retrieval-Augmented Generation (RAG) system that leverages Meta's Llama 2.0 model (via Ollama), ChromaDB for vector storage, and LangChain for process orchestration. This project seamlessly combines document retrieval and query handling, enabling:
- Contextually relevant responses to questions about uploaded documents.
- General knowledge query answering.
A sleek and intuitive dashboard enhances the user experience, making it easy to interact with the system.
QueryPal integrates robust document retrieval capabilities with LLM-driven response generation to ensure accurate and context-aware answers. The process involves:
- Retriever: Encoding and indexing external documents into vectors for similarity-based searches.
- Generator: Using Llama 2.0 (via Ollama) to generate responses based on retrieved documents or pre-trained knowledge.
LangChain orchestrates the workflow, ensuring a seamless integration of these components.
- General Queries: Answers a wide range of questions using Llama 2.0’s built-in knowledge, even without uploaded documents.
- Document-Based Q&A: Delivers precise, context-aware answers by analyzing uploaded documents.
- Embedding Creation: Generates document embeddings using HuggingFace.
- Data Persistence: Stores embeddings for future use.
- Vector Database: Builds a ChromaDB-based vector database for efficient retrieval.
- Retriever Initialization: Fetches relevant documents for user queries.
- General Query Handling: Leverages Llama 2.0 to answer questions unrelated to uploaded documents.
- LLM Integration: Ensures deterministic, contextually relevant answers using Llama 2.0 (via Ollama).
- Q&A Pipeline: Combines the retriever and generator components via LangChain.
- Frontend: Developed with React, featuring Redux for state management and React Router for navigation. The UI is intuitive and user-friendly.
- Backend: Built on Flask, hosting the RAG stack and exposing necessary APIs.
git clone [email protected]:ankitrajput0096/QueryPal-Personalized-AI-Friend.git
cd QueryPal-Personalized-AI-Friend
- Build the Docker image:
docker-compose build
- Start the Docker containers:
docker-compose up
- Start the containers with:
docker-compose -f docker-compose-run.yml up
A Postman collection is included for easy API interaction. Import the collection and use the following endpoints:
-
General Query
- Description: Handles questions unrelated to uploaded documents.
- Endpoint:
http://127.0.0.1:8090/ask_general_query
- Method: POST
- Request Body:
{ "query": "What is the capital of USA?" }
-
Upload Document
-
Similarity Search
- Description: Finds content similar to a query in uploaded documents.
- Endpoint:
http://127.0.0.1:8090/similarity_search
- Method: POST
- Request Body:
{ "query": "Find content similar to this query." }
-
Query Document
- Description: Queries uploaded documents for specific information.
- Endpoint:
http://127.0.0.1:8090/query_document
- Method: POST
- Request Body:
{ "query": "What is the content of the document?" }
-
Upload and Query Text
- Description: Uploads text and queries it simultaneously.
- Endpoint:
http://127.0.0.1:8090/text_and_query
- Method: POST
- Request Body:
{ "text": "Summary of A Brief History of Data Visualization...", "query": "What were the changes during the 1850–1900 Golden Age of statistical graphics?" }
This README ensures a clear understanding of QueryPal’s features and usage. Feel free to reach out with questions or suggestions!