Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

ragflow_api.md 4.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. ---
  2. sidebar_class_name: hidden
  3. ---
  4. # API reference
  5. RAGFlow offers RESTful APIs for you to integrate its capabilities into third-party applications.
  6. ## Base URL
  7. ```
  8. https://demo.ragflow.io/api/v1/
  9. ```
  10. ## Authorization
  11. All of RAGFlow's RESTFul APIs use API key for authorization, so keep it safe and do not expose it to the front end.
  12. Put your API key in the request header.
  13. ```buildoutcfg
  14. Authorization: Bearer {API_KEY}
  15. ```
  16. To get your API key:
  17. 1. In RAGFlow, click **Chat** tab in the middle top of the page.
  18. 2. Hover over the corresponding dialogue **>** **Chat Bot API** to show the chatbot API configuration page.
  19. 3. Click **Api Key** **>** **Create new key** to create your API key.
  20. 4. Copy and keep your API key safe.
  21. ## Create dataset
  22. This method creates (news) a dataset for a specific user.
  23. ### Request
  24. #### Request URI
  25. | Method | Request URI |
  26. |--------|-------------|
  27. | POST | `/dataset` |
  28. :::note
  29. You are *required* to save the `data.id` value returned in the response data, which is the session ID for all upcoming conversations.
  30. :::
  31. #### Request parameter
  32. | Name | Type | Required | Description |
  33. |----------------|--------|----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
  34. | `dataset_name` | string | Yes | The unique identifier assigned to each newly created dataset. `dataset_name` must be less than 2 ** 10 characters and cannot be empty. The following character sets are supported: <br />- 26 lowercase English letters (a-z)<br />- 26 uppercase English letters (A-Z)<br />- 10 digits (0-9)<br />- "_", "-", "." |
  35. ### Response
  36. ```json
  37. {
  38. "code": 0,
  39. "data": {
  40. "dataset_name": "kb1",
  41. "dataset_id": "375e8ada2d3c11ef98f93043d7ee537e"
  42. },
  43. "message": "success"
  44. }
  45. ```
  46. ## Get dataset list
  47. This method lists the created datasets for a specific user.
  48. ### Request
  49. #### Request URI
  50. | Method | Request URI |
  51. |----------|-------------|
  52. | GET | `/dataset` |
  53. ### Response
  54. #### Response parameter
  55. ```python
  56. (200,
  57. {
  58. "code": 102,
  59. "data": [
  60. {
  61. "avatar": None,
  62. "chunk_num": 0,
  63. "create_date": "Mon, 17 Jun 2024 16:00:05 GMT",
  64. "create_time": 1718611205876,
  65. "created_by": "b48110a0286411ef994a3043d7ee537e",
  66. "description": None,
  67. "doc_num": 0,
  68. "embd_id": "BAAI/bge-large-zh-v1.5",
  69. "id": "9bd6424a2c7f11ef81b83043d7ee537e",
  70. "language": "Chinese",
  71. "name": "dataset3(23)",
  72. "parser_config": {
  73. "pages": [
  74. [
  75. 1,
  76. 1000000
  77. ]
  78. ]
  79. },
  80. "parser_id": "naive",
  81. "permission": "me",
  82. "similarity_threshold": 0.2,
  83. "status": "1",
  84. "tenant_id": "b48110a0286411ef994a3043d7ee537e",
  85. "token_num": 0,
  86. "update_date": "Mon, 17 Jun 2024 16:00:05 GMT",
  87. "update_time": 1718611205876,
  88. "vector_similarity_weight": 0.3
  89. },
  90. # ... additional datasets ...
  91. ],
  92. "message": "attempt to list datasets"
  93. }
  94. )
  95. ```
  96. ## Delete dataset
  97. This method deletes a dataset for a specific user.
  98. ### Request
  99. #### Request URI
  100. | Method | Request URI |
  101. |--------|-------------------------|
  102. | DELETE | `/dataset/{dataset_id}` |
  103. #### Request parameter
  104. | Name | Type | Required | Description |
  105. |--------------|--------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------|
  106. | `dataset_id` | string | Yes | The ID of the dataset. Call ['GET' /dataset](#create-dataset) to retrieve the ID. |
  107. ### Response
  108. ```json
  109. {
  110. "success": true,
  111. "message": "Dataset deleted successfully!"
  112. }
  113. ```