Skip to content

STTTranslationConfig

autogen.beta.live.openai.STTTranslationConfig #

STTTranslationConfig(model, *, client=None)

Bases: STTConfig

Source code in autogen/beta/live/openai.py
def __init__(
    self,
    model: "AudioModel | str",
    *,
    client: AsyncOpenAI | None = None,
) -> None:
    self.model = model
    self.client = client or AsyncOpenAI()

model instance-attribute #

model = model

client instance-attribute #

client = client or AsyncOpenAI()

transcribe async #

transcribe(voice, context)
Source code in autogen/beta/live/openai.py
async def transcribe(self, voice: "VoiceInput", context: "Context") -> str:
    result = await self.client.audio.translations.create(
        model=self.model,
        file=_voice_to_wav_buffer(voice),
        response_format="text",
    )

    await context.send(TranscriptionCompletedEvent(result))
    return result

pipe #

pipe(agent)
Source code in autogen/beta/live/stt.py
def pipe(self, agent: Agent) -> "VoicePipeline":
    return VoicePipeline(agent, self)