mem0 icon indicating copy to clipboard operation
mem0 copied to clipboard

Support Direct Import in the open source lib

Open liu1700 opened this issue 1 year ago • 1 comments

Description

Support Direct Import in the open source lib Add infer parameter to control memory inference behavior

Added a new optional boolean parameter 'infer' to the add() method that allows controlling whether inference should be used when adding memories. When infer=False, the method will directly embed and store the raw messages without performing any inference or deduction, providing a faster and simpler memory storage option. This gives users more flexibility in how memories are processed and stored.

The default value is True to maintain backward compatibility.

Another change: to make the UT could run locally, I have to fix the test_proxy.py

Type of change

  • [x] New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Replaced the high-level mocking of _add_to_vector_store with detailed component-level mocks to provide better test coverage and validation of internal behaviors.

  • [x] Unit Test

Checklist:

  • [x] My code follows the style guidelines of this project
  • [x] I have performed a self-review of my own code
  • [x] I have commented my code, particularly in hard-to-understand areas
  • [x] My changes generate no new warnings
  • [x] I have added tests that prove my fix is effective or that my feature works
  • [x] New and existing unit tests pass locally with my changes
  • [x] Any dependent changes have been merged and published in downstream modules
  • [x] I have checked my code and corrected any misspellings

Maintainer Checklist

  • [ ] closes #2103
  • [ ] Made sure Checks passed

liu1700 avatar Dec 22 '24 19:12 liu1700

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Dec 22 '24 19:12 CLAassistant

@liu1700 Closing as we have this in the latest version.

parshvadaftari avatar Aug 19 '25 11:08 parshvadaftari