Skip to content

Examples#

Index > SageMakerRuntime > Examples

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

Client#

Implicit type annotations#

Can be used with boto3-stubs[sagemaker-runtime] package installed.

Write your SageMakerRuntime code as usual, type checking and code completion should work out of the box.

# SageMakerRuntimeClient usage example

from boto3.session import Session


session = Session()

client = session.client("sagemaker-runtime")  # (1)
result = client.invoke_endpoint()  # (2)
  1. client: SageMakerRuntimeClient
  2. result: InvokeEndpointOutputTypeDef

Explicit type annotations#

With boto3-stubs-lite[sagemaker-runtime] or a standalone mypy_boto3_sagemaker_runtime package, you have to explicitly specify client: SageMakerRuntimeClient type annotation.

All other type annotations are optional, as types should be discovered automatically. However, these type annotations can be helpful in your functions and methods.

# SageMakerRuntimeClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_sagemaker_runtime.client import SageMakerRuntimeClient
from mypy_boto3_sagemaker_runtime.type_defs import InvokeEndpointOutputTypeDef
from mypy_boto3_sagemaker_runtime.type_defs import InvokeEndpointInputRequestTypeDef


session = Session()

client: SageMakerRuntimeClient = session.client("sagemaker-runtime")

kwargs: InvokeEndpointInputRequestTypeDef = {...}
result: InvokeEndpointOutputTypeDef = client.invoke_endpoint(**kwargs)