Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Categories example from docs does not work #1863

Open
uahmad235 opened this issue Sep 14, 2024 · 3 comments · May be fixed by #1894
Open

Custom Categories example from docs does not work #1863

uahmad235 opened this issue Sep 14, 2024 · 3 comments · May be fixed by #1894
Assignees
Labels
enhancement New feature or request

Comments

@uahmad235
Copy link

🐛 Describe the bug

I am trying to reuse this example from docs in order to create custom categories but it throws error. Here's my code:

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."}
]
config = {
"llm":  # defining secrets for llm
"embedder":  # secrets for embedder
}

from mem0 import Memory
m = Memory.from_config(config)
m.add(messages, user_id="alice", custom_categories=custom_categories)

Here's the error I get:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
[<ipython-input-4-615dd71b2dd0>](https://localhost:8080/#) in <cell line: 1>()
----> 1 m.add(messages, user_id="alice", custom_categories=custom_categories)

TypeError: Memory.add() got an unexpected keyword argument 'custom_categories'
@ketangangal
Copy link
Contributor

ketangangal commented Sep 14, 2024

Hello @uahmad235 ,

Mem0 add method does not support this key, docs need updates.

FYI @deshraj @Dev-Khant if this feature is required or in pipeline i can work on it.

@uahmad235
Copy link
Author

Hey @ketangangal
Is this completely deprecated or moved to a different API?

@Dev-Khant
Copy link
Member

Hey @uahmad235, The doc refers to use custom_categories for the platform and not OSS package. So you can switch to platform by passing api_key in order to use custom_categories.

@spike-spiegel-21 spike-spiegel-21 linked a pull request Sep 22, 2024 that will close this issue
@Dev-Khant Dev-Khant added the enhancement New feature or request label Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants