-
Notifications
You must be signed in to change notification settings - Fork 1
AI Features
dagustin415 edited this page Feb 5, 2026
·
3 revisions
Coding Drills integrates AI through two providers:
- WebLLM (primary) — Llama-3.1-8B-Instruct running locally via WebGPU
- OpenAI (optional fallback) — Cloud-based AI via OpenAI SDK
- Model: Llama-3.1-8B-Instruct (quantized for browser)
-
Runtime:
@mlc-ai/web-llmvia WebGPU - Size: ~3GB first download (cached in browser after)
- Requirement: WebGPU-capable browser (Chrome 113+, Edge 113+)
- User clicks "Activate AI Tutor" on an exercise or UI pattern page
- WebLLM model is loaded on-demand (shows download progress)
- Model runs entirely in-browser — no data sent to servers
- Generates contextual hints, explanations, and code reviews
| Feature | Component | System Prompt |
|---|---|---|
| Exercise Tutor | ExerciseTutor.tsx |
lib/exercises/tutor-prompt.ts |
| UI Pattern Tutor | ExerciseTutor.tsx |
lib/frontend-drills/ui-patterns/tutor-prompt.ts |
| AI Mock Interview | Interview pages | lib/interview/prompts.ts |
- 72 algorithm problems across 22 algorithmic patterns
- 28 system design questions
- Covers: Two Pointers, Sliding Window, Binary Search, BFS/DFS, DP, Greedy, Backtracking, Graph, Trie, Heap, Stack, etc.
- User selects language and difficulty
- AI presents a coding problem
- User writes code and explains approach
- AI provides follow-up questions, hints, and feedback
- Progressive hint system with 4 escalation levels:
- Level 1: General direction hint
- Level 2: Pattern/approach hint
- Level 3: Specific technique hint
- Level 4: Near-solution guidance
interface InterviewConfig {
difficulty: 'easy' | 'medium' | 'hard';
language: LanguageId;
adaptiveDifficulty: boolean;
}Prompt engineering reduces token usage by ~30% through:
- Concise system prompts
- Structured response format
- Context window management for multi-turn conversations
The ExerciseTutor component provides contextual AI tutoring on exercises and UI patterns.
- Break down explanations step by step
- Clarify each instruction
- Walk through hints progressively
- Explain the solution code line by line
- Review user's code for bugs
- Narrate algorithm visualizations step by step
- All AI inference runs locally via WebGPU
- No user code or data is sent to external servers
- OpenAI fallback is opt-in only