Metadata-Version: 2.3
Name: livekit-blynt
Version: 0.2.0
Summary: Blynt STT plugin for LiveKit Agents - Real-time speech recognition with Blynt API
Author: Alexandre Caulier
Author-email: Alexandre Caulier <alexandre@blynt.ai>
Requires-Dist: livekit-agents>=1.2
Requires-Dist: websockets>=14.0
Requires-Python: >=3.12
Description-Content-Type: text/markdown

# LiveKit Plugin - Blynt STT

Blynt Speech-to-Text plugin for [LiveKit Agents](https://github.com/livekit/agents), providing real-time speech recognition through Blynt's ASR API.

## Features

- Real-time streaming speech recognition
- Support for interim and final transcriptions
- Deployment-scoped, Bearer-authenticated WebSocket connection to the Blynt API

## Installation

```bash
# Using pip
pip install livekit-blynt

# Using uv
uv add livekit-blynt
```

## Usage

The plugin connects to a Blynt **deployment**, so you must supply a `deployment_id`
and an API key. Both can be passed directly or via the `BLYNT_DEPLOYMENT_ID` and
`BLYNT_API_KEY` environment variables.

```python
from livekit.agents import AgentSession
from livekit.plugins import silero
from livekit_blynt import BlyntSTT, BlyntSTTOptions, BlyntSessionContext, Fact, DeclaredValues, STTLanguages

stt = BlyntSTT(
    options=BlyntSTTOptions(
        deployment_id="680989...",  # or set BLYNT_DEPLOYMENT_ID
        api_key="sk-...",  # or set BLYNT_API_KEY
        session_context=BlyntSessionContext(
            facts=[Fact(name="domaine", value="immatriculation")],
            hints=[DeclaredValues(values=["plaque", "AA-123-BB"])],
        ),
    ),
)

# Or, with both read from the environment:
stt = BlyntSTT(options=BlyntSTTOptions())

session = AgentSession(
    stt=stt,
    vad=silero.VAD.load(min_silence_duration=0.5),
    # ... llm, tts
)
stt.register_session(session)
```

Turns are delimited from LiveKit VAD speaking events (`user_state_changed`, or
`user_started_speaking` / `user_stopped_speaking` on older Agents versions), so a
VAD (e.g. Silero) must be attached to the `AgentSession`. Call
`stt.register_session(session)` after constructing the session.

Note: given the ASR processes audio in between those VAD events, it is recommended
to use a VAD with a `min_silence_duration` of at least 0.5s to avoid splitting the
utterance into multiple Blynt decodes.

## Configuration Options

### BlyntSTTOptions

- `deployment_id` (optional): Blynt deployment id to run the session against. Falls back to the `BLYNT_DEPLOYMENT_ID` environment variable
- `api_key` (optional): Blynt API key for Bearer auth. Falls back to the `BLYNT_API_KEY` environment variable
- `session_context` (optional): `BlyntSessionContext` with `facts` (`Fact` name/value) and `hints` (`DeclaredValues`) sent once on `start_session`

## Requirements

- Python >= 3.12
- livekit-agents >= 1.2
- websockets >= 14.0
