This documentation provides a comprehensive overview of the RAG-Powered AI Assistant repository. The project demonstrates how to build a Retrieval-Augmented Generation (RAG) assistant capable of answering questions using a custom knowledge base of publications. The assistant supports both command-line and web user interfaces, leveraging Mistral and Hugging Face models for retrieval and generation.
The primary goal of this repository is to showcase the development of an AI assistant that combines retrieval-based search with generative AI to provide contextually relevant answers from a curated set of publication data. This approach addresses the challenge of extracting actionable insights from large, domain-specific datasets, making it ideal for research, academic, or organizational knowledge bases
The RAG-Powered-AI-Assistant library is architected around modular components for scalable, efficient retrieval-augmented generation (RAG). Its design centers on two foundational classes—TextChunker and VectorDB—which together enable robust document preprocessing, vector storage, and semantic search. Here’s a detailed breakdown of how the library works, referencing the system components documentation and the overall pipeline.
The TextChunker class is responsible for transforming raw publication documents into smaller, manageable chunks suitable for embedding and retrieval.
Key Implementation Details:
Configurable Chunking:
Flexible Separators:
Metadata Preservation:
Batch Processing:
process_documents method handles a list of documents, chunking each and aggregating the results.Document Loading:
load_documents method loads documents from a directory of JSON files, extracting fields like title and publication_description.Load Documents:
TextChunker.load_documents to read and parse JSON files, extracting titles and content.Chunk Documents:
TextChunker.process_documents to split each document into chunks, each with its own metadata.The VectorDB class manages persistent storage and retrieval of text embeddings using ChromaDB and Hugging Face models.
Key Implementation Details:
Persistent Storage:
Flexible Embeddings:
Document Insertion:
Semantic Search:
Initialize Database:
Insert Documents:
Semantic Search:
git clone https://github.com/HiIAmTzeKean/RAG-Powered-AI-Assistant cd RAG-Powered-AI-Assistant
uv sync
# Create a .env file in the project root with your API keys: MISTRAL_API_KEY=your_mistral_api_key HF_KEY=your_huggingface_api_key
Sample CLI Usage:
uv run cli "What are effective techniques for handling class imbalance?"
Sample Web UI Usage:
uv run ui
/data with your own JSON or text files, provided they follow the expected schema.The RAG-Powered AI Assistant repository provides a practical, extensible template for building RAG-based assistants over custom datasets. Its modular design, support for multiple interfaces, and API flexibility make it suitable for a wide range of knowledge-driven applications.
For more details, see the repository's README and source code.