Skip to content

Examples#

Index > LexModelBuildingService > Examples

Auto-generated documentation for LexModelBuildingService type annotations stubs module types-aiobotocore-lex-models.

Client#

Implicit type annotations#

Can be used with types-aioboto3[lex-models] package installed.

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

# LexModelBuildingServiceClient usage example

from aioboto3.session import Session


session = Session()

async with session.client("lex-models") as client:  # (1)
    result = await client.create_bot_version()  # (2)
  1. client: LexModelBuildingServiceClient
  2. result: CreateBotVersionResponseTypeDef
# GetBotAliasesPaginator usage example

from aioboto3.session import Session


session = Session()

async with session.client("lex-models") as client:  # (1)
    paginator = client.get_paginator("get_bot_aliases")  # (2)
    async for item in paginator.paginate(...):
        print(item)  # (3)
  1. client: LexModelBuildingServiceClient
  2. paginator: GetBotAliasesPaginator
  3. item: GetBotAliasesResponseTypeDef

Explicit type annotations#

With types-aioboto3-lite[lex-models] or a standalone types_aiobotocore_lex_models package, you have to explicitly specify client: LexModelBuildingServiceClient 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.

# LexModelBuildingServiceClient usage example with type annotations

from aioboto3.session import Session

from types_aiobotocore_lex_models.client import LexModelBuildingServiceClient
from types_aiobotocore_lex_models.type_defs import CreateBotVersionResponseTypeDef
from types_aiobotocore_lex_models.type_defs import CreateBotVersionRequestRequestTypeDef


session = Session()

client: LexModelBuildingServiceClient
async with session.client("lex-models") as client:  # (1)
    kwargs: CreateBotVersionRequestRequestTypeDef = {...}  # (2)
    result: CreateBotVersionResponseTypeDef = await client.create_bot_version(**kwargs)  # (3)
  1. client: LexModelBuildingServiceClient
  2. kwargs: CreateBotVersionRequestRequestTypeDef
  3. result: CreateBotVersionResponseTypeDef
# GetBotAliasesPaginator usage example with type annotations

from aioboto3.session import Session

from types_aiobotocore_lex_models.client import LexModelBuildingServiceClient
from types_aiobotocore_lex_models.paginator import GetBotAliasesPaginator
from types_aiobotocore_lex_models.type_defs import GetBotAliasesResponseTypeDef


session = Session()

client: LexModelBuildingServiceClient
async with session.client("lex-models") as client:  # (1)
    paginator: GetBotAliasesPaginator = client.get_paginator("get_bot_aliases")  # (2)
    async for item in paginator.paginate(...):
        item: GetBotAliasesResponseTypeDef
        print(item)  # (3)
  1. client: LexModelBuildingServiceClient
  2. paginator: GetBotAliasesPaginator
  3. item: GetBotAliasesResponseTypeDef