💡 Chat with your PDF documents
A JavaScript library for building RAG-powered document question-answering systems. docuRAG.js provides a streamlined solution for implementing Retrieval-Augmented Generation using Qdrant vector database and local LLM integration.
- LLM Integration: Flexible local LLM support with streaming responses
- Vector Storage: Qdrant integration for vector similarity search
- Text Processing: RecursiveCharacterTextSplitter from LangChain
- Streaming Responses: Server-Sent Events (SSE) for real-time chat responses
- PDF Processing: Automatic PDF text extraction and chunking
- Session Management: Built-in session handling for document contexts
- Framework Agnostic: Can be used with any Node.js framework
- Modern JavaScript runtime (Node.js 18+ for server-side)
- Running Qdrant instance
- Local LLM server (e.g., Ollama with Llama2)
⚠️ Note: Currently tested and optimized for Llama2. Other models may work but are not officially supported.
# Start Qdrant
docker run -p 6333:6333 qdrant/qdrant
# Start Llama2
ollama run llama2
# Install docuRAG
npm install docuragimport{DocuRAG}from'docurag';// Initialize DocuRAGconstdocuRAG=newDocuRAG({qdrantUrl: 'http://localhost:6333',llmUrl: 'http://localhost:11434'});// Process a PDF bufferconst{ sessionId }=awaitdocuRAG.processPDFBuffer(pdfBuffer,fileName);// Chat with streamingawaitdocuRAG.chat(sessionId,"What is this document about?",{onData: (data)=>console.log(data.response),onEnd: ()=>console.log("Done"),onError: (error)=>console.error(error)});// Clean up when doneawaitdocuRAG.cleanup(sessionId);{// Vector Store ConfigurationqdrantUrl: string,// Qdrant server URLvectorSize: number,// Default: 3072vectorDistance: string,// Default: 'Cosine'// LLM ConfigurationllmUrl: string,// LLM server URLllmModel: string,// Default: 'llama3.2'// Text ProcessingchunkSize: number,// Default: 1000chunkOverlap: number,// Default: 200// Search ConfigurationsearchLimit: number// Default: 3}- Express Example - Complete implementation with UI
- NestJS Example - Same features, NestJS implementation
Areas for contribution:
- Additional vector store integrations
- Alternative LLM providers
- Enhanced chunking strategies
- Performance optimizations
- Testing infrastructure
MIT License - see LICENSE
Built with ❤️ by Yannis Kolovos
