From 55a376b54375c403617c318bfd52b6f2ee729c85 Mon Sep 17 00:00:00 2001 From: Prateek Chhikara Date: Wed, 16 Oct 2024 09:55:08 -0700 Subject: [PATCH 1/2] updated docs --- docs/features/direct-import.mdx | 102 ++++++++++++++++++++++++++++++++ docs/mint.json | 2 +- 2 files changed, 103 insertions(+), 1 deletion(-) create mode 100644 docs/features/direct-import.mdx diff --git a/docs/features/direct-import.mdx b/docs/features/direct-import.mdx new file mode 100644 index 0000000000..27f2dd2438 --- /dev/null +++ b/docs/features/direct-import.mdx @@ -0,0 +1,102 @@ +--- +title: Direct Memory Storage +description: 'Bypass the memory deduction phase and directly store pre-defined memories for efficient retrieval' +--- + +## How to use Direct Memory Storage? +The Direct Memory Storage 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, you need to set the `infer` parameter to `False` in the `add` method. + + + + + +```python Python +messages = [ + {"role": "user", "content": "Alice loves playing badminton"}, + {"role": "assistant", "content": "That's great! Alice is a fitness freak"}, + {"role": "user", "content": "Alice mostly cook at home because of gym plan"}, +] + + +client.add(messages, user_id="alice", infer=False) +``` + +```markdown Output +[] +``` + + +You can see that the output of 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. + + + +```python Python +client.search(query="What is Alice's favorite sport?", user_id="alice", output_format="v1.1") +``` + +```json Output +{ + "results": [ + { + "id": "19d6d7aa-2454-4e58-96fc-e74d9e9f8dd1", + "memory": "Alice loves playing badminton", + "user_id": "pc123", + "metadata": null, + "categories": null, + "created_at": "2024-10-15T21:52:11.474901-07:00", + "updated_at": "2024-10-15T21:52:11.474912-07:00" + } + ] +} +``` + + + +## How to retrieve all memories? + +You can retrieve all memories using the `get_all` method. + + + +```python Python +client.get_all(query="What is Alice's favorite sport?", user_id="alice", output_format="v1.1") +``` + +```json Output +{ + "results": [ + { + "id": "19d6d7aa-2454-4e58-96fc-e74d9e9f8dd1", + "memory": "Alice loves playing badminton", + "user_id": "pc123", + "metadata": null, + "categories": null, + "created_at": "2024-10-15T21:52:11.474901-07:00", + "updated_at": "2024-10-15T21:52:11.474912-07:00" + }, + { + "id": "8557f05d-7b3c-47e5-b409-9886f9e314fc", + "memory": "Alice mostly cook at home because of gym plan", + "user_id": "pc123", + "metadata": null, + "categories": null, + "created_at": "2024-10-15T21:52:11.474929-07:00", + "updated_at": "2024-10-15T21:52:11.474932-07:00" + } + ] +} +``` + + + +If you have any questions, please feel free to reach out to us using one of the following methods: + + \ No newline at end of file diff --git a/docs/mint.json b/docs/mint.json index f46d24ec28..2af2e08a51 100644 --- a/docs/mint.json +++ b/docs/mint.json @@ -64,7 +64,7 @@ "platform/quickstart", { "group": "Features", - "pages": ["features/selective-memory", "features/custom-categories"] + "pages": ["features/selective-memory", "features/custom-categories", "features/direct-import"] } ] }, From c5a91b549d6f44bfb324823f726e575c8d8ad0b6 Mon Sep 17 00:00:00 2001 From: Prateek Chhikara Date: Wed, 16 Oct 2024 09:57:53 -0700 Subject: [PATCH 2/2] updated docs --- docs/features/direct-import.mdx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/features/direct-import.mdx b/docs/features/direct-import.mdx index 27f2dd2438..94901952a4 100644 --- a/docs/features/direct-import.mdx +++ b/docs/features/direct-import.mdx @@ -1,10 +1,10 @@ --- -title: Direct Memory Storage +title: Direct Import description: 'Bypass the memory deduction phase and directly store pre-defined memories for efficient retrieval' --- -## How to use Direct Memory Storage? -The Direct Memory Storage feature allows users to skip the memory deduction phase and directly input pre-defined memories into the system for storage and retrieval. +## 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, you need to set the `infer` parameter to `False` in the `add` method.