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

CertStreak
Menu

Implement a solution that generates images from text prompts and reference media

A worked example

Single answer

A developer is connecting a Python image-generation application to an existing deployment in Microsoft Foundry. The OpenAI client already has the correct Azure OpenAI endpoint and authentication configuration. The image description is assigned to the request's prompt argument. The request must target the existing model deployment.

Which value should the developer supply for the model argument of client.images.generate?

Choose one answer
Why

The model argument identifies the deployment that will handle the generation request. The endpoint belongs in the client configuration, while the image description belongs in prompt.

  • Not correct: The Microsoft Foundry project name. The source records the deployment name and passes model_deployment to the model argument. It does not use the enclosing project's name for that argument.
  • Not correct: The Azure OpenAI endpoint URL. The source uses the endpoint when initializing the client and the deployment name when setting the generation request's model argument.
  • Not correct: The base model name, if different. The request uses the configured deployment name to identify the deployment.
  • Correct: The image model's deployment name. The source instructs the developer to retain the deployment name and supplies that value through model=model_deployment.

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