Skip to content

create_bot

create_bot(
    bot_name: Name,
    role_arn: RoleArn,
    data_privacy: DataPrivacy,
    idle_session_ttl_in_seconds: SessionTTL,
    *,
    config_overrides: Optional[LexModelsV2ClientConfig] = None,
    description: Optional[Description] = None,
    bot_tags: Optional[TagMap] = None,
    test_bot_alias_tags: Optional[TagMap] = None,
    bot_type: Optional[BotType] = None,
    bot_members: Optional[BotMembers] = None,
    error_log_settings: Optional[ErrorLogSettings] = None,
) -> CreateBotResponse

Creates an Amazon Lex conversational bot.

Parameters:

  • bot_name (Name) –

    The name of the bot. The bot name must be unique in the account that creates the bot.

  • description (Optional[Description], default: None ) –

    A description of the bot. It appears in lists to help you identify a particular bot.

  • role_arn (RoleArn) –

    The Amazon Resource Name (ARN) of an IAM role that has permission to access the bot.

  • data_privacy (DataPrivacy) –

    Provides information on additional privacy protections Amazon Lex should use with the bot's data.

  • idle_session_ttl_in_seconds (SessionTTL) –

    The time, in seconds, that Amazon Lex should keep information about a user's conversation with the bot.

    A user interaction remains active for the amount of time specified. If no conversation occurs during this time, the session expires and Amazon Lex deletes any data provided before the timeout.

    You can specify between 60 (1 minute) and 86,400 (24 hours) seconds.

  • bot_tags (Optional[TagMap], default: None ) –

    A list of tags to add to the bot. You can only add tags when you create a bot. You can't use the UpdateBot operation to update tags. To update tags, use the TagResource operation.

  • test_bot_alias_tags (Optional[TagMap], default: None ) –

    A list of tags to add to the test alias for a bot. You can only add tags when you create a bot. You can't use the UpdateAlias operation to update tags. To update tags on the test alias, use the TagResource operation.

  • bot_type (Optional[BotType], default: None ) –

    The type of a bot to create.

  • bot_members (Optional[BotMembers], default: None ) –

    The list of bot members in a network to be created.

  • error_log_settings (Optional[ErrorLogSettings], default: None ) –

    Specifies the configuration for error logging during bot creation.

Raises:

  • ConflictException –

    The action that you tried to perform couldn't be completed because the resource is in a conflicting state. For example, deleting a bot that is in the CREATING state. Try your request again.

  • InternalServerException –

    The service encountered an unexpected condition. Try your request again.

  • PreconditionFailedException –

    Your request couldn't be completed because one or more request fields aren't valid. Check the fields in your request and try again.

  • ServiceQuotaExceededException –

    You have reached a quota for your bot.

  • ThrottlingException –

    Your request rate is too high. Reduce the frequency of requests.

  • ValidationException –

    One of the input parameters in your request isn't valid. Check the parameters and try your request again.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_lex_models_v2/_services/lex_models_v2.py
def create_bot(
    self,
    bot_name: "capo_lex_models_v2.types.name.Name",
    role_arn: "capo_lex_models_v2.types.role_arn.RoleArn",
    data_privacy: "capo_lex_models_v2.types.data_privacy.DataPrivacy",
    idle_session_ttl_in_seconds: "capo_lex_models_v2.types.session_ttl.SessionTTL",
    *,
    config_overrides: Optional[LexModelsV2ClientConfig] = None,
    description: Optional[
        "capo_lex_models_v2.types.description.Description"
    ] = None,
    bot_tags: Optional["capo_lex_models_v2.types.tag_map.TagMap"] = None,
    test_bot_alias_tags: Optional["capo_lex_models_v2.types.tag_map.TagMap"] = None,
    bot_type: Optional["capo_lex_models_v2.types.bot_type.BotType"] = None,
    bot_members: Optional["capo_lex_models_v2.types.bot_members.BotMembers"] = None,
    error_log_settings: Optional[
        "capo_lex_models_v2.types.error_log_settings.ErrorLogSettings"
    ] = None,
) -> "capo_lex_models_v2.types.create_bot_response.CreateBotResponse":
    """<p>Creates an Amazon Lex conversational bot. </p>

    Args:
        bot_name: <p>The name of the bot. The bot name must be unique in the account that creates the bot.</p>
        description: <p>A description of the bot. It appears in lists to help you identify a particular bot.</p>
        role_arn: <p>The Amazon Resource Name (ARN) of an IAM role that has permission to access the bot.</p>
        data_privacy: <p>Provides information on additional privacy protections Amazon Lex should use with the bot's data.</p>
        idle_session_ttl_in_seconds: <p>The time, in seconds, that Amazon Lex should keep information about a user's conversation with the bot. </p> <p>A user interaction remains active for the amount of time specified. If no conversation occurs during this time, the session expires and Amazon Lex deletes any data provided before the timeout.</p> <p>You can specify between 60 (1 minute) and 86,400 (24 hours) seconds.</p>
        bot_tags: <p>A list of tags to add to the bot. You can only add tags when you create a bot. You can't use the <code>UpdateBot</code> operation to update tags. To update tags, use the <code>TagResource</code> operation.</p>
        test_bot_alias_tags: <p>A list of tags to add to the test alias for a bot. You can only add tags when you create a bot. You can't use the <code>UpdateAlias</code> operation to update tags. To update tags on the test alias, use the <code>TagResource</code> operation.</p>
        bot_type: <p>The type of a bot to create.</p>
        bot_members: <p>The list of bot members in a network to be created.</p>
        error_log_settings: <p>Specifies the configuration for error logging during bot creation.</p>

    Raises:
        capo_lex_models_v2.errors.conflict_exception.ConflictException: <p>The action that you tried to perform couldn't be completed because the resource is in a conflicting state. For example, deleting a bot that is in the CREATING state. Try your request again. </p>
        capo_lex_models_v2.errors.internal_server_exception.InternalServerException: <p>The service encountered an unexpected condition. Try your request again.</p>
        capo_lex_models_v2.errors.precondition_failed_exception.PreconditionFailedException: <p>Your request couldn't be completed because one or more request fields aren't valid. Check the fields in your request and try again.</p>
        capo_lex_models_v2.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>You have reached a quota for your bot. </p>
        capo_lex_models_v2.errors.throttling_exception.ThrottlingException: <p>Your request rate is too high. Reduce the frequency of requests.</p>
        capo_lex_models_v2.errors.validation_exception.ValidationException: <p>One of the input parameters in your request isn't valid. Check the parameters and try your request again.</p>
        capo_lex_models_v2.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_lex_models_v2.types.create_bot_request.CreateBotRequest]",
    ) -> OperationResponse[
        "capo_lex_models_v2.types.create_bot_response.CreateBotResponse"
    ]:
        import capo_lex_models_v2._operations.lex_model_building_service_v2.create_bot

        output, http_response = (
            capo_lex_models_v2._operations.lex_model_building_service_v2.create_bot.create_bot(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateBot")
    )
    input_: capo_lex_models_v2.types.create_bot_request.CreateBotRequest = {
        "bot_name": bot_name,
        "role_arn": role_arn,
        "data_privacy": data_privacy,
        "idle_session_ttl_in_seconds": idle_session_ttl_in_seconds,
    }
    if description is not None:
        input_["description"] = description
    if bot_tags is not None:
        input_["bot_tags"] = bot_tags
    if test_bot_alias_tags is not None:
        input_["test_bot_alias_tags"] = test_bot_alias_tags
    if bot_type is not None:
        input_["bot_type"] = bot_type
    if bot_members is not None:
        input_["bot_members"] = bot_members
    if error_log_settings is not None:
        input_["error_log_settings"] = error_log_settings

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output