BedrockAgentCore / Paginator / RetrieveMemoryRecords

RetrieveMemoryRecords

class BedrockAgentCore.Paginator.RetrieveMemoryRecords
paginator = client.get_paginator('retrieve_memory_records')
paginate(**kwargs)

Creates an iterator that will paginate through responses from BedrockAgentCore.Client.retrieve_memory_records().

See also: AWS API Documentation

Request Syntax

response_iterator = paginator.paginate(
    memoryId='string',
    namespace='string',
    namespacePath='string',
    searchCriteria={
        'searchQuery': 'string',
        'memoryStrategyId': 'string',
        'topK': 123,
        'metadataFilters': [
            {
                'left': {
                    'metadataKey': 'string'
                },
                'operator': 'EQUALS_TO'|'EXISTS'|'NOT_EXISTS'|'BEFORE'|'AFTER'|'CONTAINS'|'GREATER_THAN'|'GREATER_THAN_OR_EQUALS'|'LESS_THAN'|'LESS_THAN_OR_EQUALS',
                'right': {
                    'metadataValue': {
                        'stringValue': 'string',
                        'stringListValue': [
                            'string',
                        ],
                        'numberValue': 123.0,
                        'dateTimeValue': datetime(2015, 1, 1)
                    }
                }
            },
        ]
    },
    PaginationConfig={
        'MaxItems': 123,
        'PageSize': 123,
        'StartingToken': 'string'
    }
)
Parameters:
  • memoryId (string) –

    [REQUIRED]

    The identifier of the AgentCore Memory resource from which to retrieve memory records.

  • namespace (string) – The namespace prefix to filter memory records by. Searches for memory records in namespaces that start with the provided prefix. Either namespace or namespacePath is required.

  • namespacePath (string) – Use namespacePath for hierarchical retrievals. Return all memory records where namespace falls under the same parent hierarchy. Either namespace or namespacePath is required.

  • searchCriteria (dict) –

    [REQUIRED]

    The search criteria to use for finding relevant memory records. This includes the search query, memory strategy ID, and other search parameters.

    • searchQuery (string) – [REQUIRED]

      The search query to use for finding relevant memory records.

    • memoryStrategyId (string) –

      The memory strategy identifier to filter memory records by.

    • topK (integer) –

      The maximum number of top-scoring memory records to return. This value is used for semantic search ranking.

    • metadataFilters (list) –

      Filters to apply to metadata associated with a memory.

      • (dict) –

        Filters to apply to metadata associated with a memory. Specify the metadata key and value in the left and right fields and use the operator field to define the relationship to match.

        • left (dict) – [REQUIRED]

          The metadata key to evaluate.

          Note

          This is a Tagged Union structure. Only one of the following top level keys can be set: metadataKey.

          • metadataKey (string) –

            The metadata key to filter on.

        • operator (string) – [REQUIRED]

          The relationship between the metadata key and value to match when applying the metadata filter.

        • right (dict) –

          The value to compare against. Required for all operators except EXISTS and NOT_EXISTS.

          Note

          This is a Tagged Union structure. Only one of the following top level keys can be set: metadataValue.

          • metadataValue (dict) –

            The metadata value to compare against.

            Note

            This is a Tagged Union structure. Only one of the following top level keys can be set: stringValue, stringListValue, numberValue, dateTimeValue.

            • stringValue (string) –

              A string value.

            • stringListValue (list) –

              A list of string values.

              • (string) –

            • numberValue (float) –

              A numeric value.

            • dateTimeValue (datetime) –

              A timestamp value in ISO 8601 UTC format.

  • 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

{
    'memoryRecordSummaries': [
        {
            'memoryRecordId': 'string',
            'content': {
                'text': 'string'
            },
            'memoryStrategyId': 'string',
            'namespaces': [
                'string',
            ],
            'createdAt': datetime(2015, 1, 1),
            'score': 123.0,
            'timestamp': datetime(2015, 1, 1),
            'metadata': {
                'string': {
                    'stringValue': 'string',
                    'stringListValue': [
                        'string',
                    ],
                    'numberValue': 123.0,
                    'dateTimeValue': datetime(2015, 1, 1)
                }
            }
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) –

    • memoryRecordSummaries (list) –

      The list of memory record summaries that match the search criteria, ordered by relevance.

      • (dict) –

        Contains summary information about a memory record.

        • memoryRecordId (string) –

          The unique identifier of the memory record.

        • content (dict) –

          The content of the memory record.

          Note

          This is a Tagged Union structure. Only one of the following top level keys will be set: text. If a client receives an unknown member it will set SDK_UNKNOWN_MEMBER as the top level key, which maps to the name or tag of the unknown member. The structure of SDK_UNKNOWN_MEMBER is as follows:

          'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
          
          • text (string) –

            The text content of the memory record.

        • memoryStrategyId (string) –

          The identifier of the memory strategy associated with this record.

        • namespaces (list) –

          The namespaces associated with this memory record.

          • (string) –

        • createdAt (datetime) –

          The timestamp when the memory record was created.

        • score (float) –

          The relevance score of the memory record when returned as part of a search result. Higher values indicate greater relevance to the search query.

        • timestamp (datetime) –

          The timestamp based on which the memory record was ingested. This reflects the time of the source content that the record was derived from, which can differ from createdAt, the time the record itself was written.

        • metadata (dict) –

          A map of metadata key-value pairs associated with a memory record.

          • (string) –

            • (dict) –

              The value of a memory record metadata entry.

              Note

              This is a Tagged Union structure. Only one of the following top level keys will be set: stringValue, stringListValue, numberValue, dateTimeValue. If a client receives an unknown member it will set SDK_UNKNOWN_MEMBER as the top level key, which maps to the name or tag of the unknown member. The structure of SDK_UNKNOWN_MEMBER is as follows:

              'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
              
              • stringValue (string) –

                A string value.

              • stringListValue (list) –

                A list of string values.

                • (string) –

              • numberValue (float) –

                A numeric value.

              • dateTimeValue (datetime) –

                A timestamp value in ISO 8601 UTC format.

    • NextToken (string) –

      A token to resume pagination.