Skip to main content
AWS SageMaker client. Sends JSON payloads to a SageMaker endpoint via the sagemaker-runtime invoke_endpoint API. The model_name field is injected into every request body for multi-model dispatch.

AWSClient

Sends JSON payloads to an AWS SageMaker endpoint.
Name of the SageMaker endpoint.
Model identifier injected into the request body for SageMaker multi-model dispatch.
AWS region. When None, uses the default from the environment or boto_session.
Optional pre-configured boto3.Session (e.g. with explicit credentials or a custom profile). When None, a default session is created using the standard credential chain.
Read timeout in seconds.
Example:

predict

Invokes the SageMaker endpoint for prediction.
Serialized JSON request payload.
Returns: Response body as a JSON string.

embed

Invokes the SageMaker endpoint for embedding.
Serialized JSON request payload.
Returns: Response body as a JSON string.

predict_with_embedding

Invokes the SageMaker endpoint for the combined prediction+embedding mode. Returns both the gene prediction and the tile embedding from a single forward pass (the embedding is a free byproduct of the prediction backbone).
Serialized JSON request payload.
Returns: Response body as a JSON string, with embedding populated alongside output.

metadata

Fetches model metadata via /invocations. Sends a minimal request with mode set to "metadata" so the server returns model metadata instead of running inference. Returns: Response body as a JSON string.

predict_async

Predicts asynchronously via run_in_executor. boto3 is not natively async, so the synchronous predict call is delegated to a thread pool.
Serialized JSON payload.
Unused. Accepted for interface compatibility with the Client protocol.
Returns: Response body as a string.

embed_async

Embeds asynchronously via run_in_executor.
Serialized JSON payload.
Unused. Accepted for interface compatibility.
Returns: Response body as a string.

predict_with_embedding_async

Combined prediction+embedding asynchronously via run_in_executor.
Serialized JSON payload.
Unused. Accepted for interface compatibility.
Returns: Response body as a string.