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:
153
-
154
-
```bash
155
-
curl -fsSL https://ollama.com/install.sh | sh
156
-
```
157
-
158
-
#### Transformers Support
159
-
160
-
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).
161
-
162
-
#### Download Examples
123
+
### Get API Key
124
+
- Sign up and get started on[`MemOS dashboard`](https://memos-dashboard.openmem.net/cn/quickstart/?source=landing)
125
+
- Open the API Keys Console in the MemOS dashboard and copy the API Key into the initialization code
163
126
164
-
To download example code, data and configurations, run the following command:
165
-
166
-
```bash
167
-
memos download_examples
168
-
```
169
-
170
-
171
-
## 🚀 Getting Started
172
-
173
-
### ⭐️ MemOS online API
174
-
The easiest way to use MemOS. Equip your agent with memory **in minutes**!
175
-
176
-
Sign up and get started on[`MemOS dashboard`](https://memos-dashboard.openmem.net/cn/quickstart/?source=landing).
177
-
178
-
179
-
### Self-Hosted Server
180
-
1. Get the repository.
181
-
```bash
182
-
git clone https://github.com/MemTensor/MemOS.git
183
-
cd MemOS
184
-
pip install -r ./docker/requirements.txt
185
-
```
127
+
### Install via pip
186
128
187
-
2. Configure `docker/.env.example` and copy to `MemOS/.env`
#### Here is a quick example showing how to create all interface SDK
133
+
### Basic Usage
195
134
196
-
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.
135
+
- Initialize MemOS client with API Key to start sending requests
197
136
```python
198
137
# Please make sure MemoS is installed (pip install MemoryOS -U)
199
138
from memos.api.client import MemOSClient
200
139
201
140
# Initialize the client using the API Key
202
141
client = MemOSClient(api_key="YOUR_API_KEY")
142
+
```
203
143
144
+
- 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.
145
+
```python
204
146
messages = [
205
147
{"role": "user", "content": "I have planned to travel to Guangzhou during the summer vacation. What chain hotels are available for accommodation?"},
206
148
{"role": "assistant", "content": "You can consider [7 Days, All Seasons, Hilton], and so on."},
@@ -214,79 +156,90 @@ res = client.add_message(messages=messages, user_id=user_id, conversation_id=con
214
156
print(f"result: {res}")
215
157
```
216
158
217
-
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'.
159
+
- 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.
160
+
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.
218
161
```python
219
-
# Please make sure MemoS is installed (pip install MemoryOS -U)
220
-
from memos.api.client import MemOSClient
221
-
222
-
# Initialize the client using the API Key
223
-
client = MemOSClient(api_key="YOUR_API_KEY")
224
-
225
162
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?"
226
163
user_id ="memos_user_123"
227
-
conversation_id ="0928"
164
+
conversation_id ="0610"
228
165
res = client.search_memory(query=query, user_id=user_id, conversation_id=conversation_id)
229
166
230
167
print(f"result: {res}")
231
168
```
232
169
233
-
This interface is used to delete the memory of specified users and supports batch deletion.
234
-
```python
235
-
# Please make sure MemoS is installed (pip install MemoryOS -U)
res = client.delete_memory(user_ids=user_ids, memory_ids=memory_ids)
245
-
246
-
print(f"result: {res}")
247
-
```
248
-
249
-
This interface is used to add feedback to messages in the current session, allowing MemOS to correct its memory based on user feedback.
250
-
```python
251
-
# Please make sure MemoS is installed (pip install MemoryOS -U)
252
-
from memos.api.client import MemOSClient
253
-
254
-
# Initialize the client using the API Key
255
-
client = MemOSClient(api_key="YOUR_API_KEY")
256
-
257
-
user_id ="memos_user_123"
258
-
conversation_id ="memos_feedback_conv"
259
-
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."
knowledgebase_description ="A compilation of all knowledge related to the company's financial reimbursements."
171
+
### Self-Hosted Server
172
+
1. Get the repository.
173
+
```bash
174
+
git clone https://github.com/MemTensor/MemOS.git
175
+
cd MemOS
176
+
pip install -r ./docker/requirements.txt
177
+
```
178
+
2. Configure `docker/.env.example` and copy to `MemOS/.env`
179
+
- 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).
180
+
- Fill in the corresponding configuration in the `MemOS/.env` file.
###### Tips: Please ensure that Docker Compose is installed successfully and that you have navigated to the docker directory (via `cd docker`) before executing the following command.
185
+
```bash
186
+
# Enter docker directory
187
+
docker compose up
188
+
```
189
+
##### If you prefer to deploy using Docker, please refer to the [`Docker Reference`](https://docs.openmem.net/open_source/getting_started/rest_api_server/#method-1-docker-use-repository-dependency-package-imagestart-recommended-use).
190
+
191
+
- Launch via the uvicorn command line interface (CLI)
192
+
###### Tips: Please ensure that Neo4j and Qdrant are running before executing the following command.
##### For detailed integration steps, see the [`CLI Reference`](https://docs.openmem.net/open_source/getting_started/rest_api_server/#method-3client-install-with-CLI).
0 commit comments