{"id":17710519,"url":"https://github.com/adarshgurazada/openai-realtimeapi-voice-assistant","last_synced_at":"2025-03-13T19:31:02.187Z","repository":{"id":259372973,"uuid":"877701032","full_name":"Adarshgurazada/OpenAI-RealtimeAPI-Voice-Assistant","owner":"Adarshgurazada","description":"Interruptible Chatbot Using Realtime API","archived":false,"fork":false,"pushed_at":"2024-10-24T05:19:16.000Z","size":19,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-26T20:23:32.859Z","etag":null,"topics":["chatbot","interruptible","openai","python","realtimeapi","realtimestt","realtimevoiceassistant","voice","whisper"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Adarshgurazada.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-24T05:09:14.000Z","updated_at":"2025-02-04T15:05:23.000Z","dependencies_parsed_at":"2024-10-24T23:17:08.253Z","dependency_job_id":"b236b0bd-251a-4aff-be4d-442384b5d536","html_url":"https://github.com/Adarshgurazada/OpenAI-RealtimeAPI-Voice-Assistant","commit_stats":null,"previous_names":["adarshgurazada/openai-realtimeapi-voice-assistant"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Adarshgurazada%2FOpenAI-RealtimeAPI-Voice-Assistant","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Adarshgurazada%2FOpenAI-RealtimeAPI-Voice-Assistant/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Adarshgurazada%2FOpenAI-RealtimeAPI-Voice-Assistant/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Adarshgurazada%2FOpenAI-RealtimeAPI-Voice-Assistant/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Adarshgurazada","download_url":"https://codeload.github.com/Adarshgurazada/OpenAI-RealtimeAPI-Voice-Assistant/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243469102,"owners_count":20295686,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chatbot","interruptible","openai","python","realtimeapi","realtimestt","realtimevoiceassistant","voice","whisper"],"created_at":"2024-10-25T07:06:24.796Z","updated_at":"2025-03-13T19:31:02.172Z","avatar_url":"https://github.com/Adarshgurazada.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Interruptible Voice Assistant Using OpenAI RealTime API and Wake Word Detection\n\nThis repository contains two Python scripts that work together to create an interruptible voice assistant powered by OpenAI's RealTime API. The assistant features wake word detection, real-time speech-to-text (STT), text-to-speech (TTS), and the ability to carry out conversations using OpenAI’s GPT model.\n\n## Table of Contents\n- [Overview](#overview)\n- [Features](#features)\n- [Setup Instructions](#setup-instructions)\n  - [Environment Variables](#environment-variables)\n  - [Requirements](#requirements)\n  - [Running the Code](#running-the-code)\n- [Code Breakdown](#code-breakdown)\n  - [REALTIMEAPI.py](#realtimeapipy)\n  - [voice.py](#voicepy)\n- [Contributing](#contributing)\n- [License](#license)\n\n---\n\n## Overview\n\nThis repository is designed to handle voice interactions with an assistant that:\n1. Listens for a wake word (such as \"computer\").\n2. Processes speech in real-time and returns AI-generated responses.\n3. Uses both OpenAI's Whisper model for speech recognition and OpenAI's TTS models for generating human-like responses.\n\n---\n\n## Features\n- **Real-time Speech Recognition (STT)**: Streams audio from the microphone to OpenAI's Whisper model for transcription.\n- **Wake Word Detection**: Uses Picovoice's Porcupine library for efficient wake word detection.\n- **Text-to-Speech (TTS)**: Generates real-time audio responses using OpenAI's TTS model.\n- **Interruptible Responses**: Allows the user to interrupt the assistant while it is speaking.\n- **Conversation Management**: Tracks and deletes conversation history dynamically.\n\n---\n\n## Setup Instructions\n\n### Environment Variables\n\nCreate a `.env` file in the root of the project and add the following variables:\n\n```bash\nOPEN_AI=your_openai_api_key\nPORCUPINE=your_porcupine_access_key\n```\n\n### Requirements\n\nTo install the required Python packages, run:\n\n```bash\npip install -r requirements.txt\n```\n\nMake sure you also have `pyaudio` installed, which may require system-level dependencies. For example, on Debian-based systems:\n\n```bash\nsudo apt-get install portaudio19-dev\n```\n\n### Running the Code\n\n1. Clone the repository:\n    ```bash\n    git clone https://github.com/Adarshgurazada/OpenAI-RealtimeAPI-Voice-Assistant.git\n    cd OpenAI-RealtimeAPI-Voice-Assistant\n    ```\n\n2. Install the dependencies:\n    ```bash\n    pip install -r requirements.txt\n    ```\n\n3. Run the voice assistant scripts. You can start either script depending on your needs:\n\n    - **To start the assistant with OpenAI RealTime API:**\n      ```bash\n      python REALTIMEAPI.py\n      ```\n\n    - **To run the assistant with wake word detection:**\n      ```bash\n      python voice.py\n      ```\n\n---\n\n## Code Breakdown\n\n### REALTIMEAPI.py\n\nThe `REALTIMEAPI.py` script connects to OpenAI’s RealTime API to perform real-time speech recognition and response. It streams audio from your microphone, processes it through OpenAI’s Whisper model for transcription, and plays the response using text-to-speech.\n\nKey features:\n- **Wake Word Detection**: Not included.\n- **Real-time Speech-to-Text**: Uses OpenAI’s Whisper model.\n- **Text-to-Speech**: Responds in English with a British accent.\n\n### voice.py\n\nThe `voice.py` script uses Picovoice's Porcupine for wake word detection, allowing you to trigger the assistant by saying a specific keyword. Once activated, it uses OpenAI for generating responses based on the user's input.\n\nKey features:\n- **Wake Word Detection**: Triggered by the keyword \"computer\" using the Porcupine library.\n- **STT and LLM**: Uses OpenAI's Whisper model for speech-to-text and Langchain for handling conversation logic.\n- **Text-to-Speech**: Plays the response using OpenAI’s TTS model.\n\n---\n\n## Contributing\n\nFeel free to fork the project, submit issues, or make pull requests.\n\n---\n\n## License\n\nThis project is licensed under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadarshgurazada%2Fopenai-realtimeapi-voice-assistant","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadarshgurazada%2Fopenai-realtimeapi-voice-assistant","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadarshgurazada%2Fopenai-realtimeapi-voice-assistant/lists"}