writinwaters commited on
Commit
920f3c8
·
1 Parent(s): 7b6220c

DRAFT: Miscellaneous updates to HTTP API reference (#2923)

Browse files

### What problem does this PR solve?


### Type of change


- [x] Documentation Update

api/{http_api.md → http_api_reference.md} RENAMED
@@ -22,8 +22,8 @@ Creates a dataset.
22
  - Method: POST
23
  - URL: `http://{address}/api/v1/dataset`
24
  - Headers:
25
- - `content-Type: application/json`
26
- - 'Authorization: Bearer {YOUR_ACCESS_TOKEN}'
27
  - Body:
28
  - `"name"`: `string`
29
  - `"avatar"`: `string`
@@ -31,8 +31,6 @@ Creates a dataset.
31
  - `"language"`: `string`
32
  - `"embedding_model"`: `string`
33
  - `"permission"`: `string`
34
- - `"document_count"`: `integer`
35
- - `"chunk_count"`: `integer`
36
  - `"parse_method"`: `string`
37
  - `"parser_config"`: `Dataset.ParserConfig`
38
 
@@ -45,57 +43,69 @@ Creates a dataset.
45
  curl --request POST \
46
  --url http://{address}/api/v1/dataset \
47
  --header 'Content-Type: application/json' \
48
- --header 'Authorization: Bearer {YOUR_ACCESS_TOKEN}' \
49
  --data '{
50
  "name": "test",
51
  "chunk_count": 0,
52
  "document_count": 0,
53
- "parse_method": "naive"
54
  }'
55
  ```
56
 
57
  #### Request parameters
58
 
59
- - `"name"`: (*Body parameter*)
60
- The name of the dataset, which must adhere to the following requirements:
61
- - Required when creating a dataset and must be unique.
62
- - If updating a dataset, `name` must still be unique.
63
-
64
- - `"avatar"`: (*Body parameter*)
65
- Base64 encoding of the avatar.
66
-
67
- - `"description"`: (*Body parameter*)
68
- The description of the dataset.
69
-
70
- - `"language"`: (*Body parameter*)
71
- The language setting for the dataset.
72
-
73
- - `"embedding_model"`: (*Body parameter*)
74
- Embedding model used in the dataset to generate vector embeddings.
75
- - If creating a dataset, `embedding_model` must not be provided.
76
- - If updating a dataset, `embedding_model` cannot be changed.
77
-
78
- - `"permission"`: (*Body parameter*)
79
- Specifies who can access the dataset.
80
-
81
- - `"document_count"`: (*Body parameter*)
82
- Document count of the dataset.
83
- - If updating a dataset, `document_count` cannot be changed.
84
-
85
- - `"chunk_count"`: (*Body parameter*)
86
- Chunk count of the dataset.
87
- - If updating a dataset, `chunk_count` cannot be changed.
88
-
89
- - `"parse_method"`: (*Body parameter*)
90
- Parsing method of the dataset.
91
- - If updating `parse_method`, `chunk_count` must be greater than 0.
 
 
 
 
 
 
 
 
92
 
93
  - `"parser_config"`: (*Body parameter*)
94
- The configuration settings for the dataset parser.
 
 
 
 
95
 
96
  ### Response
97
 
98
- The successful response includes a JSON object like the following:
99
 
100
  ```json
101
  {
@@ -133,11 +143,7 @@ The successful response includes a JSON object like the following:
133
  }
134
  ```
135
 
136
- - `"error_code"`: `integer`
137
- `0`: The operation succeeds.
138
-
139
-
140
- The error response includes a JSON object like the following:
141
 
142
  ```json
143
  {
@@ -159,10 +165,10 @@ Deletes datasets by ID.
159
  - Method: DELETE
160
  - URL: `http://{address}/api/v1/dataset`
161
  - Headers:
162
- - `content-Type: application/json`
163
- - 'Authorization: Bearer {YOUR_ACCESS_TOKEN}'
164
  - Body:
165
- - `"ids"`: `List[string]`
166
 
167
 
168
  #### Request example
@@ -172,7 +178,7 @@ Deletes datasets by ID.
172
  curl --request DELETE \
173
  --url http://{address}/api/v1/dataset \
174
  --header 'Content-Type: application/json' \
175
- --header 'Authorization: Bearer {YOUR_ACCESS_TOKEN}' \
176
  --data '{
177
  "ids": ["test_1", "test_2"]
178
  }'
@@ -181,11 +187,11 @@ curl --request DELETE \
181
  #### Request parameters
182
 
183
  - `"ids"`: (*Body parameter*)
184
- The IDs of the dataset to delete.
185
 
186
  ### Response
187
 
188
- The successful response includes a JSON object like the following:
189
 
190
  ```json
191
  {
@@ -193,11 +199,7 @@ The successful response includes a JSON object like the following:
193
  }
194
  ```
195
 
196
- - `"error_code"`: `integer`
197
- `0`: The operation succeeds.
198
-
199
-
200
- The error response includes a JSON object like the following:
201
 
202
  ```json
203
  {
@@ -219,29 +221,27 @@ Updates configurations for a specified dataset.
219
  - Method: PUT
220
  - URL: `http://{address}/api/v1/dataset/{dataset_id}`
221
  - Headers:
222
- - `content-Type: application/json`
223
- - 'Authorization: Bearer {YOUR_ACCESS_TOKEN}'
224
- - Body: (Refer to the "Create Dataset" for the complete structure of the request body.)
225
-
 
 
226
 
227
  #### Request example
228
 
229
  ```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
  # "naive" means general.
238
  curl --request PUT \
239
  --url http://{address}/api/v1/dataset/{dataset_id} \
240
  --header 'Content-Type: application/json' \
241
- --header 'Authorization: Bearer {YOUR_ACCESS_TOKEN}' \
242
  --data '{
243
  "name": "test",
244
- "tenant_id": "4fb0cd625f9311efba4a0242ac120006",
245
  "embedding_model": "BAAI/bge-zh-v1.5",
246
  "chunk_count": 0,
247
  "document_count": 0,
@@ -251,11 +251,26 @@ curl --request PUT \
251
 
252
  #### Request parameters
253
 
254
- Refer to the "Create Dataset" for the complete structure of the request parameters.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
255
 
256
  ### Response
257
 
258
- The successful response includes a JSON object like the following:
259
 
260
  ```json
261
  {
@@ -263,11 +278,7 @@ The successful response includes a JSON object like the following:
263
  }
264
  ```
265
 
266
- - `"error_code"`: `integer`
267
- `0`: The operation succeeds.
268
-
269
-
270
- The error response includes a JSON object like the following:
271
 
272
  ```json
273
  {
@@ -291,7 +302,7 @@ Retrieves a list of datasets.
291
  - Method: GET
292
  - URL: `http://{address}/api/v1/dataset?page={page}&page_size={page_size}&orderby={orderby}&desc={desc}&name={dataset_name}&id={dataset_id}`
293
  - Headers:
294
- - 'Authorization: Bearer {YOUR_ACCESS_TOKEN}'
295
 
296
 
297
  #### Request example
@@ -303,29 +314,29 @@ Retrieves a list of datasets.
303
  # If no desc parameter is passed, the default is True
304
  curl --request GET \
305
  --url http://{address}/api/v1/dataset?page={page}&page_size={page_size}&orderby={orderby}&desc={desc}&name={dataset_name}&id={dataset_id} \
306
- --header 'Authorization: Bearer {YOUR_ACCESS_TOKEN}'
307
  ```
308
 
309
  #### Request parameters
310
 
311
- - `path`: (*Path parameter*)
312
- The current page number to retrieve from the paginated data. This parameter determines which set of records will be fetched.
313
- - `path_size`: (*Path parameter*)
314
- The number of records to retrieve per page. This controls how many records will be included in each page.
315
- - `orderby`: (*Path parameter*)
316
- The field by which the records should be sorted. This specifies the attribute or column used to order the results.
317
- - `desc`: (*Path parameter*)
318
- A boolean flag indicating whether the sorting should be in descending order.
319
- - `name`: (*Path parameter*)
320
- Dataset name
321
  - `"id"`: (*Path parameter*)
322
- The ID of the dataset to be retrieved.
323
  - `"name"`: (*Path parameter*)
324
- The name of the dataset to be retrieved.
325
 
326
  ### Response
327
 
328
- The successful response includes a JSON object like the following:
329
 
330
  ```json
331
  {
@@ -368,7 +379,7 @@ The successful response includes a JSON object like the following:
368
  }
369
  ```
370
 
371
- The error response includes a JSON object like the following:
372
 
373
  ```json
374
  {
@@ -397,7 +408,7 @@ Uploads documents to a specified dataset.
397
  - URL: `/api/v1/dataset/{dataset_id}/document`
398
  - Headers:
399
  - 'Content-Type: multipart/form-data'
400
- - 'Authorization: Bearer {YOUR_ACCESS_TOKEN}'
401
  - Form:
402
  - 'file=@{FILE_PATH}'
403
 
@@ -407,20 +418,20 @@ Uploads documents to a specified dataset.
407
  curl --request POST \
408
  --url http://{address}/api/v1/dataset/{dataset_id}/document \
409
  --header 'Content-Type: multipart/form-data' \
410
- --header 'Authorization: Bearer {YOUR_ACCESS_TOKEN}' \
411
  --form 'file=@./test.txt'
412
  ```
413
 
414
  #### Request parameters
415
 
416
- - `"dataset_id"`: (*Path parameter*)
417
- The dataset id
418
  - `"file"`: (*Body parameter*)
419
- The file to upload
420
 
421
  ### Response
422
 
423
- The successful response includes a JSON object like the following:
424
 
425
  ```json
426
  {
@@ -428,11 +439,7 @@ The successful response includes a JSON object like the following:
428
  }
429
  ```
430
 
431
- - `"error_code"`: `integer`
432
- `0`: The operation succeeds.
433
-
434
-
435
- The error response includes a JSON object like the following:
436
 
437
  ```json
438
  {
@@ -454,8 +461,8 @@ Updates configurations for a specified document.
454
  - Method: PUT
455
  - URL: `http://{address}/api/v1/dataset/{dataset_id}/document/{document_id}`
456
  - Headers:
457
- - `content-Type: application/json`
458
- - 'Authorization: Bearer {YOUR_ACCESS_TOKEN}'
459
  - Body:
460
  - `name`:`string`
461
  - `parser_method`:`string`
@@ -479,19 +486,18 @@ curl --request PUT \
479
  #### Request parameters
480
 
481
  - `"parser_method"`: (*Body parameter*)
482
- Method used to parse the document.
483
-
484
 
485
  - `"parser_config"`: (*Body parameter*)
486
- Configuration object for the parser.
487
- - If the value is `None`, a dictionary with default values will be generated.
488
 
489
  - `"name"`: (*Body parameter*)
490
- Name or title of the document.
491
 
492
  ### Response
493
 
494
- The successful response includes a JSON object like the following:
495
 
496
  ```json
497
  {
@@ -499,7 +505,7 @@ The successful response includes a JSON object like the following:
499
  }
500
  ```
501
 
502
- The error response includes a JSON object like the following:
503
 
504
  ```json
505
  {
@@ -521,7 +527,7 @@ Downloads a document from a specified dataset.
521
  - Method: GET
522
  - URL: `http://{address}/api/v1/dataset/{dataset_id}/document/{document_id}`
523
  - Headers:
524
- - 'Authorization: Bearer {YOUR_ACCESS_TOKEN}'
525
  - Output:
526
  - '{FILE_NAME}'
527
 
@@ -530,16 +536,16 @@ Downloads a document from a specified dataset.
530
  ```bash
531
  curl --request GET \
532
  --url http://{address}/api/v1/dataset/{dataset_id}/document/{document_id} \
533
- --header 'Authorization: Bearer {YOUR_ACCESS_TOKEN}' \
534
  --output ./ragflow.txt
535
  ```
536
 
537
  #### Request parameters
538
 
539
  - `"dataset_id"`: (*PATH parameter*)
540
- The dataset id
541
  - `"documents_id"`: (*PATH parameter*)
542
- The document id of the file.
543
 
544
  ### Response
545
 
@@ -549,11 +555,7 @@ The successful response includes a text object like the following:
549
  test_2.
550
  ```
551
 
552
- - `"error_code"`: `integer`
553
- `0`: The operation succeeds.
554
-
555
-
556
- The error response includes a JSON object like the following:
557
 
558
  ```json
559
  {
@@ -575,37 +577,37 @@ Retrieves a list of documents from a specified dataset.
575
  - Method: GET
576
  - URL: `/api/v1/dataset/{dataset_id}/info?keywords={keyword}&page={page}&page_size={limit}&orderby={orderby}&desc={desc}&name={name`
577
  - Headers:
578
- - `content-Type: application/json`
579
- - 'Authorization: Bearer {YOUR_ACCESS_TOKEN}'
580
 
581
  #### Request example
582
 
583
  ```bash
584
  curl --request GET \
585
  --url http://{address}/api/v1/dataset/{dataset_id}/info?offset={offset}&limit={limit}&orderby={orderby}&desc={desc}&keywords={keywords}&id={document_id} \
586
- --header 'Authorization: Bearer {YOUR_ACCESS_TOKEN}'
587
  ```
588
 
589
  #### Request parameters
590
 
591
- - `"dataset_id"`: (*PATH parameter*)
592
- The dataset id
593
- - `offset`: (*Filter parameter*)
594
- The beginning number of records for paging.
595
- - `keywords`: (*Filter parameter*)
596
- The keywords matches the search key workds;
597
- - `limit`: (*Filter parameter*)
598
- Records number to return.
599
- - `orderby`: (*Filter parameter*)
600
- The field by which the records should be sorted. This specifies the attribute or column used to order the results.
601
- - `desc`: (*Filter parameter*)
602
- A boolean flag indicating whether the sorting should be in descending order.
603
- - `id`: (*Filter parameter*)
604
- The id of the document to be got.
605
 
606
  ### Response
607
 
608
- The successful response includes a JSON object like the following:
609
 
610
  ```json
611
  {
@@ -648,11 +650,7 @@ The successful response includes a JSON object like the following:
648
  }
649
  ```
650
 
651
- - `"error_code"`: `integer`
652
- `0`: The operation succeeds.
653
-
654
-
655
- The error response includes a JSON object like the following:
656
 
657
  ```json
658
  {
@@ -674,10 +672,10 @@ Deletes documents by ID.
674
  - Method: DELETE
675
  - URL: `http://{address}/api/v1/dataset/{dataset_id}/document`
676
  - Headers:
677
- - 'Content-Type: application/json'
678
- - 'Authorization: Bearer {YOUR_ACCESS_TOKEN}'
679
  - Body:
680
- - `ids`:list[str]
681
 
682
  #### Request example
683
 
@@ -685,7 +683,7 @@ Deletes documents by ID.
685
  curl --request DELETE \
686
  --url http://{address}/api/v1/dataset/{dataset_id}/document \
687
  --header 'Content-Type: application/json' \
688
- --header 'Authorization: {YOUR ACCESS TOKEN}' \
689
  --data '{
690
  "ids": ["id_1","id_2"]
691
  }'
@@ -694,11 +692,11 @@ curl --request DELETE \
694
  #### Request parameters
695
 
696
  - `"ids"`: (*Body parameter*)
697
- The ids of teh documents to delete.
698
 
699
  ### Response
700
 
701
- The successful response includes a JSON object like the following:
702
 
703
  ```json
704
  {
@@ -706,11 +704,7 @@ The successful response includes a JSON object like the following:
706
  }.
707
  ```
708
 
709
- - `"error_code"`: `integer`
710
- `0`: The operation succeeds.
711
-
712
-
713
- The error response includes a JSON object like the following:
714
 
715
  ```json
716
  {
@@ -732,10 +726,10 @@ Parses documents in a specified dataset.
732
  - Method: POST
733
  - URL: `http://{address}/api/v1/dataset/{dataset_id}/chunk `
734
  - Headers:
735
- - `content-Type: application/json`
736
- - 'Authorization: Bearer {YOUR_ACCESS_TOKEN}'
737
  - Body:
738
- - `document_ids`:List[str]
739
 
740
  #### Request example
741
 
@@ -743,7 +737,7 @@ Parses documents in a specified dataset.
743
  curl --request POST \
744
  --url http://{address}/api/v1/dataset/{dataset_id}/chunk \
745
  --header 'Content-Type: application/json' \
746
- --header 'Authorization: Bearer {YOUR_ACCESS_TOKEN}' \
747
  --data '{"document_ids": ["97a5f1c2759811efaa500242ac120004","97ad64b6759811ef9fc30242ac120004"]}'
748
  ```
749
 
@@ -751,11 +745,11 @@ curl --request POST \
751
 
752
  - `"dataset_id"`: (*Path parameter*)
753
  - `"document_ids"`:(*Body parameter*)
754
- The ids of the documents to be parsed
755
 
756
  ### Response
757
 
758
- The successful response includes a JSON object like the following:
759
 
760
  ```json
761
  {
@@ -763,7 +757,7 @@ The successful response includes a JSON object like the following:
763
  }
764
  ```
765
 
766
- The error response includes a JSON object like the following:
767
 
768
  ```json
769
  {
@@ -785,17 +779,18 @@ Stops parsing specified documents.
785
  - Method: DELETE
786
  - URL: `http://{address}/api/v1/dataset/{dataset_id}/chunk`
787
  - Headers:
788
- - `content-Type: application/json`
789
- - 'Authorization: Bearer {YOUR_ACCESS_TOKEN}'
790
  - Body:
791
- - `document_ids`:List[str]
 
792
  #### Request example
793
 
794
  ```bash
795
  curl --request DELETE \
796
  --url http://{address}/api/v1/dataset/{dataset_id}/chunk \
797
  --header 'Content-Type: application/json' \
798
- --header 'Authorization: Bearer {YOUR_ACCESS_TOKEN}' \
799
  --data '{"document_ids": ["97a5f1c2759811efaa500242ac120004","97ad64b6759811ef9fc30242ac120004"]}'
800
  ```
801
 
@@ -803,12 +798,11 @@ curl --request DELETE \
803
 
804
  - `"dataset_id"`: (*Path parameter*)
805
  - `"document_ids"`:(*Body parameter*)
806
- The ids of the documents to be parsed
807
-
808
 
809
  ### Response
810
 
811
- The successful response includes a JSON object like the following:
812
 
813
  ```json
814
  {
@@ -816,7 +810,7 @@ The successful response includes a JSON object like the following:
816
  }
817
  ```
818
 
819
- The error response includes a JSON object like the following:
820
 
821
  ```json
822
  {
@@ -839,8 +833,8 @@ Adds a chunk to a specified document in a specified dataset.
839
  - Method: POST
840
  - URL: `http://{address}/api/v1/dataset/{dataset_id}/document/{document_id}/chunk`
841
  - Headers:
842
- - `content-Type: application/json`
843
- - 'Authorization: Bearer {YOUR_ACCESS_TOKEN}'
844
  - Body:
845
  - `content`: string
846
  - `important_keywords`: `list[string]`
@@ -851,7 +845,7 @@ Adds a chunk to a specified document in a specified dataset.
851
  curl --request POST \
852
  --url http://{address}/api/v1/dataset/{dataset_id}/document/{document_id}/chunk \
853
  --header 'Content-Type: application/json' \
854
- --header 'Authorization: Bearer {YOUR_ACCESS_TOKEN}' \
855
  --data '{
856
  "content": "ragflow content"
857
  }'
@@ -862,10 +856,12 @@ curl --request POST \
862
  - `content`:(*Body parameter*)
863
  Contains the main text or information of the chunk.
864
  - `important_keywords`(*Body parameter*)
865
- list the key terms or phrases that are significant or central to the chunk's content.
866
 
867
  ### Response
868
- Success
 
 
869
  ```json
870
  {
871
  "code": 0,
@@ -885,7 +881,8 @@ Success
885
  }
886
  ```
887
 
888
- Error
 
889
  ```json
890
  {
891
  "code": 102,
@@ -906,14 +903,14 @@ Retrieves a list of chunks from a specified document in a specified dataset.
906
  - Method: GET
907
  - URL: `http://{address}/api/v1/dataset/{dataset_id}/document/{document_id}/chunk?keywords={keywords}&offset={offset}&limit={limit}&id={id}`
908
  - Headers:
909
- - 'Authorization: Bearer {YOUR_ACCESS_TOKEN}'
910
 
911
  #### Request example
912
 
913
  ```bash
914
  curl --request GET \
915
  --url http://{address}/api/v1/dataset/{dataset_id}/document/{document_id}/chunk?keywords={keywords}&offset={offset}&limit={limit}&id={id} \
916
- --header 'Authorization: Bearer {YOUR_ACCESS_TOKEN}'
917
  ```
918
 
919
  #### Request parameters
@@ -923,15 +920,15 @@ curl --request GET \
923
  - `"offset"`(*Filter parameter*)
924
  The beginning number of records for paging.
925
  - `"keywords"`(*Filter parameter*)
926
- List chunks whose name has the given keywords
927
  - `"limit"`(*Filter parameter*)
928
- Records number to return
929
  - `"id"`(*Filter parameter*)
930
  The ID of chunk to retrieve.
931
 
932
  ### Response
933
 
934
- The successful response includes a JSON object like the following:
935
 
936
  ```json
937
  {
@@ -975,7 +972,7 @@ The successful response includes a JSON object like the following:
975
  }
976
  ```
977
 
978
- The error response includes a JSON object like the following:
979
 
980
  ```json
981
  {
@@ -997,8 +994,8 @@ Deletes chunks by ID.
997
  - Method: DELETE
998
  - URL: `http://{address}/api/v1/dataset/{dataset_id}/document/{document_id}/chunk`
999
  - Headers:
1000
- - `content-Type: application/json`
1001
- - 'Authorization: Bearer {YOUR_ACCESS_TOKEN}'
1002
  - Body:
1003
  - `chunk_ids`: `list[string]`
1004
 
@@ -1008,7 +1005,7 @@ Deletes chunks by ID.
1008
  curl --request DELETE \
1009
  --url http://{address}/api/v1/dataset/{dataset_id}/document/{document_id}/chunk \
1010
  --header 'Content-Type: application/json' \
1011
- --header 'Authorization: Bearer {YOUR_ACCESS_TOKEN}' \
1012
  --data '{
1013
  "chunk_ids": ["test_1", "test_2"]
1014
  }'
@@ -1016,19 +1013,21 @@ curl --request DELETE \
1016
 
1017
  #### Request parameters
1018
 
1019
- - `"chunk_ids"`:(*Body parameter*)
1020
- The chunks of the document to be deleted
1021
 
1022
  ### Response
1023
 
1024
- Success
 
1025
  ```json
1026
  {
1027
  "code": 0
1028
  }
1029
  ```
1030
 
1031
- Error
 
1032
  ```json
1033
  {
1034
  "code": 102,
@@ -1049,12 +1048,12 @@ Updates content or configurations for a specified chunk.
1049
  - Method: PUT
1050
  - URL: `http://{address}/api/v1/dataset/{dataset_id}/document/{document_id}/chunk/{chunk_id}`
1051
  - Headers:
1052
- - `content-Type: application/json`
1053
- - 'Authorization: Bearer {YOUR_ACCESS_TOKEN}'
1054
  - Body:
1055
- - `content`:str
1056
- - `important_keywords`:str
1057
- - `available`:int
1058
 
1059
  #### Request example
1060
 
@@ -1062,7 +1061,7 @@ Updates content or configurations for a specified chunk.
1062
  curl --request PUT \
1063
  --url http://{address}/api/v1/dataset/{dataset_id}/document/{document_id}/chunk/{chunk_id} \
1064
  --header 'Content-Type: application/json' \
1065
- --header 'Authorization: {YOUR_ACCESS_TOKEN}' \
1066
  --data '{
1067
  "content": "ragflow123",
1068
  "important_keywords": [],
@@ -1071,23 +1070,24 @@ curl --request PUT \
1071
 
1072
  #### Request parameters
1073
 
1074
- - `"content"`:(*Body parameter*)
1075
  Contains the main text or information of the chunk.
1076
- - `"important_keywords"`:(*Body parameter*)
1077
- list the key terms or phrases that are significant or central to the chunk's content.
1078
- - `"available"`:(*Body parameter*)
1079
  Indicating the availability status, 0 means unavailable and 1 means available.
1080
 
1081
  ### Response
1082
 
1083
- Success
1084
 
1085
  ```json
1086
  {
1087
  "code": 0
1088
  }
1089
  ```
1090
- Error
 
1091
 
1092
  ```json
1093
  {
@@ -1098,7 +1098,7 @@ Error
1098
 
1099
  ---
1100
 
1101
- ## Dataset retrieval test
1102
 
1103
  **GET** `/api/v1/retrieval`
1104
 
@@ -1109,12 +1109,12 @@ Retrieval test of a dataset
1109
  - Method: POST
1110
  - URL: `http://{address}/api/v1/retrieval`
1111
  - Headers:
1112
- - `content-Type: application/json`
1113
- - 'Authorization: Bearer {YOUR_ACCESS_TOKEN}'
1114
  - Body:
1115
- - `question`: str
1116
- - `datasets`: List[str]
1117
- - `documents`: List[str]
1118
  - `offset`: int
1119
  - `limit`: int
1120
  - `similarity_threshold`: float
@@ -1130,7 +1130,7 @@ Retrieval test of a dataset
1130
  curl --request POST \
1131
  --url http://{address}/api/v1/retrieval \
1132
  --header 'Content-Type: application/json' \
1133
- --header 'Authorization: {YOUR_ACCESS_TOKEN}' \
1134
  --data '{
1135
  "question": "What is advantage of ragflow?",
1136
  "datasets": [
@@ -1187,7 +1187,8 @@ curl --request POST \
1187
 
1188
  ### Response
1189
 
1190
- Success
 
1191
  ```json
1192
  {
1193
  "code": 0,
@@ -1225,7 +1226,8 @@ Success
1225
  }
1226
  ```
1227
 
1228
- Error
 
1229
  ```json
1230
  {
1231
  "code": 102,
@@ -1252,8 +1254,8 @@ Creates a chat assistant.
1252
  - Method: POST
1253
  - URL: `http://{address}/api/v1/chat`
1254
  - Headers:
1255
- - `content-Type: application/json`
1256
- - 'Authorization: Bearer {YOUR_ACCESS_TOKEN}'
1257
  - Body:
1258
  - `"name"`: `string`
1259
  - `"avatar"`: `string`
@@ -1269,7 +1271,7 @@ Creates a chat assistant.
1269
  curl --request POST \
1270
  --url http://{address}/api/v1/chat \
1271
  --header 'Content-Type: application/json' \
1272
- --header 'Authorization: Bearer {YOUR_ACCESS_TOKEN}'
1273
  --data-binary '{
1274
  "knowledgebases": [
1275
  {
@@ -1301,100 +1303,101 @@ curl --request POST \
1301
  #### Request parameters
1302
 
1303
  - `"name"`: (*Body parameter*)
1304
- The name of the created chat.
1305
- - `"assistant"`
1306
 
1307
  - `"avatar"`: (*Body parameter*)
1308
- The icon of the created chat.
1309
- - `"path"`
1310
 
1311
  - `"knowledgebases"`: (*Body parameter*)
1312
- Select knowledgebases associated.
1313
- - `["kb1"]`
1314
 
1315
  - `"id"`: (*Body parameter*)
1316
- The id of the created chat.
1317
- - `""`
1318
 
1319
  - `"llm"`: (*Body parameter*)
1320
- The LLM of the created chat.
1321
- - If the value is `None`, a dictionary with default values will be generated.
1322
 
1323
  - `"prompt"`: (*Body parameter*)
1324
- The prompt of the created chat.
1325
- - If the value is `None`, a dictionary with default values will be generated.
1326
 
1327
  ---
1328
 
1329
- ##### Chat.LLM parameters:
1330
 
1331
  - `"model_name"`: (*Body parameter*)
1332
- Large language chat model.
1333
- - If it is `None`, it will return the user's default model.
1334
 
1335
  - `"temperature"`: (*Body parameter*)
1336
- Controls the randomness of predictions by the model. A lower temperature makes the model more confident, while a higher temperature makes it more creative and diverse.
1337
- - `0.1`
1338
 
1339
  - `"top_p"`: (*Body parameter*)
1340
- Also known as "nucleus sampling," it focuses on the most likely words, cutting off the less probable ones.
1341
- - `0.3`
1342
 
1343
  - `"presence_penalty"`: (*Body parameter*)
1344
- Discourages the model from repeating the same information by penalizing repeated content.
1345
- - `0.4`
1346
 
1347
  - `"frequency_penalty"`: (*Body parameter*)
1348
- Reduces the model’s tendency to repeat words frequently.
1349
- - `0.7`
1350
 
1351
  - `"max_tokens"`: (*Body parameter*)
1352
- Sets the maximum length of the model’s output, measured in tokens (words or pieces of words).
1353
- - `512`
1354
 
1355
  ---
1356
 
1357
- ##### Chat.Prompt parameters:
1358
 
1359
  - `"similarity_threshold"`: (*Body parameter*)
1360
- Filters out chunks with similarity below this threshold.
1361
- - `0.2`
1362
 
1363
  - `"keywords_similarity_weight"`: (*Body parameter*)
1364
- Weighted keywords similarity and vector cosine similarity; the sum of weights is 1.0.
1365
- - `0.7`
1366
 
1367
  - `"top_n"`: (*Body parameter*)
1368
- Only the top N chunks above the similarity threshold will be fed to LLMs.
1369
- - `8`
1370
 
1371
  - `"variables"`: (*Body parameter*)
1372
- Variables help with different chat strategies by filling in the 'System' part of the prompt.
1373
- - `[{"key": "knowledge", "optional": True}]`
1374
 
1375
  - `"rerank_model"`: (*Body parameter*)
1376
- If empty, it uses vector cosine similarity; otherwise, it uses rerank score.
1377
- - `""`
1378
 
1379
  - `"empty_response"`: (*Body parameter*)
1380
- If nothing is retrieved, this will be used as the response. Leave blank if LLM should provide its own opinion.
1381
- - `None`
1382
 
1383
  - `"opener"`: (*Body parameter*)
1384
- The welcome message for clients.
1385
- - `"Hi! I'm your assistant, what can I do for you?"`
1386
 
1387
  - `"show_quote"`: (*Body parameter*)
1388
- Indicates whether the source of the original text should be displayed.
1389
- - `True`
1390
 
1391
  - `"prompt"`: (*Body parameter*)
1392
- Instructions for LLM to follow when answering questions, such as character design or answer length.
1393
- - `"You are an intelligent assistant. Please summarize the content of the knowledge base to answer the question. Please list the data in the knowledge base and answer in detail. When all knowledge base content is irrelevant to the question, your answer must include the sentence 'The answer you are looking for is not found in the knowledge base!' Answers need to consider chat history. Here is the knowledge base: {knowledge} The above is the knowledge base."`
1394
 
1395
  ### Response
1396
 
1397
- Success:
 
1398
  ```json
1399
  {
1400
  "code": 0,
@@ -1463,7 +1466,7 @@ Success:
1463
  }
1464
  ```
1465
 
1466
- Error:
1467
 
1468
  ```json
1469
  {
@@ -1485,16 +1488,17 @@ Updates configurations for a specified chat assistant.
1485
  - Method: PUT
1486
  - URL: `http://{address}/api/v1/chat/{chat_id}`
1487
  - Headers:
1488
- - `content-Type: application/json`
1489
- - 'Authorization: Bearer {YOUR_ACCESS_TOKEN}'
1490
  - Body: (Refer to the "Create chat" for the complete structure of the request body.)
1491
 
1492
  #### Request example
 
1493
  ```bash
1494
  curl --request PUT \
1495
  --url http://{address}/api/v1/chat/{chat_id} \
1496
  --header 'Content-Type: application/json' \
1497
- --header 'Authorization: Bearer {YOUR_ACCESS_TOKEN}' \
1498
  --data '{
1499
  "name":"Test"
1500
  }'
@@ -1506,14 +1510,16 @@ Refer to the "Create chat" for the complete structure of the request parameters.
1506
 
1507
  ### Response
1508
 
1509
- Success
 
1510
  ```json
1511
  {
1512
  "code": 0
1513
  }
1514
  ```
1515
 
1516
- Error
 
1517
  ```json
1518
  {
1519
  "code": 102,
@@ -1534,10 +1540,10 @@ Deletes chat assistants by ID.
1534
  - Method: DELETE
1535
  - URL: `http://{address}/api/v1/chat`
1536
  - Headers:
1537
- - `content-Type: application/json`
1538
- - 'Authorization: Bearer {YOUR_ACCESS_TOKEN}'
1539
  - Body:
1540
- - `ids`: List[string]
1541
 
1542
  #### Request example
1543
 
@@ -1546,29 +1552,30 @@ Deletes chat assistants by ID.
1546
  curl --request DELETE \
1547
  --url http://{address}/api/v1/chat \
1548
  --header 'Content-Type: application/json' \
1549
- --header 'Authorization: Bearer {YOUR_ACCESS_TOKEN}' \
1550
  --data '{
1551
  "ids": ["test_1", "test_2"]
1552
  }'
1553
  }'
1554
  ```
1555
 
1556
- #### Request parameters:
1557
 
1558
  - `"ids"`: (*Body parameter*)
1559
- IDs of the chats to be deleted.
1560
- - `None`
1561
 
1562
  ### Response
1563
 
1564
- Success
 
1565
  ```json
1566
  {
1567
  "code": 0
1568
  }
1569
  ```
1570
 
1571
- Error
1572
 
1573
  ```json
1574
  {
@@ -1590,45 +1597,46 @@ Retrieves a list of chat assistants.
1590
  - Method: GET
1591
  - URL: `http://{address}/api/v1/chat?page={page}&page_size={page_size}&orderby={orderby}&desc={desc}&name={dataset_name}&id={dataset_id}`
1592
  - Headers:
1593
- - 'Authorization: Bearer {YOUR_ACCESS_TOKEN}'
1594
 
1595
  #### Request example
1596
 
1597
  ```bash
1598
  curl --request GET \
1599
  --url http://{address}/api/v1/chat?page={page}&page_size={page_size}&orderby={orderby}&desc={desc}&name={dataset_name}&id={dataset_id} \
1600
- --header 'Authorization: Bearer {YOUR_ACCESS_TOKEN}'
1601
  ```
1602
 
1603
  #### Request parameters
1604
 
1605
  - `"page"`: (*Path parameter*)
1606
- The current page number to retrieve from the paginated data. This parameter determines which set of records will be fetched.
1607
- - `1`
1608
 
1609
  - `"page_size"`: (*Path parameter*)
1610
- The number of records to retrieve per page. This controls how many records will be included in each page.
1611
- - `1024`
1612
 
1613
  - `"orderby"`: (*Path parameter*)
1614
- The field by which the records should be sorted. This specifies the attribute or column used to order the results.
1615
- - `"create_time"`
1616
 
1617
  - `"desc"`: (*Path parameter*)
1618
- A boolean flag indicating whether the sorting should be in descending order.
1619
- - `True`
1620
 
1621
  - `"id"`: (*Path parameter*)
1622
- The ID of the chat to be retrieved.
1623
- - `None`
1624
 
1625
  - `"name"`: (*Path parameter*)
1626
- The name of the chat to be retrieved.
1627
- - `None`
1628
 
1629
  ### Response
1630
 
1631
- Success
 
1632
  ```json
1633
  {
1634
  "code": 0,
@@ -1706,7 +1714,7 @@ Success
1706
  }
1707
  ```
1708
 
1709
- Error
1710
 
1711
  ```json
1712
  {
@@ -1715,28 +1723,29 @@ Error
1715
  }
1716
  ```
1717
 
1718
- ## Create a chat session
1719
 
1720
  **POST** `/api/v1/chat/{chat_id}/session`
1721
 
1722
- Create a chat session
1723
 
1724
  ### Request
1725
 
1726
  - Method: POST
1727
  - URL: `http://{address}/api/v1/chat/{chat_id}/session`
1728
  - Headers:
1729
- - `content-Type: application/json`
1730
- - 'Authorization: Bearer {YOUR_ACCESS_TOKEN}'
1731
  - Body:
1732
  - name: `string`
1733
 
1734
  #### Request example
 
1735
  ```bash
1736
  curl --request POST \
1737
  --url http://{address}/api/v1/chat/{chat_id}/session \
1738
  --header 'Content-Type: application/json' \
1739
- --header 'Authorization: Bearer {YOUR_ACCESS_TOKEN}' \
1740
  --data '{
1741
  "name": "new session"
1742
  }'
@@ -1745,28 +1754,29 @@ curl --request POST \
1745
  #### Request parameters
1746
 
1747
  - `"id"`: (*Body parameter*)
1748
- The ID of the created session used to identify different sessions.
1749
- - `None`
1750
- - `id` cannot be provided when creating.
1751
 
1752
  - `"name"`: (*Body parameter*)
1753
- The name of the created session.
1754
- - `"New session"`
1755
 
1756
  - `"messages"`: (*Body parameter*)
1757
- The messages of the created session.
1758
- - `[{"role": "assistant", "content": "Hi! I am your assistant, can I help you?"}]`
1759
- - `messages` cannot be provided when creating.
1760
 
1761
  - `"chat_id"`: (*Path parameter*)
1762
- The ID of the associated chat.
1763
- - `""`
1764
- - `chat_id` cannot be changed.
1765
 
1766
 
1767
  ### Response
1768
 
1769
- Success
 
1770
  ```json
1771
  {
1772
  "code": 0,
@@ -1788,7 +1798,7 @@ Success
1788
  }
1789
  ```
1790
 
1791
- Error
1792
 
1793
  ```json
1794
  {
@@ -1819,8 +1829,8 @@ Update a chat session
1819
  - Method: PUT
1820
  - URL: `http://{address}/api/v1/chat/{chat_id}/session/{session_id}`
1821
  - Headers:
1822
- - `content-Type: application/json`
1823
- - 'Authorization: Bearer {YOUR_ACCESS_TOKEN}'
1824
  - Body:
1825
  - `name`: string
1826
 
@@ -1829,7 +1839,7 @@ Update a chat session
1829
  curl --request PUT \
1830
  --url http://{address}/api/v1/chat/{chat_id}/session/{session_id} \
1831
  --header 'Content-Type: application/json' \
1832
- --header 'Authorization: Bearer {YOUR_ACCESS_TOKEN}' \
1833
  --data '{
1834
  "name": "Updated session"
1835
  }'
@@ -1837,18 +1847,23 @@ curl --request PUT \
1837
  ```
1838
 
1839
  #### Request Parameter
1840
- - `name`:(*Body Parameter)
1841
- The name of the created session.
1842
- - `None`
 
1843
 
1844
  ### Response
1845
- Success
 
 
1846
  ```json
1847
  {
1848
  "code": 0
1849
  }
1850
  ```
1851
- Error
 
 
1852
  ```json
1853
  {
1854
  "code": 102,
@@ -1869,45 +1884,46 @@ Lists sessions associated with a specified????????????? chat assistant.
1869
  - Method: GET
1870
  - URL: `http://{address}/api/v1/chat/{chat_id}/session?page={page}&page_size={page_size}&orderby={orderby}&desc={desc}&name={dataset_name}&id={dataset_id}`
1871
  - Headers:
1872
- - 'Authorization: Bearer {YOUR_ACCESS_TOKEN}'
1873
 
1874
  #### Request example
1875
 
1876
  ```bash
1877
  curl --request GET \
1878
  --url http://{address}/api/v1/chat/{chat_id}/session?page={page}&page_size={page_size}&orderby={orderby}&desc={desc}&name={dataset_name}&id={dataset_id} \
1879
- --header 'Authorization: Bearer {YOUR_ACCESS_TOKEN}'
1880
  ```
1881
 
1882
  #### Request Parameters
1883
 
1884
  - `"page"`: (*Path parameter*)
1885
- The current page number to retrieve from the paginated data. This parameter determines which set of records will be fetched.
1886
- - `1`
1887
 
1888
  - `"page_size"`: (*Path parameter*)
1889
- The number of records to retrieve per page. This controls how many records will be included in each page.
1890
- - `1024`
1891
 
1892
  - `"orderby"`: (*Path parameter*)
1893
- The field by which the records should be sorted. This specifies the attribute or column used to order the results.
1894
- - `"create_time"`
1895
 
1896
  - `"desc"`: (*Path parameter*)
1897
- A boolean flag indicating whether the sorting should be in descending order.
1898
- - `True`
1899
 
1900
  - `"id"`: (*Path parameter*)
1901
- The ID of the session to be retrieved.
1902
- - `None`
1903
 
1904
  - `"name"`: (*Path parameter*)
1905
- The name of the session to be retrieved.
1906
- - `None`
1907
 
1908
  ### Response
1909
 
1910
- Success
 
1911
  ```json
1912
  {
1913
  "code": 0,
@@ -1931,7 +1947,7 @@ Success
1931
  }
1932
  ```
1933
 
1934
- Error
1935
 
1936
  ```json
1937
  {
@@ -1953,10 +1969,10 @@ Deletes sessions by ID.
1953
  - Method: DELETE
1954
  - URL: `http://{address}/api/v1/chat/{chat_id}/session`
1955
  - Headers:
1956
- - `content-Type: application/json`
1957
- - 'Authorization: Bearer {YOUR_ACCESS_TOKEN}'
1958
  - Body:
1959
- - `ids`: List[string]
1960
 
1961
  #### Request example
1962
 
@@ -1965,24 +1981,30 @@ Deletes sessions by ID.
1965
  curl --request DELETE \
1966
  --url http://{address}/api/v1/chat/{chat_id}/session \
1967
  --header 'Content-Type: application/json' \
1968
- --header 'Authorization: Bear {YOUR_ACCESS_TOKEN}' \
1969
  --data '{
1970
  "ids": ["test_1", "test_2"]
1971
  }'
1972
  ```
1973
 
1974
  #### Request Parameters
 
1975
  - `ids`: (*Body Parameter*)
1976
- IDs of the sessions to be deleted.
1977
- - `None`
 
1978
  ### Response
1979
- Success
 
 
1980
  ```json
1981
  {
1982
  "code": 0
1983
  }
1984
  ```
1985
- Error
 
 
1986
  ```json
1987
  {
1988
  "code": 102,
@@ -2001,15 +2023,14 @@ Asks a question to start a conversation.
2001
  ### Request
2002
 
2003
  - Method: POST
2004
- - URL: `http://{address} /api/v1/chat/{chat_id}/completion`
2005
  - Headers:
2006
- - `content-Type: application/json`
2007
- - 'Authorization: Bearer {YOUR_ACCESS_TOKEN}'
2008
  - Body:
2009
- - `question`: string
2010
- - `stream`: bool
2011
- - `session_id`: str
2012
-
2013
 
2014
  #### Request example
2015
 
@@ -2017,25 +2038,29 @@ Asks a question to start a conversation.
2017
  curl --request POST \
2018
  --url http://{address} /api/v1/chat/{chat_id}/completion \
2019
  --header 'Content-Type: application/json' \
2020
- --header 'Authorization: Bearer {YOUR_ACCESS_TOKEN}' \
2021
  --data-binary '{
2022
  "question": "你好!",
2023
  "stream": true
2024
  }'
2025
  ```
 
2026
  #### Request Parameters
 
2027
  - `question`:(*Body Parameter*)
2028
- The question you want to ask.
2029
- - question is required.
2030
- `None`
2031
  - `stream`: (*Body Parameter*)
2032
- The approach of streaming text generation.
2033
- `False`
2034
  - `session_id`: (*Body Parameter*)
2035
- The id of session.If not provided, a new session will be generated.
2036
 
2037
  ### Response
2038
- Success
 
 
2039
  ```json
2040
  data: {
2041
  "code": 0,
@@ -2135,7 +2160,9 @@ data:{
2135
  "data": true
2136
  }
2137
  ```
2138
- Error
 
 
2139
  ```json
2140
  {
2141
  "code": 102,
 
22
  - Method: POST
23
  - URL: `http://{address}/api/v1/dataset`
24
  - Headers:
25
+ - `'content-Type: application/json'`
26
+ - `'Authorization: Bearer {YOUR_API_KEY}'`
27
  - Body:
28
  - `"name"`: `string`
29
  - `"avatar"`: `string`
 
31
  - `"language"`: `string`
32
  - `"embedding_model"`: `string`
33
  - `"permission"`: `string`
 
 
34
  - `"parse_method"`: `string`
35
  - `"parser_config"`: `Dataset.ParserConfig`
36
 
 
43
  curl --request POST \
44
  --url http://{address}/api/v1/dataset \
45
  --header 'Content-Type: application/json' \
46
+ --header 'Authorization: Bearer {YOUR_API_KEY}' \
47
  --data '{
48
  "name": "test",
49
  "chunk_count": 0,
50
  "document_count": 0,
51
+ "chunk_method": "naive"
52
  }'
53
  ```
54
 
55
  #### Request parameters
56
 
57
+ - `"name"`: (*Body parameter*), `string`, *Required*
58
+ The unique name of the dataset to create. It must adhere to the following requirements:
59
+ - Permitted characters include:
60
+ - English letters (a-z, A-Z)
61
+ - Digits (0-9)
62
+ - "_" (underscore)
63
+ - Must begin with an English letter or underscore.
64
+ - Maximum 65,535 characters.
65
+ - Case-insensitive.
66
+
67
+ - `"avatar"`: (*Body parameter*), `string`
68
+ Base64 encoding of the avatar. Defaults to `""`.
69
+
70
+ - `"description"`: (*Body parameter*), `string`
71
+ A brief description of the dataset to create. Defaults to `""`.
72
+
73
+ - `"language"`: (*Body parameter*), `string`
74
+ The language setting of the dataset to create. Available options:
75
+ - `"English"` (Default)
76
+ - `"Chinese"`
77
+
78
+ - `"embedding_model"`: (*Body parameter*), `string`
79
+ The name of the embedding model to use. For example: `"BAAI/bge-zh-v1.5"`
80
+
81
+ - `"permission"`: (*Body parameter*), `string`
82
+ Specifies who can access the dataset to create. You can set it only to `"me"` for now.
83
+
84
+ - `"chunk_method"`: (*Body parameter*), `enum<string>`
85
+ The chunking method of the dataset to create. Available options:
86
+ - `"naive"`: General (default)
87
+ - `"manual`: Manual
88
+ - `"qa"`: Q&A
89
+ - `"table"`: Table
90
+ - `"paper"`: Paper
91
+ - `"book"`: Book
92
+ - `"laws"`: Laws
93
+ - `"presentation"`: Presentation
94
+ - `"picture"`: Picture
95
+ - `"one"`:One
96
+ - `"knowledge_graph"`: Knowledge Graph
97
+ - `"email"`: Email
98
 
99
  - `"parser_config"`: (*Body parameter*)
100
+ The configuration settings for the dataset parser. A `ParserConfig` object contains the following attributes:
101
+ - `"chunk_token_count"`: Defaults to `128`.
102
+ - `"layout_recognize"`: Defaults to `True`.
103
+ - `"delimiter"`: Defaults to `"\n!?。;!?"`.
104
+ - `"task_page_size"`: Defaults to `12`.
105
 
106
  ### Response
107
 
108
+ A successful response includes a JSON object like the following:
109
 
110
  ```json
111
  {
 
143
  }
144
  ```
145
 
146
+ An error response includes a JSON object like the following:
 
 
 
 
147
 
148
  ```json
149
  {
 
165
  - Method: DELETE
166
  - URL: `http://{address}/api/v1/dataset`
167
  - Headers:
168
+ - `'content-Type: application/json'`
169
+ - `'Authorization: Bearer {YOUR_API_KEY}'`
170
  - Body:
171
+ - `"ids"`: `list[string]`
172
 
173
 
174
  #### Request example
 
178
  curl --request DELETE \
179
  --url http://{address}/api/v1/dataset \
180
  --header 'Content-Type: application/json' \
181
+ --header 'Authorization: Bearer {YOUR_API_KEY}' \
182
  --data '{
183
  "ids": ["test_1", "test_2"]
184
  }'
 
187
  #### Request parameters
188
 
189
  - `"ids"`: (*Body parameter*)
190
+ The IDs of the datasets to delete. Defaults to `""`. If not specified, all datasets in the system will be deleted.
191
 
192
  ### Response
193
 
194
+ A successful response includes a JSON object like the following:
195
 
196
  ```json
197
  {
 
199
  }
200
  ```
201
 
202
+ An error response includes a JSON object like the following:
 
 
 
 
203
 
204
  ```json
205
  {
 
221
  - Method: PUT
222
  - URL: `http://{address}/api/v1/dataset/{dataset_id}`
223
  - Headers:
224
+ - `'content-Type: application/json'`
225
+ - `'Authorization: Bearer {YOUR_API_KEY}'`
226
+ - Body:
227
+ - `"name"`: `string`
228
+ - `"embedding_model"`: `string`
229
+ - `"chunk_method"`: `enum<string>`
230
 
231
  #### Request example
232
 
233
  ```bash
234
  # "id": id is required.
235
  # "name": If you update name, it can't be duplicated.
 
236
  # "embedding_model": If you update embedding_model, it can't be changed.
 
 
237
  # "parse_method": If you update parse_method, chunk_count must be 0.
238
  # "naive" means general.
239
  curl --request PUT \
240
  --url http://{address}/api/v1/dataset/{dataset_id} \
241
  --header 'Content-Type: application/json' \
242
+ --header 'Authorization: Bearer {YOUR_API_KEY}' \
243
  --data '{
244
  "name": "test",
 
245
  "embedding_model": "BAAI/bge-zh-v1.5",
246
  "chunk_count": 0,
247
  "document_count": 0,
 
251
 
252
  #### Request parameters
253
 
254
+ - `"name"`: `string` The name of the dataset to update.
255
+ - `"embedding_model"`: `string` The embedding model name to update.
256
+ - Ensure that `"chunk_count"` is `0` before updating `"embedding_model"`.
257
+ - `"chunk_method"`: `enum<string>` The chunking method for the dataset. Available options:
258
+ - `"naive"`: General
259
+ - `"manual`: Manual
260
+ - `"qa"`: Q&A
261
+ - `"table"`: Table
262
+ - `"paper"`: Paper
263
+ - `"book"`: Book
264
+ - `"laws"`: Laws
265
+ - `"presentation"`: Presentation
266
+ - `"picture"`: Picture
267
+ - `"one"`:One
268
+ - `"knowledge_graph"`: Knowledge Graph
269
+ - `"email"`: Email
270
 
271
  ### Response
272
 
273
+ A successful response includes a JSON object like the following:
274
 
275
  ```json
276
  {
 
278
  }
279
  ```
280
 
281
+ An error response includes a JSON object like the following:
 
 
 
 
282
 
283
  ```json
284
  {
 
302
  - Method: GET
303
  - URL: `http://{address}/api/v1/dataset?page={page}&page_size={page_size}&orderby={orderby}&desc={desc}&name={dataset_name}&id={dataset_id}`
304
  - Headers:
305
+ - `'Authorization: Bearer {YOUR_API_KEY}'`
306
 
307
 
308
  #### Request example
 
314
  # If no desc parameter is passed, the default is True
315
  curl --request GET \
316
  --url http://{address}/api/v1/dataset?page={page}&page_size={page_size}&orderby={orderby}&desc={desc}&name={dataset_name}&id={dataset_id} \
317
+ --header 'Authorization: Bearer {YOUR_API_KEY}'
318
  ```
319
 
320
  #### Request parameters
321
 
322
+ - `"page"`: (*Path parameter*)
323
+ Specifies the page on which the datasets will be displayed. Defaults to `1`.
324
+ - `"page_size"`: (*Path parameter*)
325
+ The number of datasets on each page. Defaults to `1024`.
326
+ - `"orderby"`: (*Path parameter*)
327
+ The field by which datasets should be sorted. Available options:
328
+ - `"create_time"` (default)
329
+ - `"update_time"`
330
+ - `"desc"`: (*Path parameter*)
331
+ Indicates whether the retrieved datasets should be sorted in descending order. Defaults to `True`.
332
  - `"id"`: (*Path parameter*)
333
+ The ID of the dataset to retrieve. Defaults to `None`.
334
  - `"name"`: (*Path parameter*)
335
+ The name of the dataset to retrieve. Defaults to `None`.
336
 
337
  ### Response
338
 
339
+ A successful response includes a JSON object like the following:
340
 
341
  ```json
342
  {
 
379
  }
380
  ```
381
 
382
+ An error response includes a JSON object like the following:
383
 
384
  ```json
385
  {
 
408
  - URL: `/api/v1/dataset/{dataset_id}/document`
409
  - Headers:
410
  - 'Content-Type: multipart/form-data'
411
+ - `'Authorization: Bearer {YOUR_API_KEY}'`
412
  - Form:
413
  - 'file=@{FILE_PATH}'
414
 
 
418
  curl --request POST \
419
  --url http://{address}/api/v1/dataset/{dataset_id}/document \
420
  --header 'Content-Type: multipart/form-data' \
421
+ --header 'Authorization: Bearer {YOUR_API_KEY}' \
422
  --form 'file=@./test.txt'
423
  ```
424
 
425
  #### Request parameters
426
 
427
+ - `"dataset_id"`: (*Path parameter*)
428
+ The dataset ID.
429
  - `"file"`: (*Body parameter*)
430
+ The file to upload.
431
 
432
  ### Response
433
 
434
+ A successful response includes a JSON object like the following:
435
 
436
  ```json
437
  {
 
439
  }
440
  ```
441
 
442
+ An error response includes a JSON object like the following:
 
 
 
 
443
 
444
  ```json
445
  {
 
461
  - Method: PUT
462
  - URL: `http://{address}/api/v1/dataset/{dataset_id}/document/{document_id}`
463
  - Headers:
464
+ - `'content-Type: application/json'`
465
+ - `'Authorization: Bearer {YOUR_API_KEY}'`
466
  - Body:
467
  - `name`:`string`
468
  - `parser_method`:`string`
 
486
  #### Request parameters
487
 
488
  - `"parser_method"`: (*Body parameter*)
489
+ Method used to parse the document.
 
490
 
491
  - `"parser_config"`: (*Body parameter*)
492
+ Configuration object for the parser.
493
+ - If the value is `None`, a dictionary with default values will be generated.
494
 
495
  - `"name"`: (*Body parameter*)
496
+ Name or title of the document.
497
 
498
  ### Response
499
 
500
+ A successful response includes a JSON object like the following:
501
 
502
  ```json
503
  {
 
505
  }
506
  ```
507
 
508
+ An error response includes a JSON object like the following:
509
 
510
  ```json
511
  {
 
527
  - Method: GET
528
  - URL: `http://{address}/api/v1/dataset/{dataset_id}/document/{document_id}`
529
  - Headers:
530
+ - `'Authorization: Bearer {YOUR_API_KEY}'`
531
  - Output:
532
  - '{FILE_NAME}'
533
 
 
536
  ```bash
537
  curl --request GET \
538
  --url http://{address}/api/v1/dataset/{dataset_id}/document/{document_id} \
539
+ --header 'Authorization: Bearer {YOUR_API_KEY}' \
540
  --output ./ragflow.txt
541
  ```
542
 
543
  #### Request parameters
544
 
545
  - `"dataset_id"`: (*PATH parameter*)
546
+ The dataset ID.
547
  - `"documents_id"`: (*PATH parameter*)
548
+ The document ID of the file.
549
 
550
  ### Response
551
 
 
555
  test_2.
556
  ```
557
 
558
+ An error response includes a JSON object like the following:
 
 
 
 
559
 
560
  ```json
561
  {
 
577
  - Method: GET
578
  - URL: `/api/v1/dataset/{dataset_id}/info?keywords={keyword}&page={page}&page_size={limit}&orderby={orderby}&desc={desc}&name={name`
579
  - Headers:
580
+ - `'content-Type: application/json'`
581
+ - `'Authorization: Bearer {YOUR_API_KEY}'`
582
 
583
  #### Request example
584
 
585
  ```bash
586
  curl --request GET \
587
  --url http://{address}/api/v1/dataset/{dataset_id}/info?offset={offset}&limit={limit}&orderby={orderby}&desc={desc}&keywords={keywords}&id={document_id} \
588
+ --header 'Authorization: Bearer {YOUR_API_KEY}'
589
  ```
590
 
591
  #### Request parameters
592
 
593
+ - `"dataset_id"`: (*PATH parameter*)
594
+ The dataset id
595
+ - `offset`: (*Filter parameter*)
596
+ The beginning number of records for paging.
597
+ - `keywords`: (*Filter parameter*)
598
+ The keywords matches the search key workds;
599
+ - `limit`: (*Filter parameter*)
600
+ Records number to return.
601
+ - `orderby`: (*Filter parameter*)
602
+ The field by which the records should be sorted. This specifies the attribute or column used to order the results.
603
+ - `desc`: (*Filter parameter*)
604
+ A boolean flag indicating whether the sorting should be in descending order.
605
+ - `id`: (*Filter parameter*)
606
+ The ID of the document to retrieve.
607
 
608
  ### Response
609
 
610
+ A successful response includes a JSON object like the following:
611
 
612
  ```json
613
  {
 
650
  }
651
  ```
652
 
653
+ An error response includes a JSON object like the following:
 
 
 
 
654
 
655
  ```json
656
  {
 
672
  - Method: DELETE
673
  - URL: `http://{address}/api/v1/dataset/{dataset_id}/document`
674
  - Headers:
675
+ - `'Content-Type: application/json'`
676
+ - `'Authorization: Bearer {YOUR_API_KEY}'`
677
  - Body:
678
+ - `ids`: `list[string]`
679
 
680
  #### Request example
681
 
 
683
  curl --request DELETE \
684
  --url http://{address}/api/v1/dataset/{dataset_id}/document \
685
  --header 'Content-Type: application/json' \
686
+ --header 'Authorization: {YOUR_API_KEY}' \
687
  --data '{
688
  "ids": ["id_1","id_2"]
689
  }'
 
692
  #### Request parameters
693
 
694
  - `"ids"`: (*Body parameter*)
695
+ The IDs of the documents to delete.
696
 
697
  ### Response
698
 
699
+ A successful response includes a JSON object like the following:
700
 
701
  ```json
702
  {
 
704
  }.
705
  ```
706
 
707
+ An error response includes a JSON object like the following:
 
 
 
 
708
 
709
  ```json
710
  {
 
726
  - Method: POST
727
  - URL: `http://{address}/api/v1/dataset/{dataset_id}/chunk `
728
  - Headers:
729
+ - `'content-Type: application/json'`
730
+ - 'Authorization: Bearer {YOUR_API_KEY}'
731
  - Body:
732
+ - `document_ids`: `list[string]`
733
 
734
  #### Request example
735
 
 
737
  curl --request POST \
738
  --url http://{address}/api/v1/dataset/{dataset_id}/chunk \
739
  --header 'Content-Type: application/json' \
740
+ --header 'Authorization: Bearer {YOUR_API_KEY}' \
741
  --data '{"document_ids": ["97a5f1c2759811efaa500242ac120004","97ad64b6759811ef9fc30242ac120004"]}'
742
  ```
743
 
 
745
 
746
  - `"dataset_id"`: (*Path parameter*)
747
  - `"document_ids"`:(*Body parameter*)
748
+ The ids of the documents to parse.
749
 
750
  ### Response
751
 
752
+ A successful response includes a JSON object like the following:
753
 
754
  ```json
755
  {
 
757
  }
758
  ```
759
 
760
+ An error response includes a JSON object like the following:
761
 
762
  ```json
763
  {
 
779
  - Method: DELETE
780
  - URL: `http://{address}/api/v1/dataset/{dataset_id}/chunk`
781
  - Headers:
782
+ - `'content-Type: application/json'`
783
+ - `'Authorization: Bearer {YOUR_API_KEY}'`
784
  - Body:
785
+ - `document_ids`: `list[string]`
786
+
787
  #### Request example
788
 
789
  ```bash
790
  curl --request DELETE \
791
  --url http://{address}/api/v1/dataset/{dataset_id}/chunk \
792
  --header 'Content-Type: application/json' \
793
+ --header 'Authorization: Bearer {YOUR_API_KEY}' \
794
  --data '{"document_ids": ["97a5f1c2759811efaa500242ac120004","97ad64b6759811ef9fc30242ac120004"]}'
795
  ```
796
 
 
798
 
799
  - `"dataset_id"`: (*Path parameter*)
800
  - `"document_ids"`:(*Body parameter*)
801
+ The IDs of the documents to parse.
 
802
 
803
  ### Response
804
 
805
+ A successful response includes a JSON object like the following:
806
 
807
  ```json
808
  {
 
810
  }
811
  ```
812
 
813
+ An error response includes a JSON object like the following:
814
 
815
  ```json
816
  {
 
833
  - Method: POST
834
  - URL: `http://{address}/api/v1/dataset/{dataset_id}/document/{document_id}/chunk`
835
  - Headers:
836
+ - `'content-Type: application/json'`
837
+ - `'Authorization: Bearer {YOUR_API_KEY}'`
838
  - Body:
839
  - `content`: string
840
  - `important_keywords`: `list[string]`
 
845
  curl --request POST \
846
  --url http://{address}/api/v1/dataset/{dataset_id}/document/{document_id}/chunk \
847
  --header 'Content-Type: application/json' \
848
+ --header 'Authorization: Bearer {YOUR_API_KEY}' \
849
  --data '{
850
  "content": "ragflow content"
851
  }'
 
856
  - `content`:(*Body parameter*)
857
  Contains the main text or information of the chunk.
858
  - `important_keywords`(*Body parameter*)
859
+ List the key terms or phrases that are significant or central to the chunk's content.
860
 
861
  ### Response
862
+
863
+ A successful response includes a JSON object like the following:
864
+
865
  ```json
866
  {
867
  "code": 0,
 
881
  }
882
  ```
883
 
884
+ An error response includes a JSON object like the following:
885
+
886
  ```json
887
  {
888
  "code": 102,
 
903
  - Method: GET
904
  - URL: `http://{address}/api/v1/dataset/{dataset_id}/document/{document_id}/chunk?keywords={keywords}&offset={offset}&limit={limit}&id={id}`
905
  - Headers:
906
+ - `'Authorization: Bearer {YOUR_API_KEY}'`
907
 
908
  #### Request example
909
 
910
  ```bash
911
  curl --request GET \
912
  --url http://{address}/api/v1/dataset/{dataset_id}/document/{document_id}/chunk?keywords={keywords}&offset={offset}&limit={limit}&id={id} \
913
+ --header 'Authorization: Bearer {YOUR_API_KEY}'
914
  ```
915
 
916
  #### Request parameters
 
920
  - `"offset"`(*Filter parameter*)
921
  The beginning number of records for paging.
922
  - `"keywords"`(*Filter parameter*)
923
+ List chunks whose name has the given keywords.
924
  - `"limit"`(*Filter parameter*)
925
+ Records number to return.
926
  - `"id"`(*Filter parameter*)
927
  The ID of chunk to retrieve.
928
 
929
  ### Response
930
 
931
+ A successful response includes a JSON object like the following:
932
 
933
  ```json
934
  {
 
972
  }
973
  ```
974
 
975
+ An error response includes a JSON object like the following:
976
 
977
  ```json
978
  {
 
994
  - Method: DELETE
995
  - URL: `http://{address}/api/v1/dataset/{dataset_id}/document/{document_id}/chunk`
996
  - Headers:
997
+ - `'content-Type: application/json'`
998
+ - `'Authorization: Bearer {YOUR_API_KEY}'`
999
  - Body:
1000
  - `chunk_ids`: `list[string]`
1001
 
 
1005
  curl --request DELETE \
1006
  --url http://{address}/api/v1/dataset/{dataset_id}/document/{document_id}/chunk \
1007
  --header 'Content-Type: application/json' \
1008
+ --header 'Authorization: Bearer {YOUR_API_KEY}' \
1009
  --data '{
1010
  "chunk_ids": ["test_1", "test_2"]
1011
  }'
 
1013
 
1014
  #### Request parameters
1015
 
1016
+ - `"chunk_ids"`:(*Body parameter*)
1017
+ The chunks of the document to delete.
1018
 
1019
  ### Response
1020
 
1021
+ A successful response includes a JSON object like the following:
1022
+
1023
  ```json
1024
  {
1025
  "code": 0
1026
  }
1027
  ```
1028
 
1029
+ An error response includes a JSON object like the following:
1030
+
1031
  ```json
1032
  {
1033
  "code": 102,
 
1048
  - Method: PUT
1049
  - URL: `http://{address}/api/v1/dataset/{dataset_id}/document/{document_id}/chunk/{chunk_id}`
1050
  - Headers:
1051
+ - `'content-Type: application/json'`
1052
+ - `'Authorization: Bearer {YOUR_API_KEY}'`
1053
  - Body:
1054
+ - `content`: `string`
1055
+ - `important_keywords`: `string`
1056
+ - `available`: `integer`
1057
 
1058
  #### Request example
1059
 
 
1061
  curl --request PUT \
1062
  --url http://{address}/api/v1/dataset/{dataset_id}/document/{document_id}/chunk/{chunk_id} \
1063
  --header 'Content-Type: application/json' \
1064
+ --header 'Authorization: {YOUR_API_KEY}' \
1065
  --data '{
1066
  "content": "ragflow123",
1067
  "important_keywords": [],
 
1070
 
1071
  #### Request parameters
1072
 
1073
+ - `"content"`:(*Body parameter*)
1074
  Contains the main text or information of the chunk.
1075
+ - `"important_keywords"`:(*Body parameter*)
1076
+ Lists the key terms or phrases that are significant or central to the chunk's content.
1077
+ - `"available"`:(*Body parameter*)
1078
  Indicating the availability status, 0 means unavailable and 1 means available.
1079
 
1080
  ### Response
1081
 
1082
+ A successful response includes a JSON object like the following:
1083
 
1084
  ```json
1085
  {
1086
  "code": 0
1087
  }
1088
  ```
1089
+
1090
+ An error response includes a JSON object like the following:
1091
 
1092
  ```json
1093
  {
 
1098
 
1099
  ---
1100
 
1101
+ ## Retrieve chunks
1102
 
1103
  **GET** `/api/v1/retrieval`
1104
 
 
1109
  - Method: POST
1110
  - URL: `http://{address}/api/v1/retrieval`
1111
  - Headers:
1112
+ - `'content-Type: application/json'`
1113
+ - `'Authorization: Bearer {YOUR_API_KEY}'`
1114
  - Body:
1115
+ - `question`: `string`
1116
+ - `datasets`: `list[string]`
1117
+ - `documents`: `list[string]`
1118
  - `offset`: int
1119
  - `limit`: int
1120
  - `similarity_threshold`: float
 
1130
  curl --request POST \
1131
  --url http://{address}/api/v1/retrieval \
1132
  --header 'Content-Type: application/json' \
1133
+ --header 'Authorization: {YOUR_API_KEY}' \
1134
  --data '{
1135
  "question": "What is advantage of ragflow?",
1136
  "datasets": [
 
1187
 
1188
  ### Response
1189
 
1190
+ A successful response includes a JSON object like the following:
1191
+
1192
  ```json
1193
  {
1194
  "code": 0,
 
1226
  }
1227
  ```
1228
 
1229
+ An error response includes a JSON object like the following:
1230
+
1231
  ```json
1232
  {
1233
  "code": 102,
 
1254
  - Method: POST
1255
  - URL: `http://{address}/api/v1/chat`
1256
  - Headers:
1257
+ - `'content-Type: application/json'`
1258
+ - `'Authorization: Bearer {YOUR_API_KEY}'`
1259
  - Body:
1260
  - `"name"`: `string`
1261
  - `"avatar"`: `string`
 
1271
  curl --request POST \
1272
  --url http://{address}/api/v1/chat \
1273
  --header 'Content-Type: application/json' \
1274
+ --header 'Authorization: Bearer {YOUR_API_KEY}'
1275
  --data-binary '{
1276
  "knowledgebases": [
1277
  {
 
1303
  #### Request parameters
1304
 
1305
  - `"name"`: (*Body parameter*)
1306
+ The name of the created chat.
1307
+ - `"assistant"`
1308
 
1309
  - `"avatar"`: (*Body parameter*)
1310
+ The icon of the created chat.
1311
+ - `"path"`
1312
 
1313
  - `"knowledgebases"`: (*Body parameter*)
1314
+ Select knowledgebases associated.
1315
+ - `["kb1"]`
1316
 
1317
  - `"id"`: (*Body parameter*)
1318
+ The id of the created chat.
1319
+ - `""`
1320
 
1321
  - `"llm"`: (*Body parameter*)
1322
+ The LLM of the created chat.
1323
+ - If the value is `None`, a dictionary with default values will be generated.
1324
 
1325
  - `"prompt"`: (*Body parameter*)
1326
+ The prompt of the created chat.
1327
+ - If the value is `None`, a dictionary with default values will be generated.
1328
 
1329
  ---
1330
 
1331
+ ##### Chat.LLM parameters
1332
 
1333
  - `"model_name"`: (*Body parameter*)
1334
+ Large language chat model.
1335
+ - If it is `None`, it will return the user's default model.
1336
 
1337
  - `"temperature"`: (*Body parameter*)
1338
+ Controls the randomness of predictions by the model. A lower temperature makes the model more confident, while a higher temperature makes it more creative and diverse.
1339
+ - `0.1`
1340
 
1341
  - `"top_p"`: (*Body parameter*)
1342
+ Also known as "nucleus sampling," it focuses on the most likely words, cutting off the less probable ones.
1343
+ - `0.3`
1344
 
1345
  - `"presence_penalty"`: (*Body parameter*)
1346
+ Discourages the model from repeating the same information by penalizing repeated content.
1347
+ - `0.4`
1348
 
1349
  - `"frequency_penalty"`: (*Body parameter*)
1350
+ Reduces the model’s tendency to repeat words frequently.
1351
+ - `0.7`
1352
 
1353
  - `"max_tokens"`: (*Body parameter*)
1354
+ Sets the maximum length of the model’s output, measured in tokens (words or pieces of words).
1355
+ - `512`
1356
 
1357
  ---
1358
 
1359
+ ##### Chat.Prompt parameters
1360
 
1361
  - `"similarity_threshold"`: (*Body parameter*)
1362
+ Filters out chunks with similarity below this threshold.
1363
+ - `0.2`
1364
 
1365
  - `"keywords_similarity_weight"`: (*Body parameter*)
1366
+ Weighted keywords similarity and vector cosine similarity; the sum of weights is 1.0.
1367
+ - `0.7`
1368
 
1369
  - `"top_n"`: (*Body parameter*)
1370
+ Only the top N chunks above the similarity threshold will be fed to LLMs.
1371
+ - `8`
1372
 
1373
  - `"variables"`: (*Body parameter*)
1374
+ Variables help with different chat strategies by filling in the 'System' part of the prompt.
1375
+ - `[{"key": "knowledge", "optional": True}]`
1376
 
1377
  - `"rerank_model"`: (*Body parameter*)
1378
+ If empty, it uses vector cosine similarity; otherwise, it uses rerank score.
1379
+ - `""`
1380
 
1381
  - `"empty_response"`: (*Body parameter*)
1382
+ If nothing is retrieved, this will be used as the response. Leave blank if LLM should provide its own opinion.
1383
+ - `None`
1384
 
1385
  - `"opener"`: (*Body parameter*)
1386
+ The welcome message for clients.
1387
+ - `"Hi! I'm your assistant, what can I do for you?"`
1388
 
1389
  - `"show_quote"`: (*Body parameter*)
1390
+ Indicates whether the source of the original text should be displayed.
1391
+ - `True`
1392
 
1393
  - `"prompt"`: (*Body parameter*)
1394
+ Instructions for LLM to follow when answering questions, such as character design or answer length.
1395
+ - `"You are an intelligent assistant. Please summarize the content of the knowledge base to answer the question. Please list the data in the knowledge base and answer in detail. When all knowledge base content is irrelevant to the question, your answer must include the sentence 'The answer you are looking for is not found in the knowledge base!' Answers need to consider chat history. Here is the knowledge base: {knowledge} The above is the knowledge base."`
1396
 
1397
  ### Response
1398
 
1399
+ A successful response includes a JSON object like the following:
1400
+
1401
  ```json
1402
  {
1403
  "code": 0,
 
1466
  }
1467
  ```
1468
 
1469
+ An error response includes a JSON object like the following:
1470
 
1471
  ```json
1472
  {
 
1488
  - Method: PUT
1489
  - URL: `http://{address}/api/v1/chat/{chat_id}`
1490
  - Headers:
1491
+ - `'content-Type: application/json'`
1492
+ - `'Authorization: Bearer {YOUR_API_KEY}'`
1493
  - Body: (Refer to the "Create chat" for the complete structure of the request body.)
1494
 
1495
  #### Request example
1496
+
1497
  ```bash
1498
  curl --request PUT \
1499
  --url http://{address}/api/v1/chat/{chat_id} \
1500
  --header 'Content-Type: application/json' \
1501
+ --header 'Authorization: Bearer {YOUR_API_KEY}' \
1502
  --data '{
1503
  "name":"Test"
1504
  }'
 
1510
 
1511
  ### Response
1512
 
1513
+ A successful response includes a JSON object like the following:
1514
+
1515
  ```json
1516
  {
1517
  "code": 0
1518
  }
1519
  ```
1520
 
1521
+ An error response includes a JSON object like the following:
1522
+
1523
  ```json
1524
  {
1525
  "code": 102,
 
1540
  - Method: DELETE
1541
  - URL: `http://{address}/api/v1/chat`
1542
  - Headers:
1543
+ - `'content-Type: application/json'`
1544
+ - `'Authorization: Bearer {YOUR_API_KEY}'`
1545
  - Body:
1546
+ - `ids`: list[string]
1547
 
1548
  #### Request example
1549
 
 
1552
  curl --request DELETE \
1553
  --url http://{address}/api/v1/chat \
1554
  --header 'Content-Type: application/json' \
1555
+ --header 'Authorization: Bearer {YOUR_API_KEY}' \
1556
  --data '{
1557
  "ids": ["test_1", "test_2"]
1558
  }'
1559
  }'
1560
  ```
1561
 
1562
+ #### Request parameters
1563
 
1564
  - `"ids"`: (*Body parameter*)
1565
+ IDs of the chats to delete.
1566
+ - `None`
1567
 
1568
  ### Response
1569
 
1570
+ A successful response includes a JSON object like the following:
1571
+
1572
  ```json
1573
  {
1574
  "code": 0
1575
  }
1576
  ```
1577
 
1578
+ An error response includes a JSON object like the following:
1579
 
1580
  ```json
1581
  {
 
1597
  - Method: GET
1598
  - URL: `http://{address}/api/v1/chat?page={page}&page_size={page_size}&orderby={orderby}&desc={desc}&name={dataset_name}&id={dataset_id}`
1599
  - Headers:
1600
+ - `'Authorization: Bearer {YOUR_API_KEY}'`
1601
 
1602
  #### Request example
1603
 
1604
  ```bash
1605
  curl --request GET \
1606
  --url http://{address}/api/v1/chat?page={page}&page_size={page_size}&orderby={orderby}&desc={desc}&name={dataset_name}&id={dataset_id} \
1607
+ --header 'Authorization: Bearer {YOUR_API_KEY}'
1608
  ```
1609
 
1610
  #### Request parameters
1611
 
1612
  - `"page"`: (*Path parameter*)
1613
+ The current page number to retrieve from the paginated data. This parameter determines which set of records will be fetched.
1614
+ - `1`
1615
 
1616
  - `"page_size"`: (*Path parameter*)
1617
+ The number of records to retrieve per page. This controls how many records will be included in each page.
1618
+ - `1024`
1619
 
1620
  - `"orderby"`: (*Path parameter*)
1621
+ The field by which the records should be sorted. This specifies the attribute or column used to order the results.
1622
+ - `"create_time"`
1623
 
1624
  - `"desc"`: (*Path parameter*)
1625
+ A boolean flag indicating whether the sorting should be in descending order.
1626
+ - `True`
1627
 
1628
  - `"id"`: (*Path parameter*)
1629
+ The ID of the chat to retrieve.
1630
+ - `None`
1631
 
1632
  - `"name"`: (*Path parameter*)
1633
+ The name of the chat to retrieve.
1634
+ - `None`
1635
 
1636
  ### Response
1637
 
1638
+ A successful response includes a JSON object like the following:
1639
+
1640
  ```json
1641
  {
1642
  "code": 0,
 
1714
  }
1715
  ```
1716
 
1717
+ An error response includes a JSON object like the following:
1718
 
1719
  ```json
1720
  {
 
1723
  }
1724
  ```
1725
 
1726
+ ## Create chat session
1727
 
1728
  **POST** `/api/v1/chat/{chat_id}/session`
1729
 
1730
+ Create a chat session.
1731
 
1732
  ### Request
1733
 
1734
  - Method: POST
1735
  - URL: `http://{address}/api/v1/chat/{chat_id}/session`
1736
  - Headers:
1737
+ - `'content-Type: application/json'`
1738
+ - `'Authorization: Bearer {YOUR_API_KEY}'`
1739
  - Body:
1740
  - name: `string`
1741
 
1742
  #### Request example
1743
+
1744
  ```bash
1745
  curl --request POST \
1746
  --url http://{address}/api/v1/chat/{chat_id}/session \
1747
  --header 'Content-Type: application/json' \
1748
+ --header 'Authorization: Bearer {YOUR_API_KEY}' \
1749
  --data '{
1750
  "name": "new session"
1751
  }'
 
1754
  #### Request parameters
1755
 
1756
  - `"id"`: (*Body parameter*)
1757
+ The ID of the created session used to identify different sessions.
1758
+ - `None`
1759
+ - `id` cannot be provided when creating.
1760
 
1761
  - `"name"`: (*Body parameter*)
1762
+ The name of the created session.
1763
+ - `"New session"`
1764
 
1765
  - `"messages"`: (*Body parameter*)
1766
+ The messages of the created session.
1767
+ - `[{"role": "assistant", "content": "Hi! I am your assistant, can I help you?"}]`
1768
+ - `messages` cannot be provided when creating.
1769
 
1770
  - `"chat_id"`: (*Path parameter*)
1771
+ The ID of the associated chat.
1772
+ - `""`
1773
+ - `chat_id` cannot be changed.
1774
 
1775
 
1776
  ### Response
1777
 
1778
+ A successful response includes a JSON object like the following:
1779
+
1780
  ```json
1781
  {
1782
  "code": 0,
 
1798
  }
1799
  ```
1800
 
1801
+ An error response includes a JSON object like the following:
1802
 
1803
  ```json
1804
  {
 
1829
  - Method: PUT
1830
  - URL: `http://{address}/api/v1/chat/{chat_id}/session/{session_id}`
1831
  - Headers:
1832
+ - `'content-Type: application/json'`
1833
+ - `'Authorization: Bearer {YOUR_API_KEY}'`
1834
  - Body:
1835
  - `name`: string
1836
 
 
1839
  curl --request PUT \
1840
  --url http://{address}/api/v1/chat/{chat_id}/session/{session_id} \
1841
  --header 'Content-Type: application/json' \
1842
+ --header 'Authorization: Bearer {YOUR_API_KEY}' \
1843
  --data '{
1844
  "name": "Updated session"
1845
  }'
 
1847
  ```
1848
 
1849
  #### Request Parameter
1850
+
1851
+ - `name`: (*Body Parameter)
1852
+ The name of the created session.
1853
+ - `None`
1854
 
1855
  ### Response
1856
+
1857
+ A successful response includes a JSON object like the following:
1858
+
1859
  ```json
1860
  {
1861
  "code": 0
1862
  }
1863
  ```
1864
+
1865
+ An error response includes a JSON object like the following:
1866
+
1867
  ```json
1868
  {
1869
  "code": 102,
 
1884
  - Method: GET
1885
  - URL: `http://{address}/api/v1/chat/{chat_id}/session?page={page}&page_size={page_size}&orderby={orderby}&desc={desc}&name={dataset_name}&id={dataset_id}`
1886
  - Headers:
1887
+ - `'Authorization: Bearer {YOUR_API_KEY}'`
1888
 
1889
  #### Request example
1890
 
1891
  ```bash
1892
  curl --request GET \
1893
  --url http://{address}/api/v1/chat/{chat_id}/session?page={page}&page_size={page_size}&orderby={orderby}&desc={desc}&name={dataset_name}&id={dataset_id} \
1894
+ --header 'Authorization: Bearer {YOUR_API_KEY}'
1895
  ```
1896
 
1897
  #### Request Parameters
1898
 
1899
  - `"page"`: (*Path parameter*)
1900
+ The current page number to retrieve from the paginated data. This parameter determines which set of records will be fetched.
1901
+ - `1`
1902
 
1903
  - `"page_size"`: (*Path parameter*)
1904
+ The number of records to retrieve per page. This controls how many records will be included in each page.
1905
+ - `1024`
1906
 
1907
  - `"orderby"`: (*Path parameter*)
1908
+ The field by which the records should be sorted. This specifies the attribute or column used to order the results.
1909
+ - `"create_time"`
1910
 
1911
  - `"desc"`: (*Path parameter*)
1912
+ A boolean flag indicating whether the sorting should be in descending order.
1913
+ - `True`
1914
 
1915
  - `"id"`: (*Path parameter*)
1916
+ The ID of the session to retrieve.
1917
+ - `None`
1918
 
1919
  - `"name"`: (*Path parameter*)
1920
+ The name of the session to retrieve.
1921
+ - `None`
1922
 
1923
  ### Response
1924
 
1925
+ A successful response includes a JSON object like the following:
1926
+
1927
  ```json
1928
  {
1929
  "code": 0,
 
1947
  }
1948
  ```
1949
 
1950
+ An error response includes a JSON object like the following:
1951
 
1952
  ```json
1953
  {
 
1969
  - Method: DELETE
1970
  - URL: `http://{address}/api/v1/chat/{chat_id}/session`
1971
  - Headers:
1972
+ - `'content-Type: application/json'`
1973
+ - `'Authorization: Bearer {YOUR_API_KEY}'`
1974
  - Body:
1975
+ - `ids`: list[string]
1976
 
1977
  #### Request example
1978
 
 
1981
  curl --request DELETE \
1982
  --url http://{address}/api/v1/chat/{chat_id}/session \
1983
  --header 'Content-Type: application/json' \
1984
+ --header 'Authorization: Bear {YOUR_API_KEY}' \
1985
  --data '{
1986
  "ids": ["test_1", "test_2"]
1987
  }'
1988
  ```
1989
 
1990
  #### Request Parameters
1991
+
1992
  - `ids`: (*Body Parameter*)
1993
+ IDs of the sessions to delete.
1994
+ - `None`
1995
+
1996
  ### Response
1997
+
1998
+ A successful response includes a JSON object like the following:
1999
+
2000
  ```json
2001
  {
2002
  "code": 0
2003
  }
2004
  ```
2005
+
2006
+ An error response includes a JSON object like the following:
2007
+
2008
  ```json
2009
  {
2010
  "code": 102,
 
2023
  ### Request
2024
 
2025
  - Method: POST
2026
+ - URL: `http://{address}/api/v1/chat/{chat_id}/completion`
2027
  - Headers:
2028
+ - `'content-Type: application/json'`
2029
+ - `'Authorization: Bearer {YOUR_API_KEY}'`
2030
  - Body:
2031
+ - `question`: `string`
2032
+ - `stream`: `bool`
2033
+ - `session_id`: `string`
 
2034
 
2035
  #### Request example
2036
 
 
2038
  curl --request POST \
2039
  --url http://{address} /api/v1/chat/{chat_id}/completion \
2040
  --header 'Content-Type: application/json' \
2041
+ --header 'Authorization: Bearer {YOUR_API_KEY}' \
2042
  --data-binary '{
2043
  "question": "你好!",
2044
  "stream": true
2045
  }'
2046
  ```
2047
+
2048
  #### Request Parameters
2049
+
2050
  - `question`:(*Body Parameter*)
2051
+ The question you want to ask.
2052
+ - question is required.
2053
+ `None`
2054
  - `stream`: (*Body Parameter*)
2055
+ The approach of streaming text generation.
2056
+ `False`
2057
  - `session_id`: (*Body Parameter*)
2058
+ The ID of session. If not provided, a new session will be generated.
2059
 
2060
  ### Response
2061
+
2062
+ A successful response includes a JSON object like the following:
2063
+
2064
  ```json
2065
  data: {
2066
  "code": 0,
 
2160
  "data": true
2161
  }
2162
  ```
2163
+
2164
+ An error response includes a JSON object like the following:
2165
+
2166
  ```json
2167
  {
2168
  "code": 102,
api/python_api_reference.md CHANGED
@@ -415,7 +415,7 @@ A `Document` object contains the following attributes:
415
  - `chunk_method` The chunk method name. Defaults to `""`. ?????naive??????
416
  - `parser_config`: `ParserConfig` Configuration object for the parser. Defaults to `{"pages": [[1, 1000000]]}`.
417
  - `source_type`: The source type of the document. Defaults to `"local"`.
418
- - `type`: Type or category of the document???????????. Defaults to `""`.
419
  - `created_by`: `str` The creator of the document. Defaults to `""`.
420
  - `size`: `int` The document size in bytes. Defaults to `0`.
421
  - `token_count`: `int` The number of tokens in the document. Defaults to `0`.
@@ -423,9 +423,14 @@ A `Document` object contains the following attributes:
423
  - `progress`: `float` The current processing progress as a percentage. Defaults to `0.0`.
424
  - `progress_msg`: `str` A message indicating the current progress status. Defaults to `""`.
425
  - `process_begin_at`: `datetime` The start time of document processing. Defaults to `None`.
426
- - `process_duation`: `float` Duration of the processing in seconds or minutes.??????? Defaults to `0.0`.
427
- - `run`: `str` ?????????????????? Defaults to `"0"`.
428
- - `status`: `str` ??????????????????? Defaults to `"1"`.
 
 
 
 
 
429
 
430
  ### Examples
431
 
@@ -492,7 +497,7 @@ The IDs of the documents to parse.
492
 
493
  ### Returns
494
 
495
- - Success: No value is returned.????????????????????
496
  - Failure: `Exception`
497
 
498
  ### Examples
 
415
  - `chunk_method` The chunk method name. Defaults to `""`. ?????naive??????
416
  - `parser_config`: `ParserConfig` Configuration object for the parser. Defaults to `{"pages": [[1, 1000000]]}`.
417
  - `source_type`: The source type of the document. Defaults to `"local"`.
418
+ - `type`: Type or category of the document. Defaults to `""`. Reserved for future use.
419
  - `created_by`: `str` The creator of the document. Defaults to `""`.
420
  - `size`: `int` The document size in bytes. Defaults to `0`.
421
  - `token_count`: `int` The number of tokens in the document. Defaults to `0`.
 
423
  - `progress`: `float` The current processing progress as a percentage. Defaults to `0.0`.
424
  - `progress_msg`: `str` A message indicating the current progress status. Defaults to `""`.
425
  - `process_begin_at`: `datetime` The start time of document processing. Defaults to `None`.
426
+ - `process_duation`: `float` Duration of the processing in seconds. Defaults to `0.0`.
427
+ - `run`: `str` The document's processing status:
428
+ - `"0"`: UNSTART (default)
429
+ - `"1"`: RUNNING
430
+ - `"2"`: CANCEL
431
+ - `"3"`: DONE
432
+ - `"4"`: FAIL
433
+ - `status`: `str` Reserved for future use.
434
 
435
  ### Examples
436
 
 
497
 
498
  ### Returns
499
 
500
+ - Success: No value is returned.
501
  - Failure: `Exception`
502
 
503
  ### Examples
web/src/components/api-service/chat-overview-modal/api-content.tsx CHANGED
@@ -1,8 +1,8 @@
1
  import HightLightMarkdown from '@/components/highlight-markdown';
2
  import { useSetModalState, useTranslate } from '@/hooks/common-hooks';
3
  import { Button, Card, Flex, Space } from 'antd';
4
- // import apiDoc from '../../../../../api/http_api.md';
5
- import apiDoc from '@parent/api/http_api.md';
6
  import ChatApiKeyModal from '../chat-api-key-modal';
7
  import EmbedModal from '../embed-modal';
8
  import { usePreviewChat, useShowEmbedModal } from '../hooks';
 
1
  import HightLightMarkdown from '@/components/highlight-markdown';
2
  import { useSetModalState, useTranslate } from '@/hooks/common-hooks';
3
  import { Button, Card, Flex, Space } from 'antd';
4
+ // import apiDoc from '../../../../../api/http_api_reference.md';
5
+ import apiDoc from '@parent/api/http_api_reference.md';
6
  import ChatApiKeyModal from '../chat-api-key-modal';
7
  import EmbedModal from '../embed-modal';
8
  import { usePreviewChat, useShowEmbedModal } from '../hooks';