AgentsforBedrockRuntime / Paginator / Retrieve

Retrieve#

class AgentsforBedrockRuntime.Paginator.Retrieve#
paginator = client.get_paginator('retrieve')
paginate(**kwargs)#

Creates an iterator that will paginate through responses from AgentsforBedrockRuntime.Client.retrieve().

See also: AWS API Documentation

Request Syntax

response_iterator = paginator.paginate(
    knowledgeBaseId='string',
    retrievalQuery={
        'text': 'string'
    },
    retrievalConfiguration={
        'vectorSearchConfiguration': {
            'numberOfResults': 123,
            'overrideSearchType': 'HYBRID'|'SEMANTIC'
        }
    },
    PaginationConfig={
        'MaxItems': 123,
        'StartingToken': 'string'
    }
)
Parameters:
  • knowledgeBaseId (string) –

    [REQUIRED]

    Identifier of the KnowledgeBase

  • retrievalQuery (dict) –

    [REQUIRED]

    Knowledge base input query.

    • text (string) – [REQUIRED]

      Knowledge base input query in text

  • retrievalConfiguration (dict) –

    Search parameters for retrieving from knowledge base.

    • vectorSearchConfiguration (dict) – [REQUIRED]

      Knowledge base vector search configuration

      • numberOfResults (integer) –

        Top-K results to retrieve from knowledge base.

      • overrideSearchType (string) –

        Override the type of query to be performed on data store

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

    • StartingToken (string) –

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

Return type:

dict

Returns:

Response Syntax

{
    'retrievalResults': [
        {
            'content': {
                'text': 'string'
            },
            'location': {
                'type': 'S3',
                's3Location': {
                    'uri': 'string'
                }
            },
            'score': 123.0
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) –

    • retrievalResults (list) –

      List of knowledge base retrieval results

      • (dict) –

        Result item returned from a knowledge base retrieval.

        • content (dict) –

          Content of a retrieval result.

          • text (string) –

            Content of a retrieval result in text

        • location (dict) –

          The source location of a retrieval result.

          • type (string) –

            The location type of a retrieval result.

          • s3Location (dict) –

            The S3 location of a retrieval result.

            • uri (string) –

              URI of S3 location

        • score (float) –

          The relevance score of a result.

    • NextToken (string) –

      A token to resume pagination.