DynamicRAG is a React-based web application that implements a dynamic Retrieval-Augmented Generation (RAG) system. It allows users to input text, process it into embeddings, and perform question-answering tasks using a combination of vector search and Large Language Models.
- Real-time text processing and chunking
- Dynamic vector database creation using Qdrant
- Batch processing of large text inputs
- Integration with a local Gaia node
- GitHub repository analysis using GitIngest
- Progress tracking and error handling
- Clean, responsive UI using Tailwind CSS and shadcn/ui components
- Node.js (v16 or higher)
- Python (for GitIngest installation)
- A running Qdrant instance (local or remote)
- A local LLM server through Gaia running on port 8080 (Tutorial: https://docs.gaianet.ai/node-guide/quick-start)
- The
nomic-embed
embedding model (auto-downloaded ingaianet
folder when the Gaia CLI is installed) - The
llama 3.2
language model (auto-downloaded ingaianet
folder when the Gaia CLI is installed. You can replace the model depending on your use-case)
- Clone the repository:
git clone https://github.com/harishkotra/dynamic-rag-gaia
cd dynamic-rag
- Install dependencies:
npm install
- Install GitIngest:
pip install gitingest
- Ensure your Qdrant server is running and accessible at http://localhost:6333
- Ensure your Gaia node is running and accessible at http://localhost:8080 (Tutorial: https://docs.gaianet.ai/node-guide/quick-start)
- Start the development server:
npm run dev
- Choose Input Mode:
- Text Input: Paste your knowledge base text into the input textarea
- GitHub Repository: Enter a GitHub repository URL to analyze its contents
- Ask Questions: Enter your query in the question field.
- Process: Click "Submit" to process your query. The system will:
- For text input: Split the input text into manageable chunks
- For GitHub repos: Fetch and process repository content using GitIngest
- Create embeddings for each chunk
- Store embeddings in a temporary Qdrant collection
- Find relevant context using vector similarity search
- Generate an answer using the local Gaia Node
- View Results: The system will display the generated response based on the relevant context found.
- Maximum chunk size: 2000 characters
- Batch processing size: 3 chunks at a time
- Chunks are created based on natural text boundaries (paragraphs and sentences)
- Uses Qdrant for vector storage and similarity search
- Creates temporary collections for each query session
- Automatically cleans up collections after use
- Uses 768-dimensional vectors for embeddings
- Compatible with OpenAI-style API endpoints
- Supports both embeddings and chat completion endpoints
- Uses the
nomic-embed
model for embeddings - Uses the
llama
model for text generation - Integrates with GitIngest for repository analysis
- NextJS API routes for command-line tool integration
DynamicRAG.js
: Main component implementing the RAG systemapp/api/gitingest/route.js
: API route for GitHub repository processing- Input handling and validation
- Progress tracking and error display
- Vector database management
- LLM integration
The system includes comprehensive error handling for:
- Text processing failures
- GitHub repository fetch and analysis errors
- Embedding creation errors
- Vector database operations
- LLM query failures
- Network issues
- React
- Tailwind CSS
- shadcn/ui components
- Lodash for utility functions
- Various UI components (@/components/ui/*)
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request