Skip to content

update_language_model

update_language_model(
    model_name: ModelName,
    *,
    config_overrides: Optional[TranscribeClientConfig] = None,
    data_access_role_arn: Optional[DataAccessRoleArn] = None,
    encryption_configuration: Optional[EncryptionConfiguration] = None,
) -> UpdateLanguageModelResponse

Updates the encryption configuration for an existing custom language model. You can use this operation to change the KMS key used to encrypt your model artifacts. The model artifacts are re-encrypted in place. No model training is required.

Your custom language model must not be in the IN_PROGRESS state when you call this operation. You cannot submit another update while a previous update is in progress. Use to check the current state of your model.

Your custom language model remains available for transcription jobs while the update is being processed.

Parameters:

  • model_name (ModelName) –

    The name of the custom language model you want to update. Model names are case sensitive.

  • data_access_role_arn (Optional[DataAccessRoleArn], default: None ) –

    The Amazon Resource Name (ARN) of an IAM role. If you include EncryptionConfiguration in your request, this role must have permissions to access the specified KMS key. If the role that you specify doesn't have the appropriate permissions, your request fails.

    IAM role ARNs have the format arn:partition:iam::account:role/role-name-with-path. For example: arn:aws:iam::111122223333:role/Admin.

    For more information, see IAM ARNs.

  • encryption_configuration (Optional[EncryptionConfiguration], default: None ) –

    Specifies the new encryption configuration for your custom language model. The model artifacts are re-encrypted in place using the specified KMS key or with an AWS-owned key if a key is not supplied.

Raises:

  • BadRequestException –

    Your request didn't pass one or more validation tests. This can occur when the entity you're trying to delete doesn't exist or if it's in a non-terminal state (such as IN PROGRESS). See the exception message field for more information.

  • ConflictException –

    A resource already exists with this name. Resource names must be unique within an Amazon Web Services account.

  • InternalFailureException –

    There was an internal error. Check the error message, correct the issue, and try your request again.

  • LimitExceededException –

    You've either sent too many requests or your input file is too long. Wait before retrying your request, or use a smaller file and try your request again.

  • NotFoundException –

    We can't find the requested resource. Check that the specified name is correct and try your request again.

  • UnknownServiceError –

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

Source code in docs_src/capo_transcribe/_services/transcribe.py
def update_language_model(
    self,
    model_name: "capo_transcribe.types.model_name.ModelName",
    *,
    config_overrides: Optional[TranscribeClientConfig] = None,
    data_access_role_arn: Optional[
        "capo_transcribe.types.data_access_role_arn.DataAccessRoleArn"
    ] = None,
    encryption_configuration: Optional[
        "capo_transcribe.types.encryption_configuration.EncryptionConfiguration"
    ] = None,
) -> "capo_transcribe.types.update_language_model_response.UpdateLanguageModelResponse":
    """<p>Updates the encryption configuration for an existing custom language model. You can use this operation to change the KMS key used to encrypt your model artifacts. The model artifacts are re-encrypted in place. No model training is required.</p> <p>Your custom language model must not be in the <code>IN_PROGRESS</code> state when you call this operation. You cannot submit another update while a previous update is in progress. Use to check the current state of your model.</p> <p>Your custom language model remains available for transcription jobs while the update is being processed.</p>

    Args:
        model_name: <p>The name of the custom language model you want to update. Model names are case sensitive.</p>
        data_access_role_arn: <p>The Amazon Resource Name (ARN) of an IAM role. If you include <code>EncryptionConfiguration</code> in your request, this role must have permissions to access the specified KMS key. If the role that you specify doesn't have the appropriate permissions, your request fails.</p> <p>IAM role ARNs have the format <code>arn:partition:iam::account:role/role-name-with-path</code>. For example: <code>arn:aws:iam::111122223333:role/Admin</code>.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html#identifiers-arns">IAM ARNs</a>.</p>
        encryption_configuration: <p>Specifies the new encryption configuration for your custom language model. The model artifacts are re-encrypted in place using the specified KMS key or with an AWS-owned key if a key is not supplied.</p>

    Raises:
        capo_transcribe.errors.bad_request_exception.BadRequestException: <p>Your request didn't pass one or more validation tests. This can occur when the entity you're trying to delete doesn't exist or if it's in a non-terminal state (such as <code>IN PROGRESS</code>). See the exception message field for more information.</p>
        capo_transcribe.errors.conflict_exception.ConflictException: <p>A resource already exists with this name. Resource names must be unique within an Amazon Web Services account.</p>
        capo_transcribe.errors.internal_failure_exception.InternalFailureException: <p>There was an internal error. Check the error message, correct the issue, and try your request again.</p>
        capo_transcribe.errors.limit_exceeded_exception.LimitExceededException: <p>You've either sent too many requests or your input file is too long. Wait before retrying your request, or use a smaller file and try your request again.</p>
        capo_transcribe.errors.not_found_exception.NotFoundException: <p>We can't find the requested resource. Check that the specified name is correct and try your request again.</p>
        capo_transcribe.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_transcribe.types.update_language_model_request.UpdateLanguageModelRequest]",
    ) -> OperationResponse[
        "capo_transcribe.types.update_language_model_response.UpdateLanguageModelResponse"
    ]:
        import capo_transcribe._operations.transcribe.update_language_model

        output, http_response = (
            capo_transcribe._operations.transcribe.update_language_model.update_language_model(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateLanguageModel")
    )
    input_: capo_transcribe.types.update_language_model_request.UpdateLanguageModelRequest = {
        "model_name": model_name
    }
    if data_access_role_arn is not None:
        input_["data_access_role_arn"] = data_access_role_arn
    if encryption_configuration is not None:
        input_["encryption_configuration"] = encryption_configuration

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