MinWordsInterruptionStrategy

class pipecat.audio.interruptions.min_words_interruption_strategy.MinWordsInterruptionStrategy(*, min_words)[source]

Bases: BaseInterruptionStrategy

This is an interruption strategy based on a minimum number of words said by the user. That is, the strategy will be true if the user has said at least that amount of words.

Parameters:

min_words (int)

async append_text(text)[source]

Appends text for later analysis. Not all strategies need to handle text.

Parameters:

text (str)

async should_interrupt()[source]

This is called when the user stops speaking and it’s time to decide whether the user should interrupt the bot. The decision will be based on the aggregated audio and/or text.

Return type:

bool

async reset()[source]

Reset the current accumulated text and/or audio.