Skip to main content
Request and response schemas for model inference. These Pydantic models define the JSON payloads exchanged between clients and a deployed model endpoint (e.g. SageMaker or a local server). Each request/response pair corresponds to a single tile.

ModelRequest

Payload sent to the model endpoint for a single tile. The tile image is base64-encoded for JSON transport. Bulk RNA counts can optionally be included for multimodal models.
str
required
Base64-encoded tile image (PNG).
list[float] | None
Optional bulk RNA counts vector.
str
required
Stem of the source slide filename.
int
required
Tile x-coordinate in the slide.
int
required
Tile y-coordinate in the slide.
int
required
Tile width in pixels.
int
required
Tile height in pixels.
float | None
Fraction of tissue in the tile.
int
required
Index of this tile in the extraction plan.

image

Decodes and returns the tile image as PIL.

ModelResponse

Payload returned by the model endpoint for a single tile. Carries the model output together with the full tile metadata from the originating request, so that downstream writers can persist everything without needing a separate schema.
list[float]
Model output vector for this tile.
str
Stem of the source slide filename.
int
Tile x-coordinate in the slide.
int
Tile y-coordinate in the slide.
int
Tile width in pixels.
int
Tile height in pixels.
float | None
Fraction of tissue in the tile.
int
Index of this tile in the extraction plan.
float | None
Extraction resolution (MPP) if available.

SageMakerRequest

Extended request for the SageMaker /invocations endpoint. Adds a model_name field so the server can dispatch to the correct model and a mode field to select the scheduler ("prediction" or "embedding").