-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Description
🐛 Describe the bug
Description
There is a type mismatch issue in the update method of the mem0/vector_stores/langchain.py file when passing parameters to the insert method.
Location
File: mem0/vector_stores/langchain.py Method: update Line: approximately line 118
Details
When the update method calls the insert method, the vector and payload parameters are not wrapped in lists, but the insert method's parameter definitions require them to be lists:
Current problematic code
def update(self, vector_id, vector=None, payload=None):
"""
Update a vector and its payload.
"""
self.delete(vector_id)
self.insert(vector, payload, [vector_id]) # Here payload and vector are not wrapped in []
insert method parameter definitions
def insert(
self, vectors: List[List[float]], payloads: Optional[List[Dict]] = None, ids: Optional[List[str]] = None
):
Suggested Fix
The vector and payload parameters should be wrapped in lists:
def update(self, vector_id, vector=None, payload=None):
"""
Update a vector and its payload.
"""
self.delete(vector_id)
self.insert([vector], [payload], [vector_id]) # Fixed: added []
Environment Information
- mem0 version: 1.0.0
- Python version: 3.10