Skip to main content

Agent Framework plugin for services using Gladia's API.

Project description

Gladia plugin for LiveKit Agents

Support for speech-to-text with Gladia.

See https://docs.livekit.io/agents/integrations/stt/gladia/ for more information.

Installation

pip install livekit-plugins-gladia

Pre-requisites

You'll need an API key from Gladia. It can be set as an environment variable: GLADIA_API_KEY

Features

  • Streaming speech-to-text
  • Multi-language support
  • Code-switching between languages
  • Interim results (partial transcriptions)
  • Voice activity detection with energy filtering
  • Optional real-time translation
  • Customizable audio parameters (sample rate, bit depth, channels, encoding)

Example Usage

from livekit.stt import STT
from livekit.plugins.gladia.stt import STT as GladiaSTT

# Basic initialization
stt = GladiaSTT(
    api_key="your-api-key-here",  # or use GLADIA_API_KEY env var
    interim_results=True
)

# With more options
stt = GladiaSTT(
    languages=["en", "fr"],                     # Specify languages or let Gladia auto-detect
    code_switching=True,                        # Allow switching between languages during recognition
    sample_rate=16000,                          # Audio sample rate in Hz
    bit_depth=16,                               # Audio bit depth
    channels=1,                                 # Number of audio channels
    encoding="wav/pcm",                         # Audio encoding format
    energy_filter=True,                         # Enable voice activity detection
    translation_enabled=True,
    translation_target_languages=["en"],
    translation_model="base",
    translation_match_original_utterances=True
    translation_context_adaptation= False,      # Enable context-aware translation
    translation_context= None,                  # Context input to guide translation
    translation_informal=False,                 # Use informal tone in translation
    pre_processing_audio_enhancer=False,        # Apply pre-processing to the audio stream to enhance the quality
    pre_processing_speech_threshold=0.6,        # Sensitivity for speech detection; closer to 1 = stricter, less background noise

    # Custom_vocabulary exemple
    custom_vocabulary=[
        "Westeros",
        {"value": "Stark"},
        {
            "value": "Night's Watch",
            "pronunciations": ["Nightz Watch"],
            "intensity": 0.4,
            "language": "en"
        }
    ],

    # Custom_spelling exemple
    custom_spelling={
        "Gorish": ["ghorish", "gaurish", "gaureish"],
        "Data Science": ["data-science", "data science"],
        ".": ["period", "full stop"],
        "SQL": ["sequel"]
    }
)

# Update options after initialization
stt.update_options(
    languages=["ja", "en"],
    translation_enabled=True,
    translation_target_languages=["fr"]
)

Using with LiveKit Agents Framework

from livekit.agents import Agent
from livekit.plugins.gladia.stt import STT as GladiaSTT

agent = Agent(
    stt=GladiaSTT(
        api_key="your-api-key-here",
        languages=["en"],
        translation_enabled=True,
        translation_target_languages=["es"]
    )
)

# Rest of your agent setup...

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

livekit_plugins_gladia-1.1.5.tar.gz (13.8 kB view details)

Uploaded Source

Built Distribution

livekit_plugins_gladia-1.1.5-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

Details for the file livekit_plugins_gladia-1.1.5.tar.gz.

File metadata

File hashes

Hashes for livekit_plugins_gladia-1.1.5.tar.gz
Algorithm Hash digest
SHA256 df363179c0f5b26988267c685409fd117653fc07dc0acef792f6514d134e1bb4
MD5 524a41dbaee7246326c1e44e5e40b258
BLAKE2b-256 320af51d1746fc8bbaa1cbfb5fa2cbd4719f50d1c2327122d782ece8a7ff8c77

See more details on using hashes here.

File details

Details for the file livekit_plugins_gladia-1.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for livekit_plugins_gladia-1.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 aba917cce5a2bbc1a572352e620c0175845832a88f76b2842ac84daf7ec41ab2
MD5 15e7d27c8744792e1e14c5c9d13c3b33
BLAKE2b-256 cdf864cda5281e21f95373d20ddee79cd9ef223df4acfbaf7117f86c9f3d4c18

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page