You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To use MemOS with [Ollama](https://ollama.com/), first install the Ollama CLI:
166
-
167
-
```bash
168
-
curl -fsSL https://ollama.com/install.sh | sh
169
-
```
170
-
171
-
#### Transformers Support
172
-
173
-
To use functionalities based on the `transformers` library, ensure you have [PyTorch](https://pytorch.org/get-started/locally/) installed (CUDA version recommended for GPU acceleration).
174
-
175
-
#### Download Examples
135
+
## 🚀 Quickstart Guide
176
136
177
-
To download example code, data and configurations, run the following command:
137
+
### Get API Key
138
+
- Sign up and get started on[`MemOS dashboard`](https://memos-dashboard.openmem.net/cn/quickstart/?source=landing)
139
+
- Open the API Keys Console in the MemOS dashboard and copy the API Key into the initialization code
178
140
179
-
```bash
180
-
memos download_examples
181
-
```
182
-
183
-
## 🚀 Getting Started
184
-
185
-
### ⭐️ MemOS online API
186
-
The easiest way to use MemOS. Equip your agent with memory **in minutes**!
187
-
188
-
Sign up and get started on[`MemOS dashboard`](https://memos-dashboard.openmem.net/cn/quickstart/?source=landing).
189
-
190
-
191
-
### Self-Hosted Server
192
-
1. Get the repository.
193
-
```bash
194
-
git clone https://github.com/MemTensor/MemOS.git
195
-
cd MemOS
196
-
pip install -r ./docker/requirements.txt
197
-
```
141
+
### Install via pip
198
142
199
-
2. Configure `docker/.env.example` and copy to `MemOS/.env`
#### Here is a quick example showing how to create interface SDK
147
+
### Basic Usage
207
148
208
-
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.
149
+
- Initialize MemOS client with API Key to start sending requests
209
150
```python
210
151
# Please make sure MemoS is installed (pip install MemoryOS -U)
211
152
from memos.api.client import MemOSClient
212
153
213
154
# Initialize the client using the API Key
214
155
client = MemOSClient(api_key="YOUR_API_KEY")
156
+
```
215
157
158
+
- This API allows you to add one or more messages to a specific conversation. As illustrated in the examples bellow, you can add messages in real time during a user-assistant interaction, import historical messages in bulk, or enrich the conversation with user preferences and behavior data. All added messages are transformed into memories by MemOS, enabling their retrieval in future conversations to support chat history management, user behavior tracking, and personalized interactions.
159
+
```python
216
160
messages = [
217
161
{"role": "user", "content": "I have planned to travel to Guangzhou during the summer vacation. What chain hotels are available for accommodation?"},
218
162
{"role": "assistant", "content": "You can consider [7 Days, All Seasons, Hilton], and so on."},
@@ -226,30 +170,19 @@ res = client.add_message(messages=messages, user_id=user_id, conversation_id=con
226
170
print(f"result: {res}")
227
171
```
228
172
229
-
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'.
173
+
- This API allows you to query a user’s memory and returns the fragments most relevant to the input. These can serve as references for the model when generating responses. As shown in the examples bellow, You can retrieve memory in real time during a user’s conversation with the AI, or perform a global search across their entire memory to create user profiles or support personalized recommendations, improving both dialogue coherence and personalization.
174
+
In the latest update, in addition to “Fact Memory”, the system now supports “Preference Memory”, enabling LLM to respond in a way that better understands the user.
230
175
```python
231
-
# Please make sure MemoS is installed (pip install MemoryOS -U)
232
-
from memos.api.client import MemOSClient
233
-
234
-
# Initialize the client using the API Key
235
-
client = MemOSClient(api_key="YOUR_API_KEY")
236
-
237
176
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?"
238
177
user_id ="memos_user_123"
239
-
conversation_id ="0928"
178
+
conversation_id ="0610"
240
179
res = client.search_memory(query=query, user_id=user_id, conversation_id=conversation_id)
241
180
242
181
print(f"result: {res}")
243
182
```
244
183
245
-
This interface is used to delete the memory of specified users and supports batch deletion.
184
+
-This API is used to delete specified user memories, supporting batch deletion.
246
185
```python
247
-
# Please make sure MemoS is installed (pip install MemoryOS -U)
@@ -258,14 +191,8 @@ res = client.delete_memory(user_ids=user_ids, memory_ids=memory_ids)
258
191
print(f"result: {res}")
259
192
```
260
193
261
-
This interface is used to add feedback to messages in the current session, allowing MemOS to correct its memory based on user feedback.
194
+
-This API is used to add feedback to current session messages, allowing MemOS to correct memories based on user feedback.
262
195
```python
263
-
# Please make sure MemoS is installed (pip install MemoryOS -U)
264
-
from memos.api.client import MemOSClient
265
-
266
-
# Initialize the client using the API Key
267
-
client = MemOSClient(api_key="YOUR_API_KEY")
268
-
269
196
user_id ="memos_user_123"
270
197
conversation_id ="memos_feedback_conv"
271
198
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."
@@ -282,14 +209,8 @@ res = client.add_feedback(
282
209
print(f"result: {res}")
283
210
```
284
211
285
-
This interface is used to create a knowledgebase associated with a project
212
+
-This API is used to create a knowledgebase associated with a project
286
213
```python
287
-
# Please make sure MemoS is installed (pip install MemoryOS -U)
knowledgebase_description ="A compilation of all knowledge related to the company's financial reimbursements."
295
216
@@ -300,6 +221,49 @@ res = client.create_knowledgebase(
300
221
print(f"result: {res}")
301
222
```
302
223
224
+
### Self-Hosted Server
225
+
1. Get the repository.
226
+
```bash
227
+
git clone https://github.com/MemTensor/MemOS.git
228
+
cd MemOS
229
+
pip install -r ./docker/requirements.txt
230
+
```
231
+
2. Configure `docker/.env.example` and copy to `MemOS/.env`
232
+
- The `OPENAI_API_KEY`,`MOS_EMBEDDER_API_KEY`,`MEMRADER_API_KEY` and others can be applied for through [`BaiLian`](https://bailian.console.aliyun.com/?spm=a2c4g.11186623.0.0.2f2165b08fRk4l&tab=api#/api).
233
+
- Fill in the corresponding configuration in the `MemOS/.env` file.
For detailed integration steps, see the [`API Reference`](https://docs-pre.openmem.net/cn/open_source/getting_started/rest_api_server/#fork-memos-%E4%BB%93%E5%BA%93%E4%BB%A3%E7%A0%81httpsgithubcommemtensormemos-%E5%88%B0%E8%87%AA%E5%B7%B1%E7%9A%84%E4%BB%93%E5%BA%93).
240
+
241
+
Example
242
+
- Add User Memory http://localhost:8000/product/add (POST)
0 commit comments