liuhua
liuhua
commited on
Commit
·
845e389
1
Parent(s):
deb9237
Turn resource to plural form (#3059)
Browse files### What problem does this PR solve?
Turn resource to plural form
### Type of change
- [x] Refactoring
Co-authored-by: liuhua <[email protected]>
- api/apps/sdk/chat.py +4 -4
- api/apps/sdk/dataset.py +4 -4
- api/apps/sdk/dify_retrieval.py +1 -1
- api/apps/sdk/doc.py +12 -12
- api/apps/sdk/session.py +5 -5
- api/http_api_reference.md +76 -76
api/apps/sdk/chat.py
CHANGED
@@ -26,7 +26,7 @@ from api.utils.api_utils import get_result
|
|
26 |
|
27 |
|
28 |
|
29 |
-
@manager.route('/
|
30 |
@token_required
|
31 |
def create(tenant_id):
|
32 |
req=request.json
|
@@ -142,7 +142,7 @@ def create(tenant_id):
|
|
142 |
res["avatar"] = res.pop("icon")
|
143 |
return get_result(data=res)
|
144 |
|
145 |
-
@manager.route('/
|
146 |
@token_required
|
147 |
def update(tenant_id,chat_id):
|
148 |
if not DialogService.query(tenant_id=tenant_id, id=chat_id, status=StatusEnum.VALID.value):
|
@@ -221,7 +221,7 @@ def update(tenant_id,chat_id):
|
|
221 |
return get_result()
|
222 |
|
223 |
|
224 |
-
@manager.route('/
|
225 |
@token_required
|
226 |
def delete(tenant_id):
|
227 |
req = request.json
|
@@ -235,7 +235,7 @@ def delete(tenant_id):
|
|
235 |
DialogService.update_by_id(id, temp_dict)
|
236 |
return get_result()
|
237 |
|
238 |
-
@manager.route('/
|
239 |
@token_required
|
240 |
def list_chat(tenant_id):
|
241 |
id = request.args.get("id")
|
|
|
26 |
|
27 |
|
28 |
|
29 |
+
@manager.route('/chats', methods=['POST'])
|
30 |
@token_required
|
31 |
def create(tenant_id):
|
32 |
req=request.json
|
|
|
142 |
res["avatar"] = res.pop("icon")
|
143 |
return get_result(data=res)
|
144 |
|
145 |
+
@manager.route('/chats/<chat_id>', methods=['PUT'])
|
146 |
@token_required
|
147 |
def update(tenant_id,chat_id):
|
148 |
if not DialogService.query(tenant_id=tenant_id, id=chat_id, status=StatusEnum.VALID.value):
|
|
|
221 |
return get_result()
|
222 |
|
223 |
|
224 |
+
@manager.route('/chats', methods=['DELETE'])
|
225 |
@token_required
|
226 |
def delete(tenant_id):
|
227 |
req = request.json
|
|
|
235 |
DialogService.update_by_id(id, temp_dict)
|
236 |
return get_result()
|
237 |
|
238 |
+
@manager.route('/chats', methods=['GET'])
|
239 |
@token_required
|
240 |
def list_chat(tenant_id):
|
241 |
id = request.args.get("id")
|
api/apps/sdk/dataset.py
CHANGED
@@ -28,7 +28,7 @@ from api.utils import get_uuid
|
|
28 |
from api.utils.api_utils import get_result, token_required, get_error_data_result, valid,get_parser_config
|
29 |
|
30 |
|
31 |
-
@manager.route('/
|
32 |
@token_required
|
33 |
def create(tenant_id):
|
34 |
req = request.json
|
@@ -88,7 +88,7 @@ def create(tenant_id):
|
|
88 |
renamed_data[new_key] = value
|
89 |
return get_result(data=renamed_data)
|
90 |
|
91 |
-
@manager.route('/
|
92 |
@token_required
|
93 |
def delete(tenant_id):
|
94 |
req = request.json
|
@@ -112,7 +112,7 @@ def delete(tenant_id):
|
|
112 |
retmsg="Delete dataset error.(Database error)")
|
113 |
return get_result(retcode=RetCode.SUCCESS)
|
114 |
|
115 |
-
@manager.route('/
|
116 |
@token_required
|
117 |
def update(tenant_id,dataset_id):
|
118 |
if not KnowledgebaseService.query(id=dataset_id,tenant_id=tenant_id):
|
@@ -183,7 +183,7 @@ def update(tenant_id,dataset_id):
|
|
183 |
return get_error_data_result(retmsg="Update dataset error.(Database error)")
|
184 |
return get_result(retcode=RetCode.SUCCESS)
|
185 |
|
186 |
-
@manager.route('/
|
187 |
@token_required
|
188 |
def list(tenant_id):
|
189 |
id = request.args.get("id")
|
|
|
28 |
from api.utils.api_utils import get_result, token_required, get_error_data_result, valid,get_parser_config
|
29 |
|
30 |
|
31 |
+
@manager.route('/datasets', methods=['POST'])
|
32 |
@token_required
|
33 |
def create(tenant_id):
|
34 |
req = request.json
|
|
|
88 |
renamed_data[new_key] = value
|
89 |
return get_result(data=renamed_data)
|
90 |
|
91 |
+
@manager.route('/datasets', methods=['DELETE'])
|
92 |
@token_required
|
93 |
def delete(tenant_id):
|
94 |
req = request.json
|
|
|
112 |
retmsg="Delete dataset error.(Database error)")
|
113 |
return get_result(retcode=RetCode.SUCCESS)
|
114 |
|
115 |
+
@manager.route('/datasets/<dataset_id>', methods=['PUT'])
|
116 |
@token_required
|
117 |
def update(tenant_id,dataset_id):
|
118 |
if not KnowledgebaseService.query(id=dataset_id,tenant_id=tenant_id):
|
|
|
183 |
return get_error_data_result(retmsg="Update dataset error.(Database error)")
|
184 |
return get_result(retcode=RetCode.SUCCESS)
|
185 |
|
186 |
+
@manager.route('/datasets', methods=['GET'])
|
187 |
@token_required
|
188 |
def list(tenant_id):
|
189 |
id = request.args.get("id")
|
api/apps/sdk/dify_retrieval.py
CHANGED
@@ -22,7 +22,7 @@ from api.settings import retrievaler, kg_retrievaler, RetCode
|
|
22 |
from api.utils.api_utils import validate_request, build_error_result, apikey_required
|
23 |
|
24 |
|
25 |
-
@manager.route('/dify/
|
26 |
@apikey_required
|
27 |
@validate_request("knowledge_id", "query")
|
28 |
def retrieval(tenant_id):
|
|
|
22 |
from api.utils.api_utils import validate_request, build_error_result, apikey_required
|
23 |
|
24 |
|
25 |
+
@manager.route('/dify/retrievals', methods=['POST'])
|
26 |
@apikey_required
|
27 |
@validate_request("knowledge_id", "query")
|
28 |
def retrieval(tenant_id):
|
api/apps/sdk/doc.py
CHANGED
@@ -55,7 +55,7 @@ MAXIMUM_OF_UPLOADING_FILES = 256
|
|
55 |
MAXIMUM_OF_UPLOADING_FILES = 256
|
56 |
|
57 |
|
58 |
-
@manager.route('/
|
59 |
@token_required
|
60 |
def upload(dataset_id, tenant_id):
|
61 |
if 'file' not in request.files:
|
@@ -103,7 +103,7 @@ def upload(dataset_id, tenant_id):
|
|
103 |
return get_result(data=renamed_doc_list)
|
104 |
|
105 |
|
106 |
-
@manager.route('/
|
107 |
@token_required
|
108 |
def update_doc(tenant_id, dataset_id, document_id):
|
109 |
req = request.json
|
@@ -169,7 +169,7 @@ def update_doc(tenant_id, dataset_id, document_id):
|
|
169 |
return get_result()
|
170 |
|
171 |
|
172 |
-
@manager.route('/
|
173 |
@token_required
|
174 |
def download(tenant_id, dataset_id, document_id):
|
175 |
if not KnowledgebaseService.query(id=dataset_id, tenant_id=tenant_id):
|
@@ -192,7 +192,7 @@ def download(tenant_id, dataset_id, document_id):
|
|
192 |
)
|
193 |
|
194 |
|
195 |
-
@manager.route('/
|
196 |
@token_required
|
197 |
def list_docs(dataset_id, tenant_id):
|
198 |
if not KnowledgebaseService.query(id=dataset_id, tenant_id=tenant_id):
|
@@ -236,7 +236,7 @@ def list_docs(dataset_id, tenant_id):
|
|
236 |
return get_result(data={"total": tol, "docs": renamed_doc_list})
|
237 |
|
238 |
|
239 |
-
@manager.route('/
|
240 |
@token_required
|
241 |
def delete(tenant_id,dataset_id):
|
242 |
if not KnowledgebaseService.query(id=dataset_id, tenant_id=tenant_id):
|
@@ -286,7 +286,7 @@ def delete(tenant_id,dataset_id):
|
|
286 |
return get_result()
|
287 |
|
288 |
|
289 |
-
@manager.route('/
|
290 |
@token_required
|
291 |
def parse(tenant_id,dataset_id):
|
292 |
if not KnowledgebaseService.query(id=dataset_id, tenant_id=tenant_id):
|
@@ -316,7 +316,7 @@ def parse(tenant_id,dataset_id):
|
|
316 |
queue_tasks(doc, bucket, name)
|
317 |
return get_result()
|
318 |
|
319 |
-
@manager.route('/
|
320 |
@token_required
|
321 |
def stop_parsing(tenant_id,dataset_id):
|
322 |
if not KnowledgebaseService.query(id=dataset_id, tenant_id=tenant_id):
|
@@ -339,7 +339,7 @@ def stop_parsing(tenant_id,dataset_id):
|
|
339 |
return get_result()
|
340 |
|
341 |
|
342 |
-
@manager.route('/
|
343 |
@token_required
|
344 |
def list_chunks(tenant_id,dataset_id,document_id):
|
345 |
if not KnowledgebaseService.query(id=dataset_id, tenant_id=tenant_id):
|
@@ -427,7 +427,7 @@ def list_chunks(tenant_id,dataset_id,document_id):
|
|
427 |
|
428 |
|
429 |
|
430 |
-
@manager.route('/
|
431 |
@token_required
|
432 |
def add_chunk(tenant_id,dataset_id,document_id):
|
433 |
if not KnowledgebaseService.query(id=dataset_id, tenant_id=tenant_id):
|
@@ -488,7 +488,7 @@ def add_chunk(tenant_id,dataset_id,document_id):
|
|
488 |
# return get_result(data={"chunk_id": chunk_id})
|
489 |
|
490 |
|
491 |
-
@manager.route('
|
492 |
@token_required
|
493 |
def rm_chunk(tenant_id,dataset_id,document_id):
|
494 |
if not KnowledgebaseService.query(id=dataset_id, tenant_id=tenant_id):
|
@@ -516,7 +516,7 @@ def rm_chunk(tenant_id,dataset_id,document_id):
|
|
516 |
|
517 |
|
518 |
|
519 |
-
@manager.route('/
|
520 |
@token_required
|
521 |
def update_chunk(tenant_id,dataset_id,document_id,chunk_id):
|
522 |
try:
|
@@ -574,7 +574,7 @@ def update_chunk(tenant_id,dataset_id,document_id,chunk_id):
|
|
574 |
|
575 |
|
576 |
|
577 |
-
@manager.route('/
|
578 |
@token_required
|
579 |
def retrieval_test(tenant_id):
|
580 |
req = request.json
|
|
|
55 |
MAXIMUM_OF_UPLOADING_FILES = 256
|
56 |
|
57 |
|
58 |
+
@manager.route('/datasets/<dataset_id>/documents', methods=['POST'])
|
59 |
@token_required
|
60 |
def upload(dataset_id, tenant_id):
|
61 |
if 'file' not in request.files:
|
|
|
103 |
return get_result(data=renamed_doc_list)
|
104 |
|
105 |
|
106 |
+
@manager.route('/datasets/<dataset_id>/documents/<document_id>', methods=['PUT'])
|
107 |
@token_required
|
108 |
def update_doc(tenant_id, dataset_id, document_id):
|
109 |
req = request.json
|
|
|
169 |
return get_result()
|
170 |
|
171 |
|
172 |
+
@manager.route('/datasets/<dataset_id>/documents/<document_id>', methods=['GET'])
|
173 |
@token_required
|
174 |
def download(tenant_id, dataset_id, document_id):
|
175 |
if not KnowledgebaseService.query(id=dataset_id, tenant_id=tenant_id):
|
|
|
192 |
)
|
193 |
|
194 |
|
195 |
+
@manager.route('/datasets/<dataset_id>/documents', methods=['GET'])
|
196 |
@token_required
|
197 |
def list_docs(dataset_id, tenant_id):
|
198 |
if not KnowledgebaseService.query(id=dataset_id, tenant_id=tenant_id):
|
|
|
236 |
return get_result(data={"total": tol, "docs": renamed_doc_list})
|
237 |
|
238 |
|
239 |
+
@manager.route('/datasets/<dataset_id>/documents', methods=['DELETE'])
|
240 |
@token_required
|
241 |
def delete(tenant_id,dataset_id):
|
242 |
if not KnowledgebaseService.query(id=dataset_id, tenant_id=tenant_id):
|
|
|
286 |
return get_result()
|
287 |
|
288 |
|
289 |
+
@manager.route('/datasets/<dataset_id>/chunks', methods=['POST'])
|
290 |
@token_required
|
291 |
def parse(tenant_id,dataset_id):
|
292 |
if not KnowledgebaseService.query(id=dataset_id, tenant_id=tenant_id):
|
|
|
316 |
queue_tasks(doc, bucket, name)
|
317 |
return get_result()
|
318 |
|
319 |
+
@manager.route('/datasets/<dataset_id>/chunks', methods=['DELETE'])
|
320 |
@token_required
|
321 |
def stop_parsing(tenant_id,dataset_id):
|
322 |
if not KnowledgebaseService.query(id=dataset_id, tenant_id=tenant_id):
|
|
|
339 |
return get_result()
|
340 |
|
341 |
|
342 |
+
@manager.route('/datasets/<dataset_id>/documents/<document_id>/chunks', methods=['GET'])
|
343 |
@token_required
|
344 |
def list_chunks(tenant_id,dataset_id,document_id):
|
345 |
if not KnowledgebaseService.query(id=dataset_id, tenant_id=tenant_id):
|
|
|
427 |
|
428 |
|
429 |
|
430 |
+
@manager.route('/datasets/<dataset_id>/documents/<document_id>/chunks', methods=['POST'])
|
431 |
@token_required
|
432 |
def add_chunk(tenant_id,dataset_id,document_id):
|
433 |
if not KnowledgebaseService.query(id=dataset_id, tenant_id=tenant_id):
|
|
|
488 |
# return get_result(data={"chunk_id": chunk_id})
|
489 |
|
490 |
|
491 |
+
@manager.route('datasets/<dataset_id>/documents/<document_id>/chunks', methods=['DELETE'])
|
492 |
@token_required
|
493 |
def rm_chunk(tenant_id,dataset_id,document_id):
|
494 |
if not KnowledgebaseService.query(id=dataset_id, tenant_id=tenant_id):
|
|
|
516 |
|
517 |
|
518 |
|
519 |
+
@manager.route('/datasets/<dataset_id>/documents/<document_id>/chunks/<chunk_id>', methods=['PUT'])
|
520 |
@token_required
|
521 |
def update_chunk(tenant_id,dataset_id,document_id,chunk_id):
|
522 |
try:
|
|
|
574 |
|
575 |
|
576 |
|
577 |
+
@manager.route('/retrievals', methods=['POST'])
|
578 |
@token_required
|
579 |
def retrieval_test(tenant_id):
|
580 |
req = request.json
|
api/apps/sdk/session.py
CHANGED
@@ -24,7 +24,7 @@ from api.utils import get_uuid
|
|
24 |
from api.utils.api_utils import get_error_data_result
|
25 |
from api.utils.api_utils import get_result, token_required
|
26 |
|
27 |
-
@manager.route('/
|
28 |
@token_required
|
29 |
def create(tenant_id,chat_id):
|
30 |
req = request.json
|
@@ -50,7 +50,7 @@ def create(tenant_id,chat_id):
|
|
50 |
del conv["reference"]
|
51 |
return get_result(data=conv)
|
52 |
|
53 |
-
@manager.route('/
|
54 |
@token_required
|
55 |
def update(tenant_id,chat_id,session_id):
|
56 |
req = request.json
|
@@ -72,7 +72,7 @@ def update(tenant_id,chat_id,session_id):
|
|
72 |
return get_result()
|
73 |
|
74 |
|
75 |
-
@manager.route('/
|
76 |
@token_required
|
77 |
def completion(tenant_id,chat_id):
|
78 |
req = request.json
|
@@ -161,7 +161,7 @@ def completion(tenant_id,chat_id):
|
|
161 |
break
|
162 |
return get_result(data=answer)
|
163 |
|
164 |
-
@manager.route('/
|
165 |
@token_required
|
166 |
def list(chat_id,tenant_id):
|
167 |
if not DialogService.query(tenant_id=tenant_id, id=chat_id, status=StatusEnum.VALID.value):
|
@@ -213,7 +213,7 @@ def list(chat_id,tenant_id):
|
|
213 |
del conv["reference"]
|
214 |
return get_result(data=convs)
|
215 |
|
216 |
-
@manager.route('/
|
217 |
@token_required
|
218 |
def delete(tenant_id,chat_id):
|
219 |
if not DialogService.query(id=chat_id, tenant_id=tenant_id, status=StatusEnum.VALID.value):
|
|
|
24 |
from api.utils.api_utils import get_error_data_result
|
25 |
from api.utils.api_utils import get_result, token_required
|
26 |
|
27 |
+
@manager.route('/chats/<chat_id>/sessions', methods=['POST'])
|
28 |
@token_required
|
29 |
def create(tenant_id,chat_id):
|
30 |
req = request.json
|
|
|
50 |
del conv["reference"]
|
51 |
return get_result(data=conv)
|
52 |
|
53 |
+
@manager.route('/chats/<chat_id>/sessions/<session_id>', methods=['PUT'])
|
54 |
@token_required
|
55 |
def update(tenant_id,chat_id,session_id):
|
56 |
req = request.json
|
|
|
72 |
return get_result()
|
73 |
|
74 |
|
75 |
+
@manager.route('/chats/<chat_id>/completions', methods=['POST'])
|
76 |
@token_required
|
77 |
def completion(tenant_id,chat_id):
|
78 |
req = request.json
|
|
|
161 |
break
|
162 |
return get_result(data=answer)
|
163 |
|
164 |
+
@manager.route('/chats/<chat_id>/sessions', methods=['GET'])
|
165 |
@token_required
|
166 |
def list(chat_id,tenant_id):
|
167 |
if not DialogService.query(tenant_id=tenant_id, id=chat_id, status=StatusEnum.VALID.value):
|
|
|
213 |
del conv["reference"]
|
214 |
return get_result(data=convs)
|
215 |
|
216 |
+
@manager.route('/chats/<chat_id>/sessions', methods=["DELETE"])
|
217 |
@token_required
|
218 |
def delete(tenant_id,chat_id):
|
219 |
if not DialogService.query(id=chat_id, tenant_id=tenant_id, status=StatusEnum.VALID.value):
|
api/http_api_reference.md
CHANGED
@@ -13,14 +13,14 @@ Dataset Management
|
|
13 |
|
14 |
## Create dataset
|
15 |
|
16 |
-
**POST** `/api/v1/
|
17 |
|
18 |
Creates a dataset.
|
19 |
|
20 |
### Request
|
21 |
|
22 |
- Method: POST
|
23 |
-
- URL: `/api/v1/
|
24 |
- Headers:
|
25 |
- `'content-Type: application/json'`
|
26 |
- `'Authorization: Bearer {YOUR_API_KEY}'`
|
@@ -38,7 +38,7 @@ Creates a dataset.
|
|
38 |
|
39 |
```bash
|
40 |
curl --request POST \
|
41 |
-
--url http://{address}/api/v1/
|
42 |
--header 'Content-Type: application/json' \
|
43 |
--header 'Authorization: Bearer {YOUR_API_KEY}' \
|
44 |
--data '{
|
@@ -151,14 +151,14 @@ Failure:
|
|
151 |
|
152 |
## Delete datasets
|
153 |
|
154 |
-
**DELETE** `/api/v1/
|
155 |
|
156 |
Deletes datasets by ID.
|
157 |
|
158 |
### Request
|
159 |
|
160 |
- Method: DELETE
|
161 |
-
- URL: `/api/v1/
|
162 |
- Headers:
|
163 |
- `'content-Type: application/json'`
|
164 |
- `'Authorization: Bearer {YOUR_API_KEY}'`
|
@@ -169,7 +169,7 @@ Deletes datasets by ID.
|
|
169 |
|
170 |
```bash
|
171 |
curl --request DELETE \
|
172 |
-
--url http://{address}/api/v1/
|
173 |
--header 'Content-Type: application/json' \
|
174 |
--header 'Authorization: Bearer {YOUR_API_KEY}' \
|
175 |
--data '{"ids": ["test_1", "test_2"]}'
|
@@ -203,14 +203,14 @@ Failure:
|
|
203 |
|
204 |
## Update dataset
|
205 |
|
206 |
-
**PUT** `/api/v1/
|
207 |
|
208 |
Updates configurations for a specified dataset.
|
209 |
|
210 |
### Request
|
211 |
|
212 |
- Method: PUT
|
213 |
-
- URL: `/api/v1/
|
214 |
- Headers:
|
215 |
- `'content-Type: application/json'`
|
216 |
- `'Authorization: Bearer {YOUR_API_KEY}'`
|
@@ -223,7 +223,7 @@ Updates configurations for a specified dataset.
|
|
223 |
|
224 |
```bash
|
225 |
curl --request PUT \
|
226 |
-
--url http://{address}/api/v1/
|
227 |
--header 'Content-Type: application/json' \
|
228 |
--header 'Authorization: Bearer {YOUR_API_KEY}' \
|
229 |
--data '
|
@@ -279,14 +279,14 @@ Failure:
|
|
279 |
|
280 |
## List datasets
|
281 |
|
282 |
-
**GET** `/api/v1/
|
283 |
|
284 |
Lists datasets.
|
285 |
|
286 |
### Request
|
287 |
|
288 |
- Method: GET
|
289 |
-
- URL: `/api/v1/
|
290 |
- Headers:
|
291 |
- `'Authorization: Bearer {YOUR_API_KEY}'`
|
292 |
|
@@ -294,7 +294,7 @@ Lists datasets.
|
|
294 |
|
295 |
```bash
|
296 |
curl --request GET \
|
297 |
-
--url http://{address}/api/v1/
|
298 |
--header 'Authorization: Bearer {YOUR_API_KEY}'
|
299 |
```
|
300 |
|
@@ -379,14 +379,14 @@ File Management within Dataset
|
|
379 |
|
380 |
## Upload documents
|
381 |
|
382 |
-
**POST** `/api/v1/
|
383 |
|
384 |
Uploads documents to a specified dataset.
|
385 |
|
386 |
### Request
|
387 |
|
388 |
- Method: POST
|
389 |
-
- URL: `/api/v1/
|
390 |
- Headers:
|
391 |
- `'Content-Type: multipart/form-data'`
|
392 |
- `'Authorization: Bearer {YOUR_API_KEY}'`
|
@@ -397,7 +397,7 @@ Uploads documents to a specified dataset.
|
|
397 |
|
398 |
```bash
|
399 |
curl --request POST \
|
400 |
-
--url http://{address}/api/v1/
|
401 |
--header 'Content-Type: multipart/form-data' \
|
402 |
--header 'Authorization: Bearer {YOUR_API_KEY}' \
|
403 |
--form 'file=@./test1.txt' \
|
@@ -457,14 +457,14 @@ Failure:
|
|
457 |
|
458 |
## Update document
|
459 |
|
460 |
-
**PUT** `/api/v1/
|
461 |
|
462 |
Updates configurations for a specified document.
|
463 |
|
464 |
### Request
|
465 |
|
466 |
- Method: PUT
|
467 |
-
- URL: `/api/v1/
|
468 |
- Headers:
|
469 |
- `'content-Type: application/json'`
|
470 |
- `'Authorization: Bearer {YOUR_API_KEY}'`
|
@@ -477,7 +477,7 @@ Updates configurations for a specified document.
|
|
477 |
|
478 |
```bash
|
479 |
curl --request PUT \
|
480 |
-
--url http://{address}/api/v1/
|
481 |
--header 'Authorization: Bearer {YOUR_API_KEY}' \
|
482 |
--header 'Content-Type: application/json' \
|
483 |
--data '
|
@@ -540,14 +540,14 @@ Failure:
|
|
540 |
|
541 |
## Download document
|
542 |
|
543 |
-
**GET** `/api/v1/
|
544 |
|
545 |
Downloads a document from a specified dataset.
|
546 |
|
547 |
### Request
|
548 |
|
549 |
- Method: GET
|
550 |
-
- URL: `/api/v1/
|
551 |
- Headers:
|
552 |
- `'Authorization: Bearer {YOUR_API_KEY}'`
|
553 |
- Output:
|
@@ -557,7 +557,7 @@ Downloads a document from a specified dataset.
|
|
557 |
|
558 |
```bash
|
559 |
curl --request GET \
|
560 |
-
--url http://{address}/api/v1/
|
561 |
--header 'Authorization: Bearer {YOUR_API_KEY}' \
|
562 |
--output ./ragflow.txt
|
563 |
```
|
@@ -590,14 +590,14 @@ Failure:
|
|
590 |
|
591 |
## List documents
|
592 |
|
593 |
-
**GET** `/api/v1/
|
594 |
|
595 |
Lists documents in a specified dataset.
|
596 |
|
597 |
### Request
|
598 |
|
599 |
- Method: GET
|
600 |
-
- URL: `/api/v1/
|
601 |
- Headers:
|
602 |
- `'content-Type: application/json'`
|
603 |
- `'Authorization: Bearer {YOUR_API_KEY}'`
|
@@ -606,7 +606,7 @@ Lists documents in a specified dataset.
|
|
606 |
|
607 |
```bash
|
608 |
curl --request GET \
|
609 |
-
--url http://{address}/api/v1/
|
610 |
--header 'Authorization: Bearer {YOUR_API_KEY}'
|
611 |
```
|
612 |
|
@@ -687,14 +687,14 @@ Failure:
|
|
687 |
|
688 |
## Delete documents
|
689 |
|
690 |
-
**DELETE** `/api/v1/
|
691 |
|
692 |
Deletes documents by ID.
|
693 |
|
694 |
### Request
|
695 |
|
696 |
- Method: DELETE
|
697 |
-
- URL: `/api/v1/
|
698 |
- Headers:
|
699 |
- `'Content-Type: application/json'`
|
700 |
- `'Authorization: Bearer {YOUR_API_KEY}'`
|
@@ -705,7 +705,7 @@ Deletes documents by ID.
|
|
705 |
|
706 |
```bash
|
707 |
curl --request DELETE \
|
708 |
-
--url http://{address}/api/v1/
|
709 |
--header 'Content-Type: application/json' \
|
710 |
--header 'Authorization: {YOUR_API_KEY}' \
|
711 |
--data '
|
@@ -744,14 +744,14 @@ Failure:
|
|
744 |
|
745 |
## Parse documents
|
746 |
|
747 |
-
**POST** `/api/v1/
|
748 |
|
749 |
Parses documents in a specified dataset.
|
750 |
|
751 |
### Request
|
752 |
|
753 |
- Method: POST
|
754 |
-
- URL: `/api/v1/
|
755 |
- Headers:
|
756 |
- `'content-Type: application/json'`
|
757 |
- 'Authorization: Bearer {YOUR_API_KEY}'
|
@@ -762,7 +762,7 @@ Parses documents in a specified dataset.
|
|
762 |
|
763 |
```bash
|
764 |
curl --request POST \
|
765 |
-
--url http://{address}/api/v1/
|
766 |
--header 'Content-Type: application/json' \
|
767 |
--header 'Authorization: Bearer {YOUR_API_KEY}' \
|
768 |
--data '
|
@@ -801,14 +801,14 @@ Failure:
|
|
801 |
|
802 |
## Stop parsing documents
|
803 |
|
804 |
-
**DELETE** `/api/v1/
|
805 |
|
806 |
Stops parsing specified documents.
|
807 |
|
808 |
### Request
|
809 |
|
810 |
- Method: DELETE
|
811 |
-
- URL: `/api/v1/
|
812 |
- Headers:
|
813 |
- `'content-Type: application/json'`
|
814 |
- `'Authorization: Bearer {YOUR_API_KEY}'`
|
@@ -819,7 +819,7 @@ Stops parsing specified documents.
|
|
819 |
|
820 |
```bash
|
821 |
curl --request DELETE \
|
822 |
-
--url http://{address}/api/v1/
|
823 |
--header 'Content-Type: application/json' \
|
824 |
--header 'Authorization: Bearer {YOUR_API_KEY}' \
|
825 |
--data '
|
@@ -858,14 +858,14 @@ Failure:
|
|
858 |
|
859 |
## Add chunks
|
860 |
|
861 |
-
**POST** `/api/v1/
|
862 |
|
863 |
Adds a chunk to a specified document in a specified dataset.
|
864 |
|
865 |
### Request
|
866 |
|
867 |
- Method: POST
|
868 |
-
- URL: `/api/v1/
|
869 |
- Headers:
|
870 |
- `'content-Type: application/json'`
|
871 |
- `'Authorization: Bearer {YOUR_API_KEY}'`
|
@@ -877,7 +877,7 @@ Adds a chunk to a specified document in a specified dataset.
|
|
877 |
|
878 |
```bash
|
879 |
curl --request POST \
|
880 |
-
--url http://{address}/api/v1/
|
881 |
--header 'Content-Type: application/json' \
|
882 |
--header 'Authorization: Bearer {YOUR_API_KEY}' \
|
883 |
--data '
|
@@ -933,14 +933,14 @@ Failure:
|
|
933 |
|
934 |
## List chunks
|
935 |
|
936 |
-
**GET** `/api/v1/
|
937 |
|
938 |
Lists chunks in a specified document.
|
939 |
|
940 |
### Request
|
941 |
|
942 |
- Method: GET
|
943 |
-
- URL: `/api/v1/
|
944 |
- Headers:
|
945 |
- `'Authorization: Bearer {YOUR_API_KEY}'`
|
946 |
|
@@ -948,7 +948,7 @@ Lists chunks in a specified document.
|
|
948 |
|
949 |
```bash
|
950 |
curl --request GET \
|
951 |
-
--url http://{address}/api/v1/
|
952 |
--header 'Authorization: Bearer {YOUR_API_KEY}'
|
953 |
```
|
954 |
|
@@ -1040,14 +1040,14 @@ Failure:
|
|
1040 |
|
1041 |
## Delete chunks
|
1042 |
|
1043 |
-
**DELETE** `/api/v1/
|
1044 |
|
1045 |
Deletes chunks by ID.
|
1046 |
|
1047 |
### Request
|
1048 |
|
1049 |
- Method: DELETE
|
1050 |
-
- URL: `/api/v1/
|
1051 |
- Headers:
|
1052 |
- `'content-Type: application/json'`
|
1053 |
- `'Authorization: Bearer {YOUR_API_KEY}'`
|
@@ -1058,7 +1058,7 @@ Deletes chunks by ID.
|
|
1058 |
|
1059 |
```bash
|
1060 |
curl --request DELETE \
|
1061 |
-
--url http://{address}/api/v1/
|
1062 |
--header 'Content-Type: application/json' \
|
1063 |
--header 'Authorization: Bearer {YOUR_API_KEY}' \
|
1064 |
--data '
|
@@ -1099,14 +1099,14 @@ Failure:
|
|
1099 |
|
1100 |
## Update chunk
|
1101 |
|
1102 |
-
**PUT** `/api/v1/
|
1103 |
|
1104 |
Updates content or configurations for a specified chunk.
|
1105 |
|
1106 |
### Request
|
1107 |
|
1108 |
- Method: PUT
|
1109 |
-
- URL: `/api/v1/
|
1110 |
- Headers:
|
1111 |
- `'content-Type: application/json'`
|
1112 |
- `'Authorization: Bearer {YOUR_API_KEY}'`
|
@@ -1119,7 +1119,7 @@ Updates content or configurations for a specified chunk.
|
|
1119 |
|
1120 |
```bash
|
1121 |
curl --request PUT \
|
1122 |
-
--url http://{address}/api/v1/
|
1123 |
--header 'Content-Type: application/json' \
|
1124 |
--header 'Authorization: {YOUR_API_KEY}' \
|
1125 |
--data '
|
@@ -1169,14 +1169,14 @@ Failure:
|
|
1169 |
|
1170 |
## Retrieve chunks
|
1171 |
|
1172 |
-
**GET** `/api/v1/
|
1173 |
|
1174 |
Retrieves chunks from specified datasets.
|
1175 |
|
1176 |
### Request
|
1177 |
|
1178 |
- Method: POST
|
1179 |
-
- URL: `/api/v1/
|
1180 |
- Headers:
|
1181 |
- `'content-Type: application/json'`
|
1182 |
- `'Authorization: Bearer {YOUR_API_KEY}'`
|
@@ -1197,7 +1197,7 @@ Retrieves chunks from specified datasets.
|
|
1197 |
|
1198 |
```bash
|
1199 |
curl --request POST \
|
1200 |
-
--url http://{address}/api/v1/
|
1201 |
--header 'Content-Type: application/json' \
|
1202 |
--header 'Authorization: {YOUR_API_KEY}' \
|
1203 |
--data '
|
@@ -1223,7 +1223,7 @@ curl --request POST \
|
|
1223 |
- `"similarity_threshold"`: (*Body parameter*)
|
1224 |
The minimum similarity score. Defaults to `0.2`.
|
1225 |
- `"vector_similarity_weight"`: (*Body parameter*), `float`
|
1226 |
-
The weight of vector cosine similarity. Defaults to `0.3`. If x represents the vector cosine similarity, then (1 - x) is the term similarity weight.
|
1227 |
- `"top_k"`: (*Body parameter*), `integer`
|
1228 |
The number of chunks engaged in vector cosine computaton. Defaults to `1024`.
|
1229 |
- `"rerank_id"`: (*Body parameter*), `integer`
|
@@ -1297,14 +1297,14 @@ Chat Assistant Management
|
|
1297 |
|
1298 |
## Create chat assistant
|
1299 |
|
1300 |
-
**POST** `/api/v1/
|
1301 |
|
1302 |
Creates a chat assistant.
|
1303 |
|
1304 |
### Request
|
1305 |
|
1306 |
- Method: POST
|
1307 |
-
- URL: `/api/v1/
|
1308 |
- Headers:
|
1309 |
- `'content-Type: application/json'`
|
1310 |
- `'Authorization: Bearer {YOUR_API_KEY}'`
|
@@ -1319,7 +1319,7 @@ Creates a chat assistant.
|
|
1319 |
|
1320 |
```shell
|
1321 |
curl --request POST \
|
1322 |
-
--url http://{address}/api/v1/
|
1323 |
--header 'Content-Type: application/json' \
|
1324 |
--header 'Authorization: Bearer {YOUR_API_KEY}'
|
1325 |
--data '{
|
@@ -1433,14 +1433,14 @@ Failure:
|
|
1433 |
|
1434 |
## Update chat assistant
|
1435 |
|
1436 |
-
**PUT** `/api/v1/
|
1437 |
|
1438 |
Updates configurations for a specified chat assistant.
|
1439 |
|
1440 |
### Request
|
1441 |
|
1442 |
- Method: PUT
|
1443 |
-
- URL: `/api/v1/
|
1444 |
- Headers:
|
1445 |
- `'content-Type: application/json'`
|
1446 |
- `'Authorization: Bearer {YOUR_API_KEY}'`
|
@@ -1455,7 +1455,7 @@ Updates configurations for a specified chat assistant.
|
|
1455 |
|
1456 |
```bash
|
1457 |
curl --request PUT \
|
1458 |
-
--url http://{address}/api/v1/
|
1459 |
--header 'Content-Type: application/json' \
|
1460 |
--header 'Authorization: Bearer {YOUR_API_KEY}' \
|
1461 |
--data '
|
@@ -1529,14 +1529,14 @@ Failure:
|
|
1529 |
|
1530 |
## Delete chat assistants
|
1531 |
|
1532 |
-
**DELETE** `/api/v1/
|
1533 |
|
1534 |
Deletes chat assistants by ID.
|
1535 |
|
1536 |
### Request
|
1537 |
|
1538 |
- Method: DELETE
|
1539 |
-
- URL: `/api/v1/
|
1540 |
- Headers:
|
1541 |
- `'content-Type: application/json'`
|
1542 |
- `'Authorization: Bearer {YOUR_API_KEY}'`
|
@@ -1547,7 +1547,7 @@ Deletes chat assistants by ID.
|
|
1547 |
|
1548 |
```bash
|
1549 |
curl --request DELETE \
|
1550 |
-
--url http://{address}/api/v1/
|
1551 |
--header 'Content-Type: application/json' \
|
1552 |
--header 'Authorization: Bearer {YOUR_API_KEY}' \
|
1553 |
--data '
|
@@ -1584,14 +1584,14 @@ Failure:
|
|
1584 |
|
1585 |
## List chat assistants
|
1586 |
|
1587 |
-
**GET** `/api/v1/
|
1588 |
|
1589 |
Lists chat assistants.
|
1590 |
|
1591 |
### Request
|
1592 |
|
1593 |
- Method: GET
|
1594 |
-
- URL: `/api/v1/
|
1595 |
- Headers:
|
1596 |
- `'Authorization: Bearer {YOUR_API_KEY}'`
|
1597 |
|
@@ -1599,7 +1599,7 @@ Lists chat assistants.
|
|
1599 |
|
1600 |
```bash
|
1601 |
curl --request GET \
|
1602 |
-
--url http://{address}/api/v1/
|
1603 |
--header 'Authorization: Bearer {YOUR_API_KEY}'
|
1604 |
```
|
1605 |
|
@@ -1683,14 +1683,14 @@ Failure:
|
|
1683 |
|
1684 |
## Create session
|
1685 |
|
1686 |
-
**POST** `/api/v1/
|
1687 |
|
1688 |
Creates a chat session.
|
1689 |
|
1690 |
### Request
|
1691 |
|
1692 |
- Method: POST
|
1693 |
-
- URL: `/api/v1/
|
1694 |
- Headers:
|
1695 |
- `'content-Type: application/json'`
|
1696 |
- `'Authorization: Bearer {YOUR_API_KEY}'`
|
@@ -1701,7 +1701,7 @@ Creates a chat session.
|
|
1701 |
|
1702 |
```bash
|
1703 |
curl --request POST \
|
1704 |
-
--url http://{address}/api/v1/
|
1705 |
--header 'Content-Type: application/json' \
|
1706 |
--header 'Authorization: Bearer {YOUR_API_KEY}' \
|
1707 |
--data '
|
@@ -1755,14 +1755,14 @@ Failure:
|
|
1755 |
|
1756 |
## Update session
|
1757 |
|
1758 |
-
**PUT** `/api/v1/
|
1759 |
|
1760 |
Updates a chat session.
|
1761 |
|
1762 |
### Request
|
1763 |
|
1764 |
- Method: PUT
|
1765 |
-
- URL: `/api/v1/
|
1766 |
- Headers:
|
1767 |
- `'content-Type: application/json'`
|
1768 |
- `'Authorization: Bearer {YOUR_API_KEY}'`
|
@@ -1772,7 +1772,7 @@ Updates a chat session.
|
|
1772 |
#### Request example
|
1773 |
```bash
|
1774 |
curl --request PUT \
|
1775 |
-
--url http://{address}/api/v1/
|
1776 |
--header 'Content-Type: application/json' \
|
1777 |
--header 'Authorization: Bearer {YOUR_API_KEY}' \
|
1778 |
--data '
|
@@ -1813,14 +1813,14 @@ Failure:
|
|
1813 |
|
1814 |
## List sessions
|
1815 |
|
1816 |
-
**GET** `/api/v1/
|
1817 |
|
1818 |
Lists sessions associated with a specified chat assistant.
|
1819 |
|
1820 |
### Request
|
1821 |
|
1822 |
- Method: GET
|
1823 |
-
- URL: `/api/v1/
|
1824 |
- Headers:
|
1825 |
- `'Authorization: Bearer {YOUR_API_KEY}'`
|
1826 |
|
@@ -1828,7 +1828,7 @@ Lists sessions associated with a specified chat assistant.
|
|
1828 |
|
1829 |
```bash
|
1830 |
curl --request GET \
|
1831 |
-
--url http://{address}/api/v1/
|
1832 |
--header 'Authorization: Bearer {YOUR_API_KEY}'
|
1833 |
```
|
1834 |
|
@@ -1891,14 +1891,14 @@ Failure:
|
|
1891 |
|
1892 |
## Delete sessions
|
1893 |
|
1894 |
-
**DELETE** `/api/v1/
|
1895 |
|
1896 |
Deletes sessions by ID.
|
1897 |
|
1898 |
### Request
|
1899 |
|
1900 |
- Method: DELETE
|
1901 |
-
- URL: `/api/v1/
|
1902 |
- Headers:
|
1903 |
- `'content-Type: application/json'`
|
1904 |
- `'Authorization: Bearer {YOUR_API_KEY}'`
|
@@ -1910,7 +1910,7 @@ Deletes sessions by ID.
|
|
1910 |
```bash
|
1911 |
# Either id or name must be provided, but not both.
|
1912 |
curl --request DELETE \
|
1913 |
-
--url http://{address}/api/v1/
|
1914 |
--header 'Content-Type: application/json' \
|
1915 |
--header 'Authorization: Bear {YOUR_API_KEY}' \
|
1916 |
--data '
|
@@ -1949,14 +1949,14 @@ Failure:
|
|
1949 |
|
1950 |
## Converse
|
1951 |
|
1952 |
-
**POST** `/api/v1/
|
1953 |
|
1954 |
Asks a question to start an AI-powered conversation.
|
1955 |
|
1956 |
### Request
|
1957 |
|
1958 |
- Method: POST
|
1959 |
-
- URL: `/api/v1/
|
1960 |
- Headers:
|
1961 |
- `'content-Type: application/json'`
|
1962 |
- `'Authorization: Bearer {YOUR_API_KEY}'`
|
@@ -1969,7 +1969,7 @@ Asks a question to start an AI-powered conversation.
|
|
1969 |
|
1970 |
```bash
|
1971 |
curl --request POST \
|
1972 |
-
--url http://{address}
|
1973 |
--header 'Content-Type: application/json' \
|
1974 |
--header 'Authorization: Bearer {YOUR_API_KEY}' \
|
1975 |
--data-binary '
|
|
|
13 |
|
14 |
## Create dataset
|
15 |
|
16 |
+
**POST** `/api/v1/datasets`
|
17 |
|
18 |
Creates a dataset.
|
19 |
|
20 |
### Request
|
21 |
|
22 |
- Method: POST
|
23 |
+
- URL: `/api/v1/datasets`
|
24 |
- Headers:
|
25 |
- `'content-Type: application/json'`
|
26 |
- `'Authorization: Bearer {YOUR_API_KEY}'`
|
|
|
38 |
|
39 |
```bash
|
40 |
curl --request POST \
|
41 |
+
--url http://{address}/api/v1/datasets \
|
42 |
--header 'Content-Type: application/json' \
|
43 |
--header 'Authorization: Bearer {YOUR_API_KEY}' \
|
44 |
--data '{
|
|
|
151 |
|
152 |
## Delete datasets
|
153 |
|
154 |
+
**DELETE** `/api/v1/datasets`
|
155 |
|
156 |
Deletes datasets by ID.
|
157 |
|
158 |
### Request
|
159 |
|
160 |
- Method: DELETE
|
161 |
+
- URL: `/api/v1/datasets`
|
162 |
- Headers:
|
163 |
- `'content-Type: application/json'`
|
164 |
- `'Authorization: Bearer {YOUR_API_KEY}'`
|
|
|
169 |
|
170 |
```bash
|
171 |
curl --request DELETE \
|
172 |
+
--url http://{address}/api/v1/datasets \
|
173 |
--header 'Content-Type: application/json' \
|
174 |
--header 'Authorization: Bearer {YOUR_API_KEY}' \
|
175 |
--data '{"ids": ["test_1", "test_2"]}'
|
|
|
203 |
|
204 |
## Update dataset
|
205 |
|
206 |
+
**PUT** `/api/v1/datasets/{dataset_id}`
|
207 |
|
208 |
Updates configurations for a specified dataset.
|
209 |
|
210 |
### Request
|
211 |
|
212 |
- Method: PUT
|
213 |
+
- URL: `/api/v1/datasets/{dataset_id}`
|
214 |
- Headers:
|
215 |
- `'content-Type: application/json'`
|
216 |
- `'Authorization: Bearer {YOUR_API_KEY}'`
|
|
|
223 |
|
224 |
```bash
|
225 |
curl --request PUT \
|
226 |
+
--url http://{address}/api/v1/datasets/{dataset_id} \
|
227 |
--header 'Content-Type: application/json' \
|
228 |
--header 'Authorization: Bearer {YOUR_API_KEY}' \
|
229 |
--data '
|
|
|
279 |
|
280 |
## List datasets
|
281 |
|
282 |
+
**GET** `/api/v1/datasets?page={page}&page_size={page_size}&orderby={orderby}&desc={desc}&name={dataset_name}&id={dataset_id}`
|
283 |
|
284 |
Lists datasets.
|
285 |
|
286 |
### Request
|
287 |
|
288 |
- Method: GET
|
289 |
+
- URL: `/api/v1/datasets?page={page}&page_size={page_size}&orderby={orderby}&desc={desc}&name={dataset_name}&id={dataset_id}`
|
290 |
- Headers:
|
291 |
- `'Authorization: Bearer {YOUR_API_KEY}'`
|
292 |
|
|
|
294 |
|
295 |
```bash
|
296 |
curl --request GET \
|
297 |
+
--url http://{address}/api/v1/datasets?page={page}&page_size={page_size}&orderby={orderby}&desc={desc}&name={dataset_name}&id={dataset_id} \
|
298 |
--header 'Authorization: Bearer {YOUR_API_KEY}'
|
299 |
```
|
300 |
|
|
|
379 |
|
380 |
## Upload documents
|
381 |
|
382 |
+
**POST** `/api/v1/datasets/{dataset_id}/documents`
|
383 |
|
384 |
Uploads documents to a specified dataset.
|
385 |
|
386 |
### Request
|
387 |
|
388 |
- Method: POST
|
389 |
+
- URL: `/api/v1/datasets/{dataset_id}/documents`
|
390 |
- Headers:
|
391 |
- `'Content-Type: multipart/form-data'`
|
392 |
- `'Authorization: Bearer {YOUR_API_KEY}'`
|
|
|
397 |
|
398 |
```bash
|
399 |
curl --request POST \
|
400 |
+
--url http://{address}/api/v1/datasets/{dataset_id}/documents \
|
401 |
--header 'Content-Type: multipart/form-data' \
|
402 |
--header 'Authorization: Bearer {YOUR_API_KEY}' \
|
403 |
--form 'file=@./test1.txt' \
|
|
|
457 |
|
458 |
## Update document
|
459 |
|
460 |
+
**PUT** `/api/v1/datasets/{dataset_id}/documents/{document_id}`
|
461 |
|
462 |
Updates configurations for a specified document.
|
463 |
|
464 |
### Request
|
465 |
|
466 |
- Method: PUT
|
467 |
+
- URL: `/api/v1/datasets/{dataset_id}/documents/{document_id}`
|
468 |
- Headers:
|
469 |
- `'content-Type: application/json'`
|
470 |
- `'Authorization: Bearer {YOUR_API_KEY}'`
|
|
|
477 |
|
478 |
```bash
|
479 |
curl --request PUT \
|
480 |
+
--url http://{address}/api/v1/datasets/{dataset_id}/info/{document_id} \
|
481 |
--header 'Authorization: Bearer {YOUR_API_KEY}' \
|
482 |
--header 'Content-Type: application/json' \
|
483 |
--data '
|
|
|
540 |
|
541 |
## Download document
|
542 |
|
543 |
+
**GET** `/api/v1/datasets/{dataset_id}/documents/{document_id}`
|
544 |
|
545 |
Downloads a document from a specified dataset.
|
546 |
|
547 |
### Request
|
548 |
|
549 |
- Method: GET
|
550 |
+
- URL: `/api/v1/datasets/{dataset_id}/documents/{document_id}`
|
551 |
- Headers:
|
552 |
- `'Authorization: Bearer {YOUR_API_KEY}'`
|
553 |
- Output:
|
|
|
557 |
|
558 |
```bash
|
559 |
curl --request GET \
|
560 |
+
--url http://{address}/api/v1/datasets/{dataset_id}/documents/{document_id} \
|
561 |
--header 'Authorization: Bearer {YOUR_API_KEY}' \
|
562 |
--output ./ragflow.txt
|
563 |
```
|
|
|
590 |
|
591 |
## List documents
|
592 |
|
593 |
+
**GET** `/api/v1/datasets/{dataset_id}/documents?offset={offset}&limit={limit}&orderby={orderby}&desc={desc}&keywords={keywords}&id={document_id}`
|
594 |
|
595 |
Lists documents in a specified dataset.
|
596 |
|
597 |
### Request
|
598 |
|
599 |
- Method: GET
|
600 |
+
- URL: `/api/v1/datasets/{dataset_id}/documents?keywords={keyword}&page={page}&page_size={limit}&orderby={orderby}&desc={desc}&name={name}`
|
601 |
- Headers:
|
602 |
- `'content-Type: application/json'`
|
603 |
- `'Authorization: Bearer {YOUR_API_KEY}'`
|
|
|
606 |
|
607 |
```bash
|
608 |
curl --request GET \
|
609 |
+
--url http://{address}/api/v1/datasets/{dataset_id}/documents?keywords={keywords}&offset={offset}&limit={limit}&orderby={orderby}&desc={desc}&id={document_id} \
|
610 |
--header 'Authorization: Bearer {YOUR_API_KEY}'
|
611 |
```
|
612 |
|
|
|
687 |
|
688 |
## Delete documents
|
689 |
|
690 |
+
**DELETE** `/api/v1/datasets/{dataset_id}/documents`
|
691 |
|
692 |
Deletes documents by ID.
|
693 |
|
694 |
### Request
|
695 |
|
696 |
- Method: DELETE
|
697 |
+
- URL: `/api/v1/datasets/{dataset_id}/documents`
|
698 |
- Headers:
|
699 |
- `'Content-Type: application/json'`
|
700 |
- `'Authorization: Bearer {YOUR_API_KEY}'`
|
|
|
705 |
|
706 |
```bash
|
707 |
curl --request DELETE \
|
708 |
+
--url http://{address}/api/v1/datasets/{dataset_id}/documents \
|
709 |
--header 'Content-Type: application/json' \
|
710 |
--header 'Authorization: {YOUR_API_KEY}' \
|
711 |
--data '
|
|
|
744 |
|
745 |
## Parse documents
|
746 |
|
747 |
+
**POST** `/api/v1/datasets/{dataset_id}/chunks`
|
748 |
|
749 |
Parses documents in a specified dataset.
|
750 |
|
751 |
### Request
|
752 |
|
753 |
- Method: POST
|
754 |
+
- URL: `/api/v1/datasets/{dataset_id}/chunks`
|
755 |
- Headers:
|
756 |
- `'content-Type: application/json'`
|
757 |
- 'Authorization: Bearer {YOUR_API_KEY}'
|
|
|
762 |
|
763 |
```bash
|
764 |
curl --request POST \
|
765 |
+
--url http://{address}/api/v1/datasets/{dataset_id}/chunks \
|
766 |
--header 'Content-Type: application/json' \
|
767 |
--header 'Authorization: Bearer {YOUR_API_KEY}' \
|
768 |
--data '
|
|
|
801 |
|
802 |
## Stop parsing documents
|
803 |
|
804 |
+
**DELETE** `/api/v1/datasets/{dataset_id}/chunks`
|
805 |
|
806 |
Stops parsing specified documents.
|
807 |
|
808 |
### Request
|
809 |
|
810 |
- Method: DELETE
|
811 |
+
- URL: `/api/v1/datasets/{dataset_id}/chunks`
|
812 |
- Headers:
|
813 |
- `'content-Type: application/json'`
|
814 |
- `'Authorization: Bearer {YOUR_API_KEY}'`
|
|
|
819 |
|
820 |
```bash
|
821 |
curl --request DELETE \
|
822 |
+
--url http://{address}/api/v1/datasets/{dataset_id}/chunks \
|
823 |
--header 'Content-Type: application/json' \
|
824 |
--header 'Authorization: Bearer {YOUR_API_KEY}' \
|
825 |
--data '
|
|
|
858 |
|
859 |
## Add chunks
|
860 |
|
861 |
+
**POST** `/api/v1/datasets/{dataset_id}/documents/{document_id}/chunks`
|
862 |
|
863 |
Adds a chunk to a specified document in a specified dataset.
|
864 |
|
865 |
### Request
|
866 |
|
867 |
- Method: POST
|
868 |
+
- URL: `/api/v1/datasets/{dataset_id}/documents/{document_id}/chunks`
|
869 |
- Headers:
|
870 |
- `'content-Type: application/json'`
|
871 |
- `'Authorization: Bearer {YOUR_API_KEY}'`
|
|
|
877 |
|
878 |
```bash
|
879 |
curl --request POST \
|
880 |
+
--url http://{address}/api/v1/datasets/{dataset_id}/documents/{document_id}/chunks \
|
881 |
--header 'Content-Type: application/json' \
|
882 |
--header 'Authorization: Bearer {YOUR_API_KEY}' \
|
883 |
--data '
|
|
|
933 |
|
934 |
## List chunks
|
935 |
|
936 |
+
**GET** `/api/v1/datasets/{dataset_id}/documents/{document_id}/chunks?keywords={keywords}&offset={offset}&limit={limit}&id={id}`
|
937 |
|
938 |
Lists chunks in a specified document.
|
939 |
|
940 |
### Request
|
941 |
|
942 |
- Method: GET
|
943 |
+
- URL: `/api/v1/datasets/{dataset_id}/documents/{document_id}/chunks?keywords={keywords}&offset={offset}&limit={limit}&id={chunk_id}`
|
944 |
- Headers:
|
945 |
- `'Authorization: Bearer {YOUR_API_KEY}'`
|
946 |
|
|
|
948 |
|
949 |
```bash
|
950 |
curl --request GET \
|
951 |
+
--url http://{address}/api/v1/datasets/{dataset_id}/documents/{document_id}/chunks?keywords={keywords}&offset={offset}&limit={limit}&id={chunk_id} \
|
952 |
--header 'Authorization: Bearer {YOUR_API_KEY}'
|
953 |
```
|
954 |
|
|
|
1040 |
|
1041 |
## Delete chunks
|
1042 |
|
1043 |
+
**DELETE** `/api/v1/datasets/{dataset_id}/documents/{document_id}/chunks`
|
1044 |
|
1045 |
Deletes chunks by ID.
|
1046 |
|
1047 |
### Request
|
1048 |
|
1049 |
- Method: DELETE
|
1050 |
+
- URL: `/api/v1/datasets/{dataset_id}/documents/{document_id}/chunks`
|
1051 |
- Headers:
|
1052 |
- `'content-Type: application/json'`
|
1053 |
- `'Authorization: Bearer {YOUR_API_KEY}'`
|
|
|
1058 |
|
1059 |
```bash
|
1060 |
curl --request DELETE \
|
1061 |
+
--url http://{address}/api/v1/datasets/{dataset_id}/documents/{document_id}/chunks \
|
1062 |
--header 'Content-Type: application/json' \
|
1063 |
--header 'Authorization: Bearer {YOUR_API_KEY}' \
|
1064 |
--data '
|
|
|
1099 |
|
1100 |
## Update chunk
|
1101 |
|
1102 |
+
**PUT** `/api/v1/datasets/{dataset_id}/documents/{document_id}/chunks/{chunk_id}`
|
1103 |
|
1104 |
Updates content or configurations for a specified chunk.
|
1105 |
|
1106 |
### Request
|
1107 |
|
1108 |
- Method: PUT
|
1109 |
+
- URL: `/api/v1/datasets/{dataset_id}/documents/{document_id}/chunks/{chunk_id}`
|
1110 |
- Headers:
|
1111 |
- `'content-Type: application/json'`
|
1112 |
- `'Authorization: Bearer {YOUR_API_KEY}'`
|
|
|
1119 |
|
1120 |
```bash
|
1121 |
curl --request PUT \
|
1122 |
+
--url http://{address}/api/v1/datasets/{dataset_id}/documents/{document_id}/chunks/{chunk_id} \
|
1123 |
--header 'Content-Type: application/json' \
|
1124 |
--header 'Authorization: {YOUR_API_KEY}' \
|
1125 |
--data '
|
|
|
1169 |
|
1170 |
## Retrieve chunks
|
1171 |
|
1172 |
+
**GET** `/api/v1/retrievals`
|
1173 |
|
1174 |
Retrieves chunks from specified datasets.
|
1175 |
|
1176 |
### Request
|
1177 |
|
1178 |
- Method: POST
|
1179 |
+
- URL: `/api/v1/retrievals`
|
1180 |
- Headers:
|
1181 |
- `'content-Type: application/json'`
|
1182 |
- `'Authorization: Bearer {YOUR_API_KEY}'`
|
|
|
1197 |
|
1198 |
```bash
|
1199 |
curl --request POST \
|
1200 |
+
--url http://{address}/api/v1/retrievals \
|
1201 |
--header 'Content-Type: application/json' \
|
1202 |
--header 'Authorization: {YOUR_API_KEY}' \
|
1203 |
--data '
|
|
|
1223 |
- `"similarity_threshold"`: (*Body parameter*)
|
1224 |
The minimum similarity score. Defaults to `0.2`.
|
1225 |
- `"vector_similarity_weight"`: (*Body parameter*), `float`
|
1226 |
+
The weight of vector cosine similarity. Defaults to `0.3`. If x represents the weight of vector cosine similarity, then (1 - x) is the term similarity weight.
|
1227 |
- `"top_k"`: (*Body parameter*), `integer`
|
1228 |
The number of chunks engaged in vector cosine computaton. Defaults to `1024`.
|
1229 |
- `"rerank_id"`: (*Body parameter*), `integer`
|
|
|
1297 |
|
1298 |
## Create chat assistant
|
1299 |
|
1300 |
+
**POST** `/api/v1/chats`
|
1301 |
|
1302 |
Creates a chat assistant.
|
1303 |
|
1304 |
### Request
|
1305 |
|
1306 |
- Method: POST
|
1307 |
+
- URL: `/api/v1/chats`
|
1308 |
- Headers:
|
1309 |
- `'content-Type: application/json'`
|
1310 |
- `'Authorization: Bearer {YOUR_API_KEY}'`
|
|
|
1319 |
|
1320 |
```shell
|
1321 |
curl --request POST \
|
1322 |
+
--url http://{address}/api/v1/chats \
|
1323 |
--header 'Content-Type: application/json' \
|
1324 |
--header 'Authorization: Bearer {YOUR_API_KEY}'
|
1325 |
--data '{
|
|
|
1433 |
|
1434 |
## Update chat assistant
|
1435 |
|
1436 |
+
**PUT** `/api/v1/chats/{chat_id}`
|
1437 |
|
1438 |
Updates configurations for a specified chat assistant.
|
1439 |
|
1440 |
### Request
|
1441 |
|
1442 |
- Method: PUT
|
1443 |
+
- URL: `/api/v1/chats/{chat_id}`
|
1444 |
- Headers:
|
1445 |
- `'content-Type: application/json'`
|
1446 |
- `'Authorization: Bearer {YOUR_API_KEY}'`
|
|
|
1455 |
|
1456 |
```bash
|
1457 |
curl --request PUT \
|
1458 |
+
--url http://{address}/api/v1/chats/{chat_id} \
|
1459 |
--header 'Content-Type: application/json' \
|
1460 |
--header 'Authorization: Bearer {YOUR_API_KEY}' \
|
1461 |
--data '
|
|
|
1529 |
|
1530 |
## Delete chat assistants
|
1531 |
|
1532 |
+
**DELETE** `/api/v1/chats`
|
1533 |
|
1534 |
Deletes chat assistants by ID.
|
1535 |
|
1536 |
### Request
|
1537 |
|
1538 |
- Method: DELETE
|
1539 |
+
- URL: `/api/v1/chats`
|
1540 |
- Headers:
|
1541 |
- `'content-Type: application/json'`
|
1542 |
- `'Authorization: Bearer {YOUR_API_KEY}'`
|
|
|
1547 |
|
1548 |
```bash
|
1549 |
curl --request DELETE \
|
1550 |
+
--url http://{address}/api/v1/chats \
|
1551 |
--header 'Content-Type: application/json' \
|
1552 |
--header 'Authorization: Bearer {YOUR_API_KEY}' \
|
1553 |
--data '
|
|
|
1584 |
|
1585 |
## List chat assistants
|
1586 |
|
1587 |
+
**GET** `/api/v1/chats?page={page}&page_size={page_size}&orderby={orderby}&desc={desc}&name={chat_name}&id={chat_id}`
|
1588 |
|
1589 |
Lists chat assistants.
|
1590 |
|
1591 |
### Request
|
1592 |
|
1593 |
- Method: GET
|
1594 |
+
- URL: `/api/v1/chats?page={page}&page_size={page_size}&orderby={orderby}&desc={desc}&name={dataset_name}&id={dataset_id}`
|
1595 |
- Headers:
|
1596 |
- `'Authorization: Bearer {YOUR_API_KEY}'`
|
1597 |
|
|
|
1599 |
|
1600 |
```bash
|
1601 |
curl --request GET \
|
1602 |
+
--url http://{address}/api/v1/chats?page={page}&page_size={page_size}&orderby={orderby}&desc={desc}&name={dataset_name}&id={dataset_id} \
|
1603 |
--header 'Authorization: Bearer {YOUR_API_KEY}'
|
1604 |
```
|
1605 |
|
|
|
1683 |
|
1684 |
## Create session
|
1685 |
|
1686 |
+
**POST** `/api/v1/chats/{chat_id}/sessions`
|
1687 |
|
1688 |
Creates a chat session.
|
1689 |
|
1690 |
### Request
|
1691 |
|
1692 |
- Method: POST
|
1693 |
+
- URL: `/api/v1/chats/{chat_id}/sessions`
|
1694 |
- Headers:
|
1695 |
- `'content-Type: application/json'`
|
1696 |
- `'Authorization: Bearer {YOUR_API_KEY}'`
|
|
|
1701 |
|
1702 |
```bash
|
1703 |
curl --request POST \
|
1704 |
+
--url http://{address}/api/v1/chats/{chat_id}/sessions \
|
1705 |
--header 'Content-Type: application/json' \
|
1706 |
--header 'Authorization: Bearer {YOUR_API_KEY}' \
|
1707 |
--data '
|
|
|
1755 |
|
1756 |
## Update session
|
1757 |
|
1758 |
+
**PUT** `/api/v1/chats/{chat_id}/sessions/{session_id}`
|
1759 |
|
1760 |
Updates a chat session.
|
1761 |
|
1762 |
### Request
|
1763 |
|
1764 |
- Method: PUT
|
1765 |
+
- URL: `/api/v1/chats/{chat_id}/sessions/{session_id}`
|
1766 |
- Headers:
|
1767 |
- `'content-Type: application/json'`
|
1768 |
- `'Authorization: Bearer {YOUR_API_KEY}'`
|
|
|
1772 |
#### Request example
|
1773 |
```bash
|
1774 |
curl --request PUT \
|
1775 |
+
--url http://{address}/api/v1/chats/{chat_id}/sessions/{session_id} \
|
1776 |
--header 'Content-Type: application/json' \
|
1777 |
--header 'Authorization: Bearer {YOUR_API_KEY}' \
|
1778 |
--data '
|
|
|
1813 |
|
1814 |
## List sessions
|
1815 |
|
1816 |
+
**GET** `/api/v1/chats/{chat_id}/sessions?page={page}&page_size={page_size}&orderby={orderby}&desc={desc}&name={session_name}&id={session_id}`
|
1817 |
|
1818 |
Lists sessions associated with a specified chat assistant.
|
1819 |
|
1820 |
### Request
|
1821 |
|
1822 |
- Method: GET
|
1823 |
+
- URL: `/api/v1/chats/{chat_id}/sessions?page={page}&page_size={page_size}&orderby={orderby}&desc={desc}&name={session_name}&id={session_id}`
|
1824 |
- Headers:
|
1825 |
- `'Authorization: Bearer {YOUR_API_KEY}'`
|
1826 |
|
|
|
1828 |
|
1829 |
```bash
|
1830 |
curl --request GET \
|
1831 |
+
--url http://{address}/api/v1/chats/{chat_id}/sessions?page={page}&page_size={page_size}&orderby={orderby}&desc={desc}&name={session_name}&id={session_id} \
|
1832 |
--header 'Authorization: Bearer {YOUR_API_KEY}'
|
1833 |
```
|
1834 |
|
|
|
1891 |
|
1892 |
## Delete sessions
|
1893 |
|
1894 |
+
**DELETE** `/api/v1/chats/{chat_id}/sessions`
|
1895 |
|
1896 |
Deletes sessions by ID.
|
1897 |
|
1898 |
### Request
|
1899 |
|
1900 |
- Method: DELETE
|
1901 |
+
- URL: `/api/v1/chats/{chat_id}/sessions`
|
1902 |
- Headers:
|
1903 |
- `'content-Type: application/json'`
|
1904 |
- `'Authorization: Bearer {YOUR_API_KEY}'`
|
|
|
1910 |
```bash
|
1911 |
# Either id or name must be provided, but not both.
|
1912 |
curl --request DELETE \
|
1913 |
+
--url http://{address}/api/v1/chats/{chat_id}/sessions \
|
1914 |
--header 'Content-Type: application/json' \
|
1915 |
--header 'Authorization: Bear {YOUR_API_KEY}' \
|
1916 |
--data '
|
|
|
1949 |
|
1950 |
## Converse
|
1951 |
|
1952 |
+
**POST** `/api/v1/chats/{chat_id}/completions`
|
1953 |
|
1954 |
Asks a question to start an AI-powered conversation.
|
1955 |
|
1956 |
### Request
|
1957 |
|
1958 |
- Method: POST
|
1959 |
+
- URL: `/api/v1/chats/{chat_id}/completions`
|
1960 |
- Headers:
|
1961 |
- `'content-Type: application/json'`
|
1962 |
- `'Authorization: Bearer {YOUR_API_KEY}'`
|
|
|
1969 |
|
1970 |
```bash
|
1971 |
curl --request POST \
|
1972 |
+
--url http://{address}/api/v1/chats/{chat_id}/completions \
|
1973 |
--header 'Content-Type: application/json' \
|
1974 |
--header 'Authorization: Bearer {YOUR_API_KEY}' \
|
1975 |
--data-binary '
|