🎙️ Gemini Live Voice Only Python
Gemini Live Voice Only is a real-time streaming library that integrates the Gemini API with FastAPI and WebRTC using fastrtc. This package enables developers to build applications that process audio streams in real time—ideal for tasks such as voice-based ID matching. 🔊
✨ Features
- 🚀 Real-time Audio Streaming: Seamlessly stream audio data via FastAPI and WebRTC.
- 🔍 Gemini API Integration: Leverage the Gemini API's live voice processing capabilities.
- ⚙️ Customizable Configuration: Set your API key, system prompt, and voice name at initialization.
- 🌍 Flexible CORS Setup: Configure CORS settings to suit your deployment needs.
- 🛠️ Easy-to-Use API: Quickly create and run your streaming server with minimal setup.
📥 Installation
Install the package from PyPI:
pip install gemini_live_voice_only
Or install it in editable mode from the source repository:
git clone <repository_url>
cd gemini_live_voice_only
pip install -e .
🚀 Usage
Here's a quick example to get you started:
from gemini_live_voice_only import create_gemini_stream
import uvicorn
# 🎛️ Configuration parameters
API_KEY = "YOUR_API_KEY"
SYSTEM_PROMPT = (
"You are a specialized ID matching tool. Compare input IDs with the reference ID 'RBTL24CB067' "
"and output only the matching percentage."
)
VOICE_NAME = "Puck"
# 🎤 Create the FastAPI app with customizable CORS settings
app = create_gemini_stream(
api_key=API_KEY,
system_prompt=SYSTEM_PROMPT,
voice_name=VOICE_NAME,
cors_origins=["https://yourdomain.com"], # specify allowed origins
cors_allow_credentials=True,
cors_allow_methods=["*"],
cors_allow_headers=["*"],
)
if __name__ == "__main__":
uvicorn.run(app, host="127.0.0.1", port=7860, reload=True)
⚙️ Configuration Options
When using the create_gemini_stream function, you can configure:
- 🔑 API Key, System Prompt, and Voice Name: Required for setting up the Gemini API connection.
- 🌐 ICE Servers: Customize the ICE server list for WebRTC connections if needed.
- 🔄 CORS Settings: Configure
cors_origins,cors_allow_credentials,cors_allow_methods, andcors_allow_headersfor cross-origin resource sharing. - 🎶 Audio Stream Parameters: Adjust
expected_layout,output_sample_rate,output_frame_size, andinput_sample_ratebased on your audio processing needs. - ⚡ Concurrency & Time Limits: Modify
concurrency_limitandtime_limitto suit your application's requirements.
🤝 Contributing
Contributions are welcome! 🎉 If you have suggestions, bug reports, or feature requests, please open an issue or submit a pull request. 🚀
Metadata
Release files for gemini-live-voice-only 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| gemini_live_voice_only-0.1.1.tar.gz | 5.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gemini_live_voice_only-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.4 kB
Release files / gemini_live_voice_only-0.1.1.tar.gz
| Download URL | gemini_live_voice_only-0.1.1.tar.gz |
|---|---|
| Size | 5.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ea516a63d0da8364c152b011485e309cc5c6d112081b9d8b4819513e27a239f3
|
|
BLAKE2b-256 checksum How to use checksums |
feec425f977d9f772badebcfe6da71d9a1ccaea9131d0ca849c54a5cc5951bcc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.1
|
Release files / gemini_live_voice_only-0.1.1-py3-none-any.whl
| Download URL | gemini_live_voice_only-0.1.1-py3-none-any.whl |
|---|---|
| Size | 6.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
232092e2459f65112fc616909adf5e2e59cd2051a703b0ad89dc77741cfa4973
|
|
BLAKE2b-256 checksum How to use checksums |
59592bb50a366bd2195ef31c232e482b09dbab392805e6cb878546a1ec51ed19
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.1
|