Implement computer vision solutions 3.2 Design and implement multimodal understanding workflows

A catalog app sends six product photos in one Chat Completions request to a…

Study guide skill: Configure apps to produce concise or detailed captions for single or multiple images

Question B5-005

A catalog app sends six product photos in one Chat Completions request to a vision-enabled model and asks for a detailed caption for each photo. The response stops partway through the fourth caption, and finish_reason is length. What should you do?

Select one answer.

  • A Set detail to high on each image so the model has more tokens for the captions
  • B Increase max_tokens (or max_completion_tokens for reasoning models) so the output isn't cut off ✓ Correct answer
  • C Send one request per photo, because a chat request can contain only one image
  • D Treat it as a content filter block and rephrase the prompt

Answer: B

A finish_reason of length means the output was incomplete because of the max_tokens setting or the model's token limit, and the guidance is to set max_tokens or max_completion_tokens (for o-series reasoning models) so the output isn't cut off. The detail setting controls how the model processes the input images, with high detail using more of the token budget per image, not more output. A content filter block returns finish_reason content_filter, and one request can contain an array of text and several images.

Deep dive

How it works

Every chat completion response has a finish_reason, and its value tells you why the output ended:

  • stop: the API returned the complete output.
  • length: the output is incomplete because of the max_tokens parameter or the model's token limit.
  • content_filter: content was left out because of a flag from the content filters.

A caption that stops partway with finish_reason length is a token-budget problem. The vision how-to calls this out: remember to set max_tokens or max_completion_tokens, or the output will be cut off. For o-series reasoning models, use max_completion_tokens instead of max_tokens. Six detailed captions need room, so raise the limit to cover all of them.

It also helps to know how images affect tokens. The detail setting on each image is low, high or auto (the default, where the model decides based on image size). Low processes a 512x512 version for faster responses and fewer tokens. High looks at the low-resolution image and then at detailed 512x512 segments, and each segment uses double the token budget. Detail affects how the input images are processed, not how much output you're allowed.

The other options, and when you'd use them

  • Set detail to high: High detail spends more tokens on each input image to look closer. It doesn't raise the output limit, so the captions would still be cut off.
  • One request per photo, because only one image is allowed: A request can contain an array of text and several images (up to 10 per chat request). Splitting requests is a design choice, not a requirement.
  • Treat it as a content filter block: A filter block shows up as finish_reason content_filter, not length.

Exam tip

Read finish_reason first: "length" means raise max_tokens (max_completion_tokens for reasoning models), "content_filter" means a safety block, and "stop" means the output is complete.

References

Last reviewed:

Ready to test yourself? The quiz asks this and every other AI-103 question, with instant feedback. Practice this in a quiz →

All Computer vision questions · AI-103 study guide

Thanks for your feedback!