Skip to content

Commit 5152f29

Browse files
committed
fix: 12.26 update README.md
1 parent 26c07a9 commit 5152f29

File tree

1 file changed

+59
-74
lines changed

1 file changed

+59
-74
lines changed

README.md

Lines changed: 59 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -181,93 +181,78 @@ res = client.search_memory(query=query, user_id=user_id, conversation_id=convers
181181
print(f"result: {res}")
182182
```
183183

184-
- This API is used to delete specified user memories, supporting batch deletion.
185-
```python
186-
user_ids = ["memos_user_123"]
187-
# Replace with the memory ID
188-
memory_ids = ["6b23b583-f4c4-4a8f-b345-58d0c48fea04"]
189-
res = client.delete_memory(user_ids=user_ids, memory_ids=memory_ids)
190-
191-
print(f"result: {res}")
192-
```
193-
194-
- This API is used to add feedback to current session messages, allowing MemOS to correct memories based on user feedback.
195-
```python
196-
user_id = "memos_user_123"
197-
conversation_id = "memos_feedback_conv"
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."
199-
# Replace with the knowledgebase ID
200-
allow_knowledgebase_ids = ["basee5ec9050-c964-484f-abf1-ce3e8e2aa5b7"]
201-
202-
res = client.add_feedback(
203-
user_id=user_id,
204-
conversation_id=conversation_id,
205-
feedback_content=feedback_content,
206-
allow_knowledgebase_ids=allow_knowledgebase_ids
207-
)
208-
209-
print(f"result: {res}")
210-
```
211-
212-
- This API is used to create a knowledgebase associated with a project
213-
```python
214-
knowledgebase_name = "Financial Reimbursement Knowledge Base"
215-
knowledgebase_description = "A compilation of all knowledge related to the company's financial reimbursements."
216-
217-
res = client.create_knowledgebase(
218-
knowledgebase_name=knowledgebase_name,
219-
knowledgebase_description=knowledgebase_description
220-
)
221-
print(f"result: {res}")
222-
```
223-
224184
### Self-Hosted Server
225185
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-
```
186+
```bash
187+
git clone https://github.com/MemTensor/MemOS.git
188+
cd MemOS
189+
pip install -r ./docker/requirements.txt
190+
```
231191
2. Configure `docker/.env.example` and copy to `MemOS/.env`
232192
- 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).
233193
- Fill in the corresponding configuration in the `MemOS/.env` file.
234194
3. Start the service.
235-
```bash
236-
uvicorn memos.api.server_api:app --host 0.0.0.0 --port 8001 --workers 2
237-
```
238195

239-
For detailed integration steps, see the [`API Reference`](https://docs.openmem.net/open_source/getting_started/rest_api_server/#run-locally).
196+
- Launch via Docker
197+
###### 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.
198+
```bash
199+
# Enter docker directory
200+
docker compose up
201+
```
202+
##### 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).
203+
204+
- Launch via the uvicorn command line interface (CLI)
205+
###### Tips: Please ensure that Neo4j and Qdrant are running before executing the following command.
206+
```bash
207+
uvicorn memos.api.server_api:app --host 0.0.0.0 --port 8001 --workers 1
208+
```
209+
##### For detailed integration steps, see the [`CLI Reference`](https://docs.openmem.net/open_source/getting_started/rest_api_server/#method-3client-install-with-CLI).
240210

241-
#### 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).
242211

243212

244213
Example
245214
- Add User Message
246-
```bash
247-
curl -X POST http://localhost:8000/product/add \
248-
-H "Content-Type: application/json" \
249-
-d '{
250-
"user_id": "8736b16e-1d20-4163-980b-a5063c3facdc",
251-
"mem_cube_id": "b32d0977-435d-4828-a86f-4f47f8b55bca",
252-
"messages": [
253-
{
254-
"role": "user",
255-
"content": "I like strawberry"
256-
}
257-
],
258-
"async_mode": "sync"
259-
}'
260-
```
215+
```python
216+
import requests
217+
import json
218+
219+
data = {
220+
"user_id": "8736b16e-1d20-4163-980b-a5063c3facdc",
221+
"mem_cube_id": "b32d0977-435d-4828-a86f-4f47f8b55bca",
222+
"messages": [
223+
{
224+
"role": "user",
225+
"content": "I like strawberry"
226+
}
227+
],
228+
"async_mode": "sync"
229+
}
230+
headers = {
231+
"Content-Type": "application/json"
232+
}
233+
url = "http://localhost:8000/product/add"
234+
235+
res = requests.post(url=url, headers=headers, data=json.dumps(data))
236+
print(f"result: {res.json()}")
237+
```
261238
- Search User Memory
262-
```bash
263-
curl -X POST http://localhost:8000/product/search \
264-
-H "Content-Type: application/json" \
265-
-d '{
266-
"query": "What do I like",
267-
"user_id": "8736b16e-1d20-4163-980b-a5063c3facdc",
268-
"mem_cube_id": "b32d0977-435d-4828-a86f-4f47f8b55bca"
269-
}'
270-
```
239+
```python
240+
import requests
241+
import json
242+
243+
data = {
244+
"query": "What do I like",
245+
"user_id": "8736b16e-1d20-4163-980b-a5063c3facdc",
246+
"mem_cube_id": "b32d0977-435d-4828-a86f-4f47f8b55bca"
247+
}
248+
headers = {
249+
"Content-Type": "application/json"
250+
}
251+
url = "http://localhost:8000/product/search"
252+
253+
res = requests.post(url=url, headers=headers, data=json.dumps(data))
254+
print(f"result: {res.json()}")
255+
```
271256

272257
## 💬 Community & Support
273258

0 commit comments

Comments
 (0)