Skip to content

SageMakerRuntimeClient

Index > SageMakerRuntime > SageMakerRuntimeClient

Auto-generated documentation for SageMakerRuntime type annotations stubs module mypy-boto3-sagemaker-runtime.

SageMakerRuntimeClient

Type annotations and code completion for boto3.client("sagemaker-runtime"). boto3 documentation

Usage example
from boto3.session import Session
from mypy_boto3_sagemaker_runtime.client import SageMakerRuntimeClient

def get_sagemaker-runtime_client() -> SageMakerRuntimeClient:
    return Session().client("sagemaker-runtime")

Exceptions

boto3 client exceptions are generated in runtime. This class provides code completion for boto3.client("sagemaker-runtime").exceptions structure.

Usage example
client = boto3.client("sagemaker-runtime")

try:
    do_something(client)
except (
    client.ClientError,
    client.InternalDependencyException,
    client.InternalFailure,
    client.ModelError,
    client.ModelNotReadyException,
    client.ServiceUnavailable,
    client.ValidationError,
) as e:
    print(e)
Type checking example
from mypy_boto3_sagemaker_runtime.client import Exceptions

def handle_error(exc: Exceptions.ClientError) -> None:
    ...

Methods

can_paginate

Check if an operation can be paginated.

Type annotations and code completion for boto3.client("sagemaker-runtime").can_paginate method. boto3 documentation

Method definition
def can_paginate(
    self,
    operation_name: str,
) -> bool:
    ...

close

Closes underlying endpoint connections.

Type annotations and code completion for boto3.client("sagemaker-runtime").close method. boto3 documentation

Method definition
def close(
    self,
) -> None:
    ...

generate_presigned_url

Generate a presigned url given a client, its method, and arguments.

Type annotations and code completion for boto3.client("sagemaker-runtime").generate_presigned_url method. boto3 documentation

Method definition
def generate_presigned_url(
    self,
    ClientMethod: str,
    Params: Mapping[str, Any] = ...,
    ExpiresIn: int = 3600,
    HttpMethod: str = ...,
) -> str:
    ...

invoke_endpoint

After you deploy a model into production using Amazon SageMaker hosting services, your client applications use this API to get inferences from the model hosted at the specified endpoint.

Type annotations and code completion for boto3.client("sagemaker-runtime").invoke_endpoint method. boto3 documentation

Method definition
def invoke_endpoint(
    self,
    *,
    EndpointName: str,
    Body: Union[str, bytes, IO[Any], StreamingBody],
    ContentType: str = ...,
    Accept: str = ...,
    CustomAttributes: str = ...,
    TargetModel: str = ...,
    TargetVariant: str = ...,
    TargetContainerHostname: str = ...,
    InferenceId: str = ...,
    EnableExplanations: str = ...,
) -> InvokeEndpointOutputTypeDef:  # (1)
    ...
  1. See InvokeEndpointOutputTypeDef
Usage example with kwargs
kwargs: InvokeEndpointInputRequestTypeDef = {  # (1)
    "EndpointName": ...,
    "Body": ...,
}

parent.invoke_endpoint(**kwargs)
  1. See InvokeEndpointInputRequestTypeDef

invoke_endpoint_async

After you deploy a model into production using Amazon SageMaker hosting services, your client applications use this API to get inferences from the model hosted at the specified endpoint in an asynchronous manner.

Type annotations and code completion for boto3.client("sagemaker-runtime").invoke_endpoint_async method. boto3 documentation

Method definition
def invoke_endpoint_async(
    self,
    *,
    EndpointName: str,
    InputLocation: str,
    ContentType: str = ...,
    Accept: str = ...,
    CustomAttributes: str = ...,
    InferenceId: str = ...,
    RequestTTLSeconds: int = ...,
    InvocationTimeoutSeconds: int = ...,
) -> InvokeEndpointAsyncOutputTypeDef:  # (1)
    ...
  1. See InvokeEndpointAsyncOutputTypeDef
Usage example with kwargs
kwargs: InvokeEndpointAsyncInputRequestTypeDef = {  # (1)
    "EndpointName": ...,
    "InputLocation": ...,
}

parent.invoke_endpoint_async(**kwargs)
  1. See InvokeEndpointAsyncInputRequestTypeDef