Skip to content

Examples#

Index > LexModelsV2 > Examples

Auto-generated documentation for LexModelsV2 type annotations stubs module mypy-boto3-lexv2-models.

Client#

Implicit type annotations#

Can be used with boto3-stubs[lexv2-models] package installed.

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

# LexModelsV2Client usage example

from boto3.session import Session


session = Session()

client = session.client("lexv2-models")  # (1)
result = client.batch_create_custom_vocabulary_item()  # (2)
  1. client: LexModelsV2Client
  2. result: BatchCreateCustomVocabularyItemResponseTypeDef
# BotAliasAvailableWaiter usage example

from boto3.session import Session


session = Session()
client = session.client("lexv2-models")  # (1)

waiter = client.get_waiter("bot_alias_available")  # (2)
waiter.wait()
  1. client: LexModelsV2Client
  2. waiter: BotAliasAvailableWaiter

Explicit type annotations#

With boto3-stubs-lite[lexv2-models] or a standalone mypy_boto3_lexv2_models package, you have to explicitly specify client: LexModelsV2Client 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.

# LexModelsV2Client usage example with type annotations

from boto3.session import Session

from mypy_boto3_lexv2_models.client import LexModelsV2Client
from mypy_boto3_lexv2_models.type_defs import BatchCreateCustomVocabularyItemResponseTypeDef
from mypy_boto3_lexv2_models.type_defs import BatchCreateCustomVocabularyItemRequestRequestTypeDef


session = Session()

client: LexModelsV2Client = session.client("lexv2-models")

kwargs: BatchCreateCustomVocabularyItemRequestRequestTypeDef = {...}
result: BatchCreateCustomVocabularyItemResponseTypeDef = client.batch_create_custom_vocabulary_item(**kwargs)
# BotAliasAvailableWaiter usage example with type annotations

from boto3.session import Session

from mypy_boto3_lexv2_models.client import LexModelsV2Client
from mypy_boto3_lexv2_models.waiter import BotAliasAvailableWaiter

session = Session()
client: LexModelsV2Client = session.client("lexv2-models")

waiter: BotAliasAvailableWaiter = client.get_waiter("bot_alias_available")
waiter.wait()