Skip to content

SageMakerRuntimeClient#

Index > SageMakerRuntime > SageMakerRuntimeClient

Auto-generated documentation for SageMakerRuntime type annotations stubs module types-aiobotocore-sagemaker-runtime.

SageMakerRuntimeClient#

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

SageMakerRuntimeClient usage example

from aiobotocore.session import get_session
from types_aiobotocore_sagemaker_runtime.client import SageMakerRuntimeClient

session = get_session()
async with session.create_client("sagemaker-runtime") as client:
    client: SageMakerRuntimeClient

Exceptions#

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

SageMakerRuntimeClient.exceptions usage example

async with session.create_client("sagemaker-runtime") as client:
    try:
        do_something(client)
    except (
            client.ClientError,
        client.InternalDependencyException,
        client.InternalFailure,
        client.ModelError,
        client.ModelNotReadyException,
        client.ServiceUnavailable,
        client.ValidationError,
    ) as e:
        print(e)
SageMakerRuntimeClient usage type checking example

from types_aiobotocore_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 session.create_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 session.create_client("sagemaker-runtime").close method. boto3 documentation

# close method definition

await def close(
    self,
) -> None:
    ...

generate_presigned_url#

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

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

# generate_presigned_url method definition

await 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 session.create_client("sagemaker-runtime").invoke_endpoint method. boto3 documentation

# invoke_endpoint method definition

await 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
# 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 session.create_client("sagemaker-runtime").invoke_endpoint_async method. boto3 documentation

# invoke_endpoint_async method definition

await 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

__aenter__#

Type annotations and code completion for session.create_client("sagemaker-runtime").__aenter__ method. boto3 documentation

# __aenter__ method definition

await def __aenter__(
    self,
) -> SageMakerRuntimeClient:
    ...

__aexit__#

Type annotations and code completion for session.create_client("sagemaker-runtime").__aexit__ method. boto3 documentation

# __aexit__ method definition

await def __aexit__(
    self,
    exc_type: Any,
    exc_val: Any,
    exc_tb: Any,
) -> Any:
    ...