A real-time Gemini API streaming library with FastAPI integration
Project description
🎙️ 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. 🚀
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gemini_live_voice_only-0.1.0.tar.gz.
File metadata
- Download URL: gemini_live_voice_only-0.1.0.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4178d21234a2a352d8b60d9134df9f140fb48a2b91dad26298a8174961a4cda7
|
|
| MD5 |
7010fd25ff60e01599c679a62c4f8090
|
|
| BLAKE2b-256 |
e3ec5c0a8cce649df640f8c8ece70b538ff0abb14d5ce0b24688db8b66dee95b
|
File details
Details for the file gemini_live_voice_only-0.1.0-py3-none-any.whl.
File metadata
- Download URL: gemini_live_voice_only-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a631fb81021fe7f5fa8c3f1b96bd62d70480ffb68502c92d8f1131f6426b10ef
|
|
| MD5 |
4c9f7922279009d4b4236aaf6924401c
|
|
| BLAKE2b-256 |
e65494172a38b1acae77ef6e2754e3f43ef1aa9588dd6719ea8e03761660ec5a
|