Skip to content

update_slot async

update_slot(
    slot_id: Id,
    slot_name: Name,
    value_elicitation_setting: SlotValueElicitationSetting,
    bot_id: Id,
    bot_version: DraftBotVersion,
    locale_id: LocaleId,
    intent_id: Id,
    *,
    config_overrides: Optional[AsyncLexModelsV2ClientConfig] = None,
    description: Optional[Description] = None,
    slot_type_id: Optional[BuiltInOrCustomSlotTypeId] = None,
    obfuscation_setting: Optional[ObfuscationSetting] = None,
    multiple_values_setting: Optional[MultipleValuesSetting] = None,
    sub_slot_setting: Optional[SubSlotSetting] = None,
) -> UpdateSlotResponse

Updates the settings for a slot.

Parameters:

  • slot_id (Id) –

    The unique identifier for the slot to update.

  • slot_name (Name) –

    The new name for the slot.

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

    The new description for the slot.

  • slot_type_id (Optional[BuiltInOrCustomSlotTypeId], default: None ) –

    The unique identifier of the new slot type to associate with this slot.

  • value_elicitation_setting (SlotValueElicitationSetting) –

    A new set of prompts that Amazon Lex sends to the user to elicit a response the provides a value for the slot.

  • obfuscation_setting (Optional[ObfuscationSetting], default: None ) –

    New settings that determine how slot values are formatted in Amazon CloudWatch logs.

  • bot_id (Id) –

    The unique identifier of the bot that contains the slot.

  • bot_version (DraftBotVersion) –

    The version of the bot that contains the slot. Must always be DRAFT.

  • locale_id (LocaleId) –

    The identifier of the language and locale that contains the slot. The string must match one of the supported locales. For more information, see Supported languages.

  • intent_id (Id) –

    The identifier of the intent that contains the slot.

  • multiple_values_setting (Optional[MultipleValuesSetting], default: None ) –

    Determines whether the slot accepts multiple values in one response. Multiple value slots are only available in the en-US locale. If you set this value to true in any other locale, Amazon Lex throws a ValidationException.

    If the multipleValuesSetting is not set, the default value is false.

  • sub_slot_setting (Optional[SubSlotSetting], default: None ) –

    Specifications for the constituent sub slots and the expression for the composite slot.

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/async_lex_models_v2.py
async def update_slot(
    self,
    slot_id: "capo_lex_models_v2.types.id.Id",
    slot_name: "capo_lex_models_v2.types.name.Name",
    value_elicitation_setting: "capo_lex_models_v2.types.slot_value_elicitation_setting.SlotValueElicitationSetting",
    bot_id: "capo_lex_models_v2.types.id.Id",
    bot_version: "capo_lex_models_v2.types.draft_bot_version.DraftBotVersion",
    locale_id: "capo_lex_models_v2.types.locale_id.LocaleId",
    intent_id: "capo_lex_models_v2.types.id.Id",
    *,
    config_overrides: Optional[AsyncLexModelsV2ClientConfig] = None,
    description: Optional[
        "capo_lex_models_v2.types.description.Description"
    ] = None,
    slot_type_id: Optional[
        "capo_lex_models_v2.types.built_in_or_custom_slot_type_id.BuiltInOrCustomSlotTypeId"
    ] = None,
    obfuscation_setting: Optional[
        "capo_lex_models_v2.types.obfuscation_setting.ObfuscationSetting"
    ] = None,
    multiple_values_setting: Optional[
        "capo_lex_models_v2.types.multiple_values_setting.MultipleValuesSetting"
    ] = None,
    sub_slot_setting: Optional[
        "capo_lex_models_v2.types.sub_slot_setting.SubSlotSetting"
    ] = None,
) -> "capo_lex_models_v2.types.update_slot_response.UpdateSlotResponse":
    """<p>Updates the settings for a slot.</p>

    Args:
        slot_id: <p>The unique identifier for the slot to update.</p>
        slot_name: <p>The new name for the slot.</p>
        description: <p>The new description for the slot.</p>
        slot_type_id: <p>The unique identifier of the new slot type to associate with this slot. </p>
        value_elicitation_setting: <p>A new set of prompts that Amazon Lex sends to the user to elicit a response the provides a value for the slot.</p>
        obfuscation_setting: <p>New settings that determine how slot values are formatted in Amazon CloudWatch logs. </p>
        bot_id: <p>The unique identifier of the bot that contains the slot.</p>
        bot_version: <p>The version of the bot that contains the slot. Must always be <code>DRAFT</code>.</p>
        locale_id: <p>The identifier of the language and locale that contains the slot. The string must match one of the supported locales. For more information, see <a href="https://docs.aws.amazon.com/lexv2/latest/dg/how-languages.html">Supported languages</a>.</p>
        intent_id: <p>The identifier of the intent that contains the slot.</p>
        multiple_values_setting: <p>Determines whether the slot accepts multiple values in one response. Multiple value slots are only available in the en-US locale. If you set this value to <code>true</code> in any other locale, Amazon Lex throws a <code>ValidationException</code>.</p> <p>If the <code>multipleValuesSetting</code> is not set, the default value is <code>false</code>.</p>
        sub_slot_setting: <p>Specifications for the constituent sub slots and the expression for the composite slot.</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.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_lex_models_v2.types.update_slot_request.UpdateSlotRequest]",
    ) -> AsyncOperationResponse[
        "capo_lex_models_v2.types.update_slot_response.UpdateSlotResponse"
    ]:
        import capo_lex_models_v2._operations.lex_model_building_service_v2.update_slot

        (
            output,
            http_response,
        ) = await capo_lex_models_v2._operations.lex_model_building_service_v2.update_slot.async_update_slot(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateSlot")
    )
    input_: capo_lex_models_v2.types.update_slot_request.UpdateSlotRequest = {
        "slot_id": slot_id,
        "slot_name": slot_name,
        "value_elicitation_setting": value_elicitation_setting,
        "bot_id": bot_id,
        "bot_version": bot_version,
        "locale_id": locale_id,
        "intent_id": intent_id,
    }
    if description is not None:
        input_["description"] = description
    if slot_type_id is not None:
        input_["slot_type_id"] = slot_type_id
    if obfuscation_setting is not None:
        input_["obfuscation_setting"] = obfuscation_setting
    if multiple_values_setting is not None:
        input_["multiple_values_setting"] = multiple_values_setting
    if sub_slot_setting is not None:
        input_["sub_slot_setting"] = sub_slot_setting

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output