Amazon Kendra Intelligent Ranking

2023/01/09 - Amazon Kendra Intelligent Ranking - 9 new api methods

Changes  Introducing Amazon Kendra Intelligent Ranking, a new set of Kendra APIs that leverages Kendra semantic ranking capabilities to improve the quality of search results from other search services (i.e. OpenSearch, ElasticSearch, Solr).

Rescore (new) Link ¶

Rescores or re-ranks search results from a search service such as OpenSearch (self managed). You use the semantic search capabilities of Amazon Kendra Intelligent Ranking to improve the search service's results.

See also: AWS API Documentation

Request Syntax

client.rescore(
    RescoreExecutionPlanId='string',
    SearchQuery='string',
    Documents=[
        {
            'Id': 'string',
            'GroupId': 'string',
            'Title': 'string',
            'Body': 'string',
            'TokenizedTitle': [
                'string',
            ],
            'TokenizedBody': [
                'string',
            ],
            'OriginalScore': ...
        },
    ]
)
type RescoreExecutionPlanId

string

param RescoreExecutionPlanId

[REQUIRED]

The identifier of the rescore execution plan. A rescore execution plan is an Amazon Kendra Intelligent Ranking resource used for provisioning the Rescore API.

type SearchQuery

string

param SearchQuery

[REQUIRED]

The input query from the search service.

type Documents

list

param Documents

[REQUIRED]

The list of documents for Amazon Kendra Intelligent Ranking to rescore or rank on.

  • (dict) --

    Information about a document from a search service such as OpenSearch (self managed). Amazon Kendra Intelligent Ranking uses this information to rank and score on.

    • Id (string) -- [REQUIRED]

      The identifier of the document from the search service.

    • GroupId (string) --

      The optional group identifier of the document from the search service. Documents with the same group identifier are grouped together and processed as one document within the service.

    • Title (string) --

      The title of the search service's document.

    • Body (string) --

      The body text of the search service's document.

    • TokenizedTitle (list) --

      The title of the search service's document represented as a list of tokens or words. You must choose to provide Title or TokenizedTitle . You cannot provide both.

      • (string) --

    • TokenizedBody (list) --

      The body text of the search service's document represented as a list of tokens or words. You must choose to provide Body or TokenizedBody . You cannot provide both.

      • (string) --

    • OriginalScore (float) -- [REQUIRED]

      The original document score or rank from the search service. Amazon Kendra Intelligent Ranking gives the document a new score or rank based on its intelligent search algorithms.

rtype

dict

returns

Response Syntax

{
    'RescoreId': 'string',
    'ResultItems': [
        {
            'DocumentId': 'string',
            'Score': ...
        },
    ]
}

Response Structure

  • (dict) --

    • RescoreId (string) --

      The identifier associated with the scores that Amazon Kendra Intelligent Ranking gives to the results. Amazon Kendra Intelligent Ranking rescores or re-ranks the results for the search service.

    • ResultItems (list) --

      A list of result items for documents with new relevancy scores. The results are in descending order.

      • (dict) --

        A result item for a document with a new relevancy score.

        • DocumentId (string) --

          The identifier of the document from the search service.

        • Score (float) --

          The relevancy score or rank that Amazon Kendra Intelligent Ranking gives to the result.

CreateRescoreExecutionPlan (new) Link ¶

Creates a rescore execution plan. A rescore execution plan is an Amazon Kendra Intelligent Ranking resource used for provisioning the Rescore API. You set the number of capacity units that you require for Amazon Kendra Intelligent Ranking to rescore or re-rank a search service's results.

For an example of using the CreateRescoreExecutionPlan API, including using the Python and Java SDKs, see Semantically ranking a search service's results.

See also: AWS API Documentation

Request Syntax

client.create_rescore_execution_plan(
    Name='string',
    Description='string',
    CapacityUnits={
        'RescoreCapacityUnits': 123
    },
    Tags=[
        {
            'Key': 'string',
            'Value': 'string'
        },
    ],
    ClientToken='string'
)
type Name

string

param Name

[REQUIRED]

A name for the rescore execution plan.

type Description

string

param Description

A description for the rescore execution plan.

type CapacityUnits

dict

param CapacityUnits

You can set additional capacity units to meet the needs of your rescore execution plan. You are given a single capacity unit by default. If you want to use the default capacity, you don't set additional capacity units. For more information on the default capacity and additional capacity units, see Adjusting capacity.

  • RescoreCapacityUnits (integer) -- [REQUIRED]

    The amount of extra capacity for your rescore execution plan.

    A single extra capacity unit for a rescore execution plan provides 0.01 rescore requests per second. You can add up to 1000 extra capacity units.

type Tags

list

param Tags

A list of key-value pairs that identify or categorize your rescore execution plan. You can also use tags to help control access to the rescore execution plan. Tag keys and values can consist of Unicode letters, digits, white space, and any of the following symbols: _ . : / = + - @.

  • (dict) --

    A key-value pair that identifies or categorizes a rescore execution plan. A rescore execution plan is an Amazon Kendra Intelligent Ranking resource used for provisioning the Rescore API. You can also use a tag to help control access to a rescore execution plan. A tag key and value can consist of Unicode letters, digits, white space, and any of the following symbols: _ . : / = + - @.

    • Key (string) -- [REQUIRED]

      The key for the tag. Keys are not case sensitive and must be unique.

    • Value (string) -- [REQUIRED]

      The value associated with the tag. The value can be an empty string but it can't be null.

type ClientToken

string

param ClientToken

A token that you provide to identify the request to create a rescore execution plan. Multiple calls to the CreateRescoreExecutionPlanRequest API with the same client token will create only one rescore execution plan.

This field is autopopulated if not provided.

rtype

dict

returns

Response Syntax

{
    'Id': 'string',
    'Arn': 'string'
}

Response Structure

  • (dict) --

    • Id (string) --

      The identifier of the rescore execution plan.

    • Arn (string) --

      The Amazon Resource Name (ARN) of the rescore execution plan.

TagResource (new) Link ¶

Adds a specified tag to a specified rescore execution plan. A rescore execution plan is an Amazon Kendra Intelligent Ranking resource used for provisioning the Rescore API. If the tag already exists, the existing value is replaced with the new value.

See also: AWS API Documentation

Request Syntax

client.tag_resource(
    ResourceARN='string',
    Tags=[
        {
            'Key': 'string',
            'Value': 'string'
        },
    ]
)
type ResourceARN

string

param ResourceARN

[REQUIRED]

The Amazon Resource Name (ARN) of the rescore execution plan to tag.

type Tags

list

param Tags

[REQUIRED]

A list of tag keys to add to a rescore execution plan. If a tag already exists, the existing value is replaced with the new value.

  • (dict) --

    A key-value pair that identifies or categorizes a rescore execution plan. A rescore execution plan is an Amazon Kendra Intelligent Ranking resource used for provisioning the Rescore API. You can also use a tag to help control access to a rescore execution plan. A tag key and value can consist of Unicode letters, digits, white space, and any of the following symbols: _ . : / = + - @.

    • Key (string) -- [REQUIRED]

      The key for the tag. Keys are not case sensitive and must be unique.

    • Value (string) -- [REQUIRED]

      The value associated with the tag. The value can be an empty string but it can't be null.

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --

    If the action is successful, the service sends back an HTTP 200 response with an empty HTTP body.

DeleteRescoreExecutionPlan (new) Link ¶

Deletes a rescore execution plan. A rescore execution plan is an Amazon Kendra Intelligent Ranking resource used for provisioning the Rescore API.

See also: AWS API Documentation

Request Syntax

client.delete_rescore_execution_plan(
    Id='string'
)
type Id

string

param Id

[REQUIRED]

The identifier of the rescore execution plan that you want to delete.

returns

None

ListRescoreExecutionPlans (new) Link ¶

Lists your rescore execution plans. A rescore execution plan is an Amazon Kendra Intelligent Ranking resource used for provisioning the Rescore API.

See also: AWS API Documentation

Request Syntax

client.list_rescore_execution_plans(
    NextToken='string',
    MaxResults=123
)
type NextToken

string

param NextToken

If the response is truncated, Amazon Kendra Intelligent Ranking returns a pagination token in the response. You can use this pagination token to retrieve the next set of rescore execution plans.

type MaxResults

integer

param MaxResults

The maximum number of rescore execution plans to return.

rtype

dict

returns

Response Syntax

{
    'SummaryItems': [
        {
            'Name': 'string',
            'Id': 'string',
            'CreatedAt': datetime(2015, 1, 1),
            'UpdatedAt': datetime(2015, 1, 1),
            'Status': 'CREATING'|'UPDATING'|'ACTIVE'|'DELETING'|'FAILED'
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • SummaryItems (list) --

      An array of summary information for one or more rescore execution plans.

      • (dict) --

        Summary information for a rescore execution plan. A rescore execution plan is an Amazon Kendra Intelligent Ranking resource used for provisioning the Rescore API.

        • Name (string) --

          The name of the rescore execution plan.

        • Id (string) --

          The identifier of the rescore execution plan.

        • CreatedAt (datetime) --

          The Unix timestamp when the rescore execution plan was created.

        • UpdatedAt (datetime) --

          The Unix timestamp when the rescore execution plan was last updated.

        • Status (string) --

          The current status of the rescore execution plan. When the value is ACTIVE , the rescore execution plan is ready for use.

    • NextToken (string) --

      If the response is truncated, Amazon Kendra Intelligent Ranking returns a pagination token in the response.

UpdateRescoreExecutionPlan (new) Link ¶

Updates a rescore execution plan. A rescore execution plan is an Amazon Kendra Intelligent Ranking resource used for provisioning the Rescore API. You can update the number of capacity units you require for Amazon Kendra Intelligent Ranking to rescore or re-rank a search service's results.

See also: AWS API Documentation

Request Syntax

client.update_rescore_execution_plan(
    Id='string',
    Name='string',
    Description='string',
    CapacityUnits={
        'RescoreCapacityUnits': 123
    }
)
type Id

string

param Id

[REQUIRED]

The identifier of the rescore execution plan that you want to update.

type Name

string

param Name

A new name for the rescore execution plan.

type Description

string

param Description

A new description for the rescore execution plan.

type CapacityUnits

dict

param CapacityUnits

You can set additional capacity units to meet the needs of your rescore execution plan. You are given a single capacity unit by default. If you want to use the default capacity, you don't set additional capacity units. For more information on the default capacity and additional capacity units, see Adjusting capacity.

  • RescoreCapacityUnits (integer) -- [REQUIRED]

    The amount of extra capacity for your rescore execution plan.

    A single extra capacity unit for a rescore execution plan provides 0.01 rescore requests per second. You can add up to 1000 extra capacity units.

returns

None

DescribeRescoreExecutionPlan (new) Link ¶

Gets information about a rescore execution plan. A rescore execution plan is an Amazon Kendra Intelligent Ranking resource used for provisioning the Rescore API.

See also: AWS API Documentation

Request Syntax

client.describe_rescore_execution_plan(
    Id='string'
)
type Id

string

param Id

[REQUIRED]

The identifier of the rescore execution plan that you want to get information on.

rtype

dict

returns

Response Syntax

{
    'Id': 'string',
    'Arn': 'string',
    'Name': 'string',
    'Description': 'string',
    'CapacityUnits': {
        'RescoreCapacityUnits': 123
    },
    'CreatedAt': datetime(2015, 1, 1),
    'UpdatedAt': datetime(2015, 1, 1),
    'Status': 'CREATING'|'UPDATING'|'ACTIVE'|'DELETING'|'FAILED',
    'ErrorMessage': 'string'
}

Response Structure

  • (dict) --

    • Id (string) --

      The identifier of the rescore execution plan.

    • Arn (string) --

      The Amazon Resource Name (ARN) of the rescore execution plan.

    • Name (string) --

      The name for the rescore execution plan.

    • Description (string) --

      The description for the rescore execution plan.

    • CapacityUnits (dict) --

      The capacity units set for the rescore execution plan. A capacity of zero indicates that the rescore execution plan is using the default capacity. For more information on the default capacity and additional capacity units, see Adjusting capacity.

      • RescoreCapacityUnits (integer) --

        The amount of extra capacity for your rescore execution plan.

        A single extra capacity unit for a rescore execution plan provides 0.01 rescore requests per second. You can add up to 1000 extra capacity units.

    • CreatedAt (datetime) --

      The Unix timestamp of when the rescore execution plan was created.

    • UpdatedAt (datetime) --

      The Unix timestamp of when the rescore execution plan was last updated.

    • Status (string) --

      The current status of the rescore execution plan. When the value is ACTIVE , the rescore execution plan is ready for use. If the Status field value is FAILED , the ErrorMessage field contains a message that explains why.

    • ErrorMessage (string) --

      When the Status field value is FAILED , the ErrorMessage field contains a message that explains why.

ListTagsForResource (new) Link ¶

Gets a list of tags associated with a specified resource. A rescore execution plan is an example of a resource that can have tags associated with it.

See also: AWS API Documentation

Request Syntax

client.list_tags_for_resource(
    ResourceARN='string'
)
type ResourceARN

string

param ResourceARN

[REQUIRED]

The Amazon Resource Name (ARN) of the rescore execution plan to get a list of tags for.

rtype

dict

returns

Response Syntax

{
    'Tags': [
        {
            'Key': 'string',
            'Value': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    If the action is successful, the service sends back an HTTP 200 response.

    • Tags (list) --

      A list of tags associated with the rescore execution plan.

      • (dict) --

        A key-value pair that identifies or categorizes a rescore execution plan. A rescore execution plan is an Amazon Kendra Intelligent Ranking resource used for provisioning the Rescore API. You can also use a tag to help control access to a rescore execution plan. A tag key and value can consist of Unicode letters, digits, white space, and any of the following symbols: _ . : / = + - @.

        • Key (string) --

          The key for the tag. Keys are not case sensitive and must be unique.

        • Value (string) --

          The value associated with the tag. The value can be an empty string but it can't be null.

UntagResource (new) Link ¶

Removes a tag from a rescore execution plan. A rescore execution plan is an Amazon Kendra Intelligent Ranking resource used for provisioning the Rescore operation.

See also: AWS API Documentation

Request Syntax

client.untag_resource(
    ResourceARN='string',
    TagKeys=[
        'string',
    ]
)
type ResourceARN

string

param ResourceARN

[REQUIRED]

The Amazon Resource Name (ARN) of the rescore execution plan to remove the tag.

type TagKeys

list

param TagKeys

[REQUIRED]

A list of tag keys to remove from the rescore execution plan. If a tag key does not exist on the resource, it is ignored.

  • (string) --

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --

    If the action is successful, the service sends back an HTTP 200 response with an empty HTTP body.