BaseSmartTurn

class pipecat.audio.turn.smart_turn.base_smart_turn.SmartTurnParams(*, stop_secs=3, pre_speech_ms=0, max_duration_secs=8)[source]

Bases: BaseModel

Parameters:
  • stop_secs (float)

  • pre_speech_ms (float)

  • max_duration_secs (float)

stop_secs: float
pre_speech_ms: float
max_duration_secs: float
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

exception pipecat.audio.turn.smart_turn.base_smart_turn.SmartTurnTimeoutException[source]

Bases: Exception

class pipecat.audio.turn.smart_turn.base_smart_turn.BaseSmartTurn(*, sample_rate=None, params=None)[source]

Bases: BaseTurnAnalyzer

Parameters:
  • sample_rate (int | None)

  • params (SmartTurnParams | None)

property speech_triggered: bool

Determines if speech has been detected.

Returns:

True if speech is triggered, otherwise False.

Return type:

bool

append_audio(buffer, is_speech)[source]

Appends audio data for analysis.

Parameters:
  • buffer (bytes) – The audio data to append.

  • is_speech (bool) – Indicates whether the appended audio is speech or not.

Returns:

The resulting state after appending the audio.

Return type:

EndOfTurnState

async analyze_end_of_turn()[source]

Analyzes if an end of turn has occurred based on the audio input.

Returns:

The result of the end of turn analysis.

Return type:

EndOfTurnState

clear()[source]

Reset the turn analyzer to its initial state.