Your profile

One profile for every MSDEVBUILD site. Only you can see it, and the site owner if you write in.

Lesson 22 of 30
❮Prev Next❯

Answer Spoken Prompts with a Multimodal Model

Module 2: Microsoft Foundry ⏱ 8 min read Updated

Your note

My notes for this lesson

Select any text in the lesson to highlight it or add a note. Saved in this browser.

    No highlights yet. Select a sentence in the lesson, then pick a colour or add a note.

    All my bookmarks and notes

    Reading settings

    For every lesson, saved in this browser.

    Text size
    Line spacing
    Font

    With IaaS you rent the virtual machine. Microsoft looks after the building, power and hardware; you patch the operating system.

    30-second answer

    To respond to a spoken prompt, deploy an audio-capable multimodal model (such as the gpt-audio or gpt-4o-audio-preview family) in Foundry and send the recording as an input_audio content part (base64 audio plus its format). The model understands the speech directly and can reply in text or audio. The older route is a pipeline: speech to text, then a text model, then text to speech. For live, low-latency talk you use a realtime model or the Voice Live API.

    Simulate it » No Azure account needed

    Exam objective: 2.2.2 Respond to spoken prompts by using a deployed multimodal model. (Skills measured as of April 15, 2026)

    Simulations

    Feel it before you read it. No account needed, nothing leaves this page.

    Azure portal: Answer a spoken prompt with a multimodal model Send a voice question to an audio-capable model.
    </> Embed

    Embed this simulation

    Free for trainers, teachers and bloggers. Paste this into your page:

    Loading the portal…

    Deploy an <strong>audio-capable</strong> model. Not every chat model accepts audio.

    👆 Click the glowing item in the portal to continue

    Read the steps as text
    1. Deploy an audio-capable model. Not every chat model accepts audio.
    2. Attach the spoken question directly. No separate transcription step.
    3. In code, the audio goes in as an input_audio content part (base64 WAV).
    4. Know both patterns and when each fits.

    🧪 Simulation for learning. Screens are simplified versions of the Azure portal; names, prices and IDs are examples. Nothing here touches real Azure.

    😟 THE PROBLEM

    Customers want to ask questions by voice, not by typing.

    😊 THE SOLUTION

    Send their audio straight to an audio-capable model.

    • Typing on phones is slow✓ Ask by voice
    • Three services to wire up✓ One multimodal call
    • Tone gets lost✓ The model hears it
    🛠️ Solved with: Audio-capable models

    Start with a question

    What if your customers would rather talk than type?

    A farmer in Madurai wants to know whether to spray before tomorrow’s rain. Typing a long question in English on a small phone is slow. Saying it out loud takes five seconds.

    Some models can now listen. You send them the recording, and they understand it the same way they understand typed text. That’s a spoken prompt to a multimodal model.

    Explain it like I’m 10

    The technical explanation

    A multimodal model takes more than one kind of input. Audio-capable models in the Foundry model catalog (for example the gpt-audio and gpt-4o-audio-preview families) take speech as input and can return text, audio or both. Check the model card for supported audio formats, languages and regions, and deploy it in your project like any other model.

    In the Foundry chat playground you can try this first: pick the audio model deployment, record or attach a short clip, and read the reply.

    Audio-capable model

    • Send the recording as input_audio
    • One model call
    • Reply in text or audio
    • Good for voice questions in an app

    Speech pipeline

    • Speech to text → text model → text to speech
    • Three calls your code chains
    • Custom speech, SSML, any neural voice
    • Transcript visible at each step

    Realtime / Voice Live

    • Streams audio both ways
    • Lowest latency, can be interrupted
    • Phone bots, live assistants
    • Uses a realtime model or Voice Live API
    Three ways to answer a spoken question

    Sending audio from Python

    Audio-capable models use the Chat Completions message format. The user message holds a list of content parts: a text instruction and an input_audio part with the recording as base64.

    import base64, os
    from openai import OpenAI
    from azure.identity import DefaultAzureCredential, get_bearer_token_provider
    
    # Sign in with Microsoft Entra ID (az login locally)
    token = get_bearer_token_provider(DefaultAzureCredential(), "https://cognitiveservices.azure.com/.default")
    client = OpenAI(
        base_url=os.environ["AZURE_OPENAI_ENDPOINT"] + "openai/v1/",  # https://<resource>.openai.azure.com/
        api_key=token,
    )
    
    # Read a short WAV recording and encode it as base64
    with open("question.wav", "rb") as f:
        audio_b64 = base64.b64encode(f.read()).decode("utf-8")
    
    completion = client.chat.completions.create(
        model="gpt-audio",            # your audio-capable deployment name
        modalities=["text"],          # use ["text", "audio"] to get speech back too
        messages=[
            {"role": "system", "content": "You are a farm advisor. Answer in two short sentences."},
            {"role": "user", "content": [
                {"type": "text", "text": "Answer the question in this recording."},
                {"type": "input_audio", "input_audio": {"data": audio_b64, "format": "wav"}},
            ]},
        ],
    )
    print(completion.choices[0].message.content)

    If you ask for ["text", "audio"] you also pass an audio option (voice and output format), and the reply’s message.audio holds base64 audio you can save and play, plus a transcript of what it said.

    Architect level Guardrails and privacy still apply

    The audio is a prompt like any other, so your deployment’s guardrails (content filters) apply to what the model hears and says. Recordings can carry personal data such as names and account numbers, so treat stored audio like any other personal data: keep only what you need, and tell users their voice is being processed by AI. That’s the transparency principle in practice.

    Real-world business scenario

    Agriculture

    An agritech co-operative in Tamil Nadu

    The problem
    Members asked crop questions by phone in mixed Tamil and English. A typed chatbot went unused because many members preferred to speak.
    What they used
    A small app that records the question, sends it as input_audio to an audio-capable model deployment in Foundry with a farm-advisor system message, and plays back the text reply through text to speech.
    Why that choice
    One model call understood mixed-language speech without a separate transcription step, and the system message kept answers short and on topic.
    The result
    Voice questions became the most used channel within weeks, and agronomists only handled the questions the model flagged as unsure.

    When to use it and when not to

    ✓ Use it when…

    • Users prefer to ask by voice, for example on a phone or in the field.
    • You want the simplest path from a recording to an answer, with one model call.
    • The model should pick up tone or hesitation that a plain transcript loses.

    ✕ Think twice when…

    • You need a particular branded neural voice, SSML control or custom vocabulary. Use Azure Speech.
    • You need live, interruptible conversation. Use a realtime model or the Voice Live API.
    • Regulations require a stored transcript at each step. The pipeline makes that easier.

    ↔ Alternatives to consider

    • Azure Speech speech to text plus a text model plus text to speech.
    • Voice Live API for live voice agents.
    Ready for more?The full lesson adds the technical explanation, when to use it, interview questions and revision notes.

    Test yourself with exercises

    4 original practice questions in the AI-901 style. Pick your answers, then check them. You will see why each option is right or wrong. Score 75% or more and this topic is marked complete.

    Question 1

    Question 1 of 4

    A mobile application records a user's spoken question. You want to send the recording directly to a model in Microsoft Foundry and receive a text answer in a single model call.

    What should you deploy?

    Question 2

    Question 2 of 4

    When you send audio to an audio-capable model by using the Chat Completions message format, which content part type carries the recording?

    Question 3

    Question 3 of 4 · Select 2

    Which TWO statements about responding to spoken prompts are true?

    Question 4

    Question 4 of 4

    A company is building a voice assistant for phone calls. Callers must be able to interrupt the assistant while it is speaking, with minimal latency. Which approach should you recommend?

    Interview preparation

    Say your answer out loud first, then open the model answer. Interviewers care more about your reasoning than the exact words.

    Beginner How can an app answer a question the user speaks out loud?

    Model answer

    Either send the recording straight to an audio-capable multimodal model, which understands the speech and replies, or transcribe it with speech to text first and send the text to a normal chat model. The first is fewer moving parts; the second gives me a transcript at every step.

    Interviewer follows up

    Can the model answer with a voice?

    You

    Yes. Audio-capable models can return audio as well as text, if you ask for both in the request.

    Intermediate What does the request look like when you send audio to the model?

    Model answer

    The user message has a list of content parts. One is a text part with the instruction, and one is an input_audio part with the base64-encoded recording and its format, such as wav. I also set modalities if I want spoken audio back.

    Experienced developer When would you still choose the speech-to-text pipeline?

    Model answer

    When I need features the Speech service gives me, like custom speech for domain words, diarization, a particular neural voice or SSML control, or when I want to log and filter the transcript before it reaches the model. The pipeline costs more latency, but each step is easy to inspect.

    Scenario A bank wants a phone assistant that can be interrupted mid-sentence. What do you suggest?

    Model answer

    A realtime approach, such as a gpt-realtime deployment or the Voice Live API. Sending one recording at a time feels like walkie-talkie; realtime streams audio both ways, so the caller can interrupt naturally.

    Quick revision

    Key points

    • Audio-capable multimodal models accept speech directly and can reply in text or audio.
    • Audio goes in an input_audio content part as base64 data with a format such as wav.
    • The classic alternative is speech to text, then a text model, then text to speech.
    • For live, interruptible conversations use a realtime model or the Voice Live API.
    • You can test spoken prompts in the Foundry chat playground before writing code.

    Important terminology

    Multimodal model
    A model that accepts more than one kind of input, such as text plus audio or text plus images.
    Audio-capable model
    A model deployment, such as the gpt-audio family, that takes audio input and can return text or spoken audio.
    input_audio
    The chat message content part that carries base64-encoded audio and its format, such as wav.
    Speech pipeline
    Speech to text, then a text model, then text to speech, chained by your code.
    Voice Live API
    An Azure Speech API for low-latency, two-way voice conversations with a generative model.

    Common mistakes

    • Sending the audio file path instead of base64-encoded audio data.
    • Expecting a text-only model such as gpt-4.1-mini to accept audio input.

    Exam tips

    • "Send speech directly to the model" = audio-capable multimodal model with input_audio.
    • "Low-latency live voice conversation" = realtime model or Voice Live API.

    Five quick revision questions

    1. 1.Which content part carries audio in the request?Show

      input_audio

    2. 2.How is the audio encoded in the request?Show

      As base64 data, with its format (for example wav).

    3. 3.Name the three steps of the speech pipeline.Show

      Speech to text, a text model, text to speech.

    4. 4.Can an audio-capable model reply with speech?Show

      Yes, it can return audio as well as text.

    5. 5.What do you use for a live, interruptible voice chat?Show

      A realtime model or the Voice Live API.

    Official references

    Finished this lesson? Tick it off. Your progress is saved in this browser.

    Next up: Build an App with Azure Speech in Foundry Tools

    Studying with a friend? Send them this lesson

    It's free and needs no sign-up. Their progress saves in their own browser.

    Lesson done? Make it stick with a quick gameSort It, Match the Pairs, Lightning Round and Who Am I? Earn XP and badges. Play ❯

    Install MSDEVBUILD Azure

    Free · no account · works offline

    Save the whole course for offline ›

    Hi, I’m your Nimbus

    Your study buddy. Pick what we do next.

    MSDEVBUILD · Multi-Stack Dev Build

    Sign in to MSDEVBUILD

    One account for Azure certifications and the blog: sign in here and you are signed in on both. Your XP, streak, practice deck and certificate stay in sync on every device. Optional: everything works without an account.