Gladia
The GladiaSTTService provides ultra-fast, real-time transcription using Gladia's optimized speech models. It includes advanced features like automatic language detection, translation, and high-performance VAD.
Installation
To use Gladia, install the required dependencies:
pip install "piopiy-ai[gladia]"
Prerequisites
- A Gladia account and API key (Get yours here).
- Set your API key in your environment:
export GLADIA_API_KEY="your_api_key_here"
Configuration
GladiaSTTService Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
api_key | str | Required | Your Gladia API key. |
sample_rate | int | None | Audio sample rate in Hz. |
model | str | "solaria-1" | Model to use (e.g., "solaria-1"). |
params | GladiaInputParams | None | Advanced VAD and language settings. |
GladiaInputParams
| Parameter | Type | Default | Description |
|---|---|---|---|
language_config | LanguageConfig | None | Multi-language and code-switching setup. |
endpointing | int | None | Silence duration (ms) for segmenting. |
enable_vad | bool | False | Enable Gladia's voice activity detection. |
Usage
Basic Setup
import os
from piopiy.services.gladia.stt import GladiaSTTService
from piopiy.services.gladia.config import GladiaInputParams
stt = GladiaSTTService(
api_key=os.getenv("GLADIA_API_KEY"),
params=GladiaInputParams(
endpointing=300,
enable_vad=True
)
)
Notes
- VAD Interruption: When
enable_vadis true, Gladia will signal when a user starts and stops speaking, which can be used to interrupt the bot immediately. - Language Detection: Gladia excelled at detecting language changes and code-switching in real-time.