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

# SageMakerRuntimeClient 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.

# Exceptions.exceptions usage example

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

try:
    do_something(client)
except (
    client.exceptions.ClientError,
    client.exceptions.InternalDependencyException,
    client.exceptions.InternalFailure,
    client.exceptions.InternalStreamFailure,
    client.exceptions.ModelError,
    client.exceptions.ModelNotReadyException,
    client.exceptions.ModelStreamError,
    client.exceptions.ServiceUnavailable,
    client.exceptions.ValidationError,
) as e:
    print(e)
# Exceptions.exceptions 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

# can_paginate 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

# close 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

# generate_presigned_url 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

# invoke_endpoint 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 = ...,
    InferenceComponentName: str = ...,
    SessionId: str = ...,
) -> InvokeEndpointOutputTypeDef:  # (1)
    ...
  1. See InvokeEndpointOutputTypeDef
# invoke_endpoint method usage example with argument unpacking

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

# invoke_endpoint_async 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
# invoke_endpoint_async method usage example with argument unpacking

kwargs: InvokeEndpointAsyncInputRequestTypeDef = {  # (1)
    "EndpointName": ...,
    "InputLocation": ...,
}

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

invoke_endpoint_with_response_stream#

Invokes a model at the specified endpoint to return the inference response as a stream.

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

# invoke_endpoint_with_response_stream method definition

def invoke_endpoint_with_response_stream(
    self,
    *,
    EndpointName: str,
    Body: Union[str, bytes, IO[Any], StreamingBody],
    ContentType: str = ...,
    Accept: str = ...,
    CustomAttributes: str = ...,
    TargetVariant: str = ...,
    TargetContainerHostname: str = ...,
    InferenceId: str = ...,
    InferenceComponentName: str = ...,
    SessionId: str = ...,
) -> InvokeEndpointWithResponseStreamOutputTypeDef:  # (1)
    ...
  1. See InvokeEndpointWithResponseStreamOutputTypeDef
# invoke_endpoint_with_response_stream method usage example with argument unpacking

kwargs: InvokeEndpointWithResponseStreamInputRequestTypeDef = {  # (1)
    "EndpointName": ...,
    "Body": ...,
}

parent.invoke_endpoint_with_response_stream(**kwargs)
  1. See InvokeEndpointWithResponseStreamInputRequestTypeDef