cecilia-uu
commited on
Commit
·
acec9a8
1
Parent(s):
7d4a201
polished doc for dataset API (#1219)
Browse files### What problem does this PR solve?
Added doc for API.
### Type of change
- [x] Documentation Update
- docs/references/ragflow_api.md +142 -13
docs/references/ragflow_api.md
CHANGED
|
@@ -8,7 +8,12 @@ RAGFlow offers RESTful APIs for you to integrate its capabilities into third-par
|
|
| 8 |
|
| 9 |
## Base URL
|
| 10 |
```
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
```
|
| 13 |
|
| 14 |
## Authorization
|
|
@@ -40,7 +45,7 @@ This method creates (news) a dataset for a specific user.
|
|
| 40 |
| POST | `/dataset` |
|
| 41 |
|
| 42 |
:::note
|
| 43 |
-
You are *required* to save the `data.
|
| 44 |
:::
|
| 45 |
|
| 46 |
#### Request parameter
|
|
@@ -78,18 +83,17 @@ This method lists the created datasets for a specific user.
|
|
| 78 |
|
| 79 |
#### Response parameter
|
| 80 |
|
| 81 |
-
```
|
| 82 |
-
(200,
|
| 83 |
{
|
| 84 |
-
"code":
|
| 85 |
"data": [
|
| 86 |
{
|
| 87 |
-
"avatar":
|
| 88 |
"chunk_num": 0,
|
| 89 |
"create_date": "Mon, 17 Jun 2024 16:00:05 GMT",
|
| 90 |
"create_time": 1718611205876,
|
| 91 |
"created_by": "b48110a0286411ef994a3043d7ee537e",
|
| 92 |
-
"description":
|
| 93 |
"doc_num": 0,
|
| 94 |
"embd_id": "BAAI/bge-large-zh-v1.5",
|
| 95 |
"id": "9bd6424a2c7f11ef81b83043d7ee537e",
|
|
@@ -112,12 +116,10 @@ This method lists the created datasets for a specific user.
|
|
| 112 |
"update_date": "Mon, 17 Jun 2024 16:00:05 GMT",
|
| 113 |
"update_time": 1718611205876,
|
| 114 |
"vector_similarity_weight": 0.3
|
| 115 |
-
}
|
| 116 |
-
# ... additional datasets ...
|
| 117 |
],
|
| 118 |
-
"message": "
|
| 119 |
}
|
| 120 |
-
)
|
| 121 |
```
|
| 122 |
|
| 123 |
## Delete dataset
|
|
@@ -142,7 +144,134 @@ This method deletes a dataset for a specific user.
|
|
| 142 |
|
| 143 |
```json
|
| 144 |
{
|
| 145 |
-
"
|
| 146 |
-
"message": "
|
| 147 |
}
|
| 148 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
## Base URL
|
| 10 |
```
|
| 11 |
+
http://<host_address>/api/v1/
|
| 12 |
+
```
|
| 13 |
+
|
| 14 |
+
## Dataset URL
|
| 15 |
+
```
|
| 16 |
+
http://<host_address>/api/v1/dataset
|
| 17 |
```
|
| 18 |
|
| 19 |
## Authorization
|
|
|
|
| 45 |
| POST | `/dataset` |
|
| 46 |
|
| 47 |
:::note
|
| 48 |
+
You are *required* to save the `data.dataset_id` value returned in the response data, which is the session ID for all upcoming conversations.
|
| 49 |
:::
|
| 50 |
|
| 51 |
#### Request parameter
|
|
|
|
| 83 |
|
| 84 |
#### Response parameter
|
| 85 |
|
| 86 |
+
```json
|
|
|
|
| 87 |
{
|
| 88 |
+
"code": 0,
|
| 89 |
"data": [
|
| 90 |
{
|
| 91 |
+
"avatar": null,
|
| 92 |
"chunk_num": 0,
|
| 93 |
"create_date": "Mon, 17 Jun 2024 16:00:05 GMT",
|
| 94 |
"create_time": 1718611205876,
|
| 95 |
"created_by": "b48110a0286411ef994a3043d7ee537e",
|
| 96 |
+
"description": null,
|
| 97 |
"doc_num": 0,
|
| 98 |
"embd_id": "BAAI/bge-large-zh-v1.5",
|
| 99 |
"id": "9bd6424a2c7f11ef81b83043d7ee537e",
|
|
|
|
| 116 |
"update_date": "Mon, 17 Jun 2024 16:00:05 GMT",
|
| 117 |
"update_time": 1718611205876,
|
| 118 |
"vector_similarity_weight": 0.3
|
| 119 |
+
}
|
|
|
|
| 120 |
],
|
| 121 |
+
"message": "List datasets successfully!"
|
| 122 |
}
|
|
|
|
| 123 |
```
|
| 124 |
|
| 125 |
## Delete dataset
|
|
|
|
| 144 |
|
| 145 |
```json
|
| 146 |
{
|
| 147 |
+
"code": 0,
|
| 148 |
+
"message": "Remove dataset: 9cefaefc2e2611ef916b3043d7ee537e successfully"
|
| 149 |
}
|
| 150 |
```
|
| 151 |
+
|
| 152 |
+
### Get the details of the specific dataset
|
| 153 |
+
|
| 154 |
+
This method gets the details of the specific dataset.
|
| 155 |
+
|
| 156 |
+
### Request
|
| 157 |
+
|
| 158 |
+
#### Request URI
|
| 159 |
+
|
| 160 |
+
| Method | Request URI |
|
| 161 |
+
|----------|-------------------------|
|
| 162 |
+
| GET | `/dataset/{dataset_id}` |
|
| 163 |
+
|
| 164 |
+
#### Request parameter
|
| 165 |
+
|
| 166 |
+
| Name | Type | Required | Description |
|
| 167 |
+
|--------------|--------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
| 168 |
+
| `dataset_id` | string | Yes | The ID of the dataset. Call ['GET' /dataset](#create-dataset) to retrieve the ID. |
|
| 169 |
+
|
| 170 |
+
### Response
|
| 171 |
+
|
| 172 |
+
```json
|
| 173 |
+
{
|
| 174 |
+
"code": 0,
|
| 175 |
+
"data": {
|
| 176 |
+
"avatar": null,
|
| 177 |
+
"chunk_num": 0,
|
| 178 |
+
"description": null,
|
| 179 |
+
"doc_num": 0,
|
| 180 |
+
"embd_id": "BAAI/bge-large-zh-v1.5",
|
| 181 |
+
"id": "060323022e3511efa8263043d7ee537e",
|
| 182 |
+
"language": "Chinese",
|
| 183 |
+
"name": "test(1)",
|
| 184 |
+
"parser_config":
|
| 185 |
+
{
|
| 186 |
+
"pages": [[1, 1000000]]
|
| 187 |
+
},
|
| 188 |
+
"parser_id": "naive",
|
| 189 |
+
"permission": "me",
|
| 190 |
+
"token_num": 0
|
| 191 |
+
},
|
| 192 |
+
"message": "success"
|
| 193 |
+
}
|
| 194 |
+
```
|
| 195 |
+
|
| 196 |
+
### Update the details of the specific dataset
|
| 197 |
+
|
| 198 |
+
This method updates the details of the specific dataset.
|
| 199 |
+
|
| 200 |
+
### Request
|
| 201 |
+
|
| 202 |
+
#### Request URI
|
| 203 |
+
|
| 204 |
+
| Method | Request URI |
|
| 205 |
+
|--------|-------------------------|
|
| 206 |
+
| PUT | `/dataset/{dataset_id}` |
|
| 207 |
+
|
| 208 |
+
#### Request parameter
|
| 209 |
+
|
| 210 |
+
You are required to input at least one parameter.
|
| 211 |
+
|
| 212 |
+
| Name | Type | Required | Description |
|
| 213 |
+
|----------------------|--------|----------|-----------------------------------------------------------------------|
|
| 214 |
+
| `name` | string | No | The name of the knowledge base, from which you get the document list. |
|
| 215 |
+
| `description` | string | No | The description of the knowledge base. |
|
| 216 |
+
| `permission` | string | No | The permission for the knowledge base, default:me. |
|
| 217 |
+
| `language` | string | No | The language of the knowledge base. |
|
| 218 |
+
| `chunk_method` | string | No | The chunk method of the knowledge base. |
|
| 219 |
+
| `embedding_model_id` | string | No | The embedding model id of the knowledge base. |
|
| 220 |
+
| `photo` | string | No | The photo of the knowledge base. |
|
| 221 |
+
| `layout_recognize` | bool | No | The layout recognize of the knowledge base. |
|
| 222 |
+
| `token_num` | int | No | The token number of the knowledge base. |
|
| 223 |
+
| `id` | string | No | The id of the knowledge base. |
|
| 224 |
+
|
| 225 |
+
### Response
|
| 226 |
+
|
| 227 |
+
### Successful response
|
| 228 |
+
|
| 229 |
+
```json
|
| 230 |
+
{
|
| 231 |
+
"code": 0,
|
| 232 |
+
"data": {
|
| 233 |
+
"avatar": null,
|
| 234 |
+
"chunk_num": 0,
|
| 235 |
+
"create_date": "Wed, 19 Jun 2024 20:33:34 GMT",
|
| 236 |
+
"create_time": 1718800414518,
|
| 237 |
+
"created_by": "b48110a0286411ef994a3043d7ee537e",
|
| 238 |
+
"description": "new_description1",
|
| 239 |
+
"doc_num": 0,
|
| 240 |
+
"embd_id": "BAAI/bge-large-zh-v1.5",
|
| 241 |
+
"id": "24f9f17a2e3811ef820e3043d7ee537e",
|
| 242 |
+
"language": "English",
|
| 243 |
+
"name": "new_name",
|
| 244 |
+
"parser_config":
|
| 245 |
+
{
|
| 246 |
+
"pages": [[1, 1000000]]
|
| 247 |
+
},
|
| 248 |
+
"parser_id": "naive",
|
| 249 |
+
"permission": "me",
|
| 250 |
+
"similarity_threshold": 0.2,
|
| 251 |
+
"status": "1",
|
| 252 |
+
"tenant_id": "b48110a0286411ef994a3043d7ee537e",
|
| 253 |
+
"token_num": 0,
|
| 254 |
+
"update_date": "Wed, 19 Jun 2024 20:33:34 GMT",
|
| 255 |
+
"update_time": 1718800414529,
|
| 256 |
+
"vector_similarity_weight": 0.3
|
| 257 |
+
},
|
| 258 |
+
"message": "success"
|
| 259 |
+
}
|
| 260 |
+
```
|
| 261 |
+
|
| 262 |
+
### Response for the operating error
|
| 263 |
+
|
| 264 |
+
```json
|
| 265 |
+
{
|
| 266 |
+
"code": 103,
|
| 267 |
+
"message": "Only the owner of knowledgebase is authorized for this operation!"
|
| 268 |
+
}
|
| 269 |
+
```
|
| 270 |
+
|
| 271 |
+
### Response for no parameter
|
| 272 |
+
```json
|
| 273 |
+
{
|
| 274 |
+
"code": 102,
|
| 275 |
+
"message": "Please input at least one parameter that you want to update!"
|
| 276 |
+
}
|
| 277 |
+
```
|