mem0 icon indicating copy to clipboard operation
mem0 copied to clipboard

Knowledge graph category fix

Open kingbootoshi opened this issue 10 months ago • 3 comments
trafficstars

Description

These changes update the knowledge graph PR fix (https://github.com/mem0ai/mem0/pull/2073) and allows us to add/search memories with additional filters of run_id, and agent_id

previously, we were only allowed to add/search graph memories via user_id, which is super restrictive for me.

I use agent_id to identify my unique agent's memory, then run_id as a specific category for my agents (general_knowledge, self_knowledge, user_specific knowledge) if the category is user_specific, THEN i use user_id to sort by the unique user_id

This way, if i wanted the AI to be able to search for the most relevant information about ALL the people it meets, then I can sort memories by agent_id and run_id = "user_specific_knowledge"

so if I'm asking about user 1, EVEN if I'm not talking to user 1, the AI agent will be able to find relevant memories image

Fixes # (issue)

Type of change

Please delete options that are not relevant.

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)

How Has This Been Tested?

By using

test_add = m.add("In the spirit realm, pastimes can include practicing shadow magic, chasing ethereal butterflies, and having floating tea parties", agent_id="test_agent", run_id="test_run", user_id="test_user")

test_search = m.search(search_query, agent_id="test_agent", run_id="test_run", user_id="test_user")

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

Please delete options that are not relevant.

  • [ ] Unit Test

Checklist:

  • [ ] My code follows the style guidelines of this project
  • [ ] I have performed a self-review of my own code
  • [ ] I have commented my code, particularly in hard-to-understand areas
  • [ ] I have made corresponding changes to the documentation
  • [ ] My changes generate no new warnings

kingbootoshi avatar Jan 03 '25 03:01 kingbootoshi

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Jan 03 '25 03:01 CLAassistant

Hey @kingbootoshi Can you please resolve the merge conflicts?

Dev-Khant avatar Jan 09 '25 12:01 Dev-Khant

these merge conflicts are tripping me up a bit bc they should be fully replaced, i edited both of these files based on the new pr pull. can take a deeper look/re-do next week when i have a moment

kingbootoshi avatar Jan 10 '25 02:01 kingbootoshi

@kingbootoshi Closing this PR as it's stale. Let me know when you open a new one.

parshvadaftari avatar Aug 23 '25 15:08 parshvadaftari