From 324e17b22616690d29fc4774dafe69d3beaf4f51 Mon Sep 17 00:00:00 2001 From: Prateek Chhikara <46902268+prateekchhikara@users.noreply.github.com> Date: Sat, 24 Aug 2024 10:10:04 -0700 Subject: [PATCH] Added docs for custom categories (#1744) --- docs/features/custom-categories.mdx | 71 +++++++++++++++++++++++++++++ docs/mint.json | 2 +- 2 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 docs/features/custom-categories.mdx diff --git a/docs/features/custom-categories.mdx b/docs/features/custom-categories.mdx new file mode 100644 index 00000000..ac36cd5d --- /dev/null +++ b/docs/features/custom-categories.mdx @@ -0,0 +1,71 @@ +--- +title: Custom Categories +description: 'Enhance your product experience by adding custom categories tailored to your needs' +--- + +## How to set custom categories? + +Users can now create custom categories tailored to their specific needs, in addition to the default categories such as travel, sports, music, and more. +To setup the custom categories, user has to specify the category name and a description of what that category signifies. +Here’s how you can do it: + +```python +from mem0 import MemoryClient + +m = MemoryClient(api_key="xxx") + +custom_categories = [ + {"cooking": "For users interested in cooking, including recipes, cooking tips, and culinary experiences."}, + {"fitness": "Includes content related to fitness, such as workouts, exercises, and fitness tips."} +] + +messages = [ + {"role" : "user", "content" : "Hi, my name is Alice. I love to play badminton."}, + {"role" : "assistant", "content" : "Hello Alice! It's nice to meet you. Badminton is such an amazing sport. How can I assist you today?"}, + {"role" : "user", "content" : "I am a fitness freak, I go to gym daily."}, + {"role" : "assistant", "content" : "That's great! Regular exercise is very beneficial for health."}, + {"role" : "user", "content" : "Because of my gym plan, I mostly cook at home."}, + {"role" : "assistant", "content" : "Cooking at home is a good way to ensure you have a balanced diet."} +] +``` + + +```python Code +client.add(messages, user_id="alice", custom_categories=custom_categories) +``` + +```markdown Memories with categories +User's name is Alice (personal_details) +Loves playing badminton (sports) +User is a fitness freak. (fitness) +Likes to go to gym daily. (fitness) +Mostly cook at home because of gym plan. (fitness, cooking) +``` + + +> Note: The more detailed the description of categories is, the better output the user will receive. + +## Default Categories +Here is the list of **default categories**. Ensure you review these before creating custom categories to prevent duplication. + +``` +- personal_details +- family +- professional_details +- sports +- travel +- food +- music +- health +- technology +- hobbies +- fashion +- entertainment +- milestones +- user_preferences +- misc +``` + +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 8f98fd55..19a9b7fa 100644 --- a/docs/mint.json +++ b/docs/mint.json @@ -62,7 +62,7 @@ "platform/quickstart", { "group": "Features", - "pages": ["features/selective-memory"] + "pages": ["features/selective-memory", "features/custom-categories"] } ] },