The Memory Layer for AI Agents - Drop-in memory infrastructure for AI agents and apps. Context that persists. Built for production.
Python agentic-memoryagentic-memory-systemagentsaiai-agentschatgptgenaillmlong-term-memorymemorymemory-managementpythonragstate-management
Graph memory docs update (#1786)
Prateek Chhikara9d0932971dd6
diff --git a/docs/components/llms/models/openai.mdx b/docs/components/llms/models/openai.mdxindex e65868493..2002baa49 100644--- a/docs/components/llms/models/openai.mdx+++ b/docs/components/llms/models/openai.mdx@@ -38,6 +38,29 @@ m = Memory.from_config(config)m.add("Likes to play cricket on weekends", user_id="alice", metadata={"category": "hobbies"})```+We also support the new [OpenAI structured-outputs](https://platform.openai.com/docs/guides/structured-outputs/introduction) model.++```python+import os+from mem0 import Memory++os.environ["OPENAI_API_KEY"] = "your-api-key"++config = {+ "llm": {+ "provider": "openai_structured",+ "config": {+ "model": "gpt-4o-2024-08-06",+ "temperature": 0.0,+ }+ }+}++m = Memory.from_config(config)+```+++## ConfigAll available parameters for the `openai` config are present in [Master List of All Params in Config](../config).\ No newline at end of filediff --git a/docs/mint.json b/docs/mint.jsonindex 7b5c47a69..93ea5cd75 100644--- a/docs/mint.json+++ b/docs/mint.json@@ -70,7 +70,10 @@"group": "Open Source","pages": ["open-source/quickstart",- "open-source/graph-memory",+ {+ "group": "Graph Memory",+ "pages": ["open-source/graph_memory/overview", "open-source/graph_memory/features"]+ },{"group": "LLMs","pages": [diff --git a/docs/open-source/graph_memory/features.mdx b/docs/open-source/graph_memory/features.mdxnew file mode 100644index 000000000..e865b7537--- /dev/null+++ b/docs/open-source/graph_memory/features.mdx@@ -0,0 +1,38 @@+---+title: Features+description: 'Graph Memory features'+---++Graph Memory is a powerful feature that allows users to create and utilize complex relationships between pieces of information.++## Graph Memory supports the following features:+A list of features provided by Graph Memory.++### Add Customize Prompt++Users can add a customized prompt that will be used to extract specific entities from the given input text.+This allows for more targeted and relevant information extraction based on the user's needs.+Here's an example of how to add a customized prompt:++```python+from mem0 import Memory++config = {+ "graph_store": {+ "provider": "neo4j",+ "config": {+ "url": "neo4j+s://xxx",+ "username": "neo4j",+ "password": "xxx"+ },+ "custom_prompt": "Please only extract entities containing sports related relationships and nothing else.",+ },+ "version": "v1.1"+}++m = Memory.from_config(config_dict=config)+```++If you want to use a managed version of Mem0, please check out [Mem0](https://app.mem0.ai). If you have any questions, please feel free to reach out to us using one of the following methods:++<Snippet file="get-help.mdx" />diff --git a/docs/open-source/graph-memory.mdx b/docs/open-source/graph_memory/overview.mdxsimilarity index 83%rename from docs/open-source/graph-memory.mdxrename to docs/open-source/graph_memory/overview.mdxindex aa060f6a7..9d53f666b 100644--- a/docs/open-source/graph-memory.mdx+++ b/docs/open-source/graph_memory/overview.mdx@@ -1,5 +1,5 @@----title: Graph Memory+title: Overviewdescription: 'Enhance your memory system with graph-based knowledge representation and retrieval'---@@ -28,9 +28,18 @@ allowfullscreenTo 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*).++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:++1. **Main Configuration**: If `llm` is set in the main config, it will be used for all graph operations.+2. **Graph Store Configuration**: If `llm` is set in the graph_store config, it will override the main config `llm` and be used specifically for graph operations.+3. **Default Configuration**: If no custom LLM is set, the default LLM (`gpt-4o-2024-08-06`) will be used for all graph operations.+Here's how you can do it:-```python++<CodeGroup>+```python Basicfrom mem0 import Memoryconfig = {@@ -48,6 +57,40 @@ config = {m = Memory.from_config(config_dict=config)```+```python Advanced (Custom LLM)+from mem0 import Memory++config = {+ "llm": {+ "provider": "openai",+ "config": {+ "model": "gpt-4o",+ "temperature": 0.2,+ "max_tokens": 1500,+ }+ },+ "graph_store": {+ "provider": "neo4j",+ "config": {+ "url": "neo4j+s://xxx",+ "username": "neo4j",+ "password": "xxx"+ },+ "llm" : {+ "provider": "openai",+ "config": {+ "model": "gpt-4o-mini",+ "temperature": 0.0,+ }+ }+ },+ "version": "v1.1"+}++m = Memory.from_config(config_dict=config)+```+</CodeGroup>+## Graph OperationsThe Mem0's graph supports the following operations: