audio_language_detection_processor#

class baf.core.processors.audio_language_detection_processor.AudioLanguageDetectionProcessor(agent, transcription_model, llm_name)[source]#

Bases: Processor

The AudioLanguageDetectionProcessor detects the spoken language in a given audio message.

This processor uses a speech-to-text model to transcribe audio and then leverages an LLM to predict the language. Ideally, you use a model that is trained for language detection, such as OpenAI’s GPT-4o-mini or anything that works well on a plethora of languages.

Parameters:
  • agent (Agent) – The agent the processor belongs to.

  • transcription_model (Speech2Text) – The speech-to-text model to use for transcription.

  • llm_name (str) – The name of the LLM to use for language detection.

agent#

The agent the processor belongs to.

Type:

Agent

_transcription_model_name#

The speech-to-text model to use for transcription.

Type:

str

_llm_name#

The name of the LLM used for language detection.

Type:

str

_nlp_engine#

The NLP Engine the Agent uses.

Type:

NLPEngine

_abc_impl = <_abc._abc_data object>#
process(session, message)[source]#

Method to process a message and predict the message’s language.

The detected language will be stored as a session parameter. The key is “user_language”.

Parameters:
  • session (Session) – the current session

  • message (str) – the message to be processed

Returns:

the original message

Return type:

str