Skip to content

v0.7.0

Latest

Choose a tag to compare

@rootint rootint released this 15 Sep 19:16

Smart turn detection for realtime

client.realtime.connect(turn_detection="smart") tells a voice agent when the user starts speaking, stops, and has finished their turn. The session then yields three new event types alongside RealtimeTranscript:

  • RealtimeSpeechStarted — speech.started, ~100 ms after the user starts talking (interrupt the agent).
  • RealtimeSpeechEnded — speech.ended, ~280 ms after silence; not necessarily the end of the turn.
  • RealtimeTurnEnd — turn.end, the turn's complete text and words, with confidence (>= 0.5 model decided, < 0.5 3 s silence limit, None closed by finish()). Arrives after every transcript of its turn and before any of the next.

Every RealtimeTranscript gains turn: int | None. Works with any delay_ms, diarize and multichannel (turns are counted per channel).

Typing

RealtimeSession is now generic in its event type. connect() is overloaded: without turn_detection iteration still yields RealtimeTranscript, so existing typed code is unaffected; with turn_detection="smart" it yields the RealtimeEvent union — narrow on event.type.

New exports: RealtimeEvent, RealtimeSpeechStarted, RealtimeSpeechEnded, RealtimeTurnEnd, RealtimeTurnDetection.