Open Shakahs opened 2 months ago
@Shakahs You have to pass the user_id
when using the graph_store
. If you're using vector_store
you can retrieve the memory without using the user_id
.
Hey @Shakahs Let us know if this fixes the issue.
@parshvadaftari I believe even for vector_store
you need to pass an id (run_id, user_id, or agent_id). Correct me @Dev-Khant if I am wrong.
Also I'm trying to create memories for the agent, not a particular user.
On Wed, Sep 25, 2024 at 2:28 PM Prateek Chhikara @.***> wrote:
@parshvadaftari https://github.com/parshvadaftari I believe even for vector_store you need to pass an id (run_id, user_id, or agent_id). Correct me @Dev-Khant https://github.com/Dev-Khant if I am wrong.
— Reply to this email directly, view it on GitHub https://github.com/mem0ai/mem0/issues/1895#issuecomment-2375296346, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAC7JHTIVNHFRISXXIWK4FDZYMTH7AVCNFSM6AAAAABOVVQG3GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNZVGI4TMMZUGY . You are receiving this because you were mentioned.Message ID: @.***>
@parshvadaftari I believe even for
vector_store
you need to pass an id (run_id, user_id, or agent_id). Correct me @Dev-Khant if I am wrong.
Prateek actually we can directly call get_all
without passing any id for vector_store
.
🐛 Describe the bug
KeyError Traceback (most recent call last) Cell In[32], line 24 20 m = Memory.from_config(config_dict=config) 22 result = m.add("I like to take short walks on weekdays.", user_id="alice", metadata={"category": "hobbies"}) ---> 24 all_memories = m.get_all()
File ~/dev/projects/Roga/code/AiResearch/venv/lib/python3.12/site-packages/mem0/memory/main.py:291, in Memory.get_all(self, user_id, agent_id, run_id, limit) 286 future_graph_entities = ( 287 executor.submit(self.graph.get_all, filters) if self.version == "v1.1" and self.enable_graph else None 288 ) 290 all_memories = future_memories.result() --> 291 graph_entities = future_graph_entities.result() if future_graph_entities else None 293 if self.version == "v1.1": 294 if self.enable_graph:
File /opt/homebrew/Cellar/python@3.12/3.12.6/Frameworks/Python.framework/Versions/3.12/lib/python3.12/concurrent/futures/_base.py:456, in Future.result(self, timeout) 454 raise CancelledError() 455 elif self._state == FINISHED: --> 456 return self.__get_result() 457 else: 458 raise TimeoutError()
File /opt/homebrew/Cellar/python@3.12/3.12.6/Frameworks/Python.framework/Versions/3.12/lib/python3.12/concurrent/futures/_base.py:401, in Future.__get_result(self) 399 if self._exception: 400 try: --> 401 raise self._exception 402 finally: 403 # Break a reference cycle with the exception in self._exception 404 self = None
File /opt/homebrew/Cellar/python@3.12/3.12.6/Frameworks/Python.framework/Versions/3.12/lib/python3.12/concurrent/futures/thread.py:58, in _WorkItem.run(self) 55 return 57 try: ---> 58 result = self.fn(*self.args, **self.kwargs) 59 except BaseException as exc: 60 self.future.set_exception(exc)
File ~/dev/projects/Roga/code/AiResearch/venv/lib/python3.12/site-packages/mem0/memory/graph_memory.py:291, in MemoryGraph.get_all(self, filters) 286 # return all nodes and relationships 287 query = """ 288 MATCH (n {user_id: $user_id})-[r]->(m {user_id: $user_id}) 289 RETURN n.name AS source, type(r) AS relationship, m.name AS target 290 """ --> 291 results = self.graph.query(query, params={"user_id": filters["user_id"]}) 293 final_results = [] 294 for result in results:
KeyError: 'user_id'