Skip to content

Servers

https://api.memnetai.com/

Default


Recall API

POST
v1/recall

This interface is used for recalling text content (such as conversation content)

heat: 6 points

📌 Attention

Human memory is not simply a process of "searching for a record", but a three-dimensional cognitive reconstruction process: it involves both common sense knowledge retrieval and reliance on retrospective historical experiences, accompanied by natural associations based on entity relationships. Furthermore, memories are combined with temporal clues to correct erroneous or outdated memories, connecting new and old cognition in a traceable manner. At the same time, the "depth of impression" of different memories in the brain also changes over time.

MemnetAI fully simulates this process in memory design, working together from multiple dimensions such as knowledge, history, relationships, time, and memory intensity, making memory no longer a static result return, but a dynamic, evolutionary, and close to human cognitive thinking process, thus achieving a truly human like memory experience.

Basic Introduction

  1. The recall process needs to rely on a piece of text content as the retrieval basis. Generally, the latest speech text content of the user in the current conversation context is used as the recall input to obtain more accurate recall results
  2. Characters are used to identify who is currently having a conversation with AI. Clearly distinguishing between different speakers helps AI better understand the context when recalling and recall content that is more relevant to a specific speaker. It is recommended to explicitly specify this parameter in general scenarios
  3. When recalling, humans may engage in both rapid and shallow associations, as well as deeper thinking based recollection. The depth of recollection often directly affects the scope of relevant content that can be thought of. For this purpose, the system provides the recallDeep parameter to control the depth of recall. In most scenarios, it is recommended to set this parameter to 1 to obtain more comprehensive and rich recall results, thereby improving the overall effect
  4. When humans recall outdated or erroneous memories, they often immediately think of the correct memories associated with them. The isIncludeLinkedNewMemoriesFromInvalid parameter exists for this purpose. If enabled, it will also add new memories associated with invalid memories to the context; It should be noted that even if not activated, non effective memory will not cause hallucination problems, as the memory change process is also recorded in the memory change log, and the contextual information is complete and up-to-date
  5. Both associative thinking ability and common sense memory ability support on-demand activation or deactivation. By default, it is recommended to enable these two abilities to activate richer semantic associations and background knowledge during the recall process, thereby achieving a more complete and natural recall effect
  6. isUsoCommonSenseDatabase is the main switch for the common sense database. If set to false, no common sense database will be used, so it is important to note that
  7. The common sense database is divided into a global common sense database, a memory common sense database, and a common sense database used only for this recall. The global common sense database and the memory common sense database need to be configured in the background station before they can be used. If you want to dynamically reference different common sense databases, please dynamically configure the commonSenseDatabaseIdList (common sense database used only for this recall) parameter every time you recall
  8. The content of memories is often used to enhance the dialogue context of large models, usually injected in the form of System prompt words. To reduce access costs, the interface return already provides encapsulated memoryPrompt, which can be directly concatenated into existing System prompt words for use without additional processing. Of course, if you have more complex requirements, you can also set the isReturningDetailedMemoryInfo parameter to 1 to obtain extremely complete recall information
  9. A namespace is used to logically isolate memory within the same project. In the same project, the uniqueness of memory is determined by the combination of "namespace+memory name". Therefore, even if the memory names are the same, as long as the namespaces are different, they will be considered as independent and non influential memory. This mechanism is suitable for complex applications with multiple users, multiple agents, or multiple scenarios coexisting

Precautions

  1. After injecting the recall content into the System prompt words, it is recommended to concatenate them at the end of the content text of the user's latest conversation (please strictly follow the usage norms of System prompt words/System prompt words) to further enhance the model's attention to system level instructions and recall information, thereby improving the overall dialogue effect
    Just like humans, memory is not static. Content that is repeatedly mentioned or recalled will leave a deeper impression in memory; And the content that has only appeared once and has not been touched again will gradually become blurred over time, making it less and less easy to recall. Its forgetting pattern roughly fits the Ebbinghaus curve
  2. Memory has a concept of time, for example, when you mention "last night", the memories of that time are more easily recalled
  3. Lenovo thinking is often the root of creativity, and implicit entity relationships not mentioned in conversations may also appear in the results of Lenovo thinking, which is a normal phenomenon
  4. Reasonably use namespaces for memory isolation. In B2C or multi-agent scenarios, it is recommended to use namespaces to isolate and manage the memory of different users, agents, or sub scenarios. For example, "User ID" or "Agent ID" can be used as namespaces to securely reuse memory names in the same project, while avoiding memory contamination between different contexts

Best practices

During the conversation between the user and the large model, whenever the user sends a new message, the message content should be used first to trigger the recall process and obtain the corresponding memoryPrompt.
Subsequently, the returned memoryPrompt is directly written and overwritten with the System prompt words in the current conversation context to enhance the overall context. At the same time, temporarily concatenate an enhanced prompt at the end of the content text of the user's message (please strictly follow the system prompt usage guidelines).
After completing the above enhancement, the updated context is submitted to the large model for inference and generation, and the dialogue process runs in long-term memory enhancement mode.
This process constitutes the optimal dialogue lifecycle that supports long-term memory. It should be noted that the enhanced prompt words spliced at the end of the user's latest message only take effect in the current round of conversation and will not be permanently written into the user's original input content. They will be dynamically generated and replaced based on the latest input in the next round of conversation.

Parameters

Header Parameters

Authorization

API key token

Typestring
Example"Token <api-key>"

Request Body

application/json
JSON
{
"memoryAgentName": "string",
"query": "string",
"namespace": "string",
"character": "string",
"recallDeep": 1,
"isIncludeLinkedNewMemoriesFromInvalid": 0,
"isUsingAssociativeThinking": 1,
"isUsingCommonSenseDatabase": 1,
"isUsingGlobalCommonSenseDatabase": 1,
"isUsingMemoryAgentCommonSenseDatabase": 1,
"commonSenseDatabaseIdList": [
"string"
],
"isReturningDetailedMemoryInfo": 0
}

Responses

application/json
JSON
{
"code": "string",
"msg": "string",
"data": {
"memoryPrompt": "string",
"memorySummaryList": [
{
"memorySummaryId": "string",
"memorySummaryText": "string",
"maxImpression": 0,
"charactersInMemory": "string",
"memnetaiContextId": "string",
"contextType": 0,
"memoryStatus": 0,
"linkedNewMemorySummaryId": "string",
"memoryChangeLog": "string",
"metaData": "string",
"score": 0,
"createTime": "string",
"updateTime": "string"
}
],
"associativeThinkingList": [
{
"nodes": [
{
"id": "string",
"name": "string"
}
],
"links": [
{
"sourceNodeId": "string",
"sourceNodeName": "string",
"targetNodeId": "string",
"targetNodeName": "string",
"distance": 0,
"relation": [
{
"relation": "string",
"maxImpression": 0
}
]
}
]
}
],
"commonSenseList": [
{
"id": 0,
"memnetaiCommonSenseDatabaseName": "string",
"text": "string",
"createTime": "string",
"updateTime": "string"
}
],
"usage": {
"consumedPoints": "string",
"consumedMemoryCount": "string",
"consumedRecallCount": "string",
"consumedThinkingCount": "string",
"consumedDreamCount": "string",
"consumedCommonMemoryWords": "string",
"hasRemainingQuota": true
}
}
}

Playground

Headers
Body

Samples

cURL
JavaScript
PHP
Python

Powered by VitePress OpenAPI