STT

class pipecat.services.aws.stt.AWSTranscribeSTTService(*, api_key=None, aws_access_key_id=None, aws_session_token=None, region='us-east-1', sample_rate=16000, language=Language.EN, **kwargs)[source]

Bases: STTService

Parameters:
  • api_key (str | None)

  • aws_access_key_id (str | None)

  • aws_session_token (str | None)

  • region (str | None)

  • sample_rate (int)

  • language (Language)

get_service_encoding(encoding)[source]

Convert internal encoding format to AWS Transcribe format.

Parameters:

encoding (str)

Return type:

str

async start(frame)[source]

Initialize the connection when the service starts.

Parameters:

frame (StartFrame)

async stop(frame)[source]

Stop the AI service.

Called when the service should stop processing. Subclasses should override this method to perform cleanup operations.

Parameters:

frame (EndFrame) – The end frame.

async cancel(frame)[source]

Cancel the AI service.

Called when the service should cancel all operations. Subclasses should override this method to handle cancellation logic.

Parameters:

frame (CancelFrame) – The cancel frame.

async run_stt(audio)[source]

Process audio data and send to AWS Transcribe

Parameters:

audio (bytes)

Return type:

AsyncGenerator[Frame, None]

language_to_service_language(language)[source]

Convert internal language enum to AWS Transcribe language code.

Parameters:

language (Language)

Return type:

str | None