### What problem does this PR solve?



### Type of change


- [x] Documentation Update
This commit is contained in:
writinwaters 2024-10-23 11:00:35 +08:00 committed by GitHub
parent 320e8f6553
commit 43b959fe58
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 84 additions and 86 deletions

View File

@ -415,7 +415,8 @@ curl --request POST \
--url http://{address}/api/v1/dataset/{dataset_id}/document \ --url http://{address}/api/v1/dataset/{dataset_id}/document \
--header 'Content-Type: multipart/form-data' \ --header 'Content-Type: multipart/form-data' \
--header 'Authorization: Bearer {YOUR_API_KEY}' \ --header 'Authorization: Bearer {YOUR_API_KEY}' \
--form 'file=@./test.txt' --form 'file=@./test1.txt' \
--form 'file=@./test2.pdf'
``` ```
#### Request parameters #### Request parameters
@ -423,7 +424,7 @@ curl --request POST \
- `"dataset_id"`: (*Path parameter*) - `"dataset_id"`: (*Path parameter*)
The ID of the dataset to which the documents will be uploaded. The ID of the dataset to which the documents will be uploaded.
- `"file"`: (*Body parameter*) - `"file"`: (*Body parameter*)
The document???? to upload. The document to upload.
### Response ### Response
@ -474,7 +475,7 @@ curl --request PUT \
--data '{ --data '{
"name": "manual.txt", "name": "manual.txt",
"chunk_method": "manual", "chunk_method": "manual",
"parser_config": {"chunk_token_count": 128, "delimiter": "\n!?。;!?", "layout_recognize": true, "task_page_size": 12} "parser_config": {"chunk_token_count": 128}
}' }'
``` ```
@ -483,7 +484,7 @@ curl --request PUT \
- `"name"`: (*Body parameter*), `string` - `"name"`: (*Body parameter*), `string`
- `"chunk_method"`: (*Body parameter*), `string` - `"chunk_method"`: (*Body parameter*), `string`
The parsing method to apply to the document. The parsing method to apply to the document:
- `"naive"`: General - `"naive"`: General
- `"manual`: Manual - `"manual`: Manual
- `"qa"`: Q&A - `"qa"`: Q&A
@ -496,16 +497,12 @@ curl --request PUT \
- `"one"`: One - `"one"`: One
- `"knowledge_graph"`: Knowledge Graph - `"knowledge_graph"`: Knowledge Graph
- `"email"`: Email - `"email"`: Email
- - `"parser_config"`: (*Body parameter*), `dict[string, Any]`
The parsing configuration for the document:
### Returns - `"chunk_token_count"`: Defaults to `128`.
- `"layout_recognize"`: Defaults to `True`.
- `"parser_config"`: (*Body parameter*) - `"delimiter"`: Defaults to `"\n!?。;!?"`.
Configuration object for the parser. - `"task_page_size"`: Defaults to `12`.
- If the value is `None`, a dictionary with default values will be generated.
- `"name"`: (*Body parameter*)
Name or title of the document.
### Response ### Response
@ -522,7 +519,7 @@ An error response includes a JSON object like the following:
```json ```json
{ {
"code": 102, "code": 102,
"message": "The dataset not own the document." "message": "The dataset does not have the document."
} }
``` ```
@ -541,7 +538,7 @@ Downloads a document from a specified dataset.
- Headers: - Headers:
- `'Authorization: Bearer {YOUR_API_KEY}'` - `'Authorization: Bearer {YOUR_API_KEY}'`
- Output: - Output:
- '{FILE_NAME}' - `'{FILE_NAME}'`
#### Request example #### Request example
@ -554,10 +551,10 @@ curl --request GET \
#### Request parameters #### Request parameters
- `"dataset_id"`: (*PATH parameter*) - `"dataset_id"`: (*Path parameter*)
The dataset ID. The dataset ID.
- `"documents_id"`: (*PATH parameter*) - `"documents_id"`: (*Path parameter*)
The document ID of the file. The ID of the document to download.
### Response ### Response
@ -602,20 +599,22 @@ curl --request GET \
#### Request parameters #### Request parameters
- `"dataset_id"`: (*PATH parameter*) - `"dataset_id"`: (*Path parameter*)
The dataset id The dataset ID.
- `offset`: (*Filter parameter*) - `"keywords"`: (*Filter parameter*), `string`
The beginning number of records for paging. The keywords used to match document titles. Defaults to `None`.
- `keywords`: (*Filter parameter*) - `"offset"`: (*Filter parameter*), `integer`
The keywords matches the search key workds; The starting index for the documents to retrieve. Typically used in conjunction with `limit`. Defaults to `1`.
- `limit`: (*Filter parameter*) - `"limit"`: (*Filter parameter*), `integer`
Records number to return. The maximum number of documents to retrieve. Defaults to `1024`.
- `orderby`: (*Filter parameter*) - `"orderby"`: (*Filter parameter*), `string`
The field by which the records should be sorted. This specifies the attribute or column used to order the results. The field by which documents should be sorted. Available options:
- `desc`: (*Filter parameter*) - `"create_time"` (default)
A boolean flag indicating whether the sorting should be in descending order. - `"update_time"`
- `id`: (*Filter parameter*) - `"desc"`: (*Filter parameter*), `bool`
The ID of the document to retrieve. Indicates whether the retrieved documents should be sorted in descending order. Defaults to `True`.
- `"document_id"`: (*Filter parameter*)
The ID of the document to retrieve. Defaults to `None`.
### Response ### Response
@ -675,7 +674,7 @@ An error response includes a JSON object like the following:
## Delete documents ## Delete documents
**DELETE** `/api/v1/dataset/{dataset_id}/document ` **DELETE** `/api/v1/dataset/{dataset_id}/document`
Deletes documents by ID. Deletes documents by ID.
@ -687,7 +686,7 @@ Deletes documents by ID.
- `'Content-Type: application/json'` - `'Content-Type: application/json'`
- `'Authorization: Bearer {YOUR_API_KEY}'` - `'Authorization: Bearer {YOUR_API_KEY}'`
- Body: - Body:
- `ids`: `list[string]` - `"ids"`: `list[string]`
#### Request example #### Request example
@ -703,7 +702,7 @@ curl --request DELETE \
#### Request parameters #### Request parameters
- `"ids"`: (*Body parameter*) - `"ids"`: (*Body parameter*), `list[string]`
The IDs of the documents to delete. The IDs of the documents to delete.
### Response ### Response
@ -736,12 +735,12 @@ Parses documents in a specified dataset.
### Request ### Request
- Method: POST - Method: POST
- URL: `/api/v1/dataset/{dataset_id}/chunk ` - URL: `/api/v1/dataset/{dataset_id}/chunk`
- Headers: - Headers:
- `'content-Type: application/json'` - `'content-Type: application/json'`
- 'Authorization: Bearer {YOUR_API_KEY}' - 'Authorization: Bearer {YOUR_API_KEY}'
- Body: - Body:
- `document_ids`: `list[string]` - `"document_ids"`: `list[string]`
#### Request example #### Request example
@ -756,7 +755,7 @@ curl --request POST \
#### Request parameters #### Request parameters
- `"dataset_id"`: (*Path parameter*) - `"dataset_id"`: (*Path parameter*)
- `"document_ids"`:(*Body parameter*) - `"document_ids"`: (*Body parameter*)
The ids of the documents to parse. The ids of the documents to parse.
### Response ### Response
@ -794,7 +793,7 @@ Stops parsing specified documents.
- `'content-Type: application/json'` - `'content-Type: application/json'`
- `'Authorization: Bearer {YOUR_API_KEY}'` - `'Authorization: Bearer {YOUR_API_KEY}'`
- Body: - Body:
- `document_ids`: `list[string]` - `"document_ids"`: `list[string]`
#### Request example #### Request example
@ -809,7 +808,7 @@ curl --request DELETE \
#### Request parameters #### Request parameters
- `"dataset_id"`: (*Path parameter*) - `"dataset_id"`: (*Path parameter*)
- `"document_ids"`:(*Body parameter*) - `"document_ids"`: (*Body parameter*)
The IDs of the documents to parse. The IDs of the documents to parse.
### Response ### Response
@ -848,8 +847,8 @@ Adds a chunk to a specified document in a specified dataset.
- `'content-Type: application/json'` - `'content-Type: application/json'`
- `'Authorization: Bearer {YOUR_API_KEY}'` - `'Authorization: Bearer {YOUR_API_KEY}'`
- Body: - Body:
- `content`: string - `"content"`: string
- `important_keywords`: `list[string]` - `"important_keywords"`: `list[string]`
#### Request example #### Request example
@ -865,9 +864,9 @@ curl --request POST \
#### Request parameters #### Request parameters
- `content`:(*Body parameter*) - `"content"`: (*Body parameter*)
Contains the main text or information of the chunk. Contains the main text or information of the chunk.
- `important_keywords`(*Body parameter*) - `"important_keywords`(*Body parameter*)
List the key terms or phrases that are significant or central to the chunk's content. List the key terms or phrases that are significant or central to the chunk's content.
### Response ### Response
@ -1009,7 +1008,7 @@ Deletes chunks by ID.
- `'content-Type: application/json'` - `'content-Type: application/json'`
- `'Authorization: Bearer {YOUR_API_KEY}'` - `'Authorization: Bearer {YOUR_API_KEY}'`
- Body: - Body:
- `chunk_ids`: `list[string]` - `"chunk_ids"`: `list[string]`
#### Request example #### Request example
@ -1025,7 +1024,7 @@ curl --request DELETE \
#### Request parameters #### Request parameters
- `"chunk_ids"`:(*Body parameter*) - `"chunk_ids"`: (*Body parameter*)
The chunks of the document to delete. The chunks of the document to delete.
### Response ### Response
@ -1063,9 +1062,9 @@ Updates content or configurations for a specified chunk.
- `'content-Type: application/json'` - `'content-Type: application/json'`
- `'Authorization: Bearer {YOUR_API_KEY}'` - `'Authorization: Bearer {YOUR_API_KEY}'`
- Body: - Body:
- `content`: `string` - `"content"`: `string`
- `important_keywords`: `string` - `"important_keywords"`: `string`
- `available`: `integer` - `"available"`: `integer`
#### Request example #### Request example
@ -1082,11 +1081,11 @@ curl --request PUT \
#### Request parameters #### Request parameters
- `"content"`:(*Body parameter*) - `"content"`: (*Body parameter*)
Contains the main text or information of the chunk. Contains the main text or information of the chunk.
- `"important_keywords"`:(*Body parameter*) - `"important_keywords"`: (*Body parameter*)
Lists the key terms or phrases that are significant or central to the chunk's content. Lists the key terms or phrases that are significant or central to the chunk's content.
- `"available"`:(*Body parameter*) - `"available"`: (*Body parameter*)
Indicating the availability status, 0 means unavailable and 1 means available. Indicating the availability status, 0 means unavailable and 1 means available.
### Response ### Response
@ -1124,17 +1123,17 @@ Retrieves chunks from specified datasets.
- `'content-Type: application/json'` - `'content-Type: application/json'`
- `'Authorization: Bearer {YOUR_API_KEY}'` - `'Authorization: Bearer {YOUR_API_KEY}'`
- Body: - Body:
- `question`: `string` - `"question"`: `string`
- `datasets`: `list[string]` - `"datasets"`: `list[string]`
- `documents`: `list[string]` - `"documents"`: `list[string]`
- `offset`: int - `"offset"`: int
- `limit`: int - `"limit"`: int
- `similarity_threshold`: float - `"similarity_threshold"`: float
- `vector_similarity_weight`: float - `"vector_similarity_weight"`: float
- `top_k`: int - `"top_k"`: int
- `rerank_id`: string - `"rerank_id"`: string
- `keyword`: bool - `"keyword"`: bool
- `highlight`: bool - `"highlight"`: bool
#### Request example #### Request example
@ -1271,12 +1270,11 @@ Creates a chat assistant.
- Body: - Body:
- `"name"`: `string` - `"name"`: `string`
- `"avatar"`: `string` - `"avatar"`: `string`
- `"knowledgebases"`: `List[DataSet]` - `"knowledgebases"`: `list[DataSet]`
- `"id"`: `string` - `"id"`: `string`
- `"llm"`: `LLM` - `"llm"`: `LLM`
- `"prompt"`: `Prompt` - `"prompt"`: `Prompt`
#### Request example #### Request example
```shell ```shell
@ -1555,7 +1553,7 @@ Deletes chat assistants by ID.
- `'content-Type: application/json'` - `'content-Type: application/json'`
- `'Authorization: Bearer {YOUR_API_KEY}'` - `'Authorization: Bearer {YOUR_API_KEY}'`
- Body: - Body:
- `ids`: list[string] - `"ids"`: `list[string]`
#### Request example #### Request example
@ -1749,7 +1747,7 @@ Create a chat session.
- `'content-Type: application/json'` - `'content-Type: application/json'`
- `'Authorization: Bearer {YOUR_API_KEY}'` - `'Authorization: Bearer {YOUR_API_KEY}'`
- Body: - Body:
- name: `string` - `"name"`: `string`
#### Request example #### Request example
@ -1844,7 +1842,7 @@ Update a chat session
- `'content-Type: application/json'` - `'content-Type: application/json'`
- `'Authorization: Bearer {YOUR_API_KEY}'` - `'Authorization: Bearer {YOUR_API_KEY}'`
- Body: - Body:
- `name`: string - `"name`: string
#### Request example #### Request example
```bash ```bash
@ -1860,7 +1858,7 @@ curl --request PUT \
#### Request Parameter #### Request Parameter
- `name`: (*Body Parameter) - `"name`: (*Body Parameter)
The name of the created session. The name of the created session.
- `None` - `None`
@ -1984,7 +1982,7 @@ Deletes sessions by ID.
- `'content-Type: application/json'` - `'content-Type: application/json'`
- `'Authorization: Bearer {YOUR_API_KEY}'` - `'Authorization: Bearer {YOUR_API_KEY}'`
- Body: - Body:
- `ids`: list[string] - `"ids"`: `list[string]`
#### Request example #### Request example
@ -2001,7 +1999,7 @@ curl --request DELETE \
#### Request Parameters #### Request Parameters
- `ids`: (*Body Parameter*) - `"ids"`: (*Body Parameter*)
IDs of the sessions to delete. IDs of the sessions to delete.
- `None` - `None`
@ -2040,9 +2038,9 @@ Asks a question to start a conversation.
- `'content-Type: application/json'` - `'content-Type: application/json'`
- `'Authorization: Bearer {YOUR_API_KEY}'` - `'Authorization: Bearer {YOUR_API_KEY}'`
- Body: - Body:
- `question`: `string` - `"question"`: `string`
- `stream`: `bool` - `"stream"`: `bool`
- `session_id`: `string` - `"session_id"`: `string`
#### Request example #### Request example
@ -2059,14 +2057,14 @@ curl --request POST \
#### Request Parameters #### Request Parameters
- `question`:(*Body Parameter*) - `"question"`: (*Body Parameter*)
The question you want to ask. The question you want to ask.
- question is required. - question is required.
`None` `None`
- `stream`: (*Body Parameter*) - `"stream"`: (*Body Parameter*)
The approach of streaming text generation. The approach of streaming text generation.
`False` `False`
- `session_id`: (*Body Parameter*) - `"session_id"`: (*Body Parameter*)
The ID of session. If not provided, a new session will be generated. The ID of session. If not provided, a new session will be generated.
### Response ### Response

View File

@ -366,7 +366,7 @@ print(doc)
## List documents ## List documents
```python ```python
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] 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]
``` ```
Lists documents in the current dataset. Lists documents in the current dataset.
@ -383,7 +383,7 @@ The keywords used to match document titles. Defaults to `None`.
#### offset: `int` #### offset: `int`
The starting index for the documents to retrieve. Typically used in confunction with `limit`. Defaults to `0`. The starting index for the documents to retrieve. Typically used in conjunction with `limit`. Defaults to `0`.
#### limit: `int` #### limit: `int`
@ -424,11 +424,11 @@ A `Document` object contains the following attributes:
- `process_begin_at`: `datetime` The start time of document processing. Defaults to `None`. - `process_begin_at`: `datetime` The start time of document processing. Defaults to `None`.
- `process_duation`: `float` Duration of the processing in seconds. Defaults to `0.0`. - `process_duation`: `float` Duration of the processing in seconds. Defaults to `0.0`.
- `run`: `str` The document's processing status: - `run`: `str` The document's processing status:
- `"0"`: UNSTART (default) ????????? - `"UNSTART"` (default)
- `"1"`: RUNNING - `"RUNNING"`
- `"2"`: CANCEL - `"CANCEL"`
- `"3"`: DONE - `"DONE"`
- `"4"`: FAIL - `"FAIL"`
- `status`: `str` Reserved for future use. - `status`: `str` Reserved for future use.
### Examples ### Examples