Skip to main content

Interface: ImageCheck

Defined in: packages/agentos/src/safety/guardrails/builtin/ImageGuardrail.ts:48

One check the image guard runs on each image.

Properties​

id​

id: string

Defined in: packages/agentos/src/safety/guardrails/builtin/ImageGuardrail.ts:50

A word of its own (letters, digits and _ . : -, at most 64), never load.


kind​

kind: "match" | "classify"

Defined in: packages/agentos/src/safety/guardrails/builtin/ImageGuardrail.ts:52

match: compares the image with known material (a hash service). classify: sends it to a model.


onError?​

optional onError: "refuse" | "skip"

Defined in: packages/agentos/src/safety/guardrails/builtin/ImageGuardrail.ts:57

What a throw, or an answer with no verdict, does. refuse (default): the image is refused as unavailable. skip: the check is a signal; its failure is written and the chain goes on. A match check is always refuse.


reasonCodes?​

optional reasonCodes: readonly string[]

Defined in: packages/agentos/src/safety/guardrails/builtin/ImageGuardrail.ts:62

Every reason code and review code the check can answer. The guard's config.reasonCodes is its own fixed codes and every check's list. A vendor's check lists its category codes.

Methods​

check()​

check(image, context): Promise<ImageCheckResult>

Defined in: packages/agentos/src/safety/guardrails/builtin/ImageGuardrail.ts:68

Judges one image: receives the guard's own copy of its bytes (never a URL) with the guard's deadlineSignal, and the call's context, and answers an ImageCheckResult. A throw, or any other answer, is a check that could not answer. Once image.deadlineSignal is aborted, send nothing, and stop a request in flight (hand the signal to it).

Parameters​

image​

ImageUnderReview

context​

GuardrailContext

Returns​

Promise<ImageCheckResult>