Skip to content

Commit 8e5efcc

Browse files
authored
Updated dataset APIs (infiniflow#2820)
### What problem does this PR solve? ### Type of change - [x] Documentation Update
1 parent 6eed115 commit 8e5efcc

File tree

2 files changed

+174
-156
lines changed

2 files changed

+174
-156
lines changed

api/http_api.md

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
**POST** `/api/v1/dataset`
77

8-
Creates a dataset.
8+
Creates a knowledge base (dataset).
99

1010
### Request
1111

@@ -31,11 +31,11 @@ Creates a dataset.
3131
#### Request example
3232

3333
```bash
34-
# "id": id must not be provided.
35-
# "name": name is required and can't be duplicated.
34+
# "id": "id" must not be provided.
35+
# "name": name is required and cannot be duplicated.
3636
# "tenant_id": tenant_id must not be provided.
37-
# "embedding_model": embedding_model must not be provided.
38-
# "navie" means general.
37+
# "embedding_model": REQUIRED.
38+
# "naive": general.
3939
curl --request POST \
4040
--url http://{address}/api/v1/dataset \
4141
--header 'Content-Type: application/json' \
@@ -51,21 +51,21 @@ curl --request POST \
5151
#### Request parameters
5252

5353
- `"id"`: (*Body parameter*)
54-
The ID of the created dataset used to uniquely identify different datasets.
55-
- If creating a dataset, `id` must not be provided.
54+
The unique identifier of each created dataset.
55+
- When creating a dataset, `id` must not be provided.
5656

5757
- `"name"`: (*Body parameter*)
5858
The name of the dataset, which must adhere to the following requirements:
5959
- Required when creating a dataset and must be unique.
60-
- If updating a dataset, `name` must still be unique.
60+
- When updating a dataset, `name` must still be unique.
6161

6262
- `"avatar"`: (*Body parameter*)
6363
Base64 encoding of the avatar.
6464

6565
- `"tenant_id"`: (*Body parameter*)
6666
The ID of the tenant associated with the dataset, used to link it with specific users.
67-
- If creating a dataset, `tenant_id` must not be provided.
68-
- If updating a dataset, `tenant_id` cannot be changed.
67+
- When creating a dataset, `tenant_id` must not be provided.
68+
- When updating a dataset, `tenant_id` cannot be changed.
6969

7070
- `"description"`: (*Body parameter*)
7171
The description of the dataset.
@@ -74,31 +74,31 @@ curl --request POST \
7474
The language setting for the dataset.
7575

7676
- `"embedding_model"`: (*Body parameter*)
77-
Embedding model used in the dataset to generate vector embeddings.
78-
- If creating a dataset, `embedding_model` must not be provided.
79-
- If updating a dataset, `embedding_model` cannot be changed.
77+
Embedding model used in the dataset for generating vector embeddings.
78+
- When creating a dataset, `embedding_model` must not be provided.
79+
- When updating a dataset, `embedding_model` cannot be changed.
8080

8181
- `"permission"`: (*Body parameter*)
8282
Specifies who can manipulate the dataset.
8383

8484
- `"document_count"`: (*Body parameter*)
8585
Document count of the dataset.
86-
- If updating a dataset, `document_count` cannot be changed.
86+
- When updating a dataset, `document_count` cannot be changed.
8787

8888
- `"chunk_count"`: (*Body parameter*)
8989
Chunk count of the dataset.
90-
- If updating a dataset, `chunk_count` cannot be changed.
90+
- When updating a dataset, `chunk_count` cannot be changed.
9191

9292
- `"parse_method"`: (*Body parameter*)
9393
Parsing method of the dataset.
94-
- If updating `parse_method`, `chunk_count` must be greater than 0.
94+
- When updating `parse_method`, `chunk_count` must be greater than 0.
9595

9696
- `"parser_config"`: (*Body parameter*)
9797
The configuration settings for the dataset parser.
9898

9999
### Response
100100

101-
The successful response includes a JSON object like the following:
101+
A successful response includes a JSON object like the following:
102102

103103
```json
104104
{
@@ -139,8 +139,7 @@ The successful response includes a JSON object like the following:
139139
- `"error_code"`: `integer`
140140
`0`: The operation succeeds.
141141

142-
143-
The error response includes a JSON object like the following:
142+
An error response includes a JSON object like the following:
144143

145144
```json
146145
{
@@ -153,7 +152,7 @@ The error response includes a JSON object like the following:
153152

154153
**DELETE** `/api/v1/dataset`
155154

156-
Deletes datasets by ids.
155+
Deletes datasets by their IDs.
157156

158157
### Request
159158

@@ -169,7 +168,7 @@ Deletes datasets by ids.
169168
#### Request example
170169

171170
```bash
172-
# Either id or name must be provided, but not both.
171+
# Specify either "ids" or "names", NOT both.
173172
curl --request DELETE \
174173
--url http://{address}/api/v1/dataset \
175174
--header 'Content-Type: application/json' \
@@ -181,13 +180,13 @@ curl --request DELETE \
181180

182181
#### Request parameters
183182

184-
- `"ids"`: (*Body parameter*)
185-
Dataset IDs to delete.
183+
- `"ids"`: (*Body parameter*)
184+
IDs of the datasets to delete.
186185

187186

188187
### Response
189188

190-
The successful response includes a JSON object like the following:
189+
A successful response includes a JSON object like the following:
191190

192191
```json
193192
{
@@ -199,7 +198,7 @@ The successful response includes a JSON object like the following:
199198
`0`: The operation succeeds.
200199

201200

202-
The error response includes a JSON object like the following:
201+
An error response includes a JSON object like the following:
203202

204203
```json
205204
{
@@ -212,7 +211,7 @@ The error response includes a JSON object like the following:
212211

213212
**PUT** `/api/v1/dataset/{dataset_id}`
214213

215-
Updates a dataset by its id.
214+
Updates a dataset by its ID.
216215

217216
### Request
218217

@@ -227,14 +226,14 @@ Updates a dataset by its id.
227226
#### Request example
228227

229228
```bash
230-
# "id": id is required.
231-
# "name": If you update name, it can't be duplicated.
232-
# "tenant_id": If you update tenant_id, it can't be changed
233-
# "embedding_model": If you update embedding_model, it can't be changed.
234-
# "chunk_count": If you update chunk_count, it can't be changed.
235-
# "document_count": If you update document_count, it can't be changed.
236-
# "parse_method": If you update parse_method, chunk_count must be 0.
237-
# "navie" means general.
229+
# "id": REQUIRED
230+
# "name": If you update "name", it cannot be duplicated.
231+
# "tenant_id": If you update "tenant_id", it cannot be changed
232+
# "embedding_model": If you update "embedding_model", it cannot be changed.
233+
# "chunk_count": If you update "chunk_count", it cannot be changed.
234+
# "document_count": If you update "document_count", it cannot be changed.
235+
# "parse_method": If you update "parse_method", "chunk_count" must be 0.
236+
# "naive": General.
238237
curl --request PUT \
239238
--url http://{address}/api/v1/dataset/{dataset_id} \
240239
--header 'Content-Type: application/json' \
@@ -245,17 +244,18 @@ curl --request PUT \
245244
"embedding_model": "BAAI/bge-zh-v1.5",
246245
"chunk_count": 0,
247246
"document_count": 0,
248-
"parse_method": "navie"
247+
"parse_method": "naive"
249248
}'
250249
```
251250

252251
#### Request parameters
253-
(Refer to the "Create Dataset" for the complete structure of the request parameters.)
252+
253+
See the "Create Dataset" for the complete structure of the request parameters.
254254

255255

256256
### Response
257257

258-
The successful response includes a JSON object like the following:
258+
A successful response includes a JSON object like the following:
259259

260260
```json
261261
{
@@ -267,7 +267,7 @@ The successful response includes a JSON object like the following:
267267
`0`: The operation succeeds.
268268

269269

270-
The error response includes a JSON object like the following:
270+
An error response includes a JSON object like the following:
271271

272272
```json
273273
{
@@ -321,7 +321,7 @@ curl --request GET \
321321

322322
### Response
323323

324-
The successful response includes a JSON object like the following:
324+
A successful response includes a JSON object like the following:
325325

326326
```json
327327
{
@@ -365,7 +365,7 @@ The successful response includes a JSON object like the following:
365365
```
366366

367367

368-
The error response includes a JSON object like the following:
368+
An error response includes a JSON object like the following:
369369

370370
```json
371371
{
@@ -409,7 +409,7 @@ curl --request POST \
409409

410410
### Response
411411

412-
The successful response includes a JSON object like the following:
412+
A successful response includes a JSON object like the following:
413413

414414
```shell
415415
{
@@ -421,7 +421,7 @@ The successful response includes a JSON object like the following:
421421
`0`: The operation succeeds.
422422

423423

424-
The error response includes a JSON object like the following:
424+
An error response includes a JSON object like the following:
425425

426426
```shell
427427
{
@@ -464,7 +464,7 @@ curl --request GET \
464464

465465
### Response
466466

467-
The successful response includes a JSON object like the following:
467+
A successful response includes a JSON object like the following:
468468

469469
```shell
470470
{
@@ -476,7 +476,7 @@ The successful response includes a JSON object like the following:
476476
`0`: The operation succeeds.
477477

478478

479-
The error response includes a JSON object like the following:
479+
An error response includes a JSON object like the following:
480480

481481
```shell
482482
{
@@ -528,7 +528,7 @@ curl --request GET \
528528

529529
### Response
530530

531-
The successful response includes a JSON object like the following:
531+
A successful response includes a JSON object like the following:
532532

533533
```shell
534534
{
@@ -605,7 +605,7 @@ The successful response includes a JSON object like the following:
605605
`0`: The operation succeeds.
606606

607607

608-
The error response includes a JSON object like the following:
608+
An error response includes a JSON object like the following:
609609

610610
```shell
611611
{
@@ -659,15 +659,15 @@ curl --request PUT \
659659

660660
### Response
661661

662-
The successful response includes a JSON object like the following:
662+
A successful response includes a JSON object like the following:
663663

664664
```shell
665665
{
666666
"code": 0
667667
}
668668
```
669669

670-
The error response includes a JSON object like the following:
670+
An error response includes a JSON object like the following:
671671

672672
```shell
673673
{
@@ -710,15 +710,15 @@ curl --request POST \
710710

711711
### Response
712712

713-
The successful response includes a JSON object like the following:
713+
A successful response includes a JSON object like the following:
714714

715715
```shell
716716
{
717717
"code": 0
718718
}
719719
```
720720

721-
The error response includes a JSON object like the following:
721+
An error response includes a JSON object like the following:
722722

723723
```shell
724724
{
@@ -761,15 +761,15 @@ curl --request DELETE \
761761

762762
### Response
763763

764-
The successful response includes a JSON object like the following:
764+
A successful response includes a JSON object like the following:
765765

766766
```shell
767767
{
768768
"code": 0
769769
}
770770
```
771771

772-
The error response includes a JSON object like the following:
772+
An error response includes a JSON object like the following:
773773

774774
```shell
775775
{
@@ -808,7 +808,7 @@ curl --request GET \
808808

809809
### Response
810810

811-
The successful response includes a JSON object like the following:
811+
A successful response includes a JSON object like the following:
812812

813813
```shell
814814
{
@@ -863,7 +863,7 @@ The successful response includes a JSON object like the following:
863863
}
864864
```
865865

866-
The error response includes a JSON object like the following:
866+
An error response includes a JSON object like the following:
867867

868868
```shell
869869
{

0 commit comments

Comments
 (0)