Skip to content

create_vocabulary async

create_vocabulary(
    instance_id: InstanceId,
    vocabulary_name: VocabularyName,
    language_code: VocabularyLanguageCode,
    content: VocabularyContent,
    *,
    config_overrides: Optional[AsyncConnectClientConfig] = None,
    client_token: Optional[ClientToken] = None,
    tags: Optional[TagMap] = None,
) -> CreateVocabularyResponse

Creates a custom vocabulary associated with your Connect Customer instance. You can set a custom vocabulary to be your default vocabulary for a given language. Contact Lens for Connect Customer uses the default vocabulary in post-call and real-time contact analysis sessions for that language.

Parameters:

  • client_token (Optional[ClientToken], default: None ) –

    A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If not provided, the Amazon Web Services SDK populates this field. For more information about idempotency, see Making retries safe with idempotent APIs. If a create request is received more than once with same client token, subsequent requests return the previous response without creating a vocabulary again.

  • instance_id (InstanceId) –

    The identifier of the Connect Customer instance. You can find the instance ID in the Amazon Resource Name (ARN) of the instance.

  • vocabulary_name (VocabularyName) –

    A unique name of the custom vocabulary.

  • language_code (VocabularyLanguageCode) –

    The language code of the vocabulary entries. For a list of languages and their corresponding language codes, see What is Amazon Transcribe?

  • content (VocabularyContent) –

    The content of the custom vocabulary in plain-text format with a table of values. Each row in the table represents a word or a phrase, described with Phrase, IPA, SoundsLike, and DisplayAs fields. Separate the fields with TAB characters. The size limit is 50KB. For more information, see Create a custom vocabulary using a table.

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

    The tags used to organize, track, or control access for this resource. For example, { "Tags": {"key1":"value1", "key2":"value2"} }.

Raises:

Source code in docs_src/capo_connect/_services/async_connect.py
async def create_vocabulary(
    self,
    instance_id: "capo_connect.types.instance_id.InstanceId",
    vocabulary_name: "capo_connect.types.vocabulary_name.VocabularyName",
    language_code: "capo_connect.types.vocabulary_language_code.VocabularyLanguageCode",
    content: "capo_connect.types.vocabulary_content.VocabularyContent",
    *,
    config_overrides: Optional[AsyncConnectClientConfig] = None,
    client_token: Optional["capo_connect.types.client_token.ClientToken"] = None,
    tags: Optional["capo_connect.types.tag_map.TagMap"] = None,
) -> "capo_connect.types.create_vocabulary_response.CreateVocabularyResponse":
    """<p>Creates a custom vocabulary associated with your Connect Customer instance. You can set a custom vocabulary to be your default vocabulary for a given language. Contact Lens for Connect Customer uses the default vocabulary in post-call and real-time contact analysis sessions for that language.</p>

    Args:
        client_token: <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If not provided, the Amazon Web Services SDK populates this field. For more information about idempotency, see <a href="https://aws.amazon.com/builders-library/making-retries-safe-with-idempotent-APIs/">Making retries safe with idempotent APIs</a>. If a create request is received more than once with same client token, subsequent requests return the previous response without creating a vocabulary again.</p>
        instance_id: <p>The identifier of the Connect Customer instance. You can <a href="https://docs.aws.amazon.com/connect/latest/adminguide/find-instance-arn.html">find the instance ID</a> in the Amazon Resource Name (ARN) of the instance.</p>
        vocabulary_name: <p>A unique name of the custom vocabulary.</p>
        language_code: <p>The language code of the vocabulary entries. For a list of languages and their corresponding language codes, see <a href="https://docs.aws.amazon.com/transcribe/latest/dg/transcribe-whatis.html">What is Amazon Transcribe?</a> </p>
        content: <p>The content of the custom vocabulary in plain-text format with a table of values. Each row in the table represents a word or a phrase, described with <code>Phrase</code>, <code>IPA</code>, <code>SoundsLike</code>, and <code>DisplayAs</code> fields. Separate the fields with TAB characters. The size limit is 50KB. For more information, see <a href="https://docs.aws.amazon.com/transcribe/latest/dg/custom-vocabulary.html#create-vocabulary-table">Create a custom vocabulary using a table</a>.</p>
        tags: <p>The tags used to organize, track, or control access for this resource. For example, { "Tags": {"key1":"value1", "key2":"value2"} }.</p>

    Raises:
        capo_connect.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient permissions to perform this action.</p>
        capo_connect.errors.internal_service_exception.InternalServiceException: <p>Request processing failed because of an error or failure with the service.</p>
        capo_connect.errors.invalid_request_exception.InvalidRequestException: <p>The request is not valid.</p>
        capo_connect.errors.resource_conflict_exception.ResourceConflictException: <p>A resource already has that name.</p>
        capo_connect.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource was not found.</p>
        capo_connect.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The service quota has been exceeded.</p>
        capo_connect.errors.throttling_exception.ThrottlingException: <p>The throttling limit has been exceeded.</p>
        capo_connect.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_connect.types.create_vocabulary_request.CreateVocabularyRequest]",
    ) -> AsyncOperationResponse[
        "capo_connect.types.create_vocabulary_response.CreateVocabularyResponse"
    ]:
        import capo_connect._operations.amazon_connect_service.create_vocabulary

        (
            output,
            http_response,
        ) = await capo_connect._operations.amazon_connect_service.create_vocabulary.async_create_vocabulary(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateVocabulary")
    )
    input_: capo_connect.types.create_vocabulary_request.CreateVocabularyRequest = {
        "instance_id": instance_id,
        "vocabulary_name": vocabulary_name,
        "language_code": language_code,
        "content": content,
    }
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if tags is not None:
        input_["tags"] = tags

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