ListMemories

Updated at:

Retrieves the details of one or more long-term memory entities in a specified workspace.

Operation description

  • When you query the first page, you only need to set MaxResults to limit the number of entries returned. The NextToken value in the response serves as the credential for querying subsequent pages. When you query subsequent pages, set the NextToken parameter to the NextToken value obtained from the previous response as the query credential (if NextToken is empty, all results have been returned and no further requests are required), and set MaxResults to limit the number of entries returned.
  • This operation is idempotent.

Rate limit: Make sure that the interval between two requests is at least 1 second. Otherwise, throttling may be triggered. If throttling occurs, retry later.

Debug

You can run this API directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After a successful run, OpenAPI Explorer can automatically generate SDK code examples.

Debug

Authorization information

The following table describes the authorization information of the API. You can use it in the Action element of a RAM policy statement to grant RAM users or RAM roles the permission to call this API. Details are as follows:

  • Action: refers to the specific permission point.

  • Access level: refers to the access level of each operation. Valid values: Write, Read, or List.

  • Resource type: refers to the resource types that support authorization for the operation. Details are as follows:

    • For required resource types, an asterisk (*) is added as a prefix.
    • For operations that do not support resource-level authorization, All Resources is used.
  • Condition key: refers to the condition keys defined by the cloud service itself.

  • Dependent action: refers to other permissions required to successfully perform the operation. The caller must have the permissions of all dependent actions for the operation to succeed.

ActionAccess levelResource typeCondition keyDependent action
sfm:ListMemorieslist
*All Resources
*
    None
None

Endpoint

GET/{workspaceId}/memoriesHTTP/1.1

Path parameters

workspaceIdstringRequired

The ID of the workspace to which the long-term memory entities belong. For information about how to obtain the workspace ID, see How to use a workspace.

Example: llm-xxxxxxxxxxxx

Query parameters

maxResultsintegerOptional

The number of entries per page in a paged query. Valid values: 1 to 50.

Default value: 10 if you do not set a value.

Example: 10
nextTokenstringOptional

The query credential (token). Set this parameter to the NextToken value returned in the previous API call.

Example: dc270401186b433f975d7e1faaa3xxxx

Response fields

object

Schema of Response

maxResultsinteger

The number of long-term memory entities per page in a paged query.

Example: 10
memoriesarray<object>

The list of long-term memory entities.

MemoryListobject

The long-term memory object.

descriptionstring

The description of the long-term memory entity.

Example: The long-term memory of my LLM application $APP_ID about user A
memoryIdstring

The ID of the long-term memory entity.

Example: 3fc531f4519444beaafffa4538f6xxxx
nextTokenstring

The query credential returned in this call.

Example: dc270401186b433f975d7e1faaa3xxxx
requestIdstring

The request ID.

Example: 6a71f2d9-f1c9-913b-818b-11402910xxxx
totalCountinteger

The total number of entries returned.

Example: 105
workspaceIdstring

The ID of the workspace to which the long-term memory entity list belongs.

Example: llm-xxxxxxxxxxxx

Response example

Success response

JSON format

{
  "maxResults": 10,
  "memories": [
    {
      "description": "我的大模型应用$APP_ID关于A用户的长期记忆体",
      "memoryId": "3fc531f4519444beaafffa4538f6xxxx"
    }
  ],
  "nextToken": "dc270401186b433f975d7e1faaa3xxxx",
  "requestId": "6a71f2d9-f1c9-913b-818b-11402910xxxx\n",
  "totalCount": 105,
  "workspaceId": "llm-xxxxxxxxxxxx\n"
}

Error codes

HTTP status codeError codeError messageDescription
400Memory.MaxResultsInvalidInput parameter maxResults is invalid.Input parameter maxResults is invalid.
400Memory.NextTokenInvalidInput parameter nextToken is invalid.Input parameter nextToken is invalid.
404Memory.MemoryIdNotFoundMemory Id not exist or is not authorized.memoryId not found
500Memory.InternalErrorMemory service inner exception.Memory service inner exception.

Visit the Error Center to view more error codes.