Browse Source

minor (#2984)

### What problem does this PR solve?



### Type of change


- [x] Documentation Update
tags/v0.13.0
writinwaters 1 year ago
parent
commit
43b959fe58
No account linked to committer's email address
2 changed files with 84 additions and 86 deletions
  1. 76
    78
      api/http_api_reference.md
  2. 8
    8
      api/python_api_reference.md

+ 76
- 78
api/http_api_reference.md View File

--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
- `"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


--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}
}' }'


``` ```


- `"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
- `"one"`: One - `"one"`: One
- `"knowledge_graph"`: Knowledge Graph - `"knowledge_graph"`: Knowledge Graph
- `"email"`: Email - `"email"`: Email
-

### Returns

- `"parser_config"`: (*Body parameter*)
Configuration object for the parser.
- If the value is `None`, a dictionary with default values will be generated.

- `"name"`: (*Body parameter*)
Name or title of the document.
- `"parser_config"`: (*Body parameter*), `dict[string, Any]`
The parsing configuration for the document:
- `"chunk_token_count"`: Defaults to `128`.
- `"layout_recognize"`: Defaults to `True`.
- `"delimiter"`: Defaults to `"\n!?。;!?"`.
- `"task_page_size"`: Defaults to `12`.


### Response ### Response


```json ```json
{ {
"code": 102, "code": 102,
"message": "The dataset not own the document."
"message": "The dataset does not have the document."
} }
``` ```


- Headers: - Headers:
- `'Authorization: Bearer {YOUR_API_KEY}'` - `'Authorization: Bearer {YOUR_API_KEY}'`
- Output: - Output:
- '{FILE_NAME}'
- `'{FILE_NAME}'`


#### Request example #### Request example




#### Request parameters #### Request parameters


- `"dataset_id"`: (*PATH parameter*)
- `"dataset_id"`: (*Path parameter*)
The dataset ID. The dataset ID.
- `"documents_id"`: (*PATH parameter*)
The document ID of the file.
- `"documents_id"`: (*Path parameter*)
The ID of the document to download.


### Response ### Response




#### Request parameters #### Request parameters


- `"dataset_id"`: (*PATH parameter*)
The dataset id
- `offset`: (*Filter parameter*)
The beginning number of records for paging.
- `keywords`: (*Filter parameter*)
The keywords matches the search key workds;
- `limit`: (*Filter parameter*)
Records number to return.
- `orderby`: (*Filter parameter*)
The field by which the records should be sorted. This specifies the attribute or column used to order the results.
- `desc`: (*Filter parameter*)
A boolean flag indicating whether the sorting should be in descending order.
- `id`: (*Filter parameter*)
The ID of the document to retrieve.
- `"dataset_id"`: (*Path parameter*)
The dataset ID.
- `"keywords"`: (*Filter parameter*), `string`
The keywords used to match document titles. Defaults to `None`.
- `"offset"`: (*Filter parameter*), `integer`
The starting index for the documents to retrieve. Typically used in conjunction with `limit`. Defaults to `1`.
- `"limit"`: (*Filter parameter*), `integer`
The maximum number of documents to retrieve. Defaults to `1024`.
- `"orderby"`: (*Filter parameter*), `string`
The field by which documents should be sorted. Available options:
- `"create_time"` (default)
- `"update_time"`
- `"desc"`: (*Filter parameter*), `bool`
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




## 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.


- `'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




#### 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
### 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


#### 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
- `'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


#### 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
- `'content-Type: application/json'` - `'content-Type: application/json'`
- `'Authorization: Bearer {YOUR_API_KEY}'` - `'Authorization: Bearer {YOUR_API_KEY}'`
- Body: - Body:
- `content`: string
- `important_keywords`: `list[string]`
- `"content"`: string
- `"important_keywords"`: `list[string]`


#### Request example #### Request example




#### 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
- `'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




#### 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
- `'content-Type: application/json'` - `'content-Type: application/json'`
- `'Authorization: Bearer {YOUR_API_KEY}'` - `'Authorization: Bearer {YOUR_API_KEY}'`
- Body: - Body:
- `content`: `string`
- `important_keywords`: `string`
- `available`: `integer`
- `"content"`: `string`
- `"important_keywords"`: `string`
- `"available"`: `integer`


#### Request example #### Request example




#### 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
- `'content-Type: application/json'` - `'content-Type: application/json'`
- `'Authorization: Bearer {YOUR_API_KEY}'` - `'Authorization: Bearer {YOUR_API_KEY}'`
- Body: - Body:
- `question`: `string`
- `datasets`: `list[string]`
- `documents`: `list[string]`
- `offset`: int
- `limit`: int
- `similarity_threshold`: float
- `vector_similarity_weight`: float
- `top_k`: int
- `rerank_id`: string
- `keyword`: bool
- `highlight`: bool
- `"question"`: `string`
- `"datasets"`: `list[string]`
- `"documents"`: `list[string]`
- `"offset"`: int
- `"limit"`: int
- `"similarity_threshold"`: float
- `"vector_similarity_weight"`: float
- `"top_k"`: int
- `"rerank_id"`: string
- `"keyword"`: bool
- `"highlight"`: bool


#### Request example #### Request example


- 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
- `'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


- `'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


- `'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


#### Request Parameter #### Request Parameter


- `name`: (*Body Parameter)
- `"name`: (*Body Parameter)
The name of the created session. The name of the created session.
- `None` - `None`


- `'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




#### Request Parameters #### Request Parameters


- `ids`: (*Body Parameter*)
- `"ids"`: (*Body Parameter*)
IDs of the sessions to delete. IDs of the sessions to delete.
- `None` - `None`


- `'content-Type: application/json'` - `'content-Type: application/json'`
- `'Authorization: Bearer {YOUR_API_KEY}'` - `'Authorization: Bearer {YOUR_API_KEY}'`
- Body: - Body:
- `question`: `string`
- `stream`: `bool`
- `session_id`: `string`
- `"question"`: `string`
- `"stream"`: `bool`
- `"session_id"`: `string`


#### Request example #### Request example




#### 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

+ 8
- 8
api/python_api_reference.md View File

## 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.


#### 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`


- `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) ?????????
- `"1"`: RUNNING
- `"2"`: CANCEL
- `"3"`: DONE
- `"4"`: FAIL
- `"UNSTART"` (default)
- `"RUNNING"`
- `"CANCEL"`
- `"DONE"`
- `"FAIL"`
- `status`: `str` Reserved for future use. - `status`: `str` Reserved for future use.


### Examples ### Examples
### Parameters ### Parameters


#### keywords: `str` #### keywords: `str`
The keywords used to match chunk content. Defaults to `None` The keywords used to match chunk content. Defaults to `None`


#### offset: `int` #### offset: `int`

Loading…
Cancel
Save