An intelligent RAG system combining vector search, knowledge graphs, and smart memory for comprehensive document analysis and conversational AI.
โ Production Ready โข Version 2.0.0 โข 94.32% F1 Score
|
Beautiful theme with smooth transitions, localStorage persistence, and optimized color palette for comfortable viewing. Context-aware conversations that remember previous Q&A, instant answers from cache, 60-70% accuracy in complex queries. Use your own OpenAI API key for complete control over costs and usage. Keys are encrypted at rest with AES encryption and never stored on the server. |
9 natural language operations to create, delete, merge, and connect nodes - no Cypher needed! Pure white text in dark mode, markdown rendering with code blocks, smooth animations throughout. |
# 1. Clone repository with submodules
git clone --recurse-submodules <repository-url>
cd LYZR-Hackathon
# If already cloned without submodules:
git submodule update --init --recursive
# 2. Setup environment
cp .env-example .env
# Edit .env with your OpenAI API key
# 3. Start services
docker-compose up --build
# 4. Access the system
# Frontend: http://localhost:3000
# API Docs: http://localhost:8000/docs
# Neo4j: http://localhost:7474Prerequisites: Docker, OpenAI API Key, 8GB+ RAM
--recurse-submodules flag or run git submodule update --init --recursive after cloning.
Complete control over your OpenAI costs:
- Bring Your Own Key: Use your personal OpenAI API key
- Encrypted at Rest: AES encryption with device-specific fingerprinting
- Never Server-Stored: Keys stay in your browser's localStorage
- Zero Trust: Server never persists your key, only uses it for requests
- Easy Setup: Configure via Settings modal in the UI
- Fallback Support: System can use environment key if user key not provided
4 intelligent search tools that auto-select or run in parallel:
- Vector Search - Semantic understanding (5x/3x retrieval multipliers)
- Graph Search - Multi-hop relationship traversal (1-hop, 2-hop)
- Filter Search - Metadata and date filtering via Elasticsearch
- Graph Update - Natural language graph modifications
- Pass 1: Broad entity extraction
- Pass 2: Find missing referenced entities
- Pass 3: Discover indirect relationships
- Result: 30-50% richer knowledge graphs, 25 concurrent chunks
- Memory-First: Checks history before searching documents
- Cost Savings: Instant cached responses
- Performance: 60-70% accuracy in complex needle-in-haystack tests
- Control: One-click memory clearing
| Metric | Score |
|---|---|
| Context Precision | 99.99% |
| Context Recall | 94.32% |
| F1 Score | 94.32% |
| Memory Speed | Instant |
| Query Speed | <2s |
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ React Frontend โ
โ โข Dark Mode UI โข Real-time Streaming โข Graph Visualization โ
โ โข Memory State Display โข Token Usage Tracking โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ HTTP/SSE
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ FastAPI Backend (v2.0) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ ๐ง Memory Manager โ โ
โ โ โข Conversation History โข Token Tracking โ โ
โ โ โข Context Compression โข Memory-First Strategy โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ ๐ค Multi-Tool Search Agent โ โ
โ โ โโโโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโ โ โ
โ โ โ Vector โ โ Graph โ โ Filter โ โ Graph โ โ โ
โ โ โ Search โ โ Search โ โ Search โ โUpdate โ โ โ
โ โ โโโโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโ โ โ
โ โ โข Smart Tool Selection โข MAX_PERFORMANCE Mode โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ ๐ธ๏ธ GraphRAG Pipeline (3-Pass) โ โ
โ โ Pass 1: Entity Extraction โ โ
โ โ Pass 2: Missing Entities โ โ
โ โ Pass 3: Indirect Relationships โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโ-โ
โ โ
โโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโ
โ โ โ โ
โผ โผ โผ โผ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโ---โ
โ PostgreSQL โ โ PGVector โ โ Neo4j โ โElasticsearchโ
โ (Metadata + โ โ (Embeddings โ โ (Knowledge โ โ (Metadata โ
โ Memory) โ โ 1536-dim) โ โ Graph) โ โ Search) โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโ---โโ
โโโโโโโโโโโโโโโโโโโโโโโ
โ User Query โ
โโโโโโโโโโโโฌโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ง Memory Check โ
โ (Memory-First) โ
โโโโโโโโโโโโฌโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโ
โ โ
โผ Found โผ Not Found
โโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโ
โ Return Cached โ โ Document Search โ
โ Answer (Instant) โ โ Required โ
โโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโฌโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโดโโโโโโโโโโโโโโ
โ โ
โผ MAX_PERFORMANCE=true โผ Standard Mode
โโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ Run All Tools โ โ ๐ค Agent Selects โ
โ in Parallel: โ โ Best Tool(s): โ
โ โข Vector Search โ โ โ
โ โข Graph Search โ โ Decision Logic: โ
โ โข Filter Search โ โ โ
โ Then synthesize results โ โ โ๏ธ "Create/Delete" โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ graph_update โ
โ โ
โ ๐ธ๏ธ "Who is X?" โ
โ "How X relates Y"โ
โ โ graph_search โ
โ โ
โ ๐ "What is X?" โ
โ "Explain..." โ
โ โ vector_search โ
โ โ
โ ๐ "Docs from 2023"โ
โ โ filter_search โ
โโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโ
โ Synthesize Results โ
โ Store in Memory โ
โ Stream to Frontend โ
โโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโ
โ Upload PDF โ
โโโโโโโโฌโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Backend: Document Processing โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ 1. Extract Text (PyMuPDF/Docling) โ
โ 2. Chunk Text (1200 chars, 500 overlap) โ
โ โ โ
โ 3. Generate Embeddings (OpenAI text-embedding-3-large) โ
โ โ โ
โ 4. GraphRAG 3-Pass Enrichment โ
โ โข Pass 1: Extract entities/relationships โ
โ โข Pass 2: Find referenced entities โ
โ โข Pass 3: Discover indirect connections โ
โโโโโโฌโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโฌโโโโโโ
โ โ โ โ
โผ โผ โผ โผ
โโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ
โPostgreSQLโ โ PGVector โ โ Neo4j โ โElasticsearch โ
โ โ โ โ โ โ โ โ
โโข Metadataโ โโข Embeddings โ โโข Entities โ โโข Text Index โ
โโข Filenameโ โโข Chunks โ โโข Relations โ โโข Metadata โ
โโข Status โ โโข Vectors โ โโข Properties โ โโข Highlights โ
โโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโ
โ User Query โ
โโโโโโโโฌโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Step 1: Memory Check (PostgreSQL) โ
โ โข Search conversation history โ
โ โข Semantic keyword matching โ
โ โข If found โ Return cached answer (FAST PATH) โ
โโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Not in memory
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Step 2: Tool Execution โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ ๐ Vector Search (PGVector + BM25) โ
โ โข Query embedding โ Similarity search โ
โ โข Retrieve top-kร5 chunks โ
โ โข Rerank with cross-encoder โ top-kร3 โ
โ โข Expand context (ยฑ2 adjacent chunks) โ
โ โ
โ ๐ธ๏ธ Graph Search (Neo4j) โ
โ โข Entity extraction from query โ
โ โข 1-hop traversal (direct connections) โ
โ โข 2-hop traversal (indirect connections) โ
โ โข Return entity network with relationships โ
โ โ
โ ๐ Filter Search (Elasticsearch) โ
โ โข Extract filters (date, author, category) โ
โ โข Metadata-based search โ
โ โข Return matching documents with highlights โ
โ โ
โ โ๏ธ Graph Update (Neo4j) โ
โ โข Parse update command โ
โ โข Execute CRUD operations on graph โ
โ โข Return success/failure status โ
โโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Step 3: LLM Synthesis โ
โ โข Combine results from tools โ
โ โข Generate comprehensive answer โ
โ โข Format with proper markdown โ
โโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Step 4: Memory Storage (PostgreSQL) โ
โ โข Store query + response โ
โ โข Track token usage โ
โ โข Update memory state โ
โโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Step 5: Stream to Frontend โ
โ โข SSE events (thinking, tool_start, tool_end) โ
โ โข Final answer with formatting โ
โ โข Memory state + token usage โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
# API & Credentials
OPENAI_API_KEY=sk-proj-your-key # Optional: Can be provided by users via UI
POSTGRES_PASSWORD=your_password
NEO4J_AUTH=neo4j/your_password
# Performance Features
MAX_PERFORMANCE=false # Run all tools in parallel
GRAPHRAG_ENABLE_MULTIPASS=true # 3-pass enrichment
# Optimal RAG Settings
CHUNK_SIZE=1200
CHUNK_OVERLAP=500
TOP_K_RESULTS=20Users can provide their own OpenAI API key through the UI:
- Click Settings Icon (โ๏ธ) in the top-right corner
- Enter Your OpenAI API Key in the modal
- Save - Key is encrypted and stored in browser localStorage
- Use the System - All API calls use your key automatically
Security Features:
- ๐ AES Encryption with browser fingerprint-based key derivation
- ๐ Client-Side Storage - Keys never leave your browser
- ๐ Zero Server Persistence - Backend receives keys via headers only
- ๐ Easy Management - Clear/update key anytime via Settings
# Upload document with your API key
curl -X POST http://localhost:8000/api/rag/upload \
-H "X-OpenAI-API-Key: sk-proj-your-key-here" \
-F "file=@document.pdf"
# Query with your API key
curl -X POST http://localhost:8000/api/rag/query/stream \
-H "Content-Type: application/json" \
-H "X-OpenAI-API-Key: sk-proj-your-key-here" \
-d '{"query": "What is this about?", "document_id": "your-id"}'
# Update graph with your API key
curl -X POST http://localhost:8000/api/rag/query/stream \
-H "Content-Type: application/json" \
-H "X-OpenAI-API-Key: sk-proj-your-key-here" \
-d '{"query": "Create AI node and connect to Python, ML", "document_id": "your-id"}'# Upload document (uses env OPENAI_API_KEY)
curl -X POST http://localhost:8000/api/rag/upload \
-F "file=@document.pdf"
# Query without custom key
curl -X POST http://localhost:8000/api/rag/query/stream \
-H "Content-Type: application/json" \
-d '{"query": "What is this about?", "document_id": "your-id"}'
# Clear memory
curl -X DELETE http://localhost:8000/api/memory/clearNote: The X-OpenAI-API-Key header is optional. If not provided, the system falls back to the OPENAI_API_KEY from environment variables.
Full API documentation: http://localhost:8000/docs
# Run unit tests (27% coverage)
docker exec lyzr-hackathon-backend-1 pytest test/unit_tests/ -v
# Run RAGAS evaluation
docker exec lyzr-hackathon-backend-1 pytest test/integration_tests/ -vSee test/README.md for detailed testing documentation.
LYZR-Hackathon/
โโโ backend/ # FastAPI + Search Agent + Memory + GraphRAG
โโโ frontend/ # React + Dark Mode + Graph Visualization
โโโ memory/ # Git submodule: Long-term memory system (Lyzr)
โ # Source: https://github.com/dev-pratap-singh/memory
โโโ test/ # Unit tests + RAGAS evaluation
โโโ docker-compose.yml
โโโ .env-example
Memory Submodule: The memory/ directory is a git submodule containing the Lyzr long-term memory implementation. It provides:
- Conversation tracking and history management
- Memory facts and user preferences storage
- Training history for model fine-tuning
- Vector-based semantic search for memory retrieval
"Graph traversal timeout":
- Multi-hop traversal can be slow on very large graphs
- Check Neo4j performance
- Consider limiting 2-hop traversal depth
- SLM for Graph Creation: Use Gemma-3-8B to reduce costs
- Microsoft GraphRAG: Full hierarchical clustering implementation
- Visual Image RAG: Late interaction models for image retrieval
- Embedding-based Memory: True semantic search vs keyword matching
- Multi-Document Evolution: Stress test with 100+ documents
Major Features:
- ๐ Bring Your Own API Key - User-provided OpenAI keys with AES encryption
- ๐ Complete Dark Mode - Beautiful theme with localStorage persistence
- ๐ง Smart Memory System - Memory-first strategy with instant cached responses
- ๐จ Enhanced UI - Pure white text in dark mode, improved markdown rendering
- ๐ Zero-Trust Security - API keys encrypted at rest, never stored on server
Natural language graph updates โข 9 operations โข Batch connections โข Real-time refresh
Multi-hop traversal โข 3-pass enrichment โข MAX_PERFORMANCE mode โข F1 Score 94.32%
Initial release โข Multi-tool agent โข Hybrid search โข RAGAS evaluation
Dev Pratap Singh โข Senior AI Engineer โข IIT Goa
Special thanks to the team for organizing this hackathon. If I don't win, I'd love to meet the team in Bangalore for coffee! โ๏ธ
Last Updated: October 15, 2025 โข Status: โ Production Ready โข Version: 2.0.0








