Launch price: every exam for $29.99 a year, for the first 300 buyers. See the price

CertStreak
Menu

Create new visual outputs by using generative models

A worked example

Multiple answers

A developer uses the OpenAI Python SDK to call client.images.generate against a gpt-image series model deployed in a Foundry resource. The solution must meet these requirements:

  • Return four candidate images in a single request.
  • Save each image as a JPEG file.

A test call returned a response with the structure shown in the exhibit.

{ "created": 1698116662, "data": [ { "b64_json": "<base64 image data>" } ] }

Which three actions should the developer include? Each correct answer presents part of the solution. Select three.

Choose 3 answers.
Why

The n parameter controls how many images one call returns, with 1–10 supported, so n=4 meets the single-request requirement. PNG is the default output format, so output_format must be set to JPEG, while WEBP isn't supported. The response carries each image as base64 data in b64_json, which the code must decode and save.

Practise this topic until it's automatic.

Ten questions a day, every answer explained, and misses that come back until you beat them.

Start free