Skip to content

create_extraction_definition async

create_extraction_definition(
    instance_id: InstanceId,
    name: ExtractionDefinitionName,
    extraction_configuration: ExtractionConfiguration,
    *,
    config_overrides: Optional[AsyncConnectClientConfig] = None,
    client_token: Optional[ClientToken] = None,
    display: Optional[ExtractionDefinitionDisplay] = None,
    tags: Optional[TagMap] = None,
) -> CreateExtractionDefinitionResponse

Creates an extraction definition in the specified Connect Customer instance. An extraction definition specifies how structured data is extracted from customer interactions using generative AI, including the prompt hint that guides extraction and the behavior when a value cannot be found.

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.

  • 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.

  • name (ExtractionDefinitionName) –

    A unique name of the extraction definition.

  • extraction_configuration (ExtractionConfiguration) –

    The configuration that defines how data is extracted, including the prompt hint and not-found behavior.

  • display (Optional[ExtractionDefinitionDisplay], default: None ) –

    The display settings for the extraction definition, including the label shown in the agent workspace.

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

    The tags used to organize, track, or control access for this resource.

Raises:

Source code in docs_src/capo_connect/_services/async_connect.py
async def create_extraction_definition(
    self,
    instance_id: "capo_connect.types.instance_id.InstanceId",
    name: "capo_connect.types.extraction_definition_name.ExtractionDefinitionName",
    extraction_configuration: "capo_connect.types.extraction_configuration.ExtractionConfiguration",
    *,
    config_overrides: Optional[AsyncConnectClientConfig] = None,
    client_token: Optional["capo_connect.types.client_token.ClientToken"] = None,
    display: Optional[
        "capo_connect.types.extraction_definition_display.ExtractionDefinitionDisplay"
    ] = None,
    tags: Optional["capo_connect.types.tag_map.TagMap"] = None,
) -> "capo_connect.types.create_extraction_definition_response.CreateExtractionDefinitionResponse":
    """<p>Creates an extraction definition in the specified Connect Customer instance. An extraction definition specifies how structured data is extracted from customer interactions using generative AI, including the prompt hint that guides extraction and the behavior when a value cannot be found.</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.</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>
        name: <p>A unique name of the extraction definition.</p>
        extraction_configuration: <p>The configuration that defines how data is extracted, including the prompt hint and not-found behavior.</p>
        display: <p>The display settings for the extraction definition, including the label shown in the agent workspace.</p>
        tags: <p>The tags used to organize, track, or control access for this resource.</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_extraction_definition_request.CreateExtractionDefinitionRequest]",
    ) -> AsyncOperationResponse[
        "capo_connect.types.create_extraction_definition_response.CreateExtractionDefinitionResponse"
    ]:
        import capo_connect._operations.amazon_connect_service.create_extraction_definition

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateExtractionDefinition")
    )
    input_: capo_connect.types.create_extraction_definition_request.CreateExtractionDefinitionRequest = {
        "instance_id": instance_id,
        "name": name,
        "extraction_configuration": extraction_configuration,
    }
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if display is not None:
        input_["display"] = display
    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