Amazon Comprehend

2019/11/25 - Amazon Comprehend - 6 new api methods

Changes  Update comprehend client to latest version

ListEndpoints (new) Link ¶

Gets a list of all existing endpoints that you've created.

See also: AWS API Documentation

Request Syntax

client.list_endpoints(
    Filter={
        'ModelArn': 'string',
        'Status': 'CREATING'|'DELETING'|'FAILED'|'IN_SERVICE'|'UPDATING',
        'CreationTimeBefore': datetime(2015, 1, 1),
        'CreationTimeAfter': datetime(2015, 1, 1)
    },
    NextToken='string',
    MaxResults=123
)
type Filter:

dict

param Filter:

Filters the endpoints that are returned. You can filter endpoints on their name, model, status, or the date and time that they were created. You can only set one filter at a time.

  • ModelArn (string) --

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

  • Status (string) --

    Specifies the status of the endpoint being returned. Possible values are: Creating, Ready, Updating, Deleting, Failed.

  • CreationTimeBefore (datetime) --

    Specifies a date before which the returned endpoint or endpoints were created.

  • CreationTimeAfter (datetime) --

    Specifies a date after which the returned endpoint or endpoints were created.

type NextToken:

string

param NextToken:

Identifies the next page of results to return.

type MaxResults:

integer

param MaxResults:

The maximum number of results to return in each page. The default is 100.

rtype:

dict

returns:

Response Syntax

{
    'EndpointPropertiesList': [
        {
            'EndpointArn': 'string',
            'Status': 'CREATING'|'DELETING'|'FAILED'|'IN_SERVICE'|'UPDATING',
            'Message': 'string',
            'ModelArn': 'string',
            'DesiredInferenceUnits': 123,
            'CurrentInferenceUnits': 123,
            'CreationTime': datetime(2015, 1, 1),
            'LastModifiedTime': datetime(2015, 1, 1)
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • EndpointPropertiesList (list) --

      Displays a list of endpoint properties being retrieved by the service in response to the request.

      • (dict) --

        Specifies information about the specified endpoint.

        • EndpointArn (string) --

          The Amazon Resource Number (ARN) of the endpoint.

        • Status (string) --

          Specifies the status of the endpoint. Because the endpoint updates and creation are asynchronous, so customers will need to wait for the endpoint to be Ready status before making inference requests.

        • Message (string) --

          Specifies a reason for failure in cases of Failed status.

        • ModelArn (string) --

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

        • DesiredInferenceUnits (integer) --

          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.

        • CurrentInferenceUnits (integer) --

          The number of inference units currently used by the model using this endpoint.

        • CreationTime (datetime) --

          The creation date and time of the endpoint.

        • LastModifiedTime (datetime) --

          The date and time that the endpoint was last modified.

    • NextToken (string) --

      Identifies the next page of results to return.

DeleteEndpoint (new) Link ¶

Deletes a model-specific endpoint for a previously-trained custom model. All endpoints must be deleted in order for the model to be deleted.

See also: AWS API Documentation

Request Syntax

client.delete_endpoint(
    EndpointArn='string'
)
type EndpointArn:

string

param EndpointArn:

[REQUIRED]

The Amazon Resource Number (ARN) of the endpoint being deleted.

rtype:

dict

returns:

Response Syntax

{}

Response Structure

  • (dict) --

ClassifyDocument (new) Link ¶

Creates a new document classification request to analyze a single document in real-time, using a previously created and trained custom model and an endpoint.

See also: AWS API Documentation

Request Syntax

client.classify_document(
    Text='string',
    EndpointArn='string'
)
type Text:

string

param Text:

[REQUIRED]

The document text to be analyzed.

type EndpointArn:

string

param EndpointArn:

[REQUIRED]

The Amazon Resource Number (ARN) of the endpoint.

rtype:

dict

returns:

Response Syntax

{
    'Classes': [
        {
            'Name': 'string',
            'Score': ...
        },
    ]
}

Response Structure

  • (dict) --

    • Classes (list) --

      The classes used by the document being analyzed. These are used for multi-class trained models. Individual classes are mutually exclusive and each document is expected to have only a single class assigned to it. For example, an animal can be a dog or a cat, but not both at the same time.

      • (dict) --

        Specifies the class that categorizes the document being analyzed

        • Name (string) --

          The name of the class.

        • Score (float) --

          The confidence score that Amazon Comprehend has this class correctly attributed.

CreateEndpoint (new) Link ¶

Creates a model-specific endpoint for synchronous inference for a previously trained custom model

See also: AWS API Documentation

Request Syntax

client.create_endpoint(
    EndpointName='string',
    ModelArn='string',
    DesiredInferenceUnits=123,
    ClientRequestToken='string',
    Tags=[
        {
            'Key': 'string',
            'Value': 'string'
        },
    ]
)
type EndpointName:

string

param EndpointName:

[REQUIRED]

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

type ModelArn:

string

param ModelArn:

[REQUIRED]

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

type DesiredInferenceUnits:

integer

param DesiredInferenceUnits:

[REQUIRED]

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.

type ClientRequestToken:

string

param ClientRequestToken:

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

This field is autopopulated if not provided.

type Tags:

list

param Tags:

Tags associated with the endpoint being created. 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.

  • (dict) --

    A key-value pair that adds as a metadata to a resource used by Amazon Comprehend. For example, a tag with the key-value pair ‘Department’:’Sales’ might be added to a resource to indicate its use by a particular department.

    • Key (string) -- [REQUIRED]

      The initial part of a key-value pair that forms a tag associated with a given resource. For instance, if you want to show which resources are used by which departments, you might use “Department” as the key portion of the pair, with multiple possible values such as “sales,” “legal,” and “administration.”

    • Value (string) --

      The second part of a key-value pair that forms a tag associated with a given resource. For instance, if you want to show which resources are used by which departments, you might use “Department” as the initial (key) portion of the pair, with a value of “sales” to indicate the sales department.

rtype:

dict

returns:

Response Syntax

{
    'EndpointArn': 'string'
}

Response Structure

  • (dict) --

    • EndpointArn (string) --

      The Amazon Resource Number (ARN) of the endpoint being created.

DescribeEndpoint (new) Link ¶

Gets the properties associated with a specific endpoint. Use this operation to get the status of an endpoint.

See also: AWS API Documentation

Request Syntax

client.describe_endpoint(
    EndpointArn='string'
)
type EndpointArn:

string

param EndpointArn:

[REQUIRED]

The Amazon Resource Number (ARN) of the endpoint being described.

rtype:

dict

returns:

Response Syntax

{
    'EndpointProperties': {
        'EndpointArn': 'string',
        'Status': 'CREATING'|'DELETING'|'FAILED'|'IN_SERVICE'|'UPDATING',
        'Message': 'string',
        'ModelArn': 'string',
        'DesiredInferenceUnits': 123,
        'CurrentInferenceUnits': 123,
        'CreationTime': datetime(2015, 1, 1),
        'LastModifiedTime': datetime(2015, 1, 1)
    }
}

Response Structure

  • (dict) --

    • EndpointProperties (dict) --

      Describes information associated with the specific endpoint.

      • EndpointArn (string) --

        The Amazon Resource Number (ARN) of the endpoint.

      • Status (string) --

        Specifies the status of the endpoint. Because the endpoint updates and creation are asynchronous, so customers will need to wait for the endpoint to be Ready status before making inference requests.

      • Message (string) --

        Specifies a reason for failure in cases of Failed status.

      • ModelArn (string) --

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

      • DesiredInferenceUnits (integer) --

        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.

      • CurrentInferenceUnits (integer) --

        The number of inference units currently used by the model using this endpoint.

      • CreationTime (datetime) --

        The creation date and time of the endpoint.

      • LastModifiedTime (datetime) --

        The date and time that the endpoint was last modified.

UpdateEndpoint (new) Link ¶

Updates information about the specified endpoint.

See also: AWS API Documentation

Request Syntax

client.update_endpoint(
    EndpointArn='string',
    DesiredInferenceUnits=123
)
type EndpointArn:

string

param EndpointArn:

[REQUIRED]

The Amazon Resource Number (ARN) of the endpoint being updated.

type DesiredInferenceUnits:

integer

param DesiredInferenceUnits:

[REQUIRED]

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.

rtype:

dict

returns:

Response Syntax

{}

Response Structure

  • (dict) --