↑ ↓ to move, Enter to open, Esc to close

    AI-901Azure AI Fundamentals

    Switch exam

    Microsoft Azure

    aws Amazon Web Services

    Google Cloud

    ServiceNow

    Databricks

    Cisco

    Salesforce

    All exams and search
    Free exam

    Exams / AI-901 / D2 Implement AI solutions by using Microsoft Foundry

    D2.3

    Implement AI solutions with computer vision and image-generation capabilities by using Foundry

    • 5 min read
    • 4 sections
    • 11 questions
    • 55–60% of the exam
    • Interpret visual input in prompts by using a deployed multimodal model
    • Create new visual outputs by using generative models
    • Build a lightweight application that includes vision capabilities

    Two different APIs, two different jobs

    Foundry exposes vision and image generation through two separate Azure OpenAI APIs. Don't mix them up:

    API Purpose Python call
    Responses API Send text (and optionally an image) to a chat/vision model, get back a generated answer client.responses.create(model=..., input=...)
    Images API Generate a brand-new image from a text prompt client.images.generate(model=..., prompt=...)

    "response = client.responses.create(" is the call for a vision-enabled conversational request; for a dedicated image-generation model such as gpt-image-1, "result = client.images.generate(" with "model="gpt-image-1", # the name of your GPT-image series deployment" is the call that turns a prompt into a picture.

    Analyze an existing imageGenerate a new imageUser prompt + imageResponses APIclient.responses.createText answer about the imageText prompt onlyImages APIclient.images.generateNew image, base64 or URL

    Sending an image for analysis: the Responses API

    A vision-enabled Responses API request is a user message whose content is a list of typed items, mixing text and image parts in one call:

    {
      "role": "user",
      "content": [
        {"type": "input_text", "text": "What is in this image?"},
        {"type": "input_image", "image_url": "<image_url>"}
      ]
    }
    
    • "{"type": "input_text", "text": "What is in this image?"}," — the text part.
    • "{"type": "input_image", "image_url": "<image_url>"}" — the image part; image_url can be a real URL, or a Base64 data URI.
    • output_text / output_image are returned by the model in the response — never valid input content types.
    • Both parts belong in the same user message. A system message only carries instructions for the model's behavior, never the user's own text/image input, and splitting the image into a second request adds an avoidable HTTP round trip — so the fastest design keeps everything in one user message, one call.

    Supplying the image itself

    Image source image_url value Example
    Publicly accessible an HTTP(S) URL "image_url": "<image_url>"
    Local file / binary data a Base64 data URI "image_url": "data:image/jpeg;base64,<BASE64_IMAGE>"

    "If you want to use a local image, you can use the following Python code to convert it to base64 so it can be passed to the API." A local filesystem path (C:\images\photo.jpg) or a file:// URI is never valid — the service cannot reach the caller's local disk, so the image bytes must travel inside the request itself. "Image URLs must be publicly accessible: private endpoints, VNet-restricted, and firewall-restricted URLs are not supported even if they are on a storage account within same or peered VNet." So a vision model accepts exactly two image formats: a public URL, or Base64-encoded image data — never a text or JSON description of the image, which carries no pixels at all.

    Generating a new image: the Images API

    "model="gpt-image-1", # the name of your GPT-image series deployment" — a deployed image-generation model is invoked with client.images.generate(model=<deployment name>, prompt=<text>). The request body (REST) typically carries prompt, size, and n (number of images).

    DALL-E 3 → GPT-image series

    An older generation of exam questions (and some REST exhibits) show a request body like:

    {
      "prompt": "A polar bear on the beach holding an icecream",
      "size": "1024x1024",
      "n": 1,
      "style": "vivid"
    }
    

    style: vivid/natural was specific to DALL-E 3, which also limited n to 1 image per call. "The DALL-E image generation model dall-e-3 was retired on March 4, 2026, and is no longer available for new deployments." "Use a gpt-image- series model for image generation instead." Current gpt-image- series models use a different parameter set — quality (low/medium/high), background (auto/transparent), output_format, output_compression — and have no style parameter. A request body containing style: vivid is therefore a DALL-E-era exhibit: recognize it as the (retired) DALL-E model, but know that new deployments use gpt-image- models with the newer parameter set instead.

    Computer vision beyond generative models: Azure Vision (Foundry Tools)

    Azure Vision in Foundry Tools analyzes existing images — it does not generate new ones and does not run live video-stream classification. Its OCR (Read) capability extracts text from images and documents: "Machine-learning-based OCR techniques allow you to extract printed or handwritten text from images such as posters, street signs, and product labels, as well as from documents like articles, reports, forms, and invoices." This covers both printed and handwritten text, including scanned letters — not text analytics (key-phrase extraction is a Language service capability) and not video thumbnailing (a media/Video Indexer capability).

    Exam traps

    • Responses API vs. Images API: analyzing/answering about an image: responses.create; generating a brand-new image from a prompt → images.generate. The Images API endpoint alone cannot take an existing image plus a free-form question.
    • Text + image in one user message, one request is both the correct structure and the fastest one; don't be fooled by distractors that move the image into a system message or a separate call.
    • input_text / input_image are Responses API input content types; output_text / output_image are what the model returns — never swap them.
    • A local image is never a filesystem path or file:// URI. It must be Base64-encoded into a data:image/jpeg;base64,... data URI; a hosted image only needs a publicly accessible URL (not one gated by a private endpoint, VNet restriction, or firewall).
    • image_base64 is not a real content-type name — Base64 data lives inside input_image's image_url field, not as its own content type.
    • style: vivid/natural is a DALL-E 3 fingerprint, and DALL-E 3 is retired (March 4, 2026); current image generation uses gpt-image- series models with quality/background/output_format instead of style.
    • Azure Vision OCR reads handwriting too, not just printed text — don't assume OCR is print-only.

    Docs

    The rest of this chapter is part of the AI-901 premium course

    Unlock every chapter, all 155 questions and spaced review with All access or a 90-day exam pass. Every Fundamentals exam stays free, and the first chapter of every exam is open.

    Chapters