mem0
mem0 copied to clipboard
feat: export mem0 as tools for Vercel AI SDK
Description
mem0 + vercel AI SDK integration is nice, but even easier way would be to import it as a tool directly for AI to call as needed, instead of calling on each message manually.
This PR is a draft implementation that creates tools user can import directly into Vercel AI SDK.
Usage example:
const memoryTools = {
addMemory: addMemoryTool,
searchMemory: searchMemoryTool,
getMemory: getMemoryTool,
deleteMemory: deleteMemoryTool,
};
const response = await generateText({
maxTokens: 1024,
temperature: 0.8,
model: model,
maxSteps: 4, // needed so agent can add more text after getting tool response
tools: memoryTools,
})
Type of change
Please delete options that are not relevant.
- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Refactor (does not change functionality, e.g. code style improvements, linting)
- [ ] Documentation update
How Has This Been Tested?
Tested happy-flow
- [ ] Unit Test
- [ ] Test Script (please provide)
Checklist:
- [ ] My code follows the style guidelines of this project
- [x] 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
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream modules
- [ ] I have checked my code and corrected any misspellings
Maintainer Checklist
- [ ] closes #xxxx (Replace xxxx with the GitHub issue number)
- [ ] Made sure Checks passed