Overview
This step-by-step tutorial demonstrates how to build "Querymancer," an AI agent that converts natural language questions into SQL queries for database interaction. Learn to create a complete locally-running application using Ollama (with Gemma 3/Qwen 2.5 models) and LangChain. Follow along as the instructor walks through the entire development process, from setting up the project structure and dependencies to implementing the agent loop with custom prompts. Discover how to create essential database interaction tools (listing tables, describing schemas, sampling data, and executing SQL) and build a functional Streamlit user interface. The tutorial includes a live demonstration of querying a database using natural language, with full source code available for MLExpert Pro subscribers. Perfect for developers looking to eliminate manual SQL writing through AI-powered database interactions.
Syllabus
00:00 - Welcome
01:00 - Full-text tutorial and source code on MLExpert.io
01:27 - AI agent and app architecture
03:04 - Database overview
04:17 - Project structure, config and dependencies
06:07 - Load LLM with Ollama
09:02 - Agent loop and prompt
14:04 - Creating database interaction tools list, describe, sample, execute SQL
21:22 - Streamlit user interface
24:40 - Live demo: querying the database with natural language
27:40 - Conclusion
Taught by
Venelin Valkov