') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); })(); GitHub - PromtEngineer/Verbi: A modular voice assistant application for experimenting with state-of-the-art transcription, response generation, and text-to-speech models. Supports OpenAI, Groq, Elevanlabs, CartesiaAI, and Deepgram APIs, plus local models via Ollama. Ideal for research and development in voice technology. · GitHub
Skip to content

Repository files navigation

VERBI - Voice Assistant 🎙️

PromtEngineer%2FVerbi | Trendshift

GitHub StarsGitHub ForksGitHub IssuesGitHub Pull RequestsLicense

Motivation ✨✨✨

Welcome to the Voice Assistant project! 🎙️ Our goal is to create a modular voice assistant application that allows you to experiment with state-of-the-art (SOTA) models for various components. The modular structure provides flexibility, enabling you to pick and choose between different SOTA models for transcription, response generation, and text-to-speech (TTS). This approach facilitates easy testing and comparison of different models, making it an ideal platform for research and development in voice assistant technologies. Whether you're a developer, researcher, or enthusiast, this project is for you!

Features 🧰

  • Modular Design: Easily switch between different models for transcription, response generation, and TTS.
  • Support for Multiple APIs: Integrates with OpenAI, Groq, and Deepgram APIs, along with placeholders for local models.
  • Audio Recording and Playback: Record audio from the microphone and play generated speech.
  • Configuration Management: Centralized configuration in config.py for easy setup and management.

Project Structure 📂

voice_assistant/
├── voice_assistant/
│ ├── __init__.py
│ ├── audio.py
│ ├── api_key_manager.py
│ ├── config.py
│ ├── transcription.py
│ ├── response_generation.py
│ ├── text_to_speech.py
│ ├── utils.py
│ ├── local_tts_api.py
│ ├── local_tts_generation.py
├── .env
├── run_voice_assistant.py
├── piper_server.py
├── setup.py
├── requirements.txt
└── README.md

Setup Instructions 📋

Prerequisites ✅

  • Python 3.10 or higher
  • Virtual environment (recommended)

Step-by-Step Instructions 🔢

  1. 📥 Clone the repository
 git clone https://github.com/PromtEngineer/Verbi.git
cd Verbi
  1. 🐍 Set up a virtual environment

Using venv:

 python -m venv venv
source venv/bin/activate # On Windows use `venv\Scripts\activate`

Using conda:

 conda create --name verbi python=3.10
conda activate verbi
  1. 📦 Install the required packages
 pip install -r requirements.txt
  1. 🛠️ Set up the environment variables

Create a .env file in the root directory and add your API keys:

 OPENAI_API_KEY=your_openai_api_key
GROQ_API_KEY=your_groq_api_key
DEEPGRAM_API_KEY=your_deepgram_api_key
LOCAL_MODEL_PATH=path/to/local/model
PIPER_SERVER_URL=server_url
  1. 🧩 Configure the models

Edit config.py to select the models you want to use:

 class Config:
# Model selection
TRANSCRIPTION_MODEL = 'groq'# Options: 'openai', 'groq', 'deepgram', 'fastwhisperapi' 'local'
RESPONSE_MODEL = 'groq'# Options: 'openai', 'groq', 'ollama', 'local'
TTS_MODEL = 'deepgram'# Options: 'openai', 'deepgram', 'elevenlabs', 'local', 'melotts', 'piper'# API keys and paths
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
GROQ_API_KEY = os.getenv("GROQ_API_KEY")
DEEPGRAM_API_KEY = os.getenv("DEEPGRAM_API_KEY")
LOCAL_MODEL_PATH = os.getenv("LOCAL_MODEL_PATH")

If you are running LLM locally via Ollama, make sure the Ollama server is runnig before starting verbi.

  1. 🔊 Configure ElevenLabs Jarvis' Voice
  • Voice samples here.
  • Follow this link to add the Jarvis voice to your ElevenLabs account.
  • Name the voice 'Paul J.' or, if you prefer a different name, ensure it matches the ELEVENLABS_VOICE_ID variable in the text_to_speech.py file.
  1. 🏃 Run the voice assistant
 python run_voice_assistant.py
  1. 🎤 Install FastWhisperAPI

    Optional step if you need a local transcription model

    Clone the repository

     cd..
    git clone https://github.com/3choff/FastWhisperAPI.git
    cd FastWhisperAPI

    Install the required packages:

     pip install -r requirements.txt

    Run the API

     fastapi run main.py

    Alternative Setup and Run Methods

    The API can also run directly on a Docker container or in Google Colab.

    Docker:

    Build a Docker container:

     docker build -t fastwhisperapi .

    Run the container

     docker run -p 8000:8000 fastwhisperapi

    Refer to the repository documentation for the Google Colab method: https://github.com/3choff/FastWhisperAPI/blob/main/README.md

  2. 🎤 Install Local TTS - MeloTTS

    Optional step if you need a local Text to Speech model

    Install MeloTTS from Github

    Use the following link to install MeloTTS for your operating system.

    Once the package is installed on your local virtual environment, you can start the api server using the following command.

     python voice_assistant/local_tts_api.py

    The local_tts_api.py file implements as fastapi server that will listen to incoming text and will generate audio using MeloTTS model. In order to use the local TTS model, you will need to update the config.py file by setting:

     TTS_MODEL = 'melotts'# Options: 'openai', 'deepgram', 'elevenlabs', 'local', 'melotts', 'piper'
  3. 🎤 Install Local TTS - Piper

    A faster and lightweight alternative to MeloTTS

    Download the Piper Binary and the voice from Github

    Use the following link to install Piper Binary for your operating system.

    Use the following link to download Piper voices. Each voice will have two files: | .onnx | Actual voice model | | .onnx.json | Model configuration |

    For example:

    models/en_US-lessac-medium/
    ├── en_US-lessac-medium.onnx
    ├── en_US-lessac-medium.onnx.json

    Once the binary and voice is downloaded on your system, edit the piper_server.py and provide the binary and voice paths.

     piper_executable = "./piper/piper"#example path to the piper binary 
    model_path = "en_US-lessac-medium.onnx"#example path to the .onnx file

    You can start the api server using the following command.

     python piper_server.py

    The piper_server.py file implements as fastapi server that will listen to incoming text and will generate audio using Piper model. In order to use the local TTS model, you will need to update the config.py file by setting:

     TTS_MODEL = 'piper'# Options: 'openai', 'deepgram', 'elevenlabs', 'local', 'melotts','piper'

    You can run the main file to start using verbi with local models.

Model Options ⚙️

Transcription Models 🎤

  • OpenAI: Uses OpenAI's Whisper model.
  • Groq: Uses Groq's Whisper-large-v3 model.
  • Deepgram: Uses Deepgram's transcription model.
  • FastWhisperAPI: Uses FastWhisperAPI, a local transcription API powered by Faster Whisper.
  • Local: Placeholder for a local speech-to-text (STT) model.

Response Generation Models 💬

  • OpenAI: Uses OpenAI's GPT-4 model.
  • Groq: Uses Groq's LLaMA model.
  • Ollama: Uses any model served via Ollama.
  • Local: Placeholder for a local language model.

Text-to-Speech (TTS) Models 🔊

  • OpenAI: Uses OpenAI's TTS model with the 'fable' voice.
  • Deepgram: Uses Deepgram's TTS model with the 'aura-angus-en' voice.
  • ElevenLabs: Uses ElevenLabs' TTS model with the 'Paul J.' voice.
  • Local: Placeholder for a local TTS model.

Detailed Module Descriptions 📘

  • run_verbi.py: Main script to run the voice assistant.
  • voice_assistant/config.py: Manages configuration settings and API keys.
  • voice_assistant/api_key_manager.py: Handles retrieval of API keys based on configured models.
  • voice_assistant/audio.py: Functions for recording and playing audio.
  • voice_assistant/transcription.py: Manages audio transcription using various APIs.
  • voice_assistant/response_generation.py: Handles generating responses using various language models.
  • voice_assistant/text_to_speech.py: Manages converting text responses into speech.
  • voice_assistant/utils.py: Contains utility functions like deleting files.
  • voice_assistant/local_tts_api.py: Contains the api implementation to run the MeloTTS model.
  • voice_assistant/local_tts_generation.py: Contains the code to use the MeloTTS api to generated audio.
  • voice_assistant/__init__.py: Initializes the voice_assistant package.

Roadmap 🛤️🛤️🛤️

Here's what's next for the Voice Assistant project:

  1. Add Support for Streaming: Enable real-time streaming of audio input and output.
  2. Add Support for ElevenLabs and Enhanced Deepgram for TTS: Integrate additional TTS options for higher quality and variety.
  3. Add Filler Audios: Include background or filler audios while waiting for model responses to enhance user experience.
  4. Add Support for Local Models Across the Board: Expand support for local models in transcription, response generation, and TTS.

Contributing 🤝

We welcome contributions from the community! If you'd like to help improve this project, please follow these steps:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature-branch).
  3. Make your changes and commit them (git commit -m 'Add new feature').
  4. Push to the branch (git push origin feature-branch).
  5. Open a pull request detailing your changes.

Star History ✨✨✨

Star History Chart

About

A modular voice assistant application for experimenting with state-of-the-art transcription, response generation, and text-to-speech models. Supports OpenAI, Groq, Elevanlabs, CartesiaAI, and Deepgram APIs, plus local models via Ollama. Ideal for research and development in voice technology.

Resources

Stars

1.1k stars

Watchers

17 watching

Forks

Releases

Packages

Used by

Contributors

Languages