--- title: SQL Books RAG emoji: 📚 colorFrom: blue colorTo: indigo sdk: gradio sdk_version: "6.6.0" app_file: app.py pinned: false --- # 📚 SQL Books RAG A Retrieval-Augmented Generation (RAG) system that answers SQL questions using content from 5 SQL textbooks. ## How It Works 1. **Retrieval** – Your question is embedded using `all-MiniLM-L6-v2` and matched against a FAISS index of ~500-word chunks extracted from the books. 2. **Generation** – The top-5 most relevant chunks are fed as context to `Llama 3.1-8B` via the Groq API to produce a detailed, grounded answer. ## Data Sources | Book | Author | |------|--------| | Practical SQL: A Beginner's Guide to Storytelling with Data | Anthony DeBarros | | SQL for Data Scientists | Renee M. Teate | | SQL for Data Analysis | Cathy Tanimura | | The Art of SQL | Stéphane Faroult | | Learning SQL: Generate, Manipulate, and Retrieve Data | Alan Beaulieu | ## Tech Stack - **Embeddings**: `sentence-transformers/all-MiniLM-L6-v2` - **Vector Store**: FAISS (IndexFlatL2) - **LLM**: `Llama 3.1-8B-Instant` via Groq API (free tier) - **UI**: Gradio