Skip to content

Examples#

Index > PersonalizeRuntime > Examples

Auto-generated documentation for PersonalizeRuntime type annotations stubs module types-aiobotocore-personalize-runtime.

Client#

Implicit type annotations#

Can be used with types-aioboto3[personalize-runtime] package installed.

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

# PersonalizeRuntimeClient usage example

from aioboto3.session import Session


session = Session()

async with session.client("personalize-runtime") as client:  # (1)
    result = await client.get_action_recommendations()  # (2)
  1. client: PersonalizeRuntimeClient
  2. result: GetActionRecommendationsResponseTypeDef

Explicit type annotations#

With types-aioboto3-lite[personalize-runtime] or a standalone types_aiobotocore_personalize_runtime package, you have to explicitly specify client: PersonalizeRuntimeClient 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.

# PersonalizeRuntimeClient usage example with type annotations

from aioboto3.session import Session

from types_aiobotocore_personalize_runtime.client import PersonalizeRuntimeClient
from types_aiobotocore_personalize_runtime.type_defs import GetActionRecommendationsResponseTypeDef
from types_aiobotocore_personalize_runtime.type_defs import GetActionRecommendationsRequestRequestTypeDef


session = Session()

client: PersonalizeRuntimeClient
async with session.client("personalize-runtime") as client:  # (1)
    kwargs: GetActionRecommendationsRequestRequestTypeDef = {...}  # (2)
    result: GetActionRecommendationsResponseTypeDef = await client.get_action_recommendations(**kwargs)  # (3)
  1. client: PersonalizeRuntimeClient
  2. kwargs: GetActionRecommendationsRequestRequestTypeDef
  3. result: GetActionRecommendationsResponseTypeDef