Welcome to Quest
Quest is a Retrieval-Augmented Generation (RAG) engine designed to assist with solving and explaining Data Structures and Algorithms (DSA) problems. It leverages a combination of retrieval-based methods and generative models to provide accurate and context-aware solutions to coding problems, explanations of concepts, and metadata about LeetCode-style questions.Installation
Get started by installing Quest and its dependencies
Quickstart
Run your first query in minutes
API Reference
Explore the RAG Engine API and components
Configuration
Configure retriever and generation parameters
What is Quest?
Quest combines the power of semantic search with large language models to provide intelligent assistance for coding problems. Instead of relying solely on web searches or generic AI responses, Quest retrieves relevant solutions from a curated dataset of 1800+ LeetCode problems and generates context-aware explanations.What problems does Quest solve?
Exact problem matching
Exact problem matching
Quest uses a hash map for instant retrieval of exact problem matches, returning solutions in milliseconds rather than seconds.
Semantic search for similar problems
Semantic search for similar problems
When exact matches aren’t found, Quest uses FAISS and HNSW indexing to find semantically similar problems and solutions.
Context-aware explanations
Context-aware explanations
Quest doesn’t just return code—it generates detailed explanations incorporating conversation history and retrieved context.
On-device processing
On-device processing
All processing happens locally using Ollama, ensuring your code and queries remain private.
Key features
Exact matching retrieval
Quickly retrieves solutions for exact matches of problem titles from a curated dataset using optimized hash maps.
Fast similarity search
Uses FAISS and HNSW indexing for efficient similarity search in high-dimensional embedding spaces.
Dual model architecture
Switches between
qwen2.5-coder:1.5b for general queries and deepseek-r1:7b for complex reasoning tasks.Conversation memory
Retains past interactions (configurable up to N queries) for contextually accurate responses across multiple queries.
Dynamic prompt switching
Implements model-specific prompt templates to prevent infinite reasoning loops and optimize response quality.
Metadata-rich responses
Provides problem difficulty, related topics, companies, and edge cases for retrieved solutions.
Optimized performance
Reduced query retrieval time from 1 minute to 15 seconds and reasoning time from 20 minutes to under 4 minutes.
Confidence-based fallback
Switches to model’s own inference for queries with confidence below 0.6 for better accuracy on unknown problems.
How it works
Quest uses a multi-stage retrieval and generation pipeline:- Query normalization - Normalizes user queries to check for exact matches
- Exact matching - Uses hash map lookup for instant exact problem matches
- Semantic retrieval - Encodes query using
all-MiniLM-L6-v2and searches HNSW index - Confidence filtering - Filters results based on similarity scores (default threshold: 0.6)
- Prompt generation - Creates context-aware prompts incorporating conversation history
- LLM generation - Generates responses using Ollama with appropriate model and parameters
- Response filtering - Extracts answer from reasoning traces for deepseek-r1 model
Quest processes everything on your local machine. You’ll need to pull the required Ollama models before using the engine.
Architecture
The core components of Quest include:- LeetCodeRetriever (
retriever2.py:26) - Manages FAISS HNSW index and metadata for 1800+ solutions - RAGEngine (
rag_engine3.py:18) - Orchestrates retrieval, prompt generation, and LLM calls - ConversationHistory (
memory_buffer.py:5) - Maintains conversation context with configurable history limit - PromptTemplates - Provides model-specific prompt templates for general and reasoning modes
- Flask API (
app.py:9) - REST API with endpoints for search, mode switching, and history management
Dataset
Quest includes a pre-generated dataset of 1800+ LeetCode solutions in JSON format, created using theqwen2.5-coder:1.5b model. Each solution includes:
- Complete code implementation
- Problem difficulty level
- Related topics and concepts
- Companies that ask the problem
- Approach explanations
Next steps
Ready to get started? Follow our installation guide to set up Quest on your machine.Install Quest
Install dependencies, unzip the dataset, and verify your setup