Skip to content

About

Real-time voice AI assistant — low-latency speech recognition and natural conversation

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

21 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rs4Machine Logo

🎙️ SofiaVoice v2.0 — Rs4Machine

SofiaVoice Demo

AI voice system for low-latency speech interaction

SofiaVoice is a public RS4 Lab experiment covering an asynchronous STT → LLM → TTS pipeline with session-isolated conversation handling.

Live App API Docs GitHub

License Python Next.js FastAPI

🇺🇸 English (this file) · 🇧🇷 Português do Brasil


📑 Table of Contents


🎯 Overview

SofiaVoice is a voice-system experiment developed by Rs4Machine within the RS4 Lab. It implements a conversational pipeline that receives audio, transcribes it, generates a response, and synthesizes speech.

The public v2.0 implementation focuses on asynchronous execution, a smaller audio payload, session-isolated state, and explicit API boundaries. The system is designed for measurement and iteration rather than opaque autonomy.

Official positioning: AI Systems Engineer focused on hybrid architectures (LLM + deterministic logic) to eliminate hallucinations and ensure auditability in production.


⚡ Key Improvements in v2.0.0

  • Asynchronous Pipeline — Full async execution (AsyncGroq + Edge-TTS) without blocking the event loop.
  • Neural TTS Migration — Replaced legacy gTTS with Microsoft Edge-TTS (FranciscaNeural), reducing audio payload sizes by 52%.
  • Hardened Security — Strict CORS domain mapping, 10 MB payload limits (HTTP 413), and input sanitization against XSS.
  • Session Isolation — Independent conversation state handling per request session.

⚡ Performance Benchmarks (v1.0 vs v2.0)

Metric / Stage Baseline v1.0 (LLaMA 3.3 70B · gTTS) v2.0 (openai/gpt-oss-20b · Edge-TTS) Optimization Gain
STT Latency (Whisper V3) ~0.84s ~0.84s —
LLM Latency (LLaMA 3.3 70B → openai/gpt-oss-20b) ~0.70s ~0.70s —
TTS Engine Synthesis ~4.41s ~1.60s – 2.50s ~40% faster
Audio Payload Size 64.5 KB 30.8 KB 52% smaller payload
Execution Architecture Synchronous / Blocking Pure Async / Non-blocking Zero thread blocking

🏗️ Architecture

sofiavoice/
├── frontend/                        → Next.js 15 (Vercel)
│   ├── app/sofia-voice/page.jsx     → Main orchestrator
│   ├── components/SofiaVoice/       → Voice interface components
│   ├── hooks/useSofiaVoice.js       → Web Audio API + API client
│   └── styles/                      → Custom UI animations
│
└── backend/                         → Python 3.14 + FastAPI (Render)
    ├── main.py                      → FastAPI instance, CORS & security middleware
    ├── config.py                    → Environment configuration
    ├── routers/voice.py              → Async voice pipeline routes
    └── services/
        ├── stt.py                   → Whisper Large v3 via Groq
        ├── llm.py                   → openai/gpt-oss-20b via AsyncGroq
        └── tts.py                   → Edge-TTS (FranciscaNeural)

🛠️ Tech Stack

Layer Technology Specification
Frontend Next.js 15 + React 19 App Router + Web Audio API
Styling CSS Modules / Tokens Rs4Machine design system
Backend Python 3.14.2 + FastAPI Asynchronous ASGI execution
Speech-to-Text Groq API Whisper Large v3
Intelligence Groq API openai/gpt-oss-20b via AsyncGroq
Text-to-Speech Edge-TTS Microsoft neural voice (pt-BR-FranciscaNeural)
Deployment Vercel (frontend) + Render (backend) Public deployment

🚀 Running Locally

Backend Setup

cd backend
python -m venv .venv

# Linux/Mac
source .venv/bin/activate
# Windows
.venv\Scripts\activate

pip install -r requirements.txt

Create a .env file inside backend/:

GROQ_API_KEY=your_groq_api_key_here
ALLOWED_ORIGINS=http://localhost:3000

Start the asynchronous API server:

uvicorn main:app --reload --port 8000

Interactive API documentation: http://localhost:8000/docs

Frontend Setup

cd frontend
npm install
npm run dev

Create a .env.local file inside frontend/:

NEXT_PUBLIC_API_URL=http://localhost:8000

Open the application at: http://localhost:3000/sofia-voice


📡 API Endpoints

Method Route Description Status Code
GET /health API operational check 200 OK
POST /api/transcribe Audio file → text transcription 200 OK / 400 Bad Request
POST /api/chat Text prompt → AI response 200 OK / 400 Bad Request
POST /api/speak Text prompt → neural Base64 audio 200 OK / 400 Bad Request
POST /api/voice Full end-to-end pipeline 200 OK / 413 Payload Too Large

🤝 Contributing

Contributions, issues, and documentation improvements are welcome.

  1. Fork the project
  2. Create a feature branch (git checkout -b feature/your-change)
  3. Commit your changes using Conventional Commits
  4. Push the branch (git push origin feature/your-change)
  5. Open a Pull Request

📄 License

This project is licensed under the MIT License — see LICENSE for details.


📬 Contact

Raphael Mendes
AI Systems Engineer & Founder · Rs4Machine

SofiaVoice v2.0.0 · RS4 Lab · September 2026

About

Real-time voice AI assistant — low-latency speech recognition and natural conversation

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages