Skip to content

Commit b91ce7d

Browse files
authored
Merge pull request #383 from antalike/fix-0206
docs: fix YAML multiline string formatting for `desc` fields
2 parents e02e88c + ab390ee commit b91ce7d

File tree

2 files changed

+32
-26
lines changed

2 files changed

+32
-26
lines changed

content/cn/open_source/modules/memories/tree_textual_memory.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
---
22
title: "TreeTextMemory: 树形明文记忆"
3-
desc: "让我们在MemOS中构建你的第一个**基于图的、树形明文记忆**!
4-
5-
**TreeTextMemory** 支持以结构化方式组织、关联并检索记忆,同时保留丰富的上下文信息与良好的可解释性。
6-
7-
MemOS当前使用[Neo4j](/open_source/modules/memories/neo4j_graph_db)作为后端,未来计划支持更多图数据库。"
3+
desc: >
4+
让我们在MemOS中构建你的第一个**基于图的、树形明文记忆**!
5+
<br>
6+
**TreeTextMemory** 支持以结构化方式组织、关联并检索记忆,同时保留丰富的上下文信息与良好的可解释性。
7+
<br>
8+
MemOS当前使用[Neo4j](/open_source/modules/memories/neo4j_graph_db)作为后端,未来计划支持更多图数据库。
89
---
910

1011

@@ -320,7 +321,7 @@ print(f"✓ 已从混合内容提取并添加 {len(mixed_memories)} 条记忆")
320321
- **上下文保持**:使用滑动窗口保持分块间的上下文连续性
321322
::
322323

323-
::注意
324+
::note
324325
**配置提示**<br>
325326
- 使用 `direct_markdown_hostnames` 参数可以指定哪些域名直接返回 Markdown 格式<br>
326327
- 支持 `mode="fast"``mode="fine"` 两种提取模式,fine 模式提取更详细<br>

content/en/open_source/modules/memories/tree_textual_memory.md

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
---
2-
title: "TreeTextMemory: Structured Hierarchical Textual Memory"
3-
desc: "Let’s build your first **graph-based, tree-structured memory** in MemOS!
4-
5-
**TreeTextMemory** helps you organize, link, and retrieve memories with rich context and explainability.
6-
7-
[Neo4j](/open_source/modules/memories/neo4j_graph_db) is the current backend, with support for additional graph stores planned in the future."
2+
title: "TreeTextMemory: Tree-Structured Plain Text Memory"
3+
desc: >
4+
Let's build your first **graph-based, tree-structured plain text memory** in MemOS!
5+
<br>
6+
**TreeTextMemory** supports organizing, associating, and retrieving memories in a structured way while preserving rich contextual information and good interpretability.
7+
<br>
8+
MemOS currently uses [Neo4j](/open_source/modules/memories/neo4j_graph_db) as the backend, with plans to support more graph databases in the future.
89
---
910

10-
1111
## Table of Contents
1212

1313
- [What You’ll Learn](#what-youll-learn)
@@ -31,6 +31,7 @@ desc: "Let’s build your first **graph-based, tree-structured memory** in MemOS
3131
## What You’ll Learn
3232

3333
By the end of this guide, you will:
34+
3435
- Extract structured memories from raw text or conversations.
3536
- Store them as **nodes** in a graph database.
3637
- Link memories into **hierarchies** and semantic graphs.
@@ -41,6 +42,7 @@ By the end of this guide, you will:
4142
### Memory Structure
4243

4344
Every node in your `TreeTextMemory` is a `TextualMemoryItem`:
45+
4446
- `id`: Unique memory ID (auto-generated if omitted).
4547
- `memory`: the main text.
4648
- `metadata`: includes hierarchy info, embeddings, tags, entities, source, and status.
@@ -63,7 +65,6 @@ Every node in your `TreeTextMemory` is a `TextualMemoryItem`:
6365
| `usage` | `list[str]` | Usage history |
6466
| `background` | `str` | Additional context |
6567

66-
6768
::note
6869
**Best Practice**<br>
6970
Use meaningful tags and background — they help organize your graph for
@@ -76,16 +77,12 @@ When you run this example, your workflow will:
7677

7778
1. **Extract:** Use an LLM to pull structured memories from raw text.
7879

79-
8080
2. **Embed:** Generate vector embeddings for similarity search.
8181

82-
8382
3. **Store & Link:** Add nodes to your graph database (Neo4j) with relationships.
8483

85-
8684
4. **Search:** Query by vector similarity, then expand results by graph hops.
8785

88-
8986
::note
9087
**Hint**<br>Graph links help retrieve context that pure vector search might miss!
9188
::
@@ -133,7 +130,9 @@ This file contains a JSON structure with `nodes` and `edges`. It can be reloaded
133130
::steps{}
134131

135132
### Create TreeTextMemory Config
133+
136134
Define:
135+
137136
- your embedder (to create vectors),
138137
- your graph DB backend (Neo4j),
139138
- and your extractor LLM (optional).
@@ -144,7 +143,6 @@ from memos.configs.memory import TreeTextMemoryConfig
144143
config = TreeTextMemoryConfig.from_json_file("examples/data/config/tree_config.json")
145144
```
146145

147-
148146
### Initialize TreeTextMemory
149147

150148
```python
@@ -311,23 +309,27 @@ print(f"✓ Extracted and added {len(mixed_memories)} memories from mixed conten
311309

312310
::note
313311
**MultiModal Reader Advantages**<br>
312+
314313
- **Smart Routing**: Automatically identifies content type (image/URL/file) and selects appropriate parser<br>
314+
315315
- **Format Support**: Supports PDF, DOCX, Markdown, HTML, images, and more<br>
316316
- **URL Parsing**: Automatically extracts web content (including GitHub, documentation sites, etc.)<br>
317317
- **Large File Handling**: Automatically chunks oversized files to avoid token limits<br>
318318
- **Context Preservation**: Uses sliding window to maintain context continuity between chunks
319319
::
320-
321320
::note
322321
**Configuration Tips**<br>
323-
- Use the `direct_markdown_hostnames` parameter to specify which domains should return Markdown format<br>
322+
323+
::note
324+
**Configuration Tip**<br>
325+
324326
- Supports both `mode="fast"` and `mode="fine"` extraction modes; fine mode extracts more details<br>
325327
- See complete examples: `/examples/mem_reader/multimodal_struct_reader.py`
326328
::
327-
328329
### Search Memories
329330

330331
Try a vector + graph search:
332+
331333
```python
332334
results = tree_memory.search("Talk about the garden", top_k=5)
333335
for i, node in enumerate(results):
@@ -393,10 +395,10 @@ Alternatively, you can configure the `internet_retriever` field directly in the
393395

394396
With this setup, when you call `tree_memory.search(query)`, the system will automatically trigger an internet search (via BochaAI, Google, or Bing), and merge the results with local memory nodes in a unified ranked list — no need to manually call `retriever.retrieve_from_internet`.
395397

396-
397398
### Replace Working Memory
398399

399400
Replace your current `WorkingMemory` nodes with new ones:
401+
400402
```python
401403
tree_memory.replace_working_memory(
402404
[{
@@ -407,15 +409,16 @@ tree_memory.replace_working_memory(
407409
```
408410

409411
### Backup & Restore
412+
410413
Dump your entire tree structure to disk and reload anytime:
414+
411415
```python
412416
tree_memory.dump("tmp/tree_memories")
413417
tree_memory.load("tmp/tree_memories")
414418
```
415419

416420
::
417421

418-
419422
### Full Code Example
420423

421424
This combines all the steps above into one end-to-end example — copy & run!
@@ -489,12 +492,12 @@ my_tree_textual_memory.drop()
489492

490493
- **Structured Hierarchy:** Organize memories like a mind map — nodes can
491494
have parents, children, and cross-links.
495+
492496
- **Graph-Style Linking:** Beyond pure hierarchy — build multi-hop reasoning
493497
chains.
494498
- **Semantic Search + Graph Expansion:** Combine the best of vectors and
495499
graphs.
496500
- **Explainability:** Trace how memories connect, merge, or evolve over time.
497-
498501
::note
499502
**Try This**<br>Add memory nodes from documents or web content. Link them
500503
manually or auto-merge similar nodes!
@@ -504,11 +507,13 @@ manually or auto-merge similar nodes!
504507

505508
- **Know more about [Neo4j](/open_source/modules/memories/neo4j_graph_db):** TreeTextMemory is powered by a graph database backend.
506509
Understanding how Neo4j handles nodes, edges, and traversal will help you design more efficient memory hierarchies, multi-hop reasoning, and context linking strategies.
510+
507511
- **Add [Activation Memory](/open_source/modules/memories/kv_cache_memory):**
508512
Experiment with
509513
runtime KV-cache for session
510514
state.
511515
- **Explore Graph Reasoning:** Build workflows for multi-hop retrieval and answer synthesis.
512516
- **Go Deep:** Check the [API Reference](/api-reference/search-memories) for advanced usage, or run more examples in `examples/`.
513-
514517
Now your agent remembers not just facts — but the connections between them!
518+
519+
Now your Agent can not only remember facts but also the connections between them!

0 commit comments

Comments
 (0)