Docs update (#1875)

This commit is contained in:
Prateek Chhikara
2024-09-17 10:53:14 -07:00
committed by GitHub
parent 55c54beeab
commit 8c3c9e1520
5 changed files with 33 additions and 16 deletions

View File

@@ -3,11 +3,11 @@ title: Overview
description: 'Enhance your memory system with graph-based knowledge representation and retrieval' 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. 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. 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.
<a target="_blank" href="https://colab.research.google.com/drive/1PfIGVHnliIlG2v8cx0g45TF0US-jRPZ1?usp=sharing"> <a target="_blank" href="https://colab.research.google.com/drive/1PfIGVHnliIlG2v8cx0g45TF0US-jRPZ1?usp=sharing">
<img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/> <img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/>
</a> </a>
@@ -27,7 +27,10 @@ allowfullscreen
To initialize Graph Memory you'll need to set up your configuration with graph store providers. 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/). 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*).
<Note>If you are using Neo4j locally, then you need to install [APOC plugins](https://neo4j.com/labs/apoc/4.1/installation/).</Note>
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: 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:

View File

@@ -9,7 +9,7 @@ class ChromaDbConfig(BaseModel):
try: try:
from chromadb.api.client import Client from chromadb.api.client import Client
except ImportError: 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 Client: ClassVar[type] = Client
collection_name: str = Field("mem0", description="Default name for the collection") collection_name: str = Field("mem0", description="Default name for the collection")

View File

@@ -3,14 +3,19 @@ import logging
from langchain_community.graphs import Neo4jGraph from langchain_community.graphs import Neo4jGraph
from rank_bm25 import BM25Okapi from rank_bm25 import BM25Okapi
from mem0.graphs.tools import (ADD_MEMORY_STRUCT_TOOL_GRAPH, from mem0.graphs.tools import (
ADD_MEMORY_TOOL_GRAPH, ADD_MESSAGE_STRUCT_TOOL, ADD_MEMORY_STRUCT_TOOL_GRAPH,
ADD_MESSAGE_TOOL, NOOP_STRUCT_TOOL, NOOP_TOOL, ADD_MEMORY_TOOL_GRAPH,
SEARCH_STRUCT_TOOL, SEARCH_TOOL, ADD_MESSAGE_STRUCT_TOOL,
UPDATE_MEMORY_STRUCT_TOOL_GRAPH, ADD_MESSAGE_TOOL,
UPDATE_MEMORY_TOOL_GRAPH) NOOP_STRUCT_TOOL,
from mem0.graphs.utils import (EXTRACT_ENTITIES_PROMPT, NOOP_TOOL,
get_update_memory_messages) 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 from mem0.utils.factory import EmbedderFactory, LlmFactory
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View File

@@ -63,7 +63,9 @@ def capture_event(event_name, memory_instance, additional_data=None):
"collection": memory_instance.collection_name, "collection": memory_instance.collection_name,
"vector_size": memory_instance.embedding_model.config.embedding_dims, "vector_size": memory_instance.embedding_model.config.embedding_dims,
"history_store": "sqlite", "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__}", "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__}", "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__}", "embedding_model": f"{memory_instance.embedding_model.__class__.__module__}.{memory_instance.embedding_model.__class__.__name__}",

View File

@@ -3,9 +3,16 @@ import os
import shutil import shutil
from qdrant_client import QdrantClient from qdrant_client import QdrantClient
from qdrant_client.models import (Distance, FieldCondition, Filter, MatchValue, from qdrant_client.models import (
PointIdsList, PointStruct, Range, Distance,
VectorParams) FieldCondition,
Filter,
MatchValue,
PointIdsList,
PointStruct,
Range,
VectorParams,
)
from mem0.vector_stores.base import VectorStoreBase from mem0.vector_stores.base import VectorStoreBase