Haven: A Private, Voice-First AI Companion for a Friend in Need
DEV Community

Haven: A Private, Voice-First AI Companion for a Friend in Need

This is a submission for the Hacktoberfest Weekend Challenge: Build for a Friend What I Built I built Haven - an empathetic, voice-first AI companion designed for a close friend who often navigates heavy personal and family matters late at night. When dealing with sensitive issues, people often hesitate to reach out to acquaintances because they fear being judged, feeling like an emotional burden, or receiving unsolicited advice when all they truly need is a safe space to breathe. Haven solves this by emulating an intimate, real-time phone call. Instead of forcing manual text typing or transactional push-to-talk buttons, Haven operates like a late-night phone call: - Instant Connection: You hit "Start Call", and Haven picks up immediately with a comforting voice: "Hey, I'm right here. How are you feeling right now?" - The Gentle Listener Rule: Early in heavy exchanges, Haven asks: "Do you want me to just listen and stay here with you, or would you like us to think through solutions together?" - Dynamic Language Mirroring: Smoothly understands and mirrors natural Hindi, Hinglish, and English without missing emotional nuance. Demo Live Interaction Mode: Haven runs a full-duplex hands-free voice loop using browser Web Speech API, with audio synthesis directly speaking back to the caller. Dual Flexibility: A dedicated "Phone Call Mode" for natural speaking, accompanied by a discreet "Text Chat Mode" for quiet environments. Code The complete source code is open-source and available on GitHub: ishhha10 / haven-companion I built Haven for a friend who often finds herself dealing with personal matters late at night, wishing she had someone trustworthy to talk to who would simply listen, never leak her vulnerabilities to cloud logs, and ask the most important question before jumping in. ๐Ÿ•ฏ๏ธ Haven - Voice-First Empathetic AI Companion Built for the Hacktoberfest DEV Weekend Challenge ("Build for a Friend"). Haven is a voice-first, empathetic AI companion designed for a friend dealing with heavy personal or family matters they cannot openly share. It focuses on 100% privacy, non-judgmental presence, and active listening rather than unsolicited advice. ๐ŸŒŸ Prize Track Architecture Coverage Prize Track Implementation Details ๐Ÿค– Gemma Track ($200) Core Intelligence defaults to Google Gemma 2 (2B) running 100% locally via Ollama ( gemma2:2b ) for zero data leakage. Features a dual-execution fallback to connect to remote OpenAI/Hugging Face-compatible endpoints for cloud setups. ๐ŸŽ™๏ธ ElevenLabs Track ($100) Converts Haven's responses into comforting audio streams using ElevenLabs API ( eleven_multilingual_v2 , voice: "Rachel"). If no API key is provided, gracefully falls back to in-app text display with zero crashes. ๐Ÿ’พ MongoDB Atlas Track ($100) Dynamic hybrid persistent memory in database.py . Automatically How I Built It Haven is engineered from the ground up for low latency and total user privacy: Google Gemma 2 (2B) via Ollama: The core conversational brain runs on Gemma 2 (2B) open weights. Using optimized token budgeting (num_predict: 45, num_ctx: 1024), Haven achieves rapid, human-paced conversational latency (1-2 seconds) directly on local hardware without cloud round-trips. Streamlit & Web Audio Bridge: The frontend provides a dark-mode phone interface. A real-time speech loop auto-detects conversational pauses and streams audio seamlessly without third-party audio drivers. Local Persistent Memory (SQLite): Haven remembers conversational emotional context across sessions using a local database, ensuring my friend doesn't have to re-explain her situation every time she opens the app. Graceful Cloud Fallback: Fully containerized with Render configurations for optional cloud hosting. Why Does Open Innovation Matter? Emotional vulnerability demands 100% privacy and zero commercial data leakage. When someone shares deeply private family struggles, that data cannot live on closed proprietary cloud APIs where prompts might be logged, inspected, or fed into opaque commercial training loops. Open innovation and open-weight models like Google Gemma make this possible: Complete Data Sovereignty: Everything from audio interpretation to memory persistence stays strictly inside the local boundary under the user's control. Reliable Offline Companionship: It runs without recurring subscription gates or external token rate limits. True Empathy Over Guardrail Rigidity: Open weights let developers shape fine-grained conversational pacing and compassionate boundaries that prioritize listening before offering unsolicited advice. Prize Categories Best Use of Gemma ($200): Built around local Google Gemma 2 (2B) inference via Ollama for private, empathetic conversational intelligence and dynamic Hinglish/English language mirroring. Best Use of Render ($200): Architected with production containerization and deployment configs ready for Render web services. Overall "Build for a Friend" Track: A purposeful, humane tool built to offer authentic comfort and listening presence to a loved one. Top comments (0)

Read on DEV Community ↗ ← Back to News

Comments

No comments yet. Start the discussion.