mem0 icon indicating copy to clipboard operation
mem0 copied to clipboard

When following the official documentation, the following error will be reported.memgraph

Open Logan-web-cell opened this issue 7 months ago • 2 comments

🐛 Describe the bug

(mem0) C:\Users\lanwuding\Desktop\mem0_study>python mem.py Traceback (most recent call last): File "C:\Users\lanwuding\Desktop\mem0_study\mem.py", line 84, in asyncio.run(main()) File "D:\an\envs\mem0\lib\asyncio\runners.py", line 44, in run return loop.run_until_complete(main) File "D:\an\envs\mem0\lib\asyncio\base_events.py", line 649, in run_until_complete return future.result() File "C:\Users\lanwuding\Desktop\mem0_study\mem.py", line 55, in main m = AsyncMemory(config) File "D:\an\envs\mem0\lib\site-packages\mem0\memory\main.py", line 815, in init self.graph = MemoryGraph(self.config) File "D:\an\envs\mem0\lib\site-packages\mem0\memory\graph_memory.py", line 36, in init self.config.graph_store.config.database, File "D:\an\envs\mem0\lib\site-packages\pydantic\main.py", line 989, in getattr raise AttributeError(f'{type(self).name!r} object has no attribute {item!r}') AttributeError: 'MemgraphConfig' object has no attribute 'database'

Logan-web-cell avatar May 15 '25 03:05 Logan-web-cell

I can't understand the issue without the code. Can you post the code? (feel free to copy my code)

MisileLab avatar May 16 '25 12:05 MisileLab

What he means is that the AsyncMemory is missing the MemGraph implementation

AsyncMemory only uses mem0.memory.graph_memory

if self.config.graph_store.config:
            from mem0.memory.graph_memory import MemoryGraph

            self.graph = MemoryGraph(self.config)
            self.enable_graph = True

compare to normal Memory which does

if self.config.graph_store.config:
            if self.config.graph_store.provider == "memgraph":
                from mem0.memory.memgraph_memory import MemoryGraph
            else:
                from mem0.memory.graph_memory import MemoryGraph

            self.graph = MemoryGraph(self.config)
            self.enable_graph = True
        else:

That leads to AsyncMemory default to neo4j which then crashes because neo4j expects a "database" property.

Also the memgraph implementation is completely broken anyway because from langchain_memgraph import Memgraph does not work. langchain_memgraph doesn't expose a Memgraph object, and this project's pyproject.toml doesn't define a dependency on it to at least revert it to a working langchain_memgraph version.

https://python.langchain.com/docs/integrations/graphs/memgraph/

It needs to be from langchain_memgraph.graphs.memgraph import Memgraph

If it's ok I can do a PR because we fixed all of this already for use in our agent framework

AndreRatzenberger avatar May 20 '25 15:05 AndreRatzenberger

I am guessing this was not PR, as I just experienced the exact thing. @AndreRatzenberger Thanks for posting this.

rogerlam1 avatar Jul 16 '25 04:07 rogerlam1

Closing as this issues is fixed with the latest release.

parshvadaftari avatar Sep 11 '25 21:09 parshvadaftari