Lesson 1 of 2 Speech Applications in Foundry

Responding to Spoken Prompts with Audio-Capable Models

This lesson explains how audio-capable models in Foundry understand audio directly, so an application can send a recorded question and receive an answer in text or speech without a separate transcription step.

Learning outcomes

After completing this lesson, you will be able to:

  • Distinguish audio-capable chat models from realtime models.
  • Describe how a spoken prompt is sent in a request.
  • Describe how live voice conversations work with realtime models and Voice Live.
  • Choose an audio approach for a scenario.

Audio-capable models

Foundry Models includes several kinds of audio model. Audio-capable chat models, such as the gpt-audio family, accept audio as input in a chat request and can respond with text, audio or both. Realtime models, such as the gpt-realtime family, stream audio in both directions over a persistent connection for live conversation. Transcription models, such as gpt-4o-mini-transcribe, convert audio to text, and some multimodal models such as Phi-4-multimodal-instruct accept audio as well as images and text. A model card lists the input and output modalities each model supports.

Match the pairs

Audio models in Foundry

Exam skills 2.2.2

Match each kind of audio model or service with what it does.

Log in to try this activity Interactive activities are free with an account.

Sending a spoken prompt

With an audio-capable chat model, the application records or loads the spoken prompt, encodes the audio as base64 and sends it as an input_audio content part in the user message of a Chat Completions request, with its format (such as wav or mp3). A text part can accompany it, for example an instruction to answer briefly. The modalities parameter chooses text output, or text and audio output with a chosen voice.

import base64
audio_b64 = base64.b64encode(open("question.wav", "rb").read()).decode()
completion = client.chat.completions.create(
    model="gpt-audio-mini",                       # deployment name of an audio-capable model
    modalities=["text"],
    messages=[
        {"role": "system", "content": "You are a museum guide. Answer in two sentences."},
        {"role": "user", "content": [
            {"type": "input_audio", "input_audio": {"data": audio_b64, "format": "wav"}},
        ]},
    ],
)
print(completion.choices[0].message.content)

Because the model hears the audio itself, it can take account of tone, hesitation and emphasis that a transcript would lose, and the application has one call instead of two.

Spot the bug

A spoken question that fails

Exam skills 2.2.2

Find the lines that stop this request from answering a recorded question.

Log in to try this activity Interactive activities are free with an account.

Live voice conversations

For conversations in which users speak and listen naturally, request-and-response calls are too slow. Realtime models keep a WebSocket or WebRTC connection open and stream audio both ways. The Voice Live API in Azure Speech goes further: it combines speech recognition, a generative model of your choice and speech synthesis as one managed service, with noise suppression, echo cancellation, detection of the end of a user's turn, handling of interruptions and optional avatars. Python applications use the azure-ai-voicelive package, and a Foundry agent can be voice-enabled so that Voice Live uses the agent's instructions and tools.

The following table compares the approaches.

ApproachBest for
Audio-capable chat model (input_audio)Answering a recorded spoken question in one call
Speech to text, then a text model, then text to speechFull control over each step, such as custom speech models
Realtime model or Voice Live APINatural, low-latency, interruptible voice conversation

The following diagram compares the three approaches.

Three ways to respond to speech. An audio-capable chat model takes a recorded question as input audio and answers in one call. A chain of speech to text, a text model and text to speech gives full control over each step, such as a custom speech model. A realtime model or the Voice Live API streams audio both ways over a persistent connection for natural, interruptible conversation; Voice Live adds noise suppression, turn detection and interruption handling.
Choose by whether the interaction is recorded or live.
Sort into groups

Choose the audio approach

Exam skills 2.2.2

Choose how an application should handle spoken prompts in each scenario.

Log in to try this activity Interactive activities are free with an account.
Worked example

Choosing an audio approach

A museum app lets visitors press a button, ask a question about an exhibit aloud and read the answer on screen. The team wants the fewest components and wants the model to notice when visitors sound confused.

Sending the recording as input_audio to an audio-capable multimodal model meets both requirements: one call, and the model hears tone directly. A transcription-then-text pipeline adds a component and loses vocal cues, and Voice Live is designed for continuous two-way voice conversation, which the app does not need.

Check yourself

What does sending audio directly to a model keep that a transcript loses?

Show answer

Vocal cues, such as tone and emphasis.

Exam Tips

Remember for the exam

  • Audio-capable chat models accept input_audio content parts and can reply in text or audio.
  • Realtime models and Voice Live handle live, interruptible voice conversations.
  • A direct audio prompt keeps vocal cues that a transcript loses.