Skip to content

Commit a1746fb

Browse files
zZhangSirglin93
andauthored
fix: update README.md (#774)
Co-authored-by: Zehao Lin <[email protected]>
1 parent b27bead commit a1746fb

File tree

1 file changed

+78
-51
lines changed

1 file changed

+78
-51
lines changed

README.md

Lines changed: 78 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
MemOS is an open-source **Agent Memory framework** that empowers AI agents with **long-term memory, personality consistency, and contextual recall**. It enables agents to **remember past interactions**, **learn over time**, and **build evolving identities** across sessions.
44

55
Designed for **AI companions, role-playing NPCs, and multi-agent systems**, MemOS provides a unified API for **memory representation, retrieval, and update** — making it the foundation for next-generation **memory-augmented AI agents**.
6-
7-
🆕 **MemOS 2.0** introduces **knowledge base system**, **multi-modal memory** (images & documents), **tool memory** for Agent optimization, **memory feedback mechanism** for precise control, and **enterprise-grade architecture** with Redis Streams scheduler and advanced DB optimizations.
86
<div align="center">
97
<a href="https://memos.openmem.net/">
108
<img src="https://statics.memtensor.com.cn/memos/memos-banner.gif" alt="MemOS Banner">
@@ -117,19 +115,7 @@ showcasing its capabilities in **information extraction**, **temporal and cross-
117115
- **Textual Memory**: For storing and retrieving unstructured or structured text knowledge.
118116
- **Activation Memory**: Caches key-value pairs (`KVCacheMemory`) to accelerate LLM inference and context reuse.
119117
- **Parametric Memory**: Stores model adaptation parameters (e.g., LoRA weights).
120-
- **Tool Memory** 🆕: Records Agent tool call trajectories and experiences to improve planning capabilities.
121-
- **📚 Knowledge Base System** 🆕: Build multi-dimensional knowledge bases with automatic document/URL parsing, splitting, and cross-project sharing capabilities.
122-
- **🔧 Memory Controllability** 🆕:
123-
- **Feedback Mechanism**: Use `add_feedback` API to correct, supplement, or replace existing memories with natural language.
124-
- **Precise Deletion**: Delete specific memories by User ID or Memory ID via API or MCP tools.
125-
- **👁️ Multi-Modal Support** 🆕: Support for image understanding and memory, including chart parsing in documents.
126-
- **⚡ Advanced Architecture**:
127-
- **DB Optimization**: Enhanced connection management and batch insertion for high-concurrency scenarios.
128-
- **Advanced Retrieval**: Custom tag and info field filtering with complex logical operations.
129-
- **Redis Streams Scheduler**: Multi-level queue architecture with intelligent orchestration for fair multi-tenant scheduling.
130-
- **Stream & Non-Stream Chat**: Ready-to-use streaming and non-streaming chat interfaces.
131118
- **🔌 Extensible**: Easily extend and customize memory modules, data sources, and LLM integrations.
132-
- **🏂 Lightweight Deployment** 🆕: Support for quick mode and complete mode deployment options.
133119

134120
## 🚀 Getting Started
135121

@@ -153,62 +139,103 @@ pip install -r ./docker/requirements.txt
153139
uvicorn memos.api.server_api:app --host 0.0.0.0 --port 8001 --workers 8
154140
```
155141

156-
### Local SDK
157-
Here's a quick example of how to create a **`MemCube`**, load it from a directory, access its memories, and save it.
142+
### Interface SDK
143+
#### Here is a quick example showing how to create all interface SDK
158144

145+
This interface is used to add messages, supporting multiple types of content and batch additions. MemOS will automatically parse the messages and handle memory for reference in subsequent conversations.
159146
```python
160-
from memos.mem_cube.general import GeneralMemCube
147+
# Please make sure MemoS is installed (pip install MemoryOS -U)
148+
from memos.api.client import MemOSClient
149+
150+
# Initialize the client using the API Key
151+
client = MemOSClient(api_key="YOUR_API_KEY")
152+
153+
messages = [
154+
{"role": "user", "content": "I have planned to travel to Guangzhou during the summer vacation. What chain hotels are available for accommodation?"},
155+
{"role": "assistant", "content": "You can consider [7 Days, All Seasons, Hilton], and so on."},
156+
{"role": "user", "content": "I'll choose 7 Days"},
157+
{"role": "assistant", "content": "Okay, ask me if you have any other questions."}
158+
]
159+
user_id = "memos_user_123"
160+
conversation_id = "0610"
161+
res = client.add_message(messages=messages, user_id=user_id, conversation_id=conversation_id)
162+
163+
print(f"result: {res}")
164+
```
161165

162-
# Initialize a MemCube from a local directory
163-
mem_cube = GeneralMemCube.init_from_dir("examples/data/mem_cube_2")
166+
This interface is used to retrieve the memories of a specified user, returning the memory fragments most relevant to the input query for Agent use. The recalled memory fragments include 'factual memory', 'preference memory', and 'tool memory'.
167+
```python
168+
# Please make sure MemoS is installed (pip install MemoryOS -U)
169+
from memos.api.client import MemOSClient
164170

165-
# Access and print all memories
166-
print("--- Textual Memories ---")
167-
for item in mem_cube.text_mem.get_all():
168-
print(item)
171+
# Initialize the client using the API Key
172+
client = MemOSClient(api_key="YOUR_API_KEY")
169173

170-
print("\n--- Activation Memories ---")
171-
for item in mem_cube.act_mem.get_all():
172-
print(item)
174+
query = "I want to go out to play during National Day. Can you recommend a city I haven't been to and a hotel brand I haven't stayed at?"
175+
user_id = "memos_user_123"
176+
conversation_id = "0928"
177+
res = client.search_memory(query=query, user_id=user_id, conversation_id=conversation_id)
173178

174-
# Save the MemCube to a new directory
175-
mem_cube.dump("tmp/mem_cube")
179+
print(f"result: {res}")
176180
```
177181

178-
**`MOS`** (Memory Operating System) is a higher-level orchestration layer that manages multiple MemCubes and provides a unified API for memory operations. Here's a quick example of how to use MOS:
179-
182+
This interface is used to delete the memory of specified users and supports batch deletion.
180183
```python
181-
from memos.configs.mem_os import MOSConfig
182-
from memos.mem_os.main import MOS
184+
# Please make sure MemoS is installed (pip install MemoryOS -U)
185+
from memos.api.client import MemOSClient
183186

187+
# Initialize the client using the API Key
188+
client = MemOSClient(api_key="YOUR_API_KEY")
189+
190+
user_ids = ["memos_user_123"]
191+
# Replace with the memory ID
192+
memory_ids = ["6b23b583-f4c4-4a8f-b345-58d0c48fea04"]
193+
res = client.delete_memory(user_ids=user_ids, memory_ids=memory_ids)
194+
195+
print(f"result: {res}")
196+
```
184197

185-
# init MOS
186-
mos_config = MOSConfig.from_json_file("examples/data/config/simple_memos_config.json")
187-
memory = MOS(mos_config)
198+
This interface is used to add feedback to messages in the current session, allowing MemOS to correct its memory based on user feedback.
199+
```python
200+
# Please make sure MemoS is installed (pip install MemoryOS -U)
201+
from memos.api.client import MemOSClient
188202

189-
# create user
190-
user_id = "b41a34d5-5cae-4b46-8c49-d03794d206f5"
191-
memory.create_user(user_id=user_id)
203+
# Initialize the client using the API Key
204+
client = MemOSClient(api_key="YOUR_API_KEY")
192205

193-
# register cube for user
194-
memory.register_mem_cube("examples/data/mem_cube_2", user_id=user_id)
206+
user_id = "memos_user_123"
207+
conversation_id = "memos_feedback_conv"
208+
feedback_content = "No, let's change it now to a meal allowance of 150 yuan per day and a lodging subsidy of 700 yuan per day for first-tier cities; for second- and third-tier cities, it remains the same as before."
209+
# Replace with the knowledgebase ID
210+
allow_knowledgebase_ids = ["basee5ec9050-c964-484f-abf1-ce3e8e2aa5b7"]
195211

196-
# add memory for user
197-
memory.add(
198-
messages=[
199-
{"role": "user", "content": "I like playing football."},
200-
{"role": "assistant", "content": "I like playing football too."},
201-
],
212+
res = client.add_feedback(
202213
user_id=user_id,
214+
conversation_id=conversation_id,
215+
feedback_content=feedback_content,
216+
allow_knowledgebase_ids=allow_knowledgebase_ids
203217
)
204218

205-
# Later, when you want to retrieve memory for user
206-
retrieved_memories = memory.search(query="What do you like?", user_id=user_id)
207-
# output text_memories: I like playing football, act_memories, para_memories
208-
print(f"text_memories: {retrieved_memories['text_mem']}")
219+
print(f"result: {res}")
209220
```
210221

211-
For more detailed examples, please check out the [`examples`](./examples) directory.
222+
This interface is used to create a knowledgebase associated with a project
223+
```python
224+
# Please make sure MemoS is installed (pip install MemoryOS -U)
225+
from memos.api.client import MemOSClient
226+
227+
# Initialize the client using the API Key
228+
client = MemOSClient(api_key="YOUR_API_KEY")
229+
230+
knowledgebase_name = "Financial Reimbursement Knowledge Base"
231+
knowledgebase_description = "A compilation of all knowledge related to the company's financial reimbursements."
232+
233+
res = client.create_knowledgebase(
234+
knowledgebase_name=knowledgebase_name,
235+
knowledgebase_description=knowledgebase_description
236+
)
237+
print(f"result: {res}")
238+
```
212239

213240
## 📦 Installation
214241

0 commit comments

Comments
 (0)