> ## Documentation Index
> Fetch the complete documentation index at: https://docs.perceptron.inc/llms.txt
> Use this file to discover all available pages before exploring further.

# Image Q&A

> Ask questions about an image and ground answers in visible regions.

Ask Perceptron Mk1.5 about objects, relationships, activities, or details in an image. Use a specific question for an inspection checklist or product audit, and request spatial annotations when the answer needs visible evidence.

## Ask a grounded question

Install `perceptron>=0.4.0` and set `PERCEPTRON_API_KEY`. This example uses a public photo of a coastal bay and asks the model to cite relevant objects with bounding boxes.

```python theme={null}
import os
from pathlib import Path

from perceptron import Client, image

client = Client(api_key=os.environ["PERCEPTRON_API_KEY"])
image_url = (
    "https://raw.githubusercontent.com/perceptron-ai-inc/perceptron/"
    "main/cookbook/_shared/assets/capabilities/qna/studio_scene.webp"
)
messages = [{
    "role": "user",
    "content": [
        image(image_url),
        {"type": "text", "text": (
            "What stands out in this scene? Describe the visible objects and their "
            "relationships. Cite the objects supporting your answer with flat point_box "
            "annotations (no collections or tracks), each with a mention and asset_idx=0. Distinguish what is "
            "visible from any interpretation, and say when a detail is unclear."
        )},
    ],
}]
response = client.chat.completions.create(
    model="perceptron-mk1.5",
    messages=messages,
    reasoning_effort="high",
    max_completion_tokens=2048,
    vision_config={"annotation_format": "box"},
)
choice = response.choices[0]
if choice.finish_reason != "stop" or choice.message.tool_calls:
    raise RuntimeError(f"Incomplete image answer: {choice.finish_reason}")
answer = choice.message.content or ""
print(answer)
Path("response.txt").write_text(answer, encoding="utf-8")
```

The answer is text in `message.content`; any boxes appear as markup within that text. For example, an annotation has this shape:

```html theme={null}
<point_box mention="object cited in the answer" asset_idx="0"> (100,150) (300,450) </point_box>
```

These coordinates illustrate the format, not a prediction for the sample image. They use the normalized 0–1000 grid, with top-left followed by bottom-right. `asset_idx="0"` selects the image supplied in this request. See [annotation format](/perceptron-mk1.5/concepts/annotations) for validation and [rendering annotations](/perceptron-mk1.5/guides/rendering-annotations) to draw the saved answer on the image.

For an answer without spatial markup, omit `vision_config` and ask for ordinary prose. To identify a small target by its center, request `annotation_format: "point"`; use `"polygon"` when a boundary is more useful than a rectangle.

## Ask a follow-up question

Continue the conversation by retaining the image and previous assistant message. Run this after the example above:

```python theme={null}
messages.append(choice.message.to_dict())
messages.append({
    "role": "user",
    "content": (
        "Which of those observations is most important to your interpretation? "
        "Explain briefly and cite its visible evidence with a flat point_box on "
        "asset_idx=0, without a collection or track wrapper."
    ),
})
follow_up = client.chat.completions.create(
    model="perceptron-mk1.5",
    messages=messages,
    reasoning_effort="high",
    max_completion_tokens=1024,
    vision_config={"annotation_format": "box"},
)
follow_up_choice = follow_up.choices[0]
if follow_up_choice.finish_reason != "stop" or follow_up_choice.message.tool_calls:
    raise RuntimeError("The follow-up answer did not complete")
print(follow_up_choice.message.content or "")
```

The image remains asset `0` because the follow-up introduces no new media. When adding reference images, use [multiple assets](/perceptron-mk1.5/guides/multiple-assets) to keep the answer attached to the correct image. Use [Multilook](/perceptron-mk1.5/guides/multilook) for independent questions that can share the same image without depending on each other's answers.

## Make the question useful

* Ask for observable evidence: “Which objects block the doorway?” is more specific than “Is this scene okay?”
* State the decision criteria and allow an uncertain answer when the needed detail is obscured or too small.
* Ask for the geometry your application needs, then validate it before displaying it. A box helps locate evidence; it does not establish that the interpretation is correct.
* Use [structured outputs](/perceptron-mk1.5/capabilities/structured-outputs) when the answer must follow a schema, [OCR](/perceptron-mk1.5/capabilities/ocr) for text extraction, and [object detection](/perceptron-mk1.5/capabilities/object-detection) for category-based localization or counts.
