OpenSearchMemory / Client / delete_memory

delete_memory

OpenSearchMemory.Client.delete_memory(**kwargs)

Deletes a memory, including its content and embedding. Deletion can’t be undone. Searches stop returning the memory shortly after you delete it.

Deleting a memory that no longer exists returns ResourceNotFoundException, so the operation is not idempotent. If you retry deletes, treat that error as success.

A memory past its expiry (set from the space’s memoryExpiryDays when the memory is written) reads as not found: the operation returns ResourceNotFoundException, as for a memory that was already deleted.

If the space uses a customer managed AWS KMS key, the call can also fail because of the key. It fails with AccessDeniedException if you aren’t allowed to use the key, and with ThrottlingException if AWS KMS throttles the request. It fails with ValidationException if the key is disabled, pending deletion, or deleted.

See also: AWS API Documentation

Request Syntax

response = client.delete_memory(
    spaceId='string',
    memoryId='string',
    actorId='string',
    strategyName='string'
)
Parameters:
  • spaceId (string) –

    [REQUIRED]

    The ID of the space that owns the memory.

  • memoryId (string) –

    [REQUIRED]

    The ID of the memory to delete.

  • actorId (string) – The ID of the actor that the memory must belong to. Omit it to skip this check. If it doesn’t match the stored memory, the call fails with ResourceNotFoundException, as if the memory did not exist.

  • strategyName (string) – The name of the strategy that the memory must belong to. Omit it to skip this check. If it doesn’t match the stored memory, the call fails with ResourceNotFoundException, as if the memory did not exist.

Return type:

dict

Returns:

Response Syntax

{
    'memoryId': 'string'
}

Response Structure

  • (dict) –

    • memoryId (string) –

      The ID of the deleted memory.

Exceptions

  • OpenSearchMemory.Client.exceptions.ResourceNotFoundException

  • OpenSearchMemory.Client.exceptions.AccessDeniedException

  • OpenSearchMemory.Client.exceptions.ThrottlingException

  • OpenSearchMemory.Client.exceptions.InternalServerException

  • OpenSearchMemory.Client.exceptions.ValidationException