Reference a JPEG or PNG by its asset name in state, instructions, or a criterion.
Build the asset
Encode the image bytes without a data-URL prefix. Use the exact same identifier, including angle brackets, in assets and state.
import base64
from pathlib import Path
assets = {"<photo>": {"type": "image", "format": "jpg",
"data_base64": base64.b64encode(Path("shelf.jpg").read_bytes()).decode()}}Ask for a region
Set state to <photo> and send this question. Box coordinates use the full input image as their coordinate frame.
{
"bottle": {
"type": "box",
"instructions": "Locate the water bottle in <photo>."
}
}Try it in the console
Open the Chemistry shelf example. Select Run request and expand a result row to compare the predicted crop with the complete image.
Place images where the question uses them
Put an image in state when several questions inspect it. Refer to the state field in the question text. For a comparison that belongs to one question, put the second asset reference inside that question’s instructions or criteria.
- StateShare a shelf photo with every question in the request.
- InstructionsInclude a reference photo in the one question that needs to compare it with the shelf.
- CriteriaUse reference images to illustrate separate Choice options.
Upload a file with multipart
Download shelf_liquids.jpg. Send the JSON in the request field and the raw image in the file field named by assets[reference].part.
curl https://api.ngila.ai/v1/systemone \
-H "Authorization: Bearer $NGILA_API_KEY" \
-F 'request={"model": "ngila-judge", "state": {"shelf": "<photo>"}, "assets": {"<photo>": {"type": "image", "format": "jpg", "part": "shelf-image"}}, "questions": {"bottle": {"type": "box", "instructions": "Locate the water bottle in the shelf photo."}, "has_bottle": {"type": "noul", "instructions": "Is a water bottle visible on the shelf?"}}};type=application/json' \
-F 'shelf-image=@shelf_liquids.jpg;type=image/jpeg'Check upload limits
Ngila accepts up to 8 MiB per multipart image. Leave room for the JSON and multipart boundaries within the 16 MiB public gateway limit. For JSON uploads, budget for base64 expansion. See Request rules and errors.
Inspect the answer
Use the Box result to draw a region and the Noul result to decide whether the example merits review. See Box coordinates and OCR verification.