A Python-based voice assistant that listens, thinks, and talks back — built as a learning project to understand speech recognition, LLM tool-calling, and text-to-speech pipelines.
- 🎤 Listens to your voice via microphone (Google Speech Recognition)
- 🧠 Thinks using Gemini AI, which decides which tool to call based on what you ask
- 🌦️ Weather — fetches live conditions for any city (OpenWeather API)
- 📰 News — pulls top 3 headlines from India (NewsAPI)
- 📖 Wikipedia — summarizes any topic in 2-3 sentences
▶️ YouTube — opens search results for a query- 🔊 Speaks the response back out loud (pyttsx3)
Your voice → Speech Recognition → Gemini (decides tool) → API call → Response → Text-to-Speech
Gemini uses function calling to automatically route your request to the right tool — you don't need to say "check weather," it figures out intent from natural conversation.
speech_recognition— voice inputpyttsx3— voice outputgoogle-genai— Gemini API client with function callingrequests— weather and news API callswikipedia— fast Wikipedia summariespython-dotenv— API key management
- Clone the repo and install dependencies:
pip install -r requirements.txt- Create a
.envfile in the project root:
GEMINI_API_KEY=your_key_here
OPENWEATHER_API_KEY=your_key_here
NEWS_API_KEY=your_key_here
- Run it:
python main.pySay "exit", "stop", or "sleep" to shut it down.
This started from a YouTube tutorial that used Selenium browser automation for Wikipedia and YouTube search. I followed that approach first, but it was slow (5-6 seconds per query, full Chrome browser boot each time) and felt like the wrong tool for what modern AI APIs can do directly.
I rebuilt the Wikipedia and YouTube modules using direct API/library calls instead of browser automation, cutting response times from ~8-10 seconds down to ~2-3 seconds.
I used Gemini extensively as a debugging and design partner throughout — including
diagnosing why the text-to-speech engine would go silent after the first response
(turned out pyttsx3's event loop breaks on reuse — fixed by reinitializing the engine
per call) and understanding Gemini's free-tier rate limits when I hit a 429 quota error
mid-testing.
This is a prototype, not a finished product. Known limitations below.
- Free tier Gemini API caps at a limited number of requests/day — you will hit this with heavy testing
- No conversation memory persistence between sessions
- YouTube tool opens search results rather than auto-playing the first video (removed Selenium auto-click for speed; could be re-added with a YouTube Data API call)
- CLI-only, no GUI/web frontend yet
- Single-user, runs locally — not deployed
Inspired by a YouTube tutorial on Selenium-based voice assistants. Rebuilt and extended with Gemini API for the reasoning layer and faster, non-Selenium data fetching.