Skip to content
cataWalterPublic

About

No description or website provided.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Gemini Voice Assistant with Memory This project is a Python-based personal assistant that uses Google's Gemini API for its conversational intelligence. It features voice input and output, a persistent memory to recall past conversations, and offline wake-word detection.

Features Conversational AI: Powered by the Google Gemini API for natural and intelligent responses.

Voice Interaction: Speak to the assistant and hear its responses spoken back to you.

Persistent Memory: The assistant remembers previous conversations by saving them to a local JSON file, allowing for contextual follow-ups.

Wake-Word Detection: Uses pvporcupine for a lightweight, offline "wake word" engine so it only listens when you want it to.

Secure API Key Management: Utilizes a .env file to keep your Google API key safe and out of the source code.

Getting Started These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites Python 3.7+

A microphone for voice input

A Google API key for the Gemini API. You can obtain one from Google AI Studio.

A Porcupine AccessKey for wake-word detection. You can get one for free from the Picovoice Console.

Installation Clone the repository:

git clone https://your-repository-url.com/your-project.git cd your-project

Create and activate a virtual environment (recommended):

For Windows

python -m venv venv .\venv\Scripts\activate

For macOS/Linux

python3 -m venv venv source venv/bin/activate

Install the required packages:

pip install -r requirements.txt

Create a .env file: In the root directory of the project, create a file named .env and add your API keys:

GEMINI_API_KEY="YOUR_GEMINI_API_KEY_HERE" PICOVOICE_ACCESS_KEY="YOUR_PICOVOICE_ACCESS_KEY_HERE"

Usage To run the assistant, simply execute the main Python script:

python main.py

The assistant will start and listen for the wake word ("Porcupine" by default, but this can be changed). Once it hears the wake word, it will start listening for your command or question.

How It Works Wake Word Detection: The pvporcupine library listens continuously for a specific wake word.

Audio Recording: Once the wake word is detected, pyaudio and SpeechRecognition work together to record audio from your microphone and transcribe it into text.

Memory Retrieval: The assistant loads the conversation history from the conversation_memory.json file.

API Call: The transcribed text, along with the recent conversation history, is sent to the Gemini API.

Response Generation: Gemini processes the input and generates a response.

Memory Update: The new user input and the assistant's response are added to the conversation_memory.json file.

Voice Output: The gTTS (Google Text-to-Speech) library converts the assistant's text response into an audio file, which is then played using playsound.

About

No description or website provided.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages