writinwaters commited on
Commit
9e1f9a0
·
1 Parent(s): d832ef1

minor (#2984)

Browse files

### What problem does this PR solve?



### Type of change


- [x] Documentation Update

api/http_api_reference.md CHANGED
@@ -415,7 +415,8 @@ curl --request POST \
415
  --url http://{address}/api/v1/dataset/{dataset_id}/document \
416
  --header 'Content-Type: multipart/form-data' \
417
  --header 'Authorization: Bearer {YOUR_API_KEY}' \
418
- --form 'file=@./test.txt'
 
419
  ```
420
 
421
  #### Request parameters
@@ -423,7 +424,7 @@ curl --request POST \
423
  - `"dataset_id"`: (*Path parameter*)
424
  The ID of the dataset to which the documents will be uploaded.
425
  - `"file"`: (*Body parameter*)
426
- The document???? to upload.
427
 
428
  ### Response
429
 
@@ -474,7 +475,7 @@ curl --request PUT \
474
  --data '{
475
  "name": "manual.txt",
476
  "chunk_method": "manual",
477
- "parser_config": {"chunk_token_count": 128, "delimiter": "\n!?。;!?", "layout_recognize": true, "task_page_size": 12}
478
  }'
479
 
480
  ```
@@ -483,7 +484,7 @@ curl --request PUT \
483
 
484
  - `"name"`: (*Body parameter*), `string`
485
  - `"chunk_method"`: (*Body parameter*), `string`
486
- The parsing method to apply to the document.
487
  - `"naive"`: General
488
  - `"manual`: Manual
489
  - `"qa"`: Q&A
@@ -496,16 +497,12 @@ curl --request PUT \
496
  - `"one"`: One
497
  - `"knowledge_graph"`: Knowledge Graph
498
  - `"email"`: Email
499
- -
500
-
501
- ### Returns
502
-
503
- - `"parser_config"`: (*Body parameter*)
504
- Configuration object for the parser.
505
- - If the value is `None`, a dictionary with default values will be generated.
506
-
507
- - `"name"`: (*Body parameter*)
508
- Name or title of the document.
509
 
510
  ### Response
511
 
@@ -522,7 +519,7 @@ An error response includes a JSON object like the following:
522
  ```json
523
  {
524
  "code": 102,
525
- "message": "The dataset not own the document."
526
  }
527
  ```
528
 
@@ -541,7 +538,7 @@ Downloads a document from a specified dataset.
541
  - Headers:
542
  - `'Authorization: Bearer {YOUR_API_KEY}'`
543
  - Output:
544
- - '{FILE_NAME}'
545
 
546
  #### Request example
547
 
@@ -554,10 +551,10 @@ curl --request GET \
554
 
555
  #### Request parameters
556
 
557
- - `"dataset_id"`: (*PATH parameter*)
558
  The dataset ID.
559
- - `"documents_id"`: (*PATH parameter*)
560
- The document ID of the file.
561
 
562
  ### Response
563
 
@@ -602,20 +599,22 @@ curl --request GET \
602
 
603
  #### Request parameters
604
 
605
- - `"dataset_id"`: (*PATH parameter*)
606
- The dataset id
607
- - `offset`: (*Filter parameter*)
608
- The beginning number of records for paging.
609
- - `keywords`: (*Filter parameter*)
610
- The keywords matches the search key workds;
611
- - `limit`: (*Filter parameter*)
612
- Records number to return.
613
- - `orderby`: (*Filter parameter*)
614
- The field by which the records should be sorted. This specifies the attribute or column used to order the results.
615
- - `desc`: (*Filter parameter*)
616
- A boolean flag indicating whether the sorting should be in descending order.
617
- - `id`: (*Filter parameter*)
618
- The ID of the document to retrieve.
 
 
619
 
620
  ### Response
621
 
@@ -675,7 +674,7 @@ An error response includes a JSON object like the following:
675
 
676
  ## Delete documents
677
 
678
- **DELETE** `/api/v1/dataset/{dataset_id}/document `
679
 
680
  Deletes documents by ID.
681
 
@@ -687,7 +686,7 @@ Deletes documents by ID.
687
  - `'Content-Type: application/json'`
688
  - `'Authorization: Bearer {YOUR_API_KEY}'`
689
  - Body:
690
- - `ids`: `list[string]`
691
 
692
  #### Request example
693
 
@@ -703,7 +702,7 @@ curl --request DELETE \
703
 
704
  #### Request parameters
705
 
706
- - `"ids"`: (*Body parameter*)
707
  The IDs of the documents to delete.
708
 
709
  ### Response
@@ -736,12 +735,12 @@ Parses documents in a specified dataset.
736
  ### Request
737
 
738
  - Method: POST
739
- - URL: `/api/v1/dataset/{dataset_id}/chunk `
740
  - Headers:
741
  - `'content-Type: application/json'`
742
  - 'Authorization: Bearer {YOUR_API_KEY}'
743
  - Body:
744
- - `document_ids`: `list[string]`
745
 
746
  #### Request example
747
 
@@ -756,7 +755,7 @@ curl --request POST \
756
  #### Request parameters
757
 
758
  - `"dataset_id"`: (*Path parameter*)
759
- - `"document_ids"`:(*Body parameter*)
760
  The ids of the documents to parse.
761
 
762
  ### Response
@@ -794,7 +793,7 @@ Stops parsing specified documents.
794
  - `'content-Type: application/json'`
795
  - `'Authorization: Bearer {YOUR_API_KEY}'`
796
  - Body:
797
- - `document_ids`: `list[string]`
798
 
799
  #### Request example
800
 
@@ -809,7 +808,7 @@ curl --request DELETE \
809
  #### Request parameters
810
 
811
  - `"dataset_id"`: (*Path parameter*)
812
- - `"document_ids"`:(*Body parameter*)
813
  The IDs of the documents to parse.
814
 
815
  ### Response
@@ -848,8 +847,8 @@ Adds a chunk to a specified document in a specified dataset.
848
  - `'content-Type: application/json'`
849
  - `'Authorization: Bearer {YOUR_API_KEY}'`
850
  - Body:
851
- - `content`: string
852
- - `important_keywords`: `list[string]`
853
 
854
  #### Request example
855
 
@@ -865,9 +864,9 @@ curl --request POST \
865
 
866
  #### Request parameters
867
 
868
- - `content`:(*Body parameter*)
869
  Contains the main text or information of the chunk.
870
- - `important_keywords`(*Body parameter*)
871
  List the key terms or phrases that are significant or central to the chunk's content.
872
 
873
  ### Response
@@ -1009,7 +1008,7 @@ Deletes chunks by ID.
1009
  - `'content-Type: application/json'`
1010
  - `'Authorization: Bearer {YOUR_API_KEY}'`
1011
  - Body:
1012
- - `chunk_ids`: `list[string]`
1013
 
1014
  #### Request example
1015
 
@@ -1025,7 +1024,7 @@ curl --request DELETE \
1025
 
1026
  #### Request parameters
1027
 
1028
- - `"chunk_ids"`:(*Body parameter*)
1029
  The chunks of the document to delete.
1030
 
1031
  ### Response
@@ -1063,9 +1062,9 @@ Updates content or configurations for a specified chunk.
1063
  - `'content-Type: application/json'`
1064
  - `'Authorization: Bearer {YOUR_API_KEY}'`
1065
  - Body:
1066
- - `content`: `string`
1067
- - `important_keywords`: `string`
1068
- - `available`: `integer`
1069
 
1070
  #### Request example
1071
 
@@ -1082,11 +1081,11 @@ curl --request PUT \
1082
 
1083
  #### Request parameters
1084
 
1085
- - `"content"`:(*Body parameter*)
1086
  Contains the main text or information of the chunk.
1087
- - `"important_keywords"`:(*Body parameter*)
1088
  Lists the key terms or phrases that are significant or central to the chunk's content.
1089
- - `"available"`:(*Body parameter*)
1090
  Indicating the availability status, 0 means unavailable and 1 means available.
1091
 
1092
  ### Response
@@ -1124,17 +1123,17 @@ Retrieves chunks from specified datasets.
1124
  - `'content-Type: application/json'`
1125
  - `'Authorization: Bearer {YOUR_API_KEY}'`
1126
  - Body:
1127
- - `question`: `string`
1128
- - `datasets`: `list[string]`
1129
- - `documents`: `list[string]`
1130
- - `offset`: int
1131
- - `limit`: int
1132
- - `similarity_threshold`: float
1133
- - `vector_similarity_weight`: float
1134
- - `top_k`: int
1135
- - `rerank_id`: string
1136
- - `keyword`: bool
1137
- - `highlight`: bool
1138
 
1139
  #### Request example
1140
 
@@ -1271,12 +1270,11 @@ Creates a chat assistant.
1271
  - Body:
1272
  - `"name"`: `string`
1273
  - `"avatar"`: `string`
1274
- - `"knowledgebases"`: `List[DataSet]`
1275
  - `"id"`: `string`
1276
  - `"llm"`: `LLM`
1277
  - `"prompt"`: `Prompt`
1278
 
1279
-
1280
  #### Request example
1281
 
1282
  ```shell
@@ -1555,7 +1553,7 @@ Deletes chat assistants by ID.
1555
  - `'content-Type: application/json'`
1556
  - `'Authorization: Bearer {YOUR_API_KEY}'`
1557
  - Body:
1558
- - `ids`: list[string]
1559
 
1560
  #### Request example
1561
 
@@ -1749,7 +1747,7 @@ Create a chat session.
1749
  - `'content-Type: application/json'`
1750
  - `'Authorization: Bearer {YOUR_API_KEY}'`
1751
  - Body:
1752
- - name: `string`
1753
 
1754
  #### Request example
1755
 
@@ -1844,7 +1842,7 @@ Update a chat session
1844
  - `'content-Type: application/json'`
1845
  - `'Authorization: Bearer {YOUR_API_KEY}'`
1846
  - Body:
1847
- - `name`: string
1848
 
1849
  #### Request example
1850
  ```bash
@@ -1860,7 +1858,7 @@ curl --request PUT \
1860
 
1861
  #### Request Parameter
1862
 
1863
- - `name`: (*Body Parameter)
1864
  The name of the created session.
1865
  - `None`
1866
 
@@ -1984,7 +1982,7 @@ Deletes sessions by ID.
1984
  - `'content-Type: application/json'`
1985
  - `'Authorization: Bearer {YOUR_API_KEY}'`
1986
  - Body:
1987
- - `ids`: list[string]
1988
 
1989
  #### Request example
1990
 
@@ -2001,7 +1999,7 @@ curl --request DELETE \
2001
 
2002
  #### Request Parameters
2003
 
2004
- - `ids`: (*Body Parameter*)
2005
  IDs of the sessions to delete.
2006
  - `None`
2007
 
@@ -2040,9 +2038,9 @@ Asks a question to start a conversation.
2040
  - `'content-Type: application/json'`
2041
  - `'Authorization: Bearer {YOUR_API_KEY}'`
2042
  - Body:
2043
- - `question`: `string`
2044
- - `stream`: `bool`
2045
- - `session_id`: `string`
2046
 
2047
  #### Request example
2048
 
@@ -2059,14 +2057,14 @@ curl --request POST \
2059
 
2060
  #### Request Parameters
2061
 
2062
- - `question`:(*Body Parameter*)
2063
  The question you want to ask.
2064
  - question is required.
2065
  `None`
2066
- - `stream`: (*Body Parameter*)
2067
  The approach of streaming text generation.
2068
  `False`
2069
- - `session_id`: (*Body Parameter*)
2070
  The ID of session. If not provided, a new session will be generated.
2071
 
2072
  ### Response
 
415
  --url http://{address}/api/v1/dataset/{dataset_id}/document \
416
  --header 'Content-Type: multipart/form-data' \
417
  --header 'Authorization: Bearer {YOUR_API_KEY}' \
418
+ --form 'file=@./test1.txt' \
419
+ --form 'file=@./test2.pdf'
420
  ```
421
 
422
  #### Request parameters
 
424
  - `"dataset_id"`: (*Path parameter*)
425
  The ID of the dataset to which the documents will be uploaded.
426
  - `"file"`: (*Body parameter*)
427
+ The document to upload.
428
 
429
  ### Response
430
 
 
475
  --data '{
476
  "name": "manual.txt",
477
  "chunk_method": "manual",
478
+ "parser_config": {"chunk_token_count": 128}
479
  }'
480
 
481
  ```
 
484
 
485
  - `"name"`: (*Body parameter*), `string`
486
  - `"chunk_method"`: (*Body parameter*), `string`
487
+ The parsing method to apply to the document:
488
  - `"naive"`: General
489
  - `"manual`: Manual
490
  - `"qa"`: Q&A
 
497
  - `"one"`: One
498
  - `"knowledge_graph"`: Knowledge Graph
499
  - `"email"`: Email
500
+ - `"parser_config"`: (*Body parameter*), `dict[string, Any]`
501
+ The parsing configuration for the document:
502
+ - `"chunk_token_count"`: Defaults to `128`.
503
+ - `"layout_recognize"`: Defaults to `True`.
504
+ - `"delimiter"`: Defaults to `"\n!?。;!?"`.
505
+ - `"task_page_size"`: Defaults to `12`.
 
 
 
 
506
 
507
  ### Response
508
 
 
519
  ```json
520
  {
521
  "code": 102,
522
+ "message": "The dataset does not have the document."
523
  }
524
  ```
525
 
 
538
  - Headers:
539
  - `'Authorization: Bearer {YOUR_API_KEY}'`
540
  - Output:
541
+ - `'{FILE_NAME}'`
542
 
543
  #### Request example
544
 
 
551
 
552
  #### Request parameters
553
 
554
+ - `"dataset_id"`: (*Path parameter*)
555
  The dataset ID.
556
+ - `"documents_id"`: (*Path parameter*)
557
+ The ID of the document to download.
558
 
559
  ### Response
560
 
 
599
 
600
  #### Request parameters
601
 
602
+ - `"dataset_id"`: (*Path parameter*)
603
+ The dataset ID.
604
+ - `"keywords"`: (*Filter parameter*), `string`
605
+ The keywords used to match document titles. Defaults to `None`.
606
+ - `"offset"`: (*Filter parameter*), `integer`
607
+ The starting index for the documents to retrieve. Typically used in conjunction with `limit`. Defaults to `1`.
608
+ - `"limit"`: (*Filter parameter*), `integer`
609
+ The maximum number of documents to retrieve. Defaults to `1024`.
610
+ - `"orderby"`: (*Filter parameter*), `string`
611
+ The field by which documents should be sorted. Available options:
612
+ - `"create_time"` (default)
613
+ - `"update_time"`
614
+ - `"desc"`: (*Filter parameter*), `bool`
615
+ Indicates whether the retrieved documents should be sorted in descending order. Defaults to `True`.
616
+ - `"document_id"`: (*Filter parameter*)
617
+ The ID of the document to retrieve. Defaults to `None`.
618
 
619
  ### Response
620
 
 
674
 
675
  ## Delete documents
676
 
677
+ **DELETE** `/api/v1/dataset/{dataset_id}/document`
678
 
679
  Deletes documents by ID.
680
 
 
686
  - `'Content-Type: application/json'`
687
  - `'Authorization: Bearer {YOUR_API_KEY}'`
688
  - Body:
689
+ - `"ids"`: `list[string]`
690
 
691
  #### Request example
692
 
 
702
 
703
  #### Request parameters
704
 
705
+ - `"ids"`: (*Body parameter*), `list[string]`
706
  The IDs of the documents to delete.
707
 
708
  ### Response
 
735
  ### Request
736
 
737
  - Method: POST
738
+ - URL: `/api/v1/dataset/{dataset_id}/chunk`
739
  - Headers:
740
  - `'content-Type: application/json'`
741
  - 'Authorization: Bearer {YOUR_API_KEY}'
742
  - Body:
743
+ - `"document_ids"`: `list[string]`
744
 
745
  #### Request example
746
 
 
755
  #### Request parameters
756
 
757
  - `"dataset_id"`: (*Path parameter*)
758
+ - `"document_ids"`: (*Body parameter*)
759
  The ids of the documents to parse.
760
 
761
  ### Response
 
793
  - `'content-Type: application/json'`
794
  - `'Authorization: Bearer {YOUR_API_KEY}'`
795
  - Body:
796
+ - `"document_ids"`: `list[string]`
797
 
798
  #### Request example
799
 
 
808
  #### Request parameters
809
 
810
  - `"dataset_id"`: (*Path parameter*)
811
+ - `"document_ids"`: (*Body parameter*)
812
  The IDs of the documents to parse.
813
 
814
  ### Response
 
847
  - `'content-Type: application/json'`
848
  - `'Authorization: Bearer {YOUR_API_KEY}'`
849
  - Body:
850
+ - `"content"`: string
851
+ - `"important_keywords"`: `list[string]`
852
 
853
  #### Request example
854
 
 
864
 
865
  #### Request parameters
866
 
867
+ - `"content"`: (*Body parameter*)
868
  Contains the main text or information of the chunk.
869
+ - `"important_keywords`(*Body parameter*)
870
  List the key terms or phrases that are significant or central to the chunk's content.
871
 
872
  ### Response
 
1008
  - `'content-Type: application/json'`
1009
  - `'Authorization: Bearer {YOUR_API_KEY}'`
1010
  - Body:
1011
+ - `"chunk_ids"`: `list[string]`
1012
 
1013
  #### Request example
1014
 
 
1024
 
1025
  #### Request parameters
1026
 
1027
+ - `"chunk_ids"`: (*Body parameter*)
1028
  The chunks of the document to delete.
1029
 
1030
  ### Response
 
1062
  - `'content-Type: application/json'`
1063
  - `'Authorization: Bearer {YOUR_API_KEY}'`
1064
  - Body:
1065
+ - `"content"`: `string`
1066
+ - `"important_keywords"`: `string`
1067
+ - `"available"`: `integer`
1068
 
1069
  #### Request example
1070
 
 
1081
 
1082
  #### Request parameters
1083
 
1084
+ - `"content"`: (*Body parameter*)
1085
  Contains the main text or information of the chunk.
1086
+ - `"important_keywords"`: (*Body parameter*)
1087
  Lists the key terms or phrases that are significant or central to the chunk's content.
1088
+ - `"available"`: (*Body parameter*)
1089
  Indicating the availability status, 0 means unavailable and 1 means available.
1090
 
1091
  ### Response
 
1123
  - `'content-Type: application/json'`
1124
  - `'Authorization: Bearer {YOUR_API_KEY}'`
1125
  - Body:
1126
+ - `"question"`: `string`
1127
+ - `"datasets"`: `list[string]`
1128
+ - `"documents"`: `list[string]`
1129
+ - `"offset"`: int
1130
+ - `"limit"`: int
1131
+ - `"similarity_threshold"`: float
1132
+ - `"vector_similarity_weight"`: float
1133
+ - `"top_k"`: int
1134
+ - `"rerank_id"`: string
1135
+ - `"keyword"`: bool
1136
+ - `"highlight"`: bool
1137
 
1138
  #### Request example
1139
 
 
1270
  - Body:
1271
  - `"name"`: `string`
1272
  - `"avatar"`: `string`
1273
+ - `"knowledgebases"`: `list[DataSet]`
1274
  - `"id"`: `string`
1275
  - `"llm"`: `LLM`
1276
  - `"prompt"`: `Prompt`
1277
 
 
1278
  #### Request example
1279
 
1280
  ```shell
 
1553
  - `'content-Type: application/json'`
1554
  - `'Authorization: Bearer {YOUR_API_KEY}'`
1555
  - Body:
1556
+ - `"ids"`: `list[string]`
1557
 
1558
  #### Request example
1559
 
 
1747
  - `'content-Type: application/json'`
1748
  - `'Authorization: Bearer {YOUR_API_KEY}'`
1749
  - Body:
1750
+ - `"name"`: `string`
1751
 
1752
  #### Request example
1753
 
 
1842
  - `'content-Type: application/json'`
1843
  - `'Authorization: Bearer {YOUR_API_KEY}'`
1844
  - Body:
1845
+ - `"name`: string
1846
 
1847
  #### Request example
1848
  ```bash
 
1858
 
1859
  #### Request Parameter
1860
 
1861
+ - `"name`: (*Body Parameter)
1862
  The name of the created session.
1863
  - `None`
1864
 
 
1982
  - `'content-Type: application/json'`
1983
  - `'Authorization: Bearer {YOUR_API_KEY}'`
1984
  - Body:
1985
+ - `"ids"`: `list[string]`
1986
 
1987
  #### Request example
1988
 
 
1999
 
2000
  #### Request Parameters
2001
 
2002
+ - `"ids"`: (*Body Parameter*)
2003
  IDs of the sessions to delete.
2004
  - `None`
2005
 
 
2038
  - `'content-Type: application/json'`
2039
  - `'Authorization: Bearer {YOUR_API_KEY}'`
2040
  - Body:
2041
+ - `"question"`: `string`
2042
+ - `"stream"`: `bool`
2043
+ - `"session_id"`: `string`
2044
 
2045
  #### Request example
2046
 
 
2057
 
2058
  #### Request Parameters
2059
 
2060
+ - `"question"`: (*Body Parameter*)
2061
  The question you want to ask.
2062
  - question is required.
2063
  `None`
2064
+ - `"stream"`: (*Body Parameter*)
2065
  The approach of streaming text generation.
2066
  `False`
2067
+ - `"session_id"`: (*Body Parameter*)
2068
  The ID of session. If not provided, a new session will be generated.
2069
 
2070
  ### Response
api/python_api_reference.md CHANGED
@@ -366,7 +366,7 @@ print(doc)
366
  ## List documents
367
 
368
  ```python
369
- Dataset.list_documents(id:str =None, keywords: str=None, offset: int=0, limit:int = 1024,order_by:str = "create_time", desc: bool = True) -> list[Document]
370
  ```
371
 
372
  Lists documents in the current dataset.
@@ -383,7 +383,7 @@ The keywords used to match document titles. Defaults to `None`.
383
 
384
  #### offset: `int`
385
 
386
- The starting index for the documents to retrieve. Typically used in confunction with `limit`. Defaults to `0`.
387
 
388
  #### limit: `int`
389
 
@@ -424,11 +424,11 @@ A `Document` object contains the following attributes:
424
  - `process_begin_at`: `datetime` The start time of document processing. Defaults to `None`.
425
  - `process_duation`: `float` Duration of the processing in seconds. Defaults to `0.0`.
426
  - `run`: `str` The document's processing status:
427
- - `"0"`: UNSTART (default) ?????????
428
- - `"1"`: RUNNING
429
- - `"2"`: CANCEL
430
- - `"3"`: DONE
431
- - `"4"`: FAIL
432
  - `status`: `str` Reserved for future use.
433
 
434
  ### Examples
@@ -626,7 +626,7 @@ Lists chunks in the current document.
626
  ### Parameters
627
 
628
  #### keywords: `str`
629
-
630
  The keywords used to match chunk content. Defaults to `None`
631
 
632
  #### offset: `int`
 
366
  ## List documents
367
 
368
  ```python
369
+ Dataset.list_documents(id:str =None, keywords: str=None, offset: int=1, limit:int = 1024,order_by:str = "create_time", desc: bool = True) -> list[Document]
370
  ```
371
 
372
  Lists documents in the current dataset.
 
383
 
384
  #### offset: `int`
385
 
386
+ The starting index for the documents to retrieve. Typically used in conjunction with `limit`. Defaults to `0`.
387
 
388
  #### limit: `int`
389
 
 
424
  - `process_begin_at`: `datetime` The start time of document processing. Defaults to `None`.
425
  - `process_duation`: `float` Duration of the processing in seconds. Defaults to `0.0`.
426
  - `run`: `str` The document's processing status:
427
+ - `"UNSTART"` (default)
428
+ - `"RUNNING"`
429
+ - `"CANCEL"`
430
+ - `"DONE"`
431
+ - `"FAIL"`
432
  - `status`: `str` Reserved for future use.
433
 
434
  ### Examples
 
626
  ### Parameters
627
 
628
  #### keywords: `str`
629
+
630
  The keywords used to match chunk content. Defaults to `None`
631
 
632
  #### offset: `int`