Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions voice-agents/livekit-voice-agent/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Open the [LiveKit Agents Playground](https://agents-playground.livekit.io) and e

| Variable | Default | Description |
|---|---|---|
| `VOICE_ID` | `sophia` | TTS voice ID — browse all voices at [waves.smallest.ai](https://waves.smallest.ai) |
| `VOICE_ID` | `meher` | TTS voice ID — browse all voices at [waves.smallest.ai](https://waves.smallest.ai) |
| `LANGUAGE` | `en` | BCP-47 language code for STT and TTS. Use `multi` for automatic detection across 39 languages |
| `LLM_MODEL` | `gpt-4o-mini` | OpenAI model name |

Expand All @@ -97,18 +97,15 @@ Real-time transcription over WebSocket with ~64ms TTFT. Set `language="multi"` t
stt=smallestai.STT(language="en")
```

### Smallest AI TTS — Lightning
### Smallest AI TTS — Lightning v3.1 Pro

The Lightning TTS plugin synthesizes audio per sentence rather than streaming tokens, so it is wrapped in `tts.StreamAdapter` with a `SentenceTokenizer`. The adapter buffers LLM output to the next sentence boundary before firing synthesis — keeping first-audio latency low while the LLM is still generating:
The plugin uses persistent WebSocket streaming backed by a connection pool for low-latency audio delivery — no `StreamAdapter` wrapper needed:

```python
tts=tts.StreamAdapter(
tts=smallestai.TTS(
model="lightning-v3.1",
voice_id="sophia",
language="en",
),
sentence_tokenizer=tokenize.basic.SentenceTokenizer(),
tts=smallestai.TTS(
model="lightning_v3.1_pro",
voice_id="meher",
language="en",
)
```

Expand Down
15 changes: 5 additions & 10 deletions voice-agents/livekit-voice-agent/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@
WorkerOptions,
cli,
metrics,
tts,
tokenize,
)
from livekit.plugins import openai, silero, smallestai

logger = logging.getLogger("livekit-voice-agent")
load_dotenv()

VOICE_ID = os.getenv("VOICE_ID", "sophia")
VOICE_ID = os.getenv("VOICE_ID", "meher")
LANGUAGE = os.getenv("LANGUAGE", "en")
LLM_MODEL = os.getenv("LLM_MODEL", "gpt-4o-mini")

Expand Down Expand Up @@ -50,13 +48,10 @@ async def entrypoint(ctx: JobContext):
vad=ctx.proc.userdata["vad"],
stt=smallestai.STT(language=LANGUAGE),
llm=openai.LLM(model=LLM_MODEL),
tts=tts.StreamAdapter(
tts=smallestai.TTS(
model="lightning-v3.1",
voice_id=VOICE_ID,
language=LANGUAGE,
),
sentence_tokenizer=tokenize.basic.SentenceTokenizer(),
tts=smallestai.TTS(
model="lightning_v3.1_pro",
voice_id=VOICE_ID,
language=LANGUAGE,
),
)

Expand Down