feat(elevenlabs): support previous_text context on STT realtime input chunks
### Feature Type
Would make my life easier
### Feature Description
The ElevenLabs realtime STT WebSocket API accepts a `previous_text` field on the `input_audio_chunk` message that primes the model with text context to improve accuracy. Per the [docs](https://elevenlabs.io/docs/api-reference/speech-to-text/v-1-speech-to-text-realtime#send.inputAudioChunk), it "can only be sent alongside the first audio chunk."
The `livekit-plugins-elevenlabs` STT plugin doesn't expose this. In `stt.py`, every `input_audio_chunk` is built with only `message_type`, `audio_base_64`, `commit`, and `sample_rate`, so there's no way to pass context.
This helps agent scenarios where prior conversation context (names, domain/medical terms, homophones) would disambiguate the next utterance.
Proposed implementation, matching the existing `keyterms`/`no_verbatim` style: add `previous_text: NotGivenOr[str]` to `STTOptions` and `STT.__init__`, then send it as the first `input_audio_chunk` per connection (respecting the first-chunk-only constraint). Applies to the `scribe_v2_realtime` path.
I already have this implemented and would happily open the PR if the maintainers are fine with the approach. Filing this first per `CONTRIBUTING.md` to confirm scope.
### Workarounds / Alternatives
`keyterms` (#5618) covers vocabulary biasing but not free-form preceding-text context, so there's no current way to feed conversational context into realtime STT.
### Additional Context
Complementary to #5618 (`keyterms`/`no_verbatim`/`enable_logging`); `previous_text` is a distinct field not covered there.
4 条评论