Olivia
A modular, offline-capable Python voice assistant for Windows — local Whisper STT, offline SAPI5 TTS, and skills that degrade gracefully without a network.
What it is / why it exists
Cloud voice assistants ship your microphone audio to someone else's servers and stop working when the network drops. Olivia keeps the core loop 100% on your machine: it records the mic, transcribes it locally with a Whisper model (faster-whisper / CTranslate2), routes the command to a skill, and replies out loud through the offline Windows SAPI5 voice. Optional skills that genuinely need the internet (search, weather, news, translate) run only when online and report an error instead of crashing the loop.
Live site: olivia.oriz.in · Landing: chirag127.github.io/olivia · Repo: github.com/chirag127/olivia
⭐ If this is useful, please star the repo — it helps others find it.
How it works
flowchart LR
Mic([Microphone]) --> STT["take_command()<br/>local faster-whisper STT"]
STT --> Router["assistant.py<br/>command router"]
Router -->|offline gate| Skills{Skill dispatch}
Skills --> Offline["Offline skills<br/>system · automation · fun · games"]
Skills --> Online["Online skills<br/>search · weather · news · translate"]
Offline --> TTS["speak()<br/>offline SAPI5 TTS"]
Online --> TTS
TTS --> Speaker([Speaker])
Config[["config.py<br/>env vars"]] -.-> STT
Config -.-> RouterSpeech recognition (Whisper), text-to-speech (SAPI5), and command routing are fully offline. The Whisper model auto-downloads once from Hugging Face on first run; after that, STT needs no network. Set OLIVIAOFFLINEONLY=1 and every online skill announces "needs internet" instead of running — the offline half keeps working.
Features
Voice-controlled, grouped by skill (O = offline, N = needs internet):
- Search & knowledge (N) — Google / YouTube / Wikipedia / Bing / DuckDuckGo + 40 other engines; "tell me about X" / "who is X" read Wikipedia summaries aloud.
- Weather (N) — current conditions for any city (OpenWeatherMap) + an internet speed test.
- News (N) — top BBC headlines (NewsAPI).
- Translation (N) — text to 100+ languages via googletrans ("translate hello to french").
- System monitoring (O) — CPU / RAM / disk / battery usage (psutil); public IP (N).
- Media — play any song/video on YouTube and control it (N); take screenshots (O).
- Communication (N) — send email (env-var credentials) and WhatsApp messages.
- Automation (O) — launch / close apps, press keys, type dictation, lock the screen, power control (shutdown/restart/logout/hibernate).
- Fun — offline jokes / cards / dice / random-password generation (O); online dad jokes (N).
- Games (O) — a Tkinter Tic-Tac-Toe with pure, testable win logic.
Tech stack
- Python 3.10+ — packaged under src/olivia/, installable (pip install -e .), console entry point olivia.
- faster-whisper (CTranslate2) — local speech-to-text, no cloud STT.
- pyttsx3 — offline Windows SAPI5 text-to-speech.
- sounddevice / numpy — mic capture.
- psutil / pyautogui / pyperclip / winshell / pywin32 — system + desktop automation (Windows).
- wikipedia / pyowm / requests / googletrans / pywhatkit / speedtest-cli / pyjokes — the online skills.
Repo structure
src/olivia/
__main__.py # entry point: python -m olivia
core/
speech.py # speak() SAPI5 TTS + take_command() local Whisper STT
assistant.py # main loop + command router + offline/online gating
config.py # env-var config (model, offline_only, email, API keys, voice)
skills/ # search · weather · news · translate · system · media ·
# communication · automation · fun (one module per group)
games/tic_tac_toe.py # Tkinter game, pure win/tie logic
utils/helpers.py # time/date/greeting, clipboard, tab helpers
tests/ # pure-logic tests (mocked mic/model, no network)
docs/ # olivia.oriz.in landing page (CNAME)The router in core/assistant.py maps spoken phrases to skill functions via small dispatch tables; every skill is independently importable and testable, with heavy/native imports kept lazy so modules load on headless CI.