Skip to main content
Client-agnostic endpoint model. Provides a single EndpointModel that pairs a ModelSpec with any Client implementation (HTTP, AWS SageMaker, GCP, Azure, …). This eliminates the need for per-backend model subclasses.

EndpointModel

Model endpoint backed by a pluggable client. Combines a ModelSpec (what the model expects and produces) with a Client (how to reach it). Supports both synchronous (predict / embed) and asynchronous (predict_async / embed_async) dispatch.
Model specification describing input requirements and output shape.
A configured Client instance (e.g. HTTPClient, AWSClient).
Optional ordered Ensembl IDs expected as bulk RNA input (M-Optimus ).
Optional ordered Ensembl IDs of predicted output genes (M-Optimus ).
Example:

model_spec

Model specification including tile and output config.

input_gene_names

Ordered Ensembl IDs expected as bulk RNA input.

output_gene_names

Ordered Ensembl IDs of predicted output genes.

predict

Sends a prediction request to the endpoint.
Tile request payload to send.
Returns: Parsed model response with predictions.

embed

Sends an embedding request to the endpoint.
Tile request payload to send.
Returns: Parsed model response with embeddings.

predict_with_embedding

Send a combined prediction+embedding request to the endpoint. Returns both the gene prediction (output) and the tile embedding (embedding) from a single forward pass, so callers needing both avoid a second inference.
Tile request payload to send.
Returns: Parsed model response with embedding populated alongside output.

predict_async

Sends a prediction request asynchronously.
Tile request payload to send.
An aiohttp.ClientSession for connection pooling.
Returns: Parsed model response with predictions.

embed_async

Sends an embedding request asynchronously.
Tile request payload to send.
An aiohttp.ClientSession for connection pooling.
Returns: Parsed model response with embeddings.

predict_with_embedding_async

Send a combined prediction+embedding request asynchronously.
Tile request payload to send.
An aiohttp.ClientSession for connection pooling.
Returns: Parsed model response with embedding populated alongside output.

__call__

Alias for predict.