feat(api): add vector store configuration endpoints#3583
feat(api): add vector store configuration endpoints#3583whysosaket merged 4 commits intomem0ai:mainfrom
Conversation
This commit introduces new API endpoints to manage the vector store configuration for mem0. It adds GET and PUT endpoints for /api/v1/config/mem0/vector_store, allowing for dynamic retrieval and updates of the vector store settings. The configuration models and database logic have been updated to support these changes, ensuring that the vector store configuration is properly initialized and persisted. Fixes mem0ai#3554
parshvadaftari
left a comment
There was a problem hiding this comment.
Looks good to me!
ci pipelines are stuck , can you please take a look. |
|
Hey that's fine, the CI pipeline for now are related to mem0 and embedchain so don't worry if they don't run. |
parshvadaftari
left a comment
There was a problem hiding this comment.
Hey @vedant381 after re-reviewing your PR, can we add a unified api end point which will be able to change any of the app config? Rather than different api end points for every config?
Hey @parshvadaftari, understood the requirement. Can you please confirm if I’ve got the understanding right about the plan of action so we can make sure we’re on the same page? Once aligned, I’ll start the development. Currently, there are 4 functions that update different parts of the configs:
The above four endpoints update individual parts of the overall app config. However, there’s another endpoint:
This one updates the entire DB object at once since it’s a PUT request, meaning the full object needs to be passed as a parameter. Based on your comment, I believe you want me to consolidate the 4 separate endpoints into a single one that supports these operations. I’ll add a unified |
|
Hey @vedant381 yes that's correct, we can still keep the /openmemory end point for backward compatibility. For the rest we can consolidate it into one. |
Yes , wont be removing the existing endpoints for backward compatibility. Will pick this up |
Hey @parshvadaftari, I’ve made the requested changes. I didn’t update the run.sh script for open memory to maintain consistency. I’ve added three endpoints , one to get the config, one to update the config, and a consolidated endpoint that handles all configurations. We can deprecate all the put configs endpoint once things are consistent and stable. |
|
@parshvadaftari bumping ! |
parshvadaftari
left a comment
There was a problem hiding this comment.
Looks good to me!
The PUT endpoint was missing the critical database save operations. This bug was introduced in upstream commit 639d26e (PR mem0ai#3583) when adding the PATCH endpoint - the save/reset/return lines were accidentally moved from PUT to PATCH instead of being duplicated in both. Added missing lines to PUT endpoint: - save_config_to_db(db, updated_config) - reset_memory_client() - return updated_config This ensures config changes (like default_infer toggle) persist when Save Configuration is clicked in the UI. Refs: upstream mem0ai/mem0 commit 639d26e
This pull request introduces support for configuring a vector store provider in the
mem0settings, alongside enhancements to configuration management endpoints. The most significant changes are the addition of a newVectorStoreProvidermodel, updates to the configuration schema and defaults, and new API endpoints for retrieving and updating vector store settings.Vector Store Configuration Support
VectorStoreProvidermodel to represent the vector store provider and its configuration, and included it as an optional field in theMem0Configmodel.vector_storefield in themem0settings.vector_storeconfiguration is present in the database-backed config, applying defaults if necessary.API Endpoint Enhancements
/mem0/vector_store.The configuration models and database logic have been updated to support these changes, ensuring that the vector store configuration is properly initialized and persisted.
Fixes #3554
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
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.
Checklist:
Maintainer Checklist