Skip to content

✨ Support for voxtral realtime stt#1277

Draft
cameledev wants to merge 1 commit intomainfrom
add-voxtral-realtime-stt
Draft

✨ Support for voxtral realtime stt#1277
cameledev wants to merge 1 commit intomainfrom
add-voxtral-realtime-stt

Conversation

@cameledev
Copy link
Copy Markdown
Collaborator

Purpose

Add support for voxtral realtime stt (live transcription).

@sonarqubecloud
Copy link
Copy Markdown

@cameledev cameledev changed the title Support for voxtral realtime stt ✨ Support for voxtral realtime stt Apr 16, 2026
)
_stt_instance = mistralai.STT(
client=client,
model="voxtral-mini-latest",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we make it an env variable?

Comment on lines 38 to +58
def create_stt_provider():
"""Create STT provider based on environment configuration."""
if STT_PROVIDER == "deepgram":
# Note: Not all Deepgram API parameters are supported by the LiveKit plugin
# detect_language is NOT supported for real-time streaming
# Use language="multi" instead for automatic multilingual support
_stt_instance = deepgram.STT(
model=os.getenv("DEEPGRAM_STT_MODEL", "nova-3"),
language=os.getenv("DEEPGRAM_STT_LANGUAGE", "multi"),
)
elif STT_PROVIDER == "kyutai":
_stt_instance = kyutai.STT(base_url=os.getenv("KYUTAI_STT_BASE_URL"))
elif STT_PROVIDER == "voxtral-realtime":
client = Mistral(
api_key=os.getenv("VOXTRAL_REALTIME_STT_API_KEY"),
server_url=os.getenv("VOXTRAL_REALTIME_STT_BASE_URL"),
)
_stt_instance = mistralai.STT(
client=client,
model="voxtral-mini-latest",
)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could refactor it to use a factory pattern with a declarative approach based on a decorator.

from typing import Callable, Dict
import os

# Registry of STT provider factories
_STT_PROVIDERS: Dict[str, Callable] = {}


def register_stt_provider(name: str):
    """Decorator to register an STT provider factory."""
    def decorator(func: Callable) -> Callable:
        _STT_PROVIDERS[name] = func
        return func
    return decorator


@register_stt_provider("deepgram")
def _create_deepgram_stt():
    # Note: Not all Deepgram API parameters are supported by the LiveKit plugin.
    # detect_language is NOT supported for real-time streaming.
    # Use language="multi" instead for automatic multilingual support.
    return deepgram.STT(
        model=os.getenv("DEEPGRAM_STT_MODEL", "nova-3"),
        language=os.getenv("DEEPGRAM_STT_LANGUAGE", "multi"),
    )


@register_stt_provider("kyutai")
def _create_kyutai_stt():
    return kyutai.STT(base_url=os.getenv("KYUTAI_STT_BASE_URL"))


@register_stt_provider("voxtral-realtime")
def _create_voxtral_realtime_stt():
    client = Mistral(
        api_key=os.getenv("VOXTRAL_REALTIME_STT_API_KEY"),
        server_url=os.getenv("VOXTRAL_REALTIME_STT_BASE_URL"),
    )
    return mistralai.STT(
        client=client,
        model=os.getenv("VOXTRAL_REALTIME_STT_MODEL", "voxtral-mini-latest"),
    )


def create_stt_provider():
    """Create STT provider based on environment configuration."""
    try:
        factory = _STT_PROVIDERS[STT_PROVIDER]
    except KeyError:
        raise ValueError(
            f"Unknown STT provider: {STT_PROVIDER!r}. "
            f"Available providers: {sorted(_STT_PROVIDERS)}"
        )
    return factory()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants