Skip to content

Conversation

andy-k-improving
Copy link
Contributor

@andy-k-improving andy-k-improving commented Sep 29, 2025

Description

  • Update existing mem0 module to allow Neptune DB to be configured as one of the option of Graph Backend.
  • Update existing logic to also print out the result of newly added graph relations.
  • Update existing Faiss strategy to return cosine similarity result instead.

Related Issues

N/A

Documentation PR

TBC

Testing

Run hatch

Checklist

  • I have read the CONTRIBUTING document
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@yonib05
Copy link
Member

yonib05 commented Sep 30, 2025

Hey @andy-k-improving ,

Looks like linting is failing on this change

tests/test_mem0.py:438:121: E501 Line too long (129 > 120)

@andy-k-improving
Copy link
Contributor Author

Hi @yonib05 , I have patched the lint issue and tested it offline, would you mind to have another look?

@andy-k-improving
Copy link
Contributor Author

@yonib05 I have updated this PR again to include the strategy for cosine similarity for Neptune DB integration.
Let me know if you have additional question, I'm happy to address.

Signed-off-by: Andy Kwok <[email protected]>
Signed-off-by: Andy Kwok <[email protected]>
Signed-off-by: Andy Kwok <[email protected]>
Signed-off-by: Andy Kwok <[email protected]>
Signed-off-by: Andy Kwok <[email protected]>
Signed-off-by: Andy Kwok <[email protected]>
Signed-off-by: Andy Kwok <[email protected]>
Signed-off-by: Andy Kwok <[email protected]>
Signed-off-by: Andy Kwok <[email protected]>
Signed-off-by: Andy Kwok <[email protected]>
Signed-off-by: Andy Kwok <[email protected]>
Signed-off-by: Andy Kwok <[email protected]>
@andy-k-improving
Copy link
Contributor Author

andy-k-improving commented Oct 7, 2025

Related to: #262
Hi @cagataycali , would you mind also have a look on this, I have rebased to #262 as you have approved for the prior, also following list of combinations are being tested locally:

  • Neptune Analytics (Vector + Graph)
  • Neptune DB (Graph) + OpenSearch (Vector)
  • OpenSearch (Vector)
  • Faiss (Vector) <- The default case

Along with the captured log / stdout when running the combination of OpenSearch + Neptune DB with test conversation:

───────────────────────── Memory for user mem0_user ──────────────────────────╮
│ My name is Alex. I like to travel and stay in Airbnbs rather than hotels. I  │
│ am planning a trip to Japan next spring. I enjoy hiking and outdoor          │
│ photography as hobbies. I have a dog named Max. My favorite cuisine is       │
│ Italian food.                                                                │
╰──────────────────────────────────────────────────────────────────────────────╯
╭────────────────────────── Memories Stored (Graph) ───────────────────────────╮
│        Graph Memories Stored                                                 │
│ ┏━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━┓                                          │
│ ┃ Source    ┃ Target              ┃                                          │
│ ┡━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━┩                                          │
│ │ mem0_user │ alex                │                                          │
│ │ mem0_user │ airbnbs             │                                          │
│ │ mem0_user │ hotels              │                                          │
│ │ mem0_user │ japan               │                                          │
│ │ mem0_user │ hiking              │                                          │
│ │ mem0_user │ outdoor_photography │                                          │
│ │ mem0_user │ max                 │                                          │
│ │ max       │ dog                 │                                          │
│ │ mem0_user │ italian_food        │                                          │
│ └───────────┴─────────────────────┘                                          │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─────────────────────────────── Memories List ────────────────────────────────╮
│                                   Memories                                   │
│ ┏━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━┳━━━━┳━━━━━┓ │
│ ┃    ┃                                                    ┃ Cr… ┃ U… ┃     ┃ │
│ ┃ ID ┃ Memory                                             ┃ At  ┃ ID ┃ Me… ┃ │
│ ┡━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━╇━━━━╇━━━━━┩ │
│ │ e… │ Prefers staying in Airbnbs over hotels             │ 20… │ m… │ No… │ │
│ │ 2… │ Has a dog named Max                                │ 20… │ m… │ No… │ │
│ │ b… │ Name is Alex                                       │ 20… │ m… │ No… │ │
│ │ d… │ Planning a trip to Japan next spring               │ 20… │ m… │ No… │ │
│ │ d… │ Enjoys hiking                                      │ 20… │ m… │ No… │ │
│ │ b… │ Enjoys outdoor photography                         │ 20… │ m… │ No… │ │
│ │ d… │ Favorite cuisine is Italian food                   │ 20… │ m… │ No… │ │
│ └────┴────────────────────────────────────────────────────┴─────┴────┴─────┘ │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─────────────────────────── Memories List (Graph) ────────────────────────────╮
│                                Graph Memories                                │
│ ┏━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━┓ │
│ ┃ Source   ┃ Relationship                                       ┃ Target   ┃ │
│ ┡━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━┩ │
│ │ mem0_us… │ prefers                                            │ airbnbs  │ │
│ │ mem0_us… │ owns                                               │ max      │ │
│ │ mem0_us… │ plans_to_visit                                     │ japan    │ │
│ │ max      │ is_a                                               │ dog      │ │
│ │ mem0_us… │ favorite_cuisine                                   │ italian… │ │
│ │ mem0_us… │ name                                               │ alex     │ │
│ │ mem0_us… │ dislikes                                           │ hotels   │ │
│ │ mem0_us… │ hobby                                              │ hiking   │ │
│ │ mem0_us… │ hobby                                              │ outdoor… │ │
│ └──────────┴────────────────────────────────────────────────────┴──────────┘ │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─────────────────────────────── Search Results ───────────────────────────────╮
│                                Search Results                                │
│ ┏━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━┳━━━┳━━━━┳━━━┓ │
│ ┃   ┃                                                    ┃    ┃ … ┃ U… ┃   ┃ │
│ ┃ … ┃ Memory                                             ┃ R… ┃ … ┃ ID ┃ … ┃ │
│ ┡━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━╇━━━╇━━━━╇━━━┩ │
│ │ … │ Planning a trip to Japan next spring               │ 0… │ … │ m… │ … │ │
│ │ … │ Prefers staying in Airbnbs over hotels             │ 0… │ … │ m… │ … │ │
│ │ … │ Enjoys hiking                                      │ 0… │ … │ m… │ … │ │
│ │ … │ Enjoys outdoor photography                         │ 0… │ … │ m… │ … │ │
│ │ … │ Favorite cuisine is Italian food                   │ 0… │ … │ m… │ … │ │
│ │ … │ Name is Alex                                       │ 0… │ … │ m… │ … │ │
│ │ … │ Has a dog named Max                                │ 0… │ … │ m… │ … │ │
│ └───┴────────────────────────────────────────────────────┴────┴───┴────┴───┘ │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─────────────────────────── Search Results (Graph) ───────────────────────────╮
│                                Search Results                                │
│ ┏━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━┓ │
│ ┃ Source   ┃ Relationship                                       ┃ Destina… ┃ │
│ ┡━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━┩ │
│ │ mem0_us… │ hobby                                              │ hiking   │ │
│ │ mem0_us… │ prefers                                            │ airbnbs  │ │
│ │ mem0_us… │ name                                               │ alex     │ │
│ │ mem0_us… │ hobby                                              │ outdoor… │ │
│ │ mem0_us… │ prefers                                            │ airbnbs  │ │
│ └──────────┴────────────────────────────────────────────────────┴──────────┘ │
╰──────────────────────────────────────────────────────────────────────────────╯

Signed-off-by: Andy Kwok <[email protected]>
Signed-off-by: Andy Kwok <[email protected]>
Signed-off-by: Andy Kwok <[email protected]>
Signed-off-by: Andy Kwok <[email protected]>
Signed-off-by: Andy Kwok <[email protected]>
Signed-off-by: Andy Kwok <[email protected]>
Signed-off-by: Andy Kwok <[email protected]>
Signed-off-by: Andy Kwok <[email protected]>
Signed-off-by: Andy Kwok <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants