From 8c3c9e1520c141e3465e9e4358c49dda71388959 Mon Sep 17 00:00:00 2001
From: Prateek Chhikara <46902268+prateekchhikara@users.noreply.github.com>
Date: Tue, 17 Sep 2024 10:53:14 -0700
Subject: [PATCH] Docs update (#1875)
---
docs/open-source/graph_memory/overview.mdx | 9 ++++++---
mem0/configs/vector_stores/chroma.py | 2 +-
mem0/memory/graph_memory.py | 21 +++++++++++++--------
mem0/memory/telemetry.py | 4 +++-
mem0/vector_stores/qdrant.py | 13 ++++++++++---
5 files changed, 33 insertions(+), 16 deletions(-)
diff --git a/docs/open-source/graph_memory/overview.mdx b/docs/open-source/graph_memory/overview.mdx
index 75bf94bf..a6593861 100644
--- a/docs/open-source/graph_memory/overview.mdx
+++ b/docs/open-source/graph_memory/overview.mdx
@@ -3,11 +3,11 @@ title: Overview
description: 'Enhance your memory system with graph-based knowledge representation and retrieval'
---
-Mem0 now supports **Graph Memory**.
+Mem0 now supports **Graph Memory**.
With Graph Memory, users can now create and utilize complex relationships between pieces of information, allowing for more nuanced and context-aware responses.
This integration enables users to leverage the strengths of both vector-based and graph-based approaches, resulting in more accurate and comprehensive information retrieval and generation.
-Try Graph Memory on Google Colab.
+Try Graph Memory on Google Colab.
@@ -27,7 +27,10 @@ allowfullscreen
To initialize Graph Memory you'll need to set up your configuration with graph store providers.
Currently, we support Neo4j as a graph store provider. You can setup [Neo4j](https://neo4j.com/) locally or use the hosted [Neo4j AuraDB](https://neo4j.com/product/auradb/).
-Moreover, you also need to set the version to `v1.1` (*prior versions are not supported*).
+Moreover, you also need to set the version to `v1.1` (*prior versions are not supported*).
+
+If you are using Neo4j locally, then you need to install [APOC plugins](https://neo4j.com/labs/apoc/4.1/installation/).
+
User can also customize the LLM for Graph Memory from the [Supported LLM list](https://docs.mem0.ai/components/llms/overview) with three levels of configuration:
diff --git a/mem0/configs/vector_stores/chroma.py b/mem0/configs/vector_stores/chroma.py
index 1b0ef4e3..afff8a8f 100644
--- a/mem0/configs/vector_stores/chroma.py
+++ b/mem0/configs/vector_stores/chroma.py
@@ -9,7 +9,7 @@ class ChromaDbConfig(BaseModel):
try:
from chromadb.api.client import Client
except ImportError:
- raise ImportError("The 'chromadb' library is required. Please install it using 'pip install chromadb'.")
+ raise ImportError("The 'chromadb' library is required. Please install it using 'pip install chromadb'.")
Client: ClassVar[type] = Client
collection_name: str = Field("mem0", description="Default name for the collection")
diff --git a/mem0/memory/graph_memory.py b/mem0/memory/graph_memory.py
index 13020f07..c14db70b 100644
--- a/mem0/memory/graph_memory.py
+++ b/mem0/memory/graph_memory.py
@@ -3,14 +3,19 @@ import logging
from langchain_community.graphs import Neo4jGraph
from rank_bm25 import BM25Okapi
-from mem0.graphs.tools import (ADD_MEMORY_STRUCT_TOOL_GRAPH,
- ADD_MEMORY_TOOL_GRAPH, ADD_MESSAGE_STRUCT_TOOL,
- ADD_MESSAGE_TOOL, NOOP_STRUCT_TOOL, NOOP_TOOL,
- SEARCH_STRUCT_TOOL, SEARCH_TOOL,
- UPDATE_MEMORY_STRUCT_TOOL_GRAPH,
- UPDATE_MEMORY_TOOL_GRAPH)
-from mem0.graphs.utils import (EXTRACT_ENTITIES_PROMPT,
- get_update_memory_messages)
+from mem0.graphs.tools import (
+ ADD_MEMORY_STRUCT_TOOL_GRAPH,
+ ADD_MEMORY_TOOL_GRAPH,
+ ADD_MESSAGE_STRUCT_TOOL,
+ ADD_MESSAGE_TOOL,
+ NOOP_STRUCT_TOOL,
+ NOOP_TOOL,
+ SEARCH_STRUCT_TOOL,
+ SEARCH_TOOL,
+ UPDATE_MEMORY_STRUCT_TOOL_GRAPH,
+ UPDATE_MEMORY_TOOL_GRAPH,
+)
+from mem0.graphs.utils import EXTRACT_ENTITIES_PROMPT, get_update_memory_messages
from mem0.utils.factory import EmbedderFactory, LlmFactory
logger = logging.getLogger(__name__)
diff --git a/mem0/memory/telemetry.py b/mem0/memory/telemetry.py
index 5cab2b1f..6865b2fe 100644
--- a/mem0/memory/telemetry.py
+++ b/mem0/memory/telemetry.py
@@ -63,7 +63,9 @@ def capture_event(event_name, memory_instance, additional_data=None):
"collection": memory_instance.collection_name,
"vector_size": memory_instance.embedding_model.config.embedding_dims,
"history_store": "sqlite",
- "graph_store": f"{memory_instance.graph.__class__.__module__}.{memory_instance.graph.__class__.__name__}" if memory_instance.config.graph_store.config else None,
+ "graph_store": f"{memory_instance.graph.__class__.__module__}.{memory_instance.graph.__class__.__name__}"
+ if memory_instance.config.graph_store.config
+ else None,
"vector_store": f"{memory_instance.vector_store.__class__.__module__}.{memory_instance.vector_store.__class__.__name__}",
"llm": f"{memory_instance.llm.__class__.__module__}.{memory_instance.llm.__class__.__name__}",
"embedding_model": f"{memory_instance.embedding_model.__class__.__module__}.{memory_instance.embedding_model.__class__.__name__}",
diff --git a/mem0/vector_stores/qdrant.py b/mem0/vector_stores/qdrant.py
index 0afcb6c4..708bf4fb 100644
--- a/mem0/vector_stores/qdrant.py
+++ b/mem0/vector_stores/qdrant.py
@@ -3,9 +3,16 @@ import os
import shutil
from qdrant_client import QdrantClient
-from qdrant_client.models import (Distance, FieldCondition, Filter, MatchValue,
- PointIdsList, PointStruct, Range,
- VectorParams)
+from qdrant_client.models import (
+ Distance,
+ FieldCondition,
+ Filter,
+ MatchValue,
+ PointIdsList,
+ PointStruct,
+ Range,
+ VectorParams,
+)
from mem0.vector_stores.base import VectorStoreBase