Skip to main content

InterruptionStrategy

Trait InterruptionStrategy 

Source
pub trait InterruptionStrategy: Send {
    // Required methods
    fn should_interrupt(&self) -> bool;
    fn append_transcription(&mut self, frame: &Frame);
    fn reset(&mut self);

    // Provided method
    fn append_audio_volume(&mut self, _volume: f32) { ... }
}
Expand description

Whether a detected user turn during bot speech should actually interrupt the bot. Mirrors pipecat’s interruption-strategy family: a turn-start (UserStartedSpeaking) is proposed by a TurnStartStrategy, and an interruption strategy is the final gate deciding whether to broadcast a Frame::Interruption. Pure + synchronous.

Required Methods§

Source

fn should_interrupt(&self) -> bool

Should the accumulated user speech-so-far interrupt the bot? Called when a turn-start is proposed while the bot is speaking.

Source

fn append_transcription(&mut self, frame: &Frame)

Feed a transcription frame so word/char-count strategies accumulate.

Source

fn reset(&mut self)

Reset accumulated state after a (non-)interruption decision.

Provided Methods§

Source

fn append_audio_volume(&mut self, _volume: f32)

Feed an audio frame’s volume so amplitude strategies accumulate.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§