AugmentedAIRuntime

Client

class AugmentedAIRuntime.Client

A low-level client representing Amazon Augmented AI Runtime:

client = session.create_client('sagemaker-a2i-runtime')

These are the available methods:

can_paginate(operation_name)

Check if an operation can be paginated.

Parameters
operation_name (string) -- The operation name. This is the same name as the method name on the client. For example, if the method name is create_foo, and you'd normally invoke the operation as client.create_foo(**kwargs), if the create_foo operation can be paginated, you can use the call client.get_paginator("create_foo").
Returns
True if the operation can be paginated, False otherwise.
delete_human_loop(**kwargs)

Deletes the specified human loop for a flow definition.

See also: AWS API Documentation

Request Syntax

response = client.delete_human_loop(
    HumanLoopName='string'
)
Parameters
HumanLoopName (string) --

[REQUIRED]

The name of the human loop that you want to delete.

Return type
dict
Returns
Response Syntax
{}

Response Structure

  • (dict) --

Exceptions

describe_human_loop(**kwargs)

Returns information about the specified human loop.

See also: AWS API Documentation

Request Syntax

response = client.describe_human_loop(
    HumanLoopName='string'
)
Parameters
HumanLoopName (string) --

[REQUIRED]

The name of the human loop that you want information about.

Return type
dict
Returns
Response Syntax
{
    'CreationTime': datetime(2015, 1, 1),
    'FailureReason': 'string',
    'FailureCode': 'string',
    'HumanLoopStatus': 'InProgress'|'Failed'|'Completed'|'Stopped'|'Stopping',
    'HumanLoopName': 'string',
    'HumanLoopArn': 'string',
    'FlowDefinitionArn': 'string',
    'HumanLoopOutput': {
        'OutputS3Uri': 'string'
    }
}

Response Structure

  • (dict) --
    • CreationTime (datetime) --

      The creation time when Amazon Augmented AI created the human loop.

    • FailureReason (string) --

      The reason why a human loop failed. The failure reason is returned when the status of the human loop is Failed .

    • FailureCode (string) --

      A failure code that identifies the type of failure.

    • HumanLoopStatus (string) --

      The status of the human loop.

    • HumanLoopName (string) --

      The name of the human loop. The name must be lowercase, unique within the Region in your account, and can have up to 63 characters. Valid characters: a-z, 0-9, and - (hyphen).

    • HumanLoopArn (string) --

      The Amazon Resource Name (ARN) of the human loop.

    • FlowDefinitionArn (string) --

      The Amazon Resource Name (ARN) of the flow definition.

    • HumanLoopOutput (dict) --

      An object that contains information about the output of the human loop.

      • OutputS3Uri (string) --

        The location of the Amazon S3 object where Amazon Augmented AI stores your human loop output.

Exceptions

generate_presigned_url(ClientMethod, Params=None, ExpiresIn=3600, HttpMethod=None)

Generate a presigned url given a client, its method, and arguments

Parameters
  • ClientMethod (string) -- The client method to presign for
  • Params (dict) -- The parameters normally passed to ClientMethod.
  • ExpiresIn (int) -- The number of seconds the presigned url is valid for. By default it expires in an hour (3600 seconds)
  • HttpMethod (string) -- The http method to use on the generated url. By default, the http method is whatever is used in the method's model.
Returns

The presigned url

get_paginator(operation_name)

Create a paginator for an operation.

Parameters
operation_name (string) -- The operation name. This is the same name as the method name on the client. For example, if the method name is create_foo, and you'd normally invoke the operation as client.create_foo(**kwargs), if the create_foo operation can be paginated, you can use the call client.get_paginator("create_foo").
Raises OperationNotPageableError
Raised if the operation is not pageable. You can use the client.can_paginate method to check if an operation is pageable.
Return type
L{botocore.paginate.Paginator}
Returns
A paginator object.
get_waiter(waiter_name)

Returns an object that can wait for some condition.

Parameters
waiter_name (str) -- The name of the waiter to get. See the waiters section of the service docs for a list of available waiters.
Returns
The specified waiter object.
Return type
botocore.waiter.Waiter
list_human_loops(**kwargs)

Returns information about human loops, given the specified parameters. If a human loop was deleted, it will not be included.

See also: AWS API Documentation

Request Syntax

response = client.list_human_loops(
    CreationTimeAfter=datetime(2015, 1, 1),
    CreationTimeBefore=datetime(2015, 1, 1),
    FlowDefinitionArn='string',
    SortOrder='Ascending'|'Descending',
    NextToken='string',
    MaxResults=123
)
Parameters
  • CreationTimeAfter (datetime) -- (Optional) The timestamp of the date when you want the human loops to begin in ISO 8601 format. For example, 2020-02-24 .
  • CreationTimeBefore (datetime) -- (Optional) The timestamp of the date before which you want the human loops to begin in ISO 8601 format. For example, 2020-02-24 .
  • FlowDefinitionArn (string) --

    [REQUIRED]

    The Amazon Resource Name (ARN) of a flow definition.

  • SortOrder (string) -- Optional. The order for displaying results. Valid values: Ascending and Descending .
  • NextToken (string) -- A token to display the next page of results.
  • MaxResults (integer) -- The total number of items to return. If the total number of available items is more than the value specified in MaxResults , then a NextToken is returned in the output. You can use this token to display the next page of results.
Return type

dict

Returns

Response Syntax

{
    'HumanLoopSummaries': [
        {
            'HumanLoopName': 'string',
            'HumanLoopStatus': 'InProgress'|'Failed'|'Completed'|'Stopped'|'Stopping',
            'CreationTime': datetime(2015, 1, 1),
            'FailureReason': 'string',
            'FlowDefinitionArn': 'string'
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • HumanLoopSummaries (list) --

      An array of objects that contain information about the human loops.

      • (dict) --

        Summary information about the human loop.

        • HumanLoopName (string) --

          The name of the human loop.

        • HumanLoopStatus (string) --

          The status of the human loop.

        • CreationTime (datetime) --

          When Amazon Augmented AI created the human loop.

        • FailureReason (string) --

          The reason why the human loop failed. A failure reason is returned when the status of the human loop is Failed .

        • FlowDefinitionArn (string) --

          The Amazon Resource Name (ARN) of the flow definition used to configure the human loop.

    • NextToken (string) --

      A token to display the next page of results.

Exceptions

start_human_loop(**kwargs)

Starts a human loop, provided that at least one activation condition is met.

See also: AWS API Documentation

Request Syntax

response = client.start_human_loop(
    HumanLoopName='string',
    FlowDefinitionArn='string',
    HumanLoopInput={
        'InputContent': 'string'
    },
    DataAttributes={
        'ContentClassifiers': [
            'FreeOfPersonallyIdentifiableInformation'|'FreeOfAdultContent',
        ]
    }
)
Parameters
  • HumanLoopName (string) --

    [REQUIRED]

    The name of the human loop.

  • FlowDefinitionArn (string) --

    [REQUIRED]

    The Amazon Resource Name (ARN) of the flow definition associated with this human loop.

  • HumanLoopInput (dict) --

    [REQUIRED]

    An object that contains information about the human loop.

    • InputContent (string) -- [REQUIRED]

      Serialized input from the human loop. The input must be a string representation of a file in JSON format.

  • DataAttributes (dict) --

    Attributes of the specified data. Use DataAttributes to specify if your data is free of personally identifiable information and/or free of adult content.

    • ContentClassifiers (list) -- [REQUIRED]

      Declares that your content is free of personally identifiable information or adult content.

      Amazon SageMaker can restrict the Amazon Mechanical Turk workers who can view your task based on this information.

      • (string) --
Return type

dict

Returns

Response Syntax

{
    'HumanLoopArn': 'string'
}

Response Structure

  • (dict) --

    • HumanLoopArn (string) --

      The Amazon Resource Name (ARN) of the human loop.

Exceptions

stop_human_loop(**kwargs)

Stops the specified human loop.

See also: AWS API Documentation

Request Syntax

response = client.stop_human_loop(
    HumanLoopName='string'
)
Parameters
HumanLoopName (string) --

[REQUIRED]

The name of the human loop that you want to stop.

Return type
dict
Returns
Response Syntax
{}

Response Structure

  • (dict) --

Exceptions

Client Exceptions

Client exceptions are available on a client instance via the exceptions property. For more detailed instructions and examples on the exact usage of client exceptions, see the error handling user guide.

The available client exceptions are:

class AugmentedAIRuntime.Client.exceptions.ConflictException

Your request has the same name as another active human loop but has different input data. You cannot start two human loops with the same name and different input data.

Example

try:
  ...
except client.exceptions.ConflictException as e:
  print(e.response)
response

The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.

Syntax

{
    'Message': 'string',
    'Error': {
        'Code': 'string',
        'Message': 'string'
    }
}

Structure

  • (dict) --

    Your request has the same name as another active human loop but has different input data. You cannot start two human loops with the same name and different input data.

    • Message (string) --
    • Error (dict) -- Normalized access to common exception attributes.
      • Code (string) -- An identifier specifying the exception type.
      • Message (string) -- A descriptive message explaining why the exception occured.
class AugmentedAIRuntime.Client.exceptions.InternalServerException

We couldn't process your request because of an issue with the server. Try again later.

Example

try:
  ...
except client.exceptions.InternalServerException as e:
  print(e.response)
response

The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.

Syntax

{
    'Message': 'string',
    'Error': {
        'Code': 'string',
        'Message': 'string'
    }
}

Structure

  • (dict) --

    We couldn't process your request because of an issue with the server. Try again later.

    • Message (string) --
    • Error (dict) -- Normalized access to common exception attributes.
      • Code (string) -- An identifier specifying the exception type.
      • Message (string) -- A descriptive message explaining why the exception occured.
class AugmentedAIRuntime.Client.exceptions.ResourceNotFoundException

We couldn't find the requested resource.

Example

try:
  ...
except client.exceptions.ResourceNotFoundException as e:
  print(e.response)
response

The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.

Syntax

{
    'Message': 'string',
    'Error': {
        'Code': 'string',
        'Message': 'string'
    }
}

Structure

  • (dict) --

    We couldn't find the requested resource.

    • Message (string) --
    • Error (dict) -- Normalized access to common exception attributes.
      • Code (string) -- An identifier specifying the exception type.
      • Message (string) -- A descriptive message explaining why the exception occured.
class AugmentedAIRuntime.Client.exceptions.ServiceQuotaExceededException

You exceeded your service quota. Delete some resources or request an increase in your service quota.

Example

try:
  ...
except client.exceptions.ServiceQuotaExceededException as e:
  print(e.response)
response

The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.

Syntax

{
    'Message': 'string',
    'Error': {
        'Code': 'string',
        'Message': 'string'
    }
}

Structure

  • (dict) --

    You exceeded your service quota. Delete some resources or request an increase in your service quota.

    • Message (string) --
    • Error (dict) -- Normalized access to common exception attributes.
      • Code (string) -- An identifier specifying the exception type.
      • Message (string) -- A descriptive message explaining why the exception occured.
class AugmentedAIRuntime.Client.exceptions.ThrottlingException

You exceeded the maximum number of requests.

Example

try:
  ...
except client.exceptions.ThrottlingException as e:
  print(e.response)
response

The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.

Syntax

{
    'Message': 'string',
    'Error': {
        'Code': 'string',
        'Message': 'string'
    }
}

Structure

  • (dict) --

    You exceeded the maximum number of requests.

    • Message (string) --
    • Error (dict) -- Normalized access to common exception attributes.
      • Code (string) -- An identifier specifying the exception type.
      • Message (string) -- A descriptive message explaining why the exception occured.
class AugmentedAIRuntime.Client.exceptions.ValidationException

The request isn't valid. Check the syntax and try again.

Example

try:
  ...
except client.exceptions.ValidationException as e:
  print(e.response)
response

The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.

Syntax

{
    'Message': 'string',
    'Error': {
        'Code': 'string',
        'Message': 'string'
    }
}

Structure

  • (dict) --

    The request isn't valid. Check the syntax and try again.

    • Message (string) --
    • Error (dict) -- Normalized access to common exception attributes.
      • Code (string) -- An identifier specifying the exception type.
      • Message (string) -- A descriptive message explaining why the exception occured.

Paginators

The available paginators are:

class AugmentedAIRuntime.Paginator.ListHumanLoops
paginator = client.get_paginator('list_human_loops')
paginate(**kwargs)

Creates an iterator that will paginate through responses from AugmentedAIRuntime.Client.list_human_loops().

See also: AWS API Documentation

Request Syntax

response_iterator = paginator.paginate(
    CreationTimeAfter=datetime(2015, 1, 1),
    CreationTimeBefore=datetime(2015, 1, 1),
    FlowDefinitionArn='string',
    SortOrder='Ascending'|'Descending',
    PaginationConfig={
        'MaxItems': 123,
        'PageSize': 123,
        'StartingToken': 'string'
    }
)
Parameters
  • CreationTimeAfter (datetime) -- (Optional) The timestamp of the date when you want the human loops to begin in ISO 8601 format. For example, 2020-02-24 .
  • CreationTimeBefore (datetime) -- (Optional) The timestamp of the date before which you want the human loops to begin in ISO 8601 format. For example, 2020-02-24 .
  • FlowDefinitionArn (string) --

    [REQUIRED]

    The Amazon Resource Name (ARN) of a flow definition.

  • SortOrder (string) -- Optional. The order for displaying results. Valid values: Ascending and Descending .
  • PaginationConfig (dict) --

    A dictionary that provides parameters to control pagination.

    • MaxItems (integer) --

      The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken will be provided in the output that you can use to resume pagination.

    • PageSize (integer) --

      The size of each page.

    • StartingToken (string) --

      A token to specify where to start paginating. This is the NextToken from a previous response.

Return type

dict

Returns

Response Syntax

{
    'HumanLoopSummaries': [
        {
            'HumanLoopName': 'string',
            'HumanLoopStatus': 'InProgress'|'Failed'|'Completed'|'Stopped'|'Stopping',
            'CreationTime': datetime(2015, 1, 1),
            'FailureReason': 'string',
            'FlowDefinitionArn': 'string'
        },
    ],

}

Response Structure

  • (dict) --

    • HumanLoopSummaries (list) --

      An array of objects that contain information about the human loops.

      • (dict) --

        Summary information about the human loop.

        • HumanLoopName (string) --

          The name of the human loop.

        • HumanLoopStatus (string) --

          The status of the human loop.

        • CreationTime (datetime) --

          When Amazon Augmented AI created the human loop.

        • FailureReason (string) --

          The reason why the human loop failed. A failure reason is returned when the status of the human loop is Failed .

        • FlowDefinitionArn (string) --

          The Amazon Resource Name (ARN) of the flow definition used to configure the human loop.