Skip to content

create_endpoint async

create_endpoint(
    endpoint_name: ComprehendEndpointName,
    desired_inference_units: InferenceUnitsInteger,
    *,
    config_overrides: Optional[AsyncComprehendClientConfig] = None,
    model_arn: Optional[ComprehendModelArn] = None,
    client_request_token: Optional[ClientRequestTokenString] = None,
    tags: Optional[TagList] = None,
    data_access_role_arn: Optional[IamRoleArn] = None,
    flywheel_arn: Optional[ComprehendFlywheelArn] = None,
) -> CreateEndpointResponse

Creates a model-specific endpoint for synchronous inference for a previously trained custom model For information about endpoints, see Managing endpoints.

Parameters:

  • endpoint_name (ComprehendEndpointName) –

    This is the descriptive suffix that becomes part of the EndpointArn used for all subsequent requests to this resource.

  • model_arn (Optional[ComprehendModelArn], default: None ) –

    The Amazon Resource Number (ARN) of the model to which the endpoint will be attached.

  • desired_inference_units (InferenceUnitsInteger) –

    The desired number of inference units to be used by the model using this endpoint. Each inference unit represents of a throughput of 100 characters per second.

  • client_request_token (Optional[ClientRequestTokenString], default: None ) –

    An idempotency token provided by the customer. If this token matches a previous endpoint creation request, Amazon Comprehend will not return a ResourceInUseException.

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

    Tags to associate with the endpoint. A tag is a key-value pair that adds metadata to the endpoint. For example, a tag with "Sales" as the key might be added to an endpoint to indicate its use by the sales department.

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

    The Amazon Resource Name (ARN) of the IAM role that grants Amazon Comprehend read access to trained custom models encrypted with a customer managed key (ModelKmsKeyId).

  • flywheel_arn (Optional[ComprehendFlywheelArn], default: None ) –

    The Amazon Resource Number (ARN) of the flywheel to which the endpoint will be attached.

Raises:

Source code in docs_src/capo_comprehend/_services/async_comprehend.py
async def create_endpoint(
    self,
    endpoint_name: "capo_comprehend.types.comprehend_endpoint_name.ComprehendEndpointName",
    desired_inference_units: "capo_comprehend.types.inference_units_integer.InferenceUnitsInteger",
    *,
    config_overrides: Optional[AsyncComprehendClientConfig] = None,
    model_arn: Optional[
        "capo_comprehend.types.comprehend_model_arn.ComprehendModelArn"
    ] = None,
    client_request_token: Optional[
        "capo_comprehend.types.client_request_token_string.ClientRequestTokenString"
    ] = None,
    tags: Optional["capo_comprehend.types.tag_list.TagList"] = None,
    data_access_role_arn: Optional[
        "capo_comprehend.types.iam_role_arn.IamRoleArn"
    ] = None,
    flywheel_arn: Optional[
        "capo_comprehend.types.comprehend_flywheel_arn.ComprehendFlywheelArn"
    ] = None,
) -> "capo_comprehend.types.create_endpoint_response.CreateEndpointResponse":
    """<p>Creates a model-specific endpoint for synchronous inference for a previously trained custom model For information about endpoints, see <a href="https://docs.aws.amazon.com/comprehend/latest/dg/manage-endpoints.html">Managing endpoints</a>.</p>

    Args:
        endpoint_name: <p>This is the descriptive suffix that becomes part of the <code>EndpointArn</code> used for all subsequent requests to this resource. </p>
        model_arn: <p>The Amazon Resource Number (ARN) of the model to which the endpoint will be attached.</p>
        desired_inference_units: <p> The desired number of inference units to be used by the model using this endpoint. Each inference unit represents of a throughput of 100 characters per second.</p>
        client_request_token: <p>An idempotency token provided by the customer. If this token matches a previous endpoint creation request, Amazon Comprehend will not return a <code>ResourceInUseException</code>. </p>
        tags: <p>Tags to associate with the endpoint. A tag is a key-value pair that adds metadata to the endpoint. For example, a tag with "Sales" as the key might be added to an endpoint to indicate its use by the sales department. </p>
        data_access_role_arn: <p>The Amazon Resource Name (ARN) of the IAM role that grants Amazon Comprehend read access to trained custom models encrypted with a customer managed key (ModelKmsKeyId).</p>
        flywheel_arn: <p>The Amazon Resource Number (ARN) of the flywheel to which the endpoint will be attached.</p>

    Raises:
        capo_comprehend.errors.internal_server_exception.InternalServerException: <p>An internal server error occurred. Retry your request.</p>
        capo_comprehend.errors.invalid_request_exception.InvalidRequestException: <p>The request is invalid.</p>
        capo_comprehend.errors.resource_in_use_exception.ResourceInUseException: <p>The specified resource name is already in use. Use a different name and try your request again.</p>
        capo_comprehend.errors.resource_limit_exceeded_exception.ResourceLimitExceededException: <p>The maximum number of resources per account has been exceeded. Review the resources, and then try your request again.</p>
        capo_comprehend.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource ARN was not found. Check the ARN and try your request again.</p>
        capo_comprehend.errors.resource_unavailable_exception.ResourceUnavailableException: <p>The specified resource is not available. Check the resource and try your request again.</p>
        capo_comprehend.errors.too_many_requests_exception.TooManyRequestsException: <p>The number of requests exceeds the limit. Resubmit your request later.</p>
        capo_comprehend.errors.too_many_tags_exception.TooManyTagsException: <p>The request contains more tags than can be associated with a resource (50 tags per resource). The maximum number of tags includes both existing tags and those included in your current request. </p>
        capo_comprehend.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_comprehend.types.create_endpoint_request.CreateEndpointRequest]",
    ) -> AsyncOperationResponse[
        "capo_comprehend.types.create_endpoint_response.CreateEndpointResponse"
    ]:
        import capo_comprehend._operations.comprehend_20171127.create_endpoint

        (
            output,
            http_response,
        ) = await capo_comprehend._operations.comprehend_20171127.create_endpoint.async_create_endpoint(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateEndpoint")
    )
    input_: capo_comprehend.types.create_endpoint_request.CreateEndpointRequest = {
        "endpoint_name": endpoint_name,
        "desired_inference_units": desired_inference_units,
    }
    if model_arn is not None:
        input_["model_arn"] = model_arn
    if client_request_token is None:
        client_request_token = str(uuid.uuid4())
    input_["client_request_token"] = client_request_token
    if tags is not None:
        input_["tags"] = tags
    if data_access_role_arn is not None:
        input_["data_access_role_arn"] = data_access_role_arn
    if flywheel_arn is not None:
        input_["flywheel_arn"] = flywheel_arn

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