Skip to content

Dm Image Probe

Probe whether a decisions-model judge reads image input.

A decisions model accepts any state, so a call that merely succeeds proves nothing. The probe instead asks the judge the color of solid-color squares and trusts it only when it names every one.

cached_verdict(model_id)

Return the cached probe verdict for a model id.

Parameters:

Name Type Description Default
model_id str

The decisions model id.

required

Returns:

Type Description
bool | None

bool | None: The definitive verdict, or None when the model was never probed or its last probe failed transiently.

clear_cache()

Forget every cached probe verdict.

dm_reads_images(invoker, record_usage=None) async

Check whether a decisions model reads image input, probing once per model id.

Parameters:

Name Type Description Default
invoker BaseDMInvoker

The decisions-model judge.

required
record_usage Callable[[DMOutput], None] | None

Called with each probe output, to count its tokens. Defaults to None.

None

Returns:

Name Type Description
bool bool

True when the judge names the color of every probe image.

rejection_reason(model_id)

Return the provider error that rejected a model's probe.

Parameters:

Name Type Description Default
model_id str

The decisions model id.

required

Returns:

Type Description
str | None

str | None: The provider's error message, or None when the provider did not reject the probe request.

solid_png(rgb)

Encode a solid-color square as PNG bytes, without an imaging dependency.

Parameters:

Name Type Description Default
rgb tuple[int, int, int]

The square's color.

required

Returns:

Name Type Description
bytes bytes

The PNG file content.