Skip to main content

How to Use Direct Import

The Direct Import feature allows users to skip the memory deduction phase and directly input pre-defined memories into the system for storage and retrieval. To enable this feature, set the infer parameter to False in the add method.
messages = [
    {"role": "user", "content": "Alice loves playing badminton"},
    {"role": "assistant", "content": "That's great! Alice is a fitness freak"},
    {"role": "user", "content": "Alice mostly cooks at home because of her gym plan"},
]


client.add(messages, user_id="alice", infer=False)
You can see that the output of the add call is an empty list.
Only messages with the role “user” will be used for storage. Messages with roles such as “assistant” or “system” will be ignored during the storage process.

How to Retrieve Memories

You can retrieve memories using the search method.
client.search("What is Alice's favorite sport?", user_id="alice")

How to Retrieve All Memories

You can retrieve all memories using the get_all method.
client.get_all(query="What is Alice's favorite sport?", user_id="alice")
If you have any questions, please feel free to reach out to us using one of the following methods:
I