Your profile

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

Lesson 24 of 30
❮Prev Next❯

Use Images in 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

    A multimodal model such as GPT-4.1, GPT-4o or the GPT-5 family can read images as part of a prompt. In the Foundry chat playground you attach a photo and ask about it. In code you send a user message with an input_text part and an input_image part, where the image is an https URL or a base64 data URL. The model describes, compares, reads text or answers questions about the image, but it can still misread small details, so ask specific questions and check important answers.

    Simulate it » No Azure account needed

    Exam objective: 2.3.1 Interpret visual input in 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: Ask a multimodal model about an image Attach a photo and ask questions about it.
    </> Embed

    Embed this simulation

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

    Loading the portal…

    Use a <strong>multimodal</strong> deployment such as gpt-4.1-mini, which accepts images as well as text.

    👆 Click the glowing item in the portal to continue

    Read the steps as text
    1. Use a multimodal deployment such as gpt-4.1-mini, which accepts images as well as text.
    2. Attach a photo with the 📎 button and ask a question about it.
    3. In code, send an input_image part (a URL or base64 data) next to the input_text.
    4. Models reason about images; Azure Vision returns structured results.

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

    😟 THE PROBLEM

    Insurance agents describe car damage by hand from photos.

    😊 THE SOLUTION

    Ask a multimodal model about each photo.

    • Photos need describing✓ input_image in the prompt
    • Specific questions about images✓ Ask them in plain words
    • Need consistent fields✓ Ask for JSON output
    🛠️ Solved with: Multimodal prompts

    Start with a question

    What if you could show the model a photo instead of describing it?

    Try explaining a dented car bumper in words: “it’s a small dent, sort of left of the number plate, maybe the size of a cricket ball”. Now just take a photo.

    Multimodal models can look. You send the picture with your question, and the model answers about what it sees. An insurance clerk, a shopkeeper or a student with a confusing diagram can all skip the long description.

    Explain it like I’m 10

    The technical explanation

    Models such as GPT-4.1, GPT-4o and the GPT-5 family accept images in the prompt. The model card in the Foundry model catalog lists the supported inputs, so check it says image input before you deploy.

    In the chat playground

    Open your multimodal deployment in the chat playground, attach an image to the message, and ask a question. The system message still applies, so you can say “You are an insurance assessor. Describe visible damage only, and don’t guess the repair cost.” It’s the fastest way to see whether the model handles your kind of image.

    In code

    With the Foundry SDK, the user message holds a list of content parts: input_text for the question and input_image for the picture.

    import base64, os
    from azure.identity import DefaultAzureCredential
    from azure.ai.projects import AIProjectClient
    
    project = AIProjectClient(endpoint=os.environ["FOUNDRY_PROJECT_ENDPOINT"], credential=DefaultAzureCredential())
    openai = project.get_openai_client()
    
    # A local photo becomes a base64 data URL
    with open("bumper.jpg", "rb") as f:
        data_url = "data:image/jpeg;base64," + base64.b64encode(f.read()).decode("utf-8")
    
    response = openai.responses.create(
        model="gpt-4.1",  # a multimodal deployment name
        instructions="You are an insurance assessor. Describe visible damage only.",
        input=[{
            "role": "user",
            "content": [
                {"type": "input_text", "text": "Where is the damage on this car, and how large does it look?"},
                {"type": "input_image", "image_url": data_url},
                # or an online image: {"type": "input_image", "image_url": "https://example.com/bumper.jpg"}
            ],
        }],
    )
    print(response.output_text)

    You can put several images in one message, for example “before” and “after” photos, and ask the model to compare them.

    https URL

    • Image is already online
    • Small request
    • The service must be able to fetch the link

    Base64 data URL

    • Image is on the device or private
    • Works without a public link
    • Bigger request, so resize big photos
    URL or base64?

    Getting good answers from images

    DoWhy
    Ask a specific question (“What’s the expiry date on the label?”)Vague prompts get vague descriptions
    Send a clear, well-lit, upright image, cropped to what mattersBlur, rotation and clutter cause misreads
    Tell it to say when it’s unsureCuts down confident guesses
    Check counts, small text and measurementsThese are common weak spots
    Keep a person in the loop for medical, legal or safety decisionsThe model can be wrong and isn’t accountable

    Images cost tokens like text does, and bigger or higher-detail images use more. Your deployment’s guardrails (content filters) check image inputs too, and you shouldn’t send images of people without a good reason and their awareness.

    Architect level The image detail setting

    The input_image part can take an optional detail value: low, high or auto. Low sends a small version of the image and uses far fewer tokens, which is fine for “is this a cat or a dog?”. High lets the model look at tiles of the full image, which helps with small print and fine detail but costs more tokens. Auto lets the service choose.

    Real-world business scenario

    Insurance

    Fabrikam Insurance

    The problem
    Motor claims arrived with phone photos and short, unclear descriptions. Assessors spent the first ten minutes of each claim just working out what was damaged.
    What they used
    The claims app sends each photo as a base64 input_image to a gpt-4.1 deployment with a system message that asks for visible damage, location and a confidence note, and never a payout amount.
    Why that choice
    A multimodal model handles any angle and any car without training a custom model, and the system message keeps it to description, not decisions.
    The result
    Assessors start each claim with a short damage summary to check, while the payout decision stays with a person.

    When to use it and when not to

    ✓ Use it when…

    • Users can show the problem faster than they can describe it.
    • Questions about images vary, so a fixed analysis feature would be too rigid.
    • You want to compare images, explain a diagram or read a label in context.

    ✕ Think twice when…

    • You need exact counts, measurements or bounding boxes. Use a dedicated vision feature and check results.
    • High-stakes decisions such as diagnosis without a qualified person reviewing.
    • Identifying people from their faces. Face recognition is limited access and needs a strong reason.

    ↔ Alternatives to consider

    • Azure Vision in Foundry Tools for captions, tags, objects and OCR.
    • Content Understanding to pull defined fields out of images.
    • gpt-image-1 when you need to create or edit an image.
    Ready for more?The full lesson adds the technical explanation, when to use it, interview questions and revision notes.

    Test yourself with exercises

    5 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 5

    An insurance application lets customers upload a photo of vehicle damage. The application must ask a model deployed in Microsoft Foundry to describe the visible damage.

    Which type of model deployment is required?

    Question 2

    Question 2 of 5 · Select 2

    You send an image to a multimodal model by using an input_image content part in the Responses API. Which TWO formats can you use for the image?

    Question 3

    Question 3 of 5

    You want to test whether a multimodal model can read labels in product photos before you write any code. What should you use?

    Question 4

    Question 4 of 5

    A multimodal model repeatedly miscounts small items in shelf photos. Which action is most likely to improve the results?

    Question 5

    Question 5 of 5

    Which statement about image inputs to a model deployment in Microsoft Foundry is true?

    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 do you ask a model a question about a photo?

    Model answer

    Use a deployed multimodal model like gpt-4.1. In the Foundry chat playground I attach the image and type the question. In code I send a user message with a text part and an input_image part holding a URL or base64 image.

    Interviewer follows up

    Does every model accept images?

    You

    No. The model card lists the input types. Text-only models and most small models can't take images.

    Intermediate When would you send an image as base64 instead of a URL?

    Model answer

    When the image is on the user's device or in private storage the model can't reach, such as an insurance claim photo. A public https URL is fine for images that are already online. Base64 makes the request bigger, so I resize large photos first.

    Experienced developer Would you use a multimodal model or Azure Vision to read meter numbers from thousands of photos?

    Model answer

    For a fixed job at volume, like reading printed numbers, Azure Vision's OCR or a Content Understanding analyzer gives structured, repeatable output. A multimodal model shines when the question changes, like 'is this meter damaged, and what would you check next?'. I'd often combine them.

    Scenario Your model keeps miscounting items on a shelf photo. What do you do?

    Model answer

    Send a higher-detail or cropped image, ask a narrower question ('count only the red packets on the top shelf'), and tell it to say if it's unsure. If counts must be exact, I'd use a dedicated object detection approach and keep a person checking the results.

    Quick revision

    Key points

    • Multimodal models (GPT-4.1, GPT-4o, GPT-5 family) accept images alongside text.
    • In the chat playground, attach an image to your message and ask about it.
    • In code, the user content has input_text and input_image parts.
    • input_image takes an https URL or a base64 data URL (data:image/jpeg;base64,...).
    • Ask specific questions, keep images clear, and check important answers. Guardrails apply to images too.

    Important terminology

    Multimodal model
    A model that accepts more than one kind of input, here text plus images.
    input_image
    The Responses API content part that carries an image as an https URL or a base64 data URL.
    Data URL
    An image embedded as text, in the form data:image/jpeg;base64,... so the model doesn't need to fetch a link.
    Image detail
    An optional setting (low, high or auto) that trades image resolution, and so tokens, against detail.
    Azure Vision in Foundry Tools
    The Foundry Tools service for fixed image analysis such as captions, tags, objects and OCR.

    Common mistakes

    • Sending an image to a text-only deployment and expecting it to see the picture.
    • Trusting exact counts, tiny text or measurements without checking.

    Exam tips

    • "Ask questions about a photo in a prompt" = multimodal model with an input_image part.
    • "Fixed captions, tags or OCR at scale" = Azure Vision or Content Understanding instead.

    Five quick revision questions

    1. 1.Which content part carries an image in the Responses API?Show

      input_image

    2. 2.Name two ways to pass the image.Show

      An https URL or a base64 data URL.

    3. 3.Where can you try image prompts without code?Show

      The chat playground in the Foundry portal.

    4. 4.Do content filters apply to image prompts?Show

      Yes, guardrails check image inputs too.

    5. 5.Name one task multimodal models often get wrong.Show

      Exact counting, small text or precise measurements.

    Official references

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

    Next up: Generate Images with Generative Models

    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.