您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

template.en.mdx 80KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352
  1. {/**
  2. * @typedef Props
  3. * @property {string} apiBaseUrl
  4. */}
  5. import { CodeGroup } from '@/app/components/develop/code.tsx'
  6. import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstruction, Paragraph } from '@/app/components/develop/md.tsx'
  7. # Knowledge API
  8. <div>
  9. ### Authentication
  10. Service API authenticates using an `API-Key`.
  11. It is suggested that developers store the `API-Key` in the backend instead of sharing or storing it in the client side to avoid the leakage of the `API-Key`, which may lead to property loss.
  12. All API requests should include your `API-Key` in the **`Authorization`** HTTP Header, as shown below:
  13. <CodeGroup title="Code">
  14. ```javascript
  15. Authorization: Bearer {API_KEY}
  16. ```
  17. </CodeGroup>
  18. </div>
  19. <hr className='ml-0 mr-0' />
  20. <Heading
  21. url='/datasets/{dataset_id}/document/create-by-text'
  22. method='POST'
  23. title='Create a Document from Text'
  24. name='#create-by-text'
  25. />
  26. <Row>
  27. <Col>
  28. This API is based on an existing knowledge and creates a new document through text based on this knowledge.
  29. ### Path
  30. <Properties>
  31. <Property name='dataset_id' type='string' key='dataset_id'>
  32. Knowledge ID
  33. </Property>
  34. </Properties>
  35. ### Request Body
  36. <Properties>
  37. <Property name='name' type='string' key='name'>
  38. Document name
  39. </Property>
  40. <Property name='text' type='string' key='text'>
  41. Document content
  42. </Property>
  43. <Property name='indexing_technique' type='string' key='indexing_technique'>
  44. Index mode
  45. - <code>high_quality</code> High quality: embedding using embedding model, built as vector database index
  46. - <code>economy</code> Economy: Build using inverted index of keyword table index
  47. </Property>
  48. <Property name='doc_form' type='string' key='doc_form'>
  49. Format of indexed content
  50. - <code>text_model</code> Text documents are directly embedded; `economy` mode defaults to using this form
  51. - <code>hierarchical_model</code> Parent-child mode
  52. - <code>qa_model</code> Q&A Mode: Generates Q&A pairs for segmented documents and then embeds the questions
  53. </Property>
  54. <Property name='doc_language' type='string' key='doc_language'>
  55. In Q&A mode, specify the language of the document, for example: <code>English</code>, <code>Chinese</code>
  56. </Property>
  57. <Property name='process_rule' type='object' key='process_rule'>
  58. Processing rules
  59. - <code>mode</code> (string) Cleaning, segmentation mode, automatic / custom / hierarchical
  60. - <code>rules</code> (object) Custom rules (in automatic mode, this field is empty)
  61. - <code>pre_processing_rules</code> (array[object]) Preprocessing rules
  62. - <code>id</code> (string) Unique identifier for the preprocessing rule
  63. - enumerate
  64. - <code>remove_extra_spaces</code> Replace consecutive spaces, newlines, tabs
  65. - <code>remove_urls_emails</code> Delete URL, email address
  66. - <code>enabled</code> (bool) Whether to select this rule or not. If no document ID is passed in, it represents the default value.
  67. - <code>segmentation</code> (object) Segmentation rules
  68. - <code>separator</code> Custom segment identifier, currently only allows one delimiter to be set. Default is \n
  69. - <code>max_tokens</code> Maximum length (token) defaults to 1000
  70. - <code>parent_mode</code> Retrieval mode of parent chunks: <code>full-doc</code> full text retrieval / <code>paragraph</code> paragraph retrieval
  71. - <code>subchunk_segmentation</code> (object) Child chunk rules
  72. - <code>separator</code> Segmentation identifier. Currently, only one delimiter is allowed. The default is <code>***</code>
  73. - <code>max_tokens</code> The maximum length (tokens) must be validated to be shorter than the length of the parent chunk
  74. - <code>chunk_overlap</code> Define the overlap between adjacent chunks (optional)
  75. </Property>
  76. <PropertyInstruction>When no parameters are set for the knowledge base, the first upload requires the following parameters to be provided; if not provided, the default parameters will be used.</PropertyInstruction>
  77. <Property name='retrieval_model' type='object' key='retrieval_model'>
  78. Retrieval model
  79. - <code>search_method</code> (string) Search method
  80. - <code>hybrid_search</code> Hybrid search
  81. - <code>semantic_search</code> Semantic search
  82. - <code>full_text_search</code> Full-text search
  83. - <code>reranking_enable</code> (bool) Whether to enable reranking
  84. - <code>reranking_mode</code> (object) Rerank model configuration
  85. - <code>reranking_provider_name</code> (string) Rerank model provider
  86. - <code>reranking_model_name</code> (string) Rerank model name
  87. - <code>top_k</code> (int) Number of results to return
  88. - <code>score_threshold_enabled</code> (bool) Whether to enable score threshold
  89. - <code>score_threshold</code> (float) Score threshold
  90. </Property>
  91. <Property name='embedding_model' type='string' key='embedding_model'>
  92. Embedding model name
  93. </Property>
  94. <Property name='embedding_model_provider' type='string' key='embedding_model_provider'>
  95. Embedding model provider
  96. </Property>
  97. </Properties>
  98. </Col>
  99. <Col sticky>
  100. <CodeGroup
  101. title="Request"
  102. tag="POST"
  103. label="/datasets/{dataset_id}/document/create-by-text"
  104. targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/document/create-by-text' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"name": "text","text": "text","indexing_technique": "high_quality","process_rule": {"mode": "automatic"}}'`}
  105. >
  106. ```bash {{ title: 'cURL' }}
  107. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/document/create-by-text' \
  108. --header 'Authorization: Bearer {api_key}' \
  109. --header 'Content-Type: application/json' \
  110. --data-raw '{
  111. "name": "text",
  112. "text": "text",
  113. "indexing_technique": "high_quality",
  114. "process_rule": {
  115. "mode": "automatic"
  116. }
  117. }'
  118. ```
  119. </CodeGroup>
  120. <CodeGroup title="Response">
  121. ```json {{ title: 'Response' }}
  122. {
  123. "document": {
  124. "id": "",
  125. "position": 1,
  126. "data_source_type": "upload_file",
  127. "data_source_info": {
  128. "upload_file_id": ""
  129. },
  130. "dataset_process_rule_id": "",
  131. "name": "text.txt",
  132. "created_from": "api",
  133. "created_by": "",
  134. "created_at": 1695690280,
  135. "tokens": 0,
  136. "indexing_status": "waiting",
  137. "error": null,
  138. "enabled": true,
  139. "disabled_at": null,
  140. "disabled_by": null,
  141. "archived": false,
  142. "display_status": "queuing",
  143. "word_count": 0,
  144. "hit_count": 0,
  145. "doc_form": "text_model"
  146. },
  147. "batch": ""
  148. }
  149. ```
  150. </CodeGroup>
  151. </Col>
  152. </Row>
  153. <hr className='ml-0 mr-0' />
  154. <Heading
  155. url='/datasets/{dataset_id}/document/create-by-file'
  156. method='POST'
  157. title='Create a Document from a File'
  158. name='#create-by-file'
  159. />
  160. <Row>
  161. <Col>
  162. This API is based on an existing knowledge and creates a new document through a file based on this knowledge.
  163. ### Path
  164. <Properties>
  165. <Property name='dataset_id' type='string' key='dataset_id'>
  166. Knowledge ID
  167. </Property>
  168. </Properties>
  169. ### Request Body
  170. <Properties>
  171. <Property name='data' type='multipart/form-data json string' key='data'>
  172. - <code>original_document_id</code> Source document ID (optional)
  173. - Used to re-upload the document or modify the document cleaning and segmentation configuration. The missing information is copied from the source document
  174. - The source document cannot be an archived document
  175. - When original_document_id is passed in, the update operation is performed on behalf of the document. process_rule is a fillable item. If not filled in, the segmentation method of the source document will be used by default
  176. - When original_document_id is not passed in, the new operation is performed on behalf of the document, and process_rule is required
  177. - <code>indexing_technique</code> Index mode
  178. - <code>high_quality</code> High quality: embedding using embedding model, built as vector database index
  179. - <code>economy</code> Economy: Build using inverted index of keyword table index
  180. - <code>doc_form</code> Format of indexed content
  181. - <code>text_model</code> Text documents are directly embedded; `economy` mode defaults to using this form
  182. - <code>hierarchical_model</code> Parent-child mode
  183. - <code>qa_model</code> Q&A Mode: Generates Q&A pairs for segmented documents and then embeds the questions
  184. - <code>doc_language</code> In Q&A mode, specify the language of the document, for example: <code>English</code>, <code>Chinese</code>
  185. - <code>process_rule</code> Processing rules
  186. - <code>mode</code> (string) Cleaning, segmentation mode, automatic / custom / hierarchical
  187. - <code>rules</code> (object) Custom rules (in automatic mode, this field is empty)
  188. - <code>pre_processing_rules</code> (array[object]) Preprocessing rules
  189. - <code>id</code> (string) Unique identifier for the preprocessing rule
  190. - enumerate
  191. - <code>remove_extra_spaces</code> Replace consecutive spaces, newlines, tabs
  192. - <code>remove_urls_emails</code> Delete URL, email address
  193. - <code>enabled</code> (bool) Whether to select this rule or not. If no document ID is passed in, it represents the default value.
  194. - <code>segmentation</code> (object) Segmentation rules
  195. - <code>separator</code> Custom segment identifier, currently only allows one delimiter to be set. Default is \n
  196. - <code>max_tokens</code> Maximum length (token) defaults to 1000
  197. - <code>parent_mode</code> Retrieval mode of parent chunks: <code>full-doc</code> full text retrieval / <code>paragraph</code> paragraph retrieval
  198. - <code>subchunk_segmentation</code> (object) Child chunk rules
  199. - <code>separator</code> Segmentation identifier. Currently, only one delimiter is allowed. The default is <code>***</code>
  200. - <code>max_tokens</code> The maximum length (tokens) must be validated to be shorter than the length of the parent chunk
  201. - <code>chunk_overlap</code> Define the overlap between adjacent chunks (optional)
  202. </Property>
  203. <Property name='file' type='multipart/form-data' key='file'>
  204. Files that need to be uploaded.
  205. </Property>
  206. <PropertyInstruction>When no parameters are set for the knowledge base, the first upload requires the following parameters to be provided; if not provided, the default parameters will be used.</PropertyInstruction>
  207. <Property name='retrieval_model' type='object' key='retrieval_model'>
  208. Retrieval model
  209. - <code>search_method</code> (string) Search method
  210. - <code>hybrid_search</code> Hybrid search
  211. - <code>semantic_search</code> Semantic search
  212. - <code>full_text_search</code> Full-text search
  213. - <code>reranking_enable</code> (bool) Whether to enable reranking
  214. - <code>reranking_mode</code> (object) Rerank model configuration
  215. - <code>reranking_provider_name</code> (string) Rerank model provider
  216. - <code>reranking_model_name</code> (string) Rerank model name
  217. - <code>top_k</code> (int) Number of results to return
  218. - <code>score_threshold_enabled</code> (bool) Whether to enable score threshold
  219. - <code>score_threshold</code> (float) Score threshold
  220. </Property>
  221. <Property name='embedding_model' type='string' key='embedding_model'>
  222. Embedding model name
  223. </Property>
  224. <Property name='embedding_model_provider' type='string' key='embedding_model_provider'>
  225. Embedding model provider
  226. </Property>
  227. </Properties>
  228. </Col>
  229. <Col sticky>
  230. <CodeGroup
  231. title="Request"
  232. tag="POST"
  233. label="/datasets/{dataset_id}/document/create-by-file"
  234. targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/document/create-by-file' \\\n--header 'Authorization: Bearer {api_key}' \\\n--form 'data="{"indexing_technique":"high_quality","process_rule":{"rules":{"pre_processing_rules":[{"id":"remove_extra_spaces","enabled":true},{"id":"remove_urls_emails","enabled":true}],"segmentation":{"separator":"###","max_tokens":500}},"mode":"custom"}}";type=text/plain' \\\n--form 'file=@"/path/to/file"'`}
  235. >
  236. ```bash {{ title: 'cURL' }}
  237. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/document/create-by-file' \
  238. --header 'Authorization: Bearer {api_key}' \
  239. --form 'data="{\"name\":\"Dify\",\"indexing_technique\":\"high_quality\",\"process_rule\":{\"rules\":{\"pre_processing_rules\":[{\"id\":\"remove_extra_spaces\",\"enabled\":true},{\"id\":\"remove_urls_emails\",\"enabled\":true}],\"segmentation\":{\"separator\":\"###\",\"max_tokens\":500}},\"mode\":\"custom\"}}";type=text/plain' \
  240. --form 'file=@"/path/to/file"'
  241. ```
  242. </CodeGroup>
  243. <CodeGroup title="Response">
  244. ```json {{ title: 'Response' }}
  245. {
  246. "document": {
  247. "id": "",
  248. "position": 1,
  249. "data_source_type": "upload_file",
  250. "data_source_info": {
  251. "upload_file_id": ""
  252. },
  253. "dataset_process_rule_id": "",
  254. "name": "Dify.txt",
  255. "created_from": "api",
  256. "created_by": "",
  257. "created_at": 1695308667,
  258. "tokens": 0,
  259. "indexing_status": "waiting",
  260. "error": null,
  261. "enabled": true,
  262. "disabled_at": null,
  263. "disabled_by": null,
  264. "archived": false,
  265. "display_status": "queuing",
  266. "word_count": 0,
  267. "hit_count": 0,
  268. "doc_form": "text_model"
  269. },
  270. "batch": ""
  271. }
  272. ```
  273. </CodeGroup>
  274. </Col>
  275. </Row>
  276. <hr className='ml-0 mr-0' />
  277. <Heading
  278. url='/datasets'
  279. method='POST'
  280. title='Create an Empty Knowledge Base'
  281. name='#create_empty_dataset'
  282. />
  283. <Row>
  284. <Col>
  285. ### Request Body
  286. <Properties>
  287. <Property name='name' type='string' key='name'>
  288. Knowledge name
  289. </Property>
  290. <Property name='description' type='string' key='description'>
  291. Knowledge description (optional)
  292. </Property>
  293. <Property name='indexing_technique' type='string' key='indexing_technique'>
  294. Index technique (optional)
  295. If this is not set, embedding_model, embedding_model_provider and retrieval_model will be set to null
  296. - <code>high_quality</code> High quality
  297. - <code>economy</code> Economy
  298. </Property>
  299. <Property name='permission' type='string' key='permission'>
  300. Permission
  301. - <code>only_me</code> Only me
  302. - <code>all_team_members</code> All team members
  303. - <code>partial_members</code> Partial members
  304. </Property>
  305. <Property name='provider' type='string' key='provider'>
  306. Provider (optional, default: vendor)
  307. - <code>vendor</code> Vendor
  308. - <code>external</code> External knowledge
  309. </Property>
  310. <Property name='external_knowledge_api_id' type='str' key='external_knowledge_api_id'>
  311. External knowledge API ID (optional)
  312. </Property>
  313. <Property name='external_knowledge_id' type='str' key='external_knowledge_id'>
  314. External knowledge ID (optional)
  315. </Property>
  316. <Property name='embedding_model' type='str' key='embedding_model'>
  317. Embedding model name (optional)
  318. </Property>
  319. <Property name='embedding_model_provider' type='str' key='embedding_model_provider'>
  320. Embedding model provider name (optional)
  321. </Property>
  322. <Property name='retrieval_model' type='object' key='retrieval_model'>
  323. Retrieval model (optional)
  324. - <code>search_method</code> (string) Search method
  325. - <code>hybrid_search</code> Hybrid search
  326. - <code>semantic_search</code> Semantic search
  327. - <code>full_text_search</code> Full-text search
  328. - <code>reranking_enable</code> (bool) Whether to enable reranking
  329. - <code>reranking_model</code> (object) Rerank model configuration
  330. - <code>reranking_provider_name</code> (string) Rerank model provider
  331. - <code>reranking_model_name</code> (string) Rerank model name
  332. - <code>top_k</code> (int) Number of results to return
  333. - <code>score_threshold_enabled</code> (bool) Whether to enable score threshold
  334. - <code>score_threshold</code> (float) Score threshold
  335. </Property>
  336. </Properties>
  337. </Col>
  338. <Col sticky>
  339. <CodeGroup
  340. title="Request"
  341. tag="POST"
  342. label="/datasets"
  343. targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"name": "name", "permission": "only_me"}'`}
  344. >
  345. ```bash {{ title: 'cURL' }}
  346. curl --location --request POST '${apiBaseUrl}/v1/datasets' \
  347. --header 'Authorization: Bearer {api_key}' \
  348. --header 'Content-Type: application/json' \
  349. --data-raw '{
  350. "name": "name",
  351. "permission": "only_me"
  352. }'
  353. ```
  354. </CodeGroup>
  355. <CodeGroup title="Response">
  356. ```json {{ title: 'Response' }}
  357. {
  358. "id": "",
  359. "name": "name",
  360. "description": null,
  361. "provider": "vendor",
  362. "permission": "only_me",
  363. "data_source_type": null,
  364. "indexing_technique": null,
  365. "app_count": 0,
  366. "document_count": 0,
  367. "word_count": 0,
  368. "created_by": "",
  369. "created_at": 1695636173,
  370. "updated_by": "",
  371. "updated_at": 1695636173,
  372. "embedding_model": null,
  373. "embedding_model_provider": null,
  374. "embedding_available": null
  375. }
  376. ```
  377. </CodeGroup>
  378. </Col>
  379. </Row>
  380. <hr className='ml-0 mr-0' />
  381. <Heading
  382. url='/datasets'
  383. method='GET'
  384. title='Get Knowledge Base List'
  385. name='#dataset_list'
  386. />
  387. <Row>
  388. <Col>
  389. ### Query
  390. <Properties>
  391. <Property name='keyword' type='string' key='keyword'>
  392. Search keyword, optional
  393. </Property>
  394. <Property name='tag_ids' type='array[string]' key='tag_ids'>
  395. Tag ID list, optional
  396. </Property>
  397. <Property name='page' type='string' key='page'>
  398. Page number, optional, default 1
  399. </Property>
  400. <Property name='limit' type='string' key='limit'>
  401. Number of items returned, optional, default 20, range 1-100
  402. </Property>
  403. <Property name='include_all' type='boolean' key='include_all'>
  404. Whether to include all datasets (only effective for owners), optional, defaults to false
  405. </Property>
  406. </Properties>
  407. </Col>
  408. <Col sticky>
  409. <CodeGroup
  410. title="Request"
  411. tag="GET"
  412. label="/datasets"
  413. targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets?page=1&limit=20' \\\n--header 'Authorization: Bearer {api_key}'`}
  414. >
  415. ```bash {{ title: 'cURL' }}
  416. curl --location --request GET '${props.apiBaseUrl}/datasets?page=1&limit=20' \
  417. --header 'Authorization: Bearer {api_key}'
  418. ```
  419. </CodeGroup>
  420. <CodeGroup title="Response">
  421. ```json {{ title: 'Response' }}
  422. {
  423. "data": [
  424. {
  425. "id": "",
  426. "name": "name",
  427. "description": "desc",
  428. "permission": "only_me",
  429. "data_source_type": "upload_file",
  430. "indexing_technique": "",
  431. "app_count": 2,
  432. "document_count": 10,
  433. "word_count": 1200,
  434. "created_by": "",
  435. "created_at": "",
  436. "updated_by": "",
  437. "updated_at": ""
  438. },
  439. ...
  440. ],
  441. "has_more": true,
  442. "limit": 20,
  443. "total": 50,
  444. "page": 1
  445. }
  446. ```
  447. </CodeGroup>
  448. </Col>
  449. </Row>
  450. <hr className='ml-0 mr-0' />
  451. <Heading
  452. url='/datasets/{dataset_id}'
  453. method='GET'
  454. title='Get knowledge base details by knowledge base ID'
  455. name='#view_dataset'
  456. />
  457. <Row>
  458. <Col>
  459. ### Path
  460. <Properties>
  461. <Property name='dataset_id' type='string' key='dataset_id'>
  462. Knowledge Base ID
  463. </Property>
  464. </Properties>
  465. </Col>
  466. <Col sticky>
  467. <CodeGroup
  468. title="Request"
  469. tag="GET"
  470. label="/datasets/{dataset_id}"
  471. targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}' \\\n--header 'Authorization: Bearer {api_key}'`}
  472. >
  473. ```bash {{ title: 'cURL' }}
  474. curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}' \
  475. --header 'Authorization: Bearer {api_key}'
  476. ```
  477. </CodeGroup>
  478. <CodeGroup title="Response">
  479. ```json {{ title: 'Response' }}
  480. {
  481. "id": "eaedb485-95ac-4ffd-ab1e-18da6d676a2f",
  482. "name": "Test Knowledge Base",
  483. "description": "",
  484. "provider": "vendor",
  485. "permission": "only_me",
  486. "data_source_type": null,
  487. "indexing_technique": null,
  488. "app_count": 0,
  489. "document_count": 0,
  490. "word_count": 0,
  491. "created_by": "e99a1635-f725-4951-a99a-1daaaa76cfc6",
  492. "created_at": 1735620612,
  493. "updated_by": "e99a1635-f725-4951-a99a-1daaaa76cfc6",
  494. "updated_at": 1735620612,
  495. "embedding_model": null,
  496. "embedding_model_provider": null,
  497. "embedding_available": true,
  498. "retrieval_model_dict": {
  499. "search_method": "semantic_search",
  500. "reranking_enable": false,
  501. "reranking_mode": null,
  502. "reranking_model": {
  503. "reranking_provider_name": "",
  504. "reranking_model_name": ""
  505. },
  506. "weights": null,
  507. "top_k": 2,
  508. "score_threshold_enabled": false,
  509. "score_threshold": null
  510. },
  511. "tags": [],
  512. "doc_form": null,
  513. "external_knowledge_info": {
  514. "external_knowledge_id": null,
  515. "external_knowledge_api_id": null,
  516. "external_knowledge_api_name": null,
  517. "external_knowledge_api_endpoint": null
  518. },
  519. "external_retrieval_model": {
  520. "top_k": 2,
  521. "score_threshold": 0.0,
  522. "score_threshold_enabled": null
  523. }
  524. }
  525. ```
  526. </CodeGroup>
  527. </Col>
  528. </Row>
  529. <hr className='ml-0 mr-0' />
  530. <Heading
  531. url='/datasets/{dataset_id}'
  532. method='PATCH'
  533. title='Update knowledge base'
  534. name='#update_dataset'
  535. />
  536. <Row>
  537. <Col>
  538. ### Path
  539. <Properties>
  540. <Property name='dataset_id' type='string' key='dataset_id'>
  541. Knowledge Base ID
  542. </Property>
  543. <Property name='indexing_technique' type='string' key='indexing_technique'>
  544. Index technique (optional)
  545. - <code>high_quality</code> High quality
  546. - <code>economy</code> Economy
  547. </Property>
  548. <Property name='permission' type='string' key='permission'>
  549. Permission
  550. - <code>only_me</code> Only me
  551. - <code>all_team_members</code> All team members
  552. - <code>partial_members</code> Partial members
  553. </Property>
  554. <Property name='embedding_model_provider' type='string' key='embedding_model_provider'>
  555. Specified embedding model provider, must be set up in the system first, corresponding to the provider field(Optional)
  556. </Property>
  557. <Property name='embedding_model' type='string' key='embedding_model'>
  558. Specified embedding model, corresponding to the model field(Optional)
  559. </Property>
  560. <Property name='retrieval_model' type='object' key='retrieval_model'>
  561. Retrieval model (optional, if not filled, it will be recalled according to the default method)
  562. - <code>search_method</code> (text) Search method: One of the following four keywords is required
  563. - <code>keyword_search</code> Keyword search
  564. - <code>semantic_search</code> Semantic search
  565. - <code>full_text_search</code> Full-text search
  566. - <code>hybrid_search</code> Hybrid search
  567. - <code>reranking_enable</code> (bool) Whether to enable reranking, required if the search mode is semantic_search or hybrid_search (optional)
  568. - <code>reranking_mode</code> (object) Rerank model configuration, required if reranking is enabled
  569. - <code>reranking_provider_name</code> (string) Rerank model provider
  570. - <code>reranking_model_name</code> (string) Rerank model name
  571. - <code>weights</code> (float) Semantic search weight setting in hybrid search mode
  572. - <code>top_k</code> (integer) Number of results to return (optional)
  573. - <code>score_threshold_enabled</code> (bool) Whether to enable score threshold
  574. - <code>score_threshold</code> (float) Score threshold
  575. </Property>
  576. <Property name='partial_member_list' type='array' key='partial_member_list'>
  577. Partial member list(Optional)
  578. </Property>
  579. </Properties>
  580. </Col>
  581. <Col sticky>
  582. <CodeGroup
  583. title="Request"
  584. tag="PATCH"
  585. label="/datasets/{dataset_id}"
  586. targetCode={`curl --location --request PATCH '${props.apiBaseUrl}/datasets/{dataset_id}' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{
  587. "name": "Test Knowledge Base",
  588. "indexing_technique": "high_quality",
  589. "permission": "only_me",
  590. "embedding_model_provider": "zhipuai",
  591. "embedding_model": "embedding-3",
  592. "retrieval_model": {
  593. "search_method": "keyword_search",
  594. "reranking_enable": false,
  595. "reranking_mode": null,
  596. "reranking_model": {
  597. "reranking_provider_name": "",
  598. "reranking_model_name": ""
  599. },
  600. "weights": null,
  601. "top_k": 1,
  602. "score_threshold_enabled": false,
  603. "score_threshold": null
  604. },
  605. "partial_member_list": []
  606. }'
  607. `}
  608. >
  609. ```bash {{ title: 'cURL' }}
  610. curl --location --request PATCH '${props.apiBaseUrl}/datasets/{dataset_id}' \
  611. --header 'Authorization: Bearer {api_key}' \
  612. --header 'Content-Type: application/json' \
  613. --data-raw '{
  614. "name": "Test Knowledge Base",
  615. "indexing_technique": "high_quality",
  616. "permission": "only_me",
  617. "embedding_model_provider": "zhipuai",
  618. "embedding_model": "embedding-3",
  619. "retrieval_model": {
  620. "search_method": "keyword_search",
  621. "reranking_enable": false,
  622. "reranking_mode": null,
  623. "reranking_model": {
  624. "reranking_provider_name": "",
  625. "reranking_model_name": ""
  626. },
  627. "weights": null,
  628. "top_k": 1,
  629. "score_threshold_enabled": false,
  630. "score_threshold": null
  631. },
  632. "partial_member_list": []
  633. }'
  634. ```
  635. </CodeGroup>
  636. <CodeGroup title="Response">
  637. ```json {{ title: 'Response' }}
  638. {
  639. "id": "eaedb485-95ac-4ffd-ab1e-18da6d676a2f",
  640. "name": "Test Knowledge Base",
  641. "description": "",
  642. "provider": "vendor",
  643. "permission": "only_me",
  644. "data_source_type": null,
  645. "indexing_technique": "high_quality",
  646. "app_count": 0,
  647. "document_count": 0,
  648. "word_count": 0,
  649. "created_by": "e99a1635-f725-4951-a99a-1daaaa76cfc6",
  650. "created_at": 1735620612,
  651. "updated_by": "e99a1635-f725-4951-a99a-1daaaa76cfc6",
  652. "updated_at": 1735622679,
  653. "embedding_model": "embedding-3",
  654. "embedding_model_provider": "zhipuai",
  655. "embedding_available": null,
  656. "retrieval_model_dict": {
  657. "search_method": "semantic_search",
  658. "reranking_enable": false,
  659. "reranking_mode": null,
  660. "reranking_model": {
  661. "reranking_provider_name": "",
  662. "reranking_model_name": ""
  663. },
  664. "weights": null,
  665. "top_k": 2,
  666. "score_threshold_enabled": false,
  667. "score_threshold": null
  668. },
  669. "tags": [],
  670. "doc_form": null,
  671. "external_knowledge_info": {
  672. "external_knowledge_id": null,
  673. "external_knowledge_api_id": null,
  674. "external_knowledge_api_name": null,
  675. "external_knowledge_api_endpoint": null
  676. },
  677. "external_retrieval_model": {
  678. "top_k": 2,
  679. "score_threshold": 0.0,
  680. "score_threshold_enabled": null
  681. },
  682. "partial_member_list": []
  683. }
  684. ```
  685. </CodeGroup>
  686. </Col>
  687. </Row>
  688. <hr className='ml-0 mr-0' />
  689. <Heading
  690. url='/datasets/{dataset_id}'
  691. method='DELETE'
  692. title='Delete a Knowledge Base'
  693. name='#delete_dataset'
  694. />
  695. <Row>
  696. <Col>
  697. ### Path
  698. <Properties>
  699. <Property name='dataset_id' type='string' key='dataset_id'>
  700. Knowledge ID
  701. </Property>
  702. </Properties>
  703. </Col>
  704. <Col sticky>
  705. <CodeGroup
  706. title="Request"
  707. tag="DELETE"
  708. label="/datasets/{dataset_id}"
  709. targetCode={`curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}' \\\n--header 'Authorization: Bearer {api_key}'`}
  710. >
  711. ```bash {{ title: 'cURL' }}
  712. curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}' \
  713. --header 'Authorization: Bearer {api_key}'
  714. ```
  715. </CodeGroup>
  716. <CodeGroup title="Response">
  717. ```text {{ title: 'Response' }}
  718. 204 No Content
  719. ```
  720. </CodeGroup>
  721. </Col>
  722. </Row>
  723. <hr className='ml-0 mr-0' />
  724. <Heading
  725. url='/datasets/{dataset_id}/documents/{document_id}/update-by-text'
  726. method='POST'
  727. title='Update a Document with Text'
  728. name='#update-by-text'
  729. />
  730. <Row>
  731. <Col>
  732. This API is based on an existing knowledge and updates the document through text based on this knowledge.
  733. ### Path
  734. <Properties>
  735. <Property name='dataset_id' type='string' key='dataset_id'>
  736. Knowledge ID
  737. </Property>
  738. <Property name='document_id' type='string' key='document_id'>
  739. Document ID
  740. </Property>
  741. </Properties>
  742. ### Request Body
  743. <Properties>
  744. <Property name='name' type='string' key='name'>
  745. Document name (optional)
  746. </Property>
  747. <Property name='text' type='string' key='text'>
  748. Document content (optional)
  749. </Property>
  750. <Property name='process_rule' type='object' key='process_rule'>
  751. Processing rules
  752. - <code>mode</code> (string) Cleaning, segmentation mode, automatic / custom / hierarchical
  753. - <code>rules</code> (object) Custom rules (in automatic mode, this field is empty)
  754. - <code>pre_processing_rules</code> (array[object]) Preprocessing rules
  755. - <code>id</code> (string) Unique identifier for the preprocessing rule
  756. - enumerate
  757. - <code>remove_extra_spaces</code> Replace consecutive spaces, newlines, tabs
  758. - <code>remove_urls_emails</code> Delete URL, email address
  759. - <code>enabled</code> (bool) Whether to select this rule or not. If no document ID is passed in, it represents the default value.
  760. - <code>segmentation</code> (object) Segmentation rules
  761. - <code>separator</code> Custom segment identifier, currently only allows one delimiter to be set. Default is \n
  762. - <code>max_tokens</code> Maximum length (token) defaults to 1000
  763. - <code>parent_mode</code> Retrieval mode of parent chunks: <code>full-doc</code> full text retrieval / <code>paragraph</code> paragraph retrieval
  764. - <code>subchunk_segmentation</code> (object) Child chunk rules
  765. - <code>separator</code> Segmentation identifier. Currently, only one delimiter is allowed. The default is <code>***</code>
  766. - <code>max_tokens</code> The maximum length (tokens) must be validated to be shorter than the length of the parent chunk
  767. - <code>chunk_overlap</code> Define the overlap between adjacent chunks (optional)
  768. </Property>
  769. </Properties>
  770. </Col>
  771. <Col sticky>
  772. <CodeGroup
  773. title="Request"
  774. tag="POST"
  775. label="/datasets/{dataset_id}/documents/{document_id}/update-by-text"
  776. targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/update-by-text' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"name": "name","text": "text"}'`}
  777. >
  778. ```bash {{ title: 'cURL' }}
  779. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/update-by-text' \
  780. --header 'Authorization: Bearer {api_key}' \
  781. --header 'Content-Type: application/json' \
  782. --data-raw '{
  783. "name": "name",
  784. "text": "text"
  785. }'
  786. ```
  787. </CodeGroup>
  788. <CodeGroup title="Response">
  789. ```json {{ title: 'Response' }}
  790. {
  791. "document": {
  792. "id": "",
  793. "position": 1,
  794. "data_source_type": "upload_file",
  795. "data_source_info": {
  796. "upload_file_id": ""
  797. },
  798. "dataset_process_rule_id": "",
  799. "name": "name.txt",
  800. "created_from": "api",
  801. "created_by": "",
  802. "created_at": 1695308667,
  803. "tokens": 0,
  804. "indexing_status": "waiting",
  805. "error": null,
  806. "enabled": true,
  807. "disabled_at": null,
  808. "disabled_by": null,
  809. "archived": false,
  810. "display_status": "queuing",
  811. "word_count": 0,
  812. "hit_count": 0,
  813. "doc_form": "text_model"
  814. },
  815. "batch": ""
  816. }
  817. ```
  818. </CodeGroup>
  819. </Col>
  820. </Row>
  821. <hr className='ml-0 mr-0' />
  822. <Heading
  823. url='/datasets/{dataset_id}/documents/{document_id}/update-by-file'
  824. method='POST'
  825. title='Update a Document with a File'
  826. name='#update-by-file'
  827. />
  828. <Row>
  829. <Col>
  830. This API is based on an existing knowledge, and updates documents through files based on this knowledge
  831. ### Path
  832. <Properties>
  833. <Property name='dataset_id' type='string' key='dataset_id'>
  834. Knowledge ID
  835. </Property>
  836. <Property name='document_id' type='string' key='document_id'>
  837. Document ID
  838. </Property>
  839. </Properties>
  840. ### Request Body
  841. <Properties>
  842. <Property name='name' type='string' key='name'>
  843. Document name (optional)
  844. </Property>
  845. <Property name='file' type='multipart/form-data' key='file'>
  846. Files to be uploaded
  847. </Property>
  848. <Property name='process_rule' type='object' key='process_rule'>
  849. Processing rules
  850. - <code>mode</code> (string) Cleaning, segmentation mode, automatic / custom / hierarchical
  851. - <code>rules</code> (object) Custom rules (in automatic mode, this field is empty)
  852. - <code>pre_processing_rules</code> (array[object]) Preprocessing rules
  853. - <code>id</code> (string) Unique identifier for the preprocessing rule
  854. - enumerate
  855. - <code>remove_extra_spaces</code> Replace consecutive spaces, newlines, tabs
  856. - <code>remove_urls_emails</code> Delete URL, email address
  857. - <code>enabled</code> (bool) Whether to select this rule or not. If no document ID is passed in, it represents the default value.
  858. - <code>segmentation</code> (object) Segmentation rules
  859. - <code>separator</code> Custom segment identifier, currently only allows one delimiter to be set. Default is \n
  860. - <code>max_tokens</code> Maximum length (token) defaults to 1000
  861. - <code>parent_mode</code> Retrieval mode of parent chunks: <code>full-doc</code> full text retrieval / <code>paragraph</code> paragraph retrieval
  862. - <code>subchunk_segmentation</code> (object) Child chunk rules
  863. - <code>separator</code> Segmentation identifier. Currently, only one delimiter is allowed. The default is <code>***</code>
  864. - <code>max_tokens</code> The maximum length (tokens) must be validated to be shorter than the length of the parent chunk
  865. - <code>chunk_overlap</code> Define the overlap between adjacent chunks (optional)
  866. </Property>
  867. </Properties>
  868. </Col>
  869. <Col sticky>
  870. <CodeGroup
  871. title="Request"
  872. tag="POST"
  873. label="/datasets/{dataset_id}/documents/{document_id}/update-by-file"
  874. targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/update-by-file' \\\n--header 'Authorization: Bearer {api_key}' \\\n--form 'data="{"name":"Dify","indexing_technique":"high_quality","process_rule":{"rules":{"pre_processing_rules":[{"id":"remove_extra_spaces","enabled":true},{"id":"remove_urls_emails","enabled":true}],"segmentation":{"separator":"###","max_tokens":500}},"mode":"custom"}}";type=text/plain' \\\n--form 'file=@"/path/to/file"'`}
  875. >
  876. ```bash {{ title: 'cURL' }}
  877. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/update-by-file' \
  878. --header 'Authorization: Bearer {api_key}' \
  879. --form 'data="{\"name\":\"Dify\",\"indexing_technique\":\"high_quality\",\"process_rule\":{\"rules\":{\"pre_processing_rules\":[{\"id\":\"remove_extra_spaces\",\"enabled\":true},{\"id\":\"remove_urls_emails\",\"enabled\":true}],\"segmentation\":{\"separator\":\"###\",\"max_tokens\":500}},\"mode\":\"custom\"}}";type=text/plain' \
  880. --form 'file=@"/path/to/file"'
  881. ```
  882. </CodeGroup>
  883. <CodeGroup title="Response">
  884. ```json {{ title: 'Response' }}
  885. {
  886. "document": {
  887. "id": "",
  888. "position": 1,
  889. "data_source_type": "upload_file",
  890. "data_source_info": {
  891. "upload_file_id": ""
  892. },
  893. "dataset_process_rule_id": "",
  894. "name": "Dify.txt",
  895. "created_from": "api",
  896. "created_by": "",
  897. "created_at": 1695308667,
  898. "tokens": 0,
  899. "indexing_status": "waiting",
  900. "error": null,
  901. "enabled": true,
  902. "disabled_at": null,
  903. "disabled_by": null,
  904. "archived": false,
  905. "display_status": "queuing",
  906. "word_count": 0,
  907. "hit_count": 0,
  908. "doc_form": "text_model"
  909. },
  910. "batch": "20230921150427533684"
  911. }
  912. ```
  913. </CodeGroup>
  914. </Col>
  915. </Row>
  916. <hr className='ml-0 mr-0' />
  917. <Heading
  918. url='/datasets/{dataset_id}/documents/{batch}/indexing-status'
  919. method='GET'
  920. title='Get Document Embedding Status (Progress)'
  921. name='#indexing_status'
  922. />
  923. <Row>
  924. <Col>
  925. ### Path
  926. <Properties>
  927. <Property name='dataset_id' type='string' key='dataset_id'>
  928. Knowledge ID
  929. </Property>
  930. <Property name='batch' type='string' key='batch'>
  931. Batch number of uploaded documents
  932. </Property>
  933. </Properties>
  934. </Col>
  935. <Col sticky>
  936. <CodeGroup
  937. title="Request"
  938. tag="GET"
  939. label="/datasets/{dataset_id}/documents/{batch}/indexing-status"
  940. targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{batch}/indexing-status' \\\n--header 'Authorization: Bearer {api_key}'`}
  941. >
  942. ```bash {{ title: 'cURL' }}
  943. curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{batch}/indexing-status' \
  944. --header 'Authorization: Bearer {api_key}' \
  945. ```
  946. </CodeGroup>
  947. <CodeGroup title="Response">
  948. ```json {{ title: 'Response' }}
  949. {
  950. "data":[{
  951. "id": "",
  952. "indexing_status": "indexing",
  953. "processing_started_at": 1681623462.0,
  954. "parsing_completed_at": 1681623462.0,
  955. "cleaning_completed_at": 1681623462.0,
  956. "splitting_completed_at": 1681623462.0,
  957. "completed_at": null,
  958. "paused_at": null,
  959. "error": null,
  960. "stopped_at": null,
  961. "completed_segments": 24,
  962. "total_segments": 100
  963. }]
  964. }
  965. ```
  966. </CodeGroup>
  967. </Col>
  968. </Row>
  969. <hr className='ml-0 mr-0' />
  970. <Heading
  971. url='/datasets/{dataset_id}/documents/{document_id}'
  972. method='DELETE'
  973. title='Delete a Document'
  974. name='#delete_document'
  975. />
  976. <Row>
  977. <Col>
  978. ### Path
  979. <Properties>
  980. <Property name='dataset_id' type='string' key='dataset_id'>
  981. Knowledge ID
  982. </Property>
  983. <Property name='document_id' type='string' key='document_id'>
  984. Document ID
  985. </Property>
  986. </Properties>
  987. </Col>
  988. <Col sticky>
  989. <CodeGroup
  990. title="Request"
  991. tag="DELETE"
  992. label="/datasets/{dataset_id}/documents/{document_id}"
  993. targetCode={`curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}' \\\n--header 'Authorization: Bearer {api_key}'`}
  994. >
  995. ```bash {{ title: 'cURL' }}
  996. curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}' \
  997. --header 'Authorization: Bearer {api_key}' \
  998. ```
  999. </CodeGroup>
  1000. <CodeGroup title="Response">
  1001. ```text {{ title: 'Response' }}
  1002. 204 No Content
  1003. ```
  1004. </CodeGroup>
  1005. </Col>
  1006. </Row>
  1007. <hr className='ml-0 mr-0' />
  1008. <Heading
  1009. url='/datasets/{dataset_id}/documents'
  1010. method='GET'
  1011. title='Get the Document List of a Knowledge Base'
  1012. name='#dataset_document_list'
  1013. />
  1014. <Row>
  1015. <Col>
  1016. ### Path
  1017. <Properties>
  1018. <Property name='dataset_id' type='string' key='dataset_id'>
  1019. Knowledge ID
  1020. </Property>
  1021. </Properties>
  1022. ### Query
  1023. <Properties>
  1024. <Property name='keyword' type='string' key='keyword'>
  1025. Search keywords, currently only search document names (optional)
  1026. </Property>
  1027. <Property name='page' type='string' key='page'>
  1028. Page number (optional)
  1029. </Property>
  1030. <Property name='limit' type='string' key='limit'>
  1031. Number of items returned, default 20, range 1-100 (optional)
  1032. </Property>
  1033. </Properties>
  1034. </Col>
  1035. <Col sticky>
  1036. <CodeGroup
  1037. title="Request"
  1038. tag="GET"
  1039. label="/datasets/{dataset_id}/documents"
  1040. targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents' \\\n--header 'Authorization: Bearer {api_key}'`}
  1041. >
  1042. ```bash {{ title: 'cURL' }}
  1043. curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents' \
  1044. --header 'Authorization: Bearer {api_key}' \
  1045. ```
  1046. </CodeGroup>
  1047. <CodeGroup title="Response">
  1048. ```json {{ title: 'Response' }}
  1049. {
  1050. "data": [
  1051. {
  1052. "id": "",
  1053. "position": 1,
  1054. "data_source_type": "file_upload",
  1055. "data_source_info": null,
  1056. "dataset_process_rule_id": null,
  1057. "name": "dify",
  1058. "created_from": "",
  1059. "created_by": "",
  1060. "created_at": 1681623639,
  1061. "tokens": 0,
  1062. "indexing_status": "waiting",
  1063. "error": null,
  1064. "enabled": true,
  1065. "disabled_at": null,
  1066. "disabled_by": null,
  1067. "archived": false
  1068. },
  1069. ],
  1070. "has_more": false,
  1071. "limit": 20,
  1072. "total": 9,
  1073. "page": 1
  1074. }
  1075. ```
  1076. </CodeGroup>
  1077. </Col>
  1078. </Row>
  1079. <hr className='ml-0 mr-0' />
  1080. <Heading
  1081. url='/datasets/{dataset_id}/documents/{document_id}/segments'
  1082. method='POST'
  1083. title='Add Chunks to a Document'
  1084. name='#create_new_segment'
  1085. />
  1086. <Row>
  1087. <Col>
  1088. ### Path
  1089. <Properties>
  1090. <Property name='dataset_id' type='string' key='dataset_id'>
  1091. Knowledge ID
  1092. </Property>
  1093. <Property name='document_id' type='string' key='document_id'>
  1094. Document ID
  1095. </Property>
  1096. </Properties>
  1097. ### Request Body
  1098. <Properties>
  1099. <Property name='segments' type='object list' key='segments'>
  1100. - <code>content</code> (text) Text content / question content, required
  1101. - <code>answer</code> (text) Answer content, if the mode of the knowledge is Q&A mode, pass the value (optional)
  1102. - <code>keywords</code> (list) Keywords (optional)
  1103. </Property>
  1104. </Properties>
  1105. </Col>
  1106. <Col sticky>
  1107. <CodeGroup
  1108. title="Request"
  1109. tag="POST"
  1110. label="/datasets/{dataset_id}/documents/{document_id}/segments"
  1111. targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"segments": [{"content": "1","answer": "1","keywords": ["a"]}]}'`}
  1112. >
  1113. ```bash {{ title: 'cURL' }}
  1114. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments' \
  1115. --header 'Authorization: Bearer {api_key}' \
  1116. --header 'Content-Type: application/json' \
  1117. --data-raw '{
  1118. "segments": [
  1119. {
  1120. "content": "1",
  1121. "answer": "1",
  1122. "keywords": ["a"]
  1123. }
  1124. ]
  1125. }'
  1126. ```
  1127. </CodeGroup>
  1128. <CodeGroup title="Response">
  1129. ```json {{ title: 'Response' }}
  1130. {
  1131. "data": [{
  1132. "id": "",
  1133. "position": 1,
  1134. "document_id": "",
  1135. "content": "1",
  1136. "answer": "1",
  1137. "word_count": 25,
  1138. "tokens": 0,
  1139. "keywords": [
  1140. "a"
  1141. ],
  1142. "index_node_id": "",
  1143. "index_node_hash": "",
  1144. "hit_count": 0,
  1145. "enabled": true,
  1146. "disabled_at": null,
  1147. "disabled_by": null,
  1148. "status": "completed",
  1149. "created_by": "",
  1150. "created_at": 1695312007,
  1151. "indexing_at": 1695312007,
  1152. "completed_at": 1695312007,
  1153. "error": null,
  1154. "stopped_at": null
  1155. }],
  1156. "doc_form": "text_model"
  1157. }
  1158. ```
  1159. </CodeGroup>
  1160. </Col>
  1161. </Row>
  1162. <hr className='ml-0 mr-0' />
  1163. <Heading
  1164. url='/datasets/{dataset_id}/documents/{document_id}/segments'
  1165. method='GET'
  1166. title='Get Chunks from a Document'
  1167. name='#get_segment'
  1168. />
  1169. <Row>
  1170. <Col>
  1171. ### Path
  1172. <Properties>
  1173. <Property name='dataset_id' type='string' key='dataset_id'>
  1174. Knowledge ID
  1175. </Property>
  1176. <Property name='document_id' type='string' key='document_id'>
  1177. Document ID
  1178. </Property>
  1179. </Properties>
  1180. ### Query
  1181. <Properties>
  1182. <Property name='keyword' type='string' key='keyword'>
  1183. Keyword (optional)
  1184. </Property>
  1185. <Property name='status' type='string' key='status'>
  1186. Search status, completed
  1187. </Property>
  1188. <Property name='page' type='string' key='page'>
  1189. Page number (optional)
  1190. </Property>
  1191. <Property name='limit' type='string' key='limit'>
  1192. Number of items returned, default 20, range 1-100 (optional)
  1193. </Property>
  1194. </Properties>
  1195. </Col>
  1196. <Col sticky>
  1197. <CodeGroup
  1198. title="Request"
  1199. tag="GET"
  1200. label="/datasets/{dataset_id}/documents/{document_id}/segments"
  1201. targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json'`}
  1202. >
  1203. ```bash {{ title: 'cURL' }}
  1204. curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments' \
  1205. --header 'Authorization: Bearer {api_key}' \
  1206. --header 'Content-Type: application/json'
  1207. ```
  1208. </CodeGroup>
  1209. <CodeGroup title="Response">
  1210. ```json {{ title: 'Response' }}
  1211. {
  1212. "data": [{
  1213. "id": "",
  1214. "position": 1,
  1215. "document_id": "",
  1216. "content": "1",
  1217. "answer": "1",
  1218. "word_count": 25,
  1219. "tokens": 0,
  1220. "keywords": [
  1221. "a"
  1222. ],
  1223. "index_node_id": "",
  1224. "index_node_hash": "",
  1225. "hit_count": 0,
  1226. "enabled": true,
  1227. "disabled_at": null,
  1228. "disabled_by": null,
  1229. "status": "completed",
  1230. "created_by": "",
  1231. "created_at": 1695312007,
  1232. "indexing_at": 1695312007,
  1233. "completed_at": 1695312007,
  1234. "error": null,
  1235. "stopped_at": null
  1236. }],
  1237. "doc_form": "text_model",
  1238. "has_more": false,
  1239. "limit": 20,
  1240. "total": 9,
  1241. "page": 1
  1242. }
  1243. ```
  1244. </CodeGroup>
  1245. </Col>
  1246. </Row>
  1247. <hr className='ml-0 mr-0' />
  1248. <Heading
  1249. url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}'
  1250. method='DELETE'
  1251. title='Delete a Chunk in a Document'
  1252. name='#delete_segment'
  1253. />
  1254. <Row>
  1255. <Col>
  1256. ### Path
  1257. <Properties>
  1258. <Property name='dataset_id' type='string' key='dataset_id'>
  1259. Knowledge ID
  1260. </Property>
  1261. <Property name='document_id' type='string' key='document_id'>
  1262. Document ID
  1263. </Property>
  1264. <Property name='segment_id' type='string' key='segment_id'>
  1265. Document Segment ID
  1266. </Property>
  1267. </Properties>
  1268. </Col>
  1269. <Col sticky>
  1270. <CodeGroup
  1271. title="Request"
  1272. tag="DELETE"
  1273. label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}"
  1274. targetCode={`curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json'`}
  1275. >
  1276. ```bash {{ title: 'cURL' }}
  1277. curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}' \
  1278. --header 'Authorization: Bearer {api_key}' \
  1279. --header 'Content-Type: application/json'
  1280. ```
  1281. </CodeGroup>
  1282. <CodeGroup title="Response">
  1283. ```text {{ title: 'Response' }}
  1284. 204 No Content
  1285. ```
  1286. </CodeGroup>
  1287. </Col>
  1288. </Row>
  1289. <hr className='ml-0 mr-0' />
  1290. <Heading
  1291. url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}'
  1292. method='POST'
  1293. title='Update a Chunk in a Document'
  1294. name='#update_segment'
  1295. />
  1296. <Row>
  1297. <Col>
  1298. ### POST
  1299. <Properties>
  1300. <Property name='dataset_id' type='string' key='dataset_id'>
  1301. Knowledge ID
  1302. </Property>
  1303. <Property name='document_id' type='string' key='document_id'>
  1304. Document ID
  1305. </Property>
  1306. <Property name='segment_id' type='string' key='segment_id'>
  1307. Document Segment ID
  1308. </Property>
  1309. </Properties>
  1310. ### Request Body
  1311. <Properties>
  1312. <Property name='segment' type='object' key='segment'>
  1313. - <code>content</code> (text) Text content / question content, required
  1314. - <code>answer</code> (text) Answer content, passed if the knowledge is in Q&A mode (optional)
  1315. - <code>keywords</code> (list) Keyword (optional)
  1316. - <code>enabled</code> (bool) False / true (optional)
  1317. - <code>regenerate_child_chunks</code> (bool) Whether to regenerate child chunks (optional)
  1318. </Property>
  1319. </Properties>
  1320. </Col>
  1321. <Col sticky>
  1322. <CodeGroup
  1323. title="Request"
  1324. tag="POST"
  1325. label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}"
  1326. targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json'\\\n--data-raw '{\"segment\": {\"content\": \"1\",\"answer\": \"1\", \"keywords\": [\"a\"], \"enabled\": false}}'`}
  1327. >
  1328. ```bash {{ title: 'cURL' }}
  1329. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}' \
  1330. --header 'Content-Type: application/json' \
  1331. --data-raw '{
  1332. "segment": {
  1333. "content": "1",
  1334. "answer": "1",
  1335. "keywords": ["a"],
  1336. "enabled": false
  1337. }
  1338. }'
  1339. ```
  1340. </CodeGroup>
  1341. <CodeGroup title="Response">
  1342. ```json {{ title: 'Response' }}
  1343. {
  1344. "data": {
  1345. "id": "",
  1346. "position": 1,
  1347. "document_id": "",
  1348. "content": "1",
  1349. "answer": "1",
  1350. "word_count": 25,
  1351. "tokens": 0,
  1352. "keywords": [
  1353. "a"
  1354. ],
  1355. "index_node_id": "",
  1356. "index_node_hash": "",
  1357. "hit_count": 0,
  1358. "enabled": true,
  1359. "disabled_at": null,
  1360. "disabled_by": null,
  1361. "status": "completed",
  1362. "created_by": "",
  1363. "created_at": 1695312007,
  1364. "indexing_at": 1695312007,
  1365. "completed_at": 1695312007,
  1366. "error": null,
  1367. "stopped_at": null
  1368. },
  1369. "doc_form": "text_model"
  1370. }
  1371. ```
  1372. </CodeGroup>
  1373. </Col>
  1374. </Row>
  1375. <hr className='ml-0 mr-0' />
  1376. <Heading
  1377. url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks'
  1378. method='POST'
  1379. title='Create Child Chunk'
  1380. name='#create_child_chunk'
  1381. />
  1382. <Row>
  1383. <Col>
  1384. ### Path
  1385. <Properties>
  1386. <Property name='dataset_id' type='string' key='dataset_id'>
  1387. Knowledge ID
  1388. </Property>
  1389. <Property name='document_id' type='string' key='document_id'>
  1390. Document ID
  1391. </Property>
  1392. <Property name='segment_id' type='string' key='segment_id'>
  1393. Segment ID
  1394. </Property>
  1395. </Properties>
  1396. ### Request Body
  1397. <Properties>
  1398. <Property name='content' type='string' key='content'>
  1399. Child chunk content
  1400. </Property>
  1401. </Properties>
  1402. </Col>
  1403. <Col sticky>
  1404. <CodeGroup
  1405. title="Request"
  1406. tag="POST"
  1407. label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks"
  1408. targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"content": "Child chunk content"}'`}
  1409. >
  1410. ```bash {{ title: 'cURL' }}
  1411. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks' \
  1412. --header 'Authorization: Bearer {api_key}' \
  1413. --header 'Content-Type: application/json' \
  1414. --data-raw '{
  1415. "content": "Child chunk content"
  1416. }'
  1417. ```
  1418. </CodeGroup>
  1419. <CodeGroup title="Response">
  1420. ```json {{ title: 'Response' }}
  1421. {
  1422. "data": {
  1423. "id": "",
  1424. "segment_id": "",
  1425. "content": "Child chunk content",
  1426. "word_count": 25,
  1427. "tokens": 0,
  1428. "index_node_id": "",
  1429. "index_node_hash": "",
  1430. "status": "completed",
  1431. "created_by": "",
  1432. "created_at": 1695312007,
  1433. "indexing_at": 1695312007,
  1434. "completed_at": 1695312007,
  1435. "error": null,
  1436. "stopped_at": null
  1437. }
  1438. }
  1439. ```
  1440. </CodeGroup>
  1441. </Col>
  1442. </Row>
  1443. <hr className='ml-0 mr-0' />
  1444. <Heading
  1445. url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks'
  1446. method='GET'
  1447. title='Get Child Chunks'
  1448. name='#get_child_chunks'
  1449. />
  1450. <Row>
  1451. <Col>
  1452. ### Path
  1453. <Properties>
  1454. <Property name='dataset_id' type='string' key='dataset_id'>
  1455. Knowledge ID
  1456. </Property>
  1457. <Property name='document_id' type='string' key='document_id'>
  1458. Document ID
  1459. </Property>
  1460. <Property name='segment_id' type='string' key='segment_id'>
  1461. Segment ID
  1462. </Property>
  1463. </Properties>
  1464. ### Query
  1465. <Properties>
  1466. <Property name='keyword' type='string' key='keyword'>
  1467. Search keyword (optional)
  1468. </Property>
  1469. <Property name='page' type='integer' key='page'>
  1470. Page number (optional, default: 1)
  1471. </Property>
  1472. <Property name='limit' type='integer' key='limit'>
  1473. Items per page (optional, default: 20, max: 100)
  1474. </Property>
  1475. </Properties>
  1476. </Col>
  1477. <Col sticky>
  1478. <CodeGroup
  1479. title="Request"
  1480. tag="GET"
  1481. label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks"
  1482. targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks?page=1&limit=20' \\\n--header 'Authorization: Bearer {api_key}'`}
  1483. >
  1484. ```bash {{ title: 'cURL' }}
  1485. curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks?page=1&limit=20' \
  1486. --header 'Authorization: Bearer {api_key}'
  1487. ```
  1488. </CodeGroup>
  1489. <CodeGroup title="Response">
  1490. ```json {{ title: 'Response' }}
  1491. {
  1492. "data": [{
  1493. "id": "",
  1494. "segment_id": "",
  1495. "content": "Child chunk content",
  1496. "word_count": 25,
  1497. "tokens": 0,
  1498. "index_node_id": "",
  1499. "index_node_hash": "",
  1500. "status": "completed",
  1501. "created_by": "",
  1502. "created_at": 1695312007,
  1503. "indexing_at": 1695312007,
  1504. "completed_at": 1695312007,
  1505. "error": null,
  1506. "stopped_at": null
  1507. }],
  1508. "total": 1,
  1509. "total_pages": 1,
  1510. "page": 1,
  1511. "limit": 20
  1512. }
  1513. ```
  1514. </CodeGroup>
  1515. </Col>
  1516. </Row>
  1517. <hr className='ml-0 mr-0' />
  1518. <Heading
  1519. url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}'
  1520. method='DELETE'
  1521. title='Delete Child Chunk'
  1522. name='#delete_child_chunk'
  1523. />
  1524. <Row>
  1525. <Col>
  1526. ### Path
  1527. <Properties>
  1528. <Property name='dataset_id' type='string' key='dataset_id'>
  1529. Knowledge ID
  1530. </Property>
  1531. <Property name='document_id' type='string' key='document_id'>
  1532. Document ID
  1533. </Property>
  1534. <Property name='segment_id' type='string' key='segment_id'>
  1535. Segment ID
  1536. </Property>
  1537. <Property name='child_chunk_id' type='string' key='child_chunk_id'>
  1538. Child Chunk ID
  1539. </Property>
  1540. </Properties>
  1541. </Col>
  1542. <Col sticky>
  1543. <CodeGroup
  1544. title="Request"
  1545. tag="DELETE"
  1546. label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}"
  1547. targetCode={`curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/segments/{segment_id}/child_chunks/{child_chunk_id}' \\\n--header 'Authorization: Bearer {api_key}'`}
  1548. >
  1549. ```bash {{ title: 'cURL' }}
  1550. curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/segments/{segment_id}/child_chunks/{child_chunk_id}' \
  1551. --header 'Authorization: Bearer {api_key}'
  1552. ```
  1553. </CodeGroup>
  1554. <CodeGroup title="Response">
  1555. ```text {{ title: 'Response' }}
  1556. 204 No Content
  1557. ```
  1558. </CodeGroup>
  1559. </Col>
  1560. </Row>
  1561. <hr className='ml-0 mr-0' />
  1562. <Heading
  1563. url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}'
  1564. method='PATCH'
  1565. title='Update Child Chunk'
  1566. name='#update_child_chunk'
  1567. />
  1568. <Row>
  1569. <Col>
  1570. ### Path
  1571. <Properties>
  1572. <Property name='dataset_id' type='string' key='dataset_id'>
  1573. Knowledge ID
  1574. </Property>
  1575. <Property name='document_id' type='string' key='document_id'>
  1576. Document ID
  1577. </Property>
  1578. <Property name='segment_id' type='string' key='segment_id'>
  1579. Segment ID
  1580. </Property>
  1581. <Property name='child_chunk_id' type='string' key='child_chunk_id'>
  1582. Child Chunk ID
  1583. </Property>
  1584. </Properties>
  1585. ### Request Body
  1586. <Properties>
  1587. <Property name='content' type='string' key='content'>
  1588. Child chunk content
  1589. </Property>
  1590. </Properties>
  1591. </Col>
  1592. <Col sticky>
  1593. <CodeGroup
  1594. title="Request"
  1595. tag="PATCH"
  1596. label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}"
  1597. targetCode={`curl --location --request PATCH '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"content": "Updated child chunk content"}'`}
  1598. >
  1599. ```bash {{ title: 'cURL' }}
  1600. curl --location --request PATCH '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}' \
  1601. --header 'Authorization: Bearer {api_key}' \
  1602. --header 'Content-Type: application/json' \
  1603. --data-raw '{
  1604. "content": "Updated child chunk content"
  1605. }'
  1606. ```
  1607. </CodeGroup>
  1608. <CodeGroup title="Response">
  1609. ```json {{ title: 'Response' }}
  1610. {
  1611. "data": {
  1612. "id": "",
  1613. "segment_id": "",
  1614. "content": "Updated child chunk content",
  1615. "word_count": 25,
  1616. "tokens": 0,
  1617. "index_node_id": "",
  1618. "index_node_hash": "",
  1619. "status": "completed",
  1620. "created_by": "",
  1621. "created_at": 1695312007,
  1622. "indexing_at": 1695312007,
  1623. "completed_at": 1695312007,
  1624. "error": null,
  1625. "stopped_at": null
  1626. }
  1627. }
  1628. ```
  1629. </CodeGroup>
  1630. </Col>
  1631. </Row>
  1632. <hr className='ml-0 mr-0' />
  1633. <Heading
  1634. url='/datasets/{dataset_id}/documents/{document_id}/upload-file'
  1635. method='GET'
  1636. title='Get Upload File'
  1637. name='#get_upload_file'
  1638. />
  1639. <Row>
  1640. <Col>
  1641. ### Path
  1642. <Properties>
  1643. <Property name='dataset_id' type='string' key='dataset_id'>
  1644. Knowledge ID
  1645. </Property>
  1646. <Property name='document_id' type='string' key='document_id'>
  1647. Document ID
  1648. </Property>
  1649. </Properties>
  1650. </Col>
  1651. <Col sticky>
  1652. <CodeGroup
  1653. title="Request"
  1654. tag="GET"
  1655. label="/datasets/{dataset_id}/documents/{document_id}/upload-file"
  1656. targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/upload-file' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json'`}
  1657. >
  1658. ```bash {{ title: 'cURL' }}
  1659. curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/upload-file' \
  1660. --header 'Authorization: Bearer {api_key}' \
  1661. --header 'Content-Type: application/json'
  1662. ```
  1663. </CodeGroup>
  1664. <CodeGroup title="Response">
  1665. ```json {{ title: 'Response' }}
  1666. {
  1667. "id": "file_id",
  1668. "name": "file_name",
  1669. "size": 1024,
  1670. "extension": "txt",
  1671. "url": "preview_url",
  1672. "download_url": "download_url",
  1673. "mime_type": "text/plain",
  1674. "created_by": "user_id",
  1675. "created_at": 1728734540,
  1676. }
  1677. ```
  1678. </CodeGroup>
  1679. </Col>
  1680. </Row>
  1681. <hr className='ml-0 mr-0' />
  1682. <Heading
  1683. url='/datasets/{dataset_id}/retrieve'
  1684. method='POST'
  1685. title='Retrieve Chunks from a Knowledge Base'
  1686. name='#dataset_retrieval'
  1687. />
  1688. <Row>
  1689. <Col>
  1690. ### Path
  1691. <Properties>
  1692. <Property name='dataset_id' type='string' key='dataset_id'>
  1693. Knowledge ID
  1694. </Property>
  1695. </Properties>
  1696. ### Request Body
  1697. <Properties>
  1698. <Property name='query' type='string' key='query'>
  1699. Query keyword
  1700. </Property>
  1701. <Property name='retrieval_model' type='object' key='retrieval_model'>
  1702. Retrieval model (optional, if not filled, it will be recalled according to the default method)
  1703. - <code>search_method</code> (text) Search method: One of the following four keywords is required
  1704. - <code>keyword_search</code> Keyword search
  1705. - <code>semantic_search</code> Semantic search
  1706. - <code>full_text_search</code> Full-text search
  1707. - <code>hybrid_search</code> Hybrid search
  1708. - <code>reranking_enable</code> (bool) Whether to enable reranking, required if the search mode is semantic_search or hybrid_search (optional)
  1709. - <code>reranking_mode</code> (object) Rerank model configuration, required if reranking is enabled
  1710. - <code>reranking_provider_name</code> (string) Rerank model provider
  1711. - <code>reranking_model_name</code> (string) Rerank model name
  1712. - <code>weights</code> (float) Semantic search weight setting in hybrid search mode
  1713. - <code>top_k</code> (integer) Number of results to return (optional)
  1714. - <code>score_threshold_enabled</code> (bool) Whether to enable score threshold
  1715. - <code>score_threshold</code> (float) Score threshold
  1716. </Property>
  1717. <Property name='external_retrieval_model' type='object' key='external_retrieval_model'>
  1718. Unused field
  1719. </Property>
  1720. </Properties>
  1721. </Col>
  1722. <Col sticky>
  1723. <CodeGroup
  1724. title="Request"
  1725. tag="POST"
  1726. label="/datasets/{dataset_id}/retrieve"
  1727. targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/retrieve' \\\n--header 'Authorization: Bearer {api_key}'\\\n--header 'Content-Type: application/json'\\\n--data-raw '{
  1728. "query": "test",
  1729. "retrieval_model": {
  1730. "search_method": "keyword_search",
  1731. "reranking_enable": false,
  1732. "reranking_mode": null,
  1733. "reranking_model": {
  1734. "reranking_provider_name": "",
  1735. "reranking_model_name": ""
  1736. },
  1737. "weights": null,
  1738. "top_k": 1,
  1739. "score_threshold_enabled": false,
  1740. "score_threshold": null
  1741. }
  1742. }'`}
  1743. >
  1744. ```bash {{ title: 'cURL' }}
  1745. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/retrieve' \
  1746. --header 'Authorization: Bearer {api_key}' \
  1747. --header 'Content-Type: application/json' \
  1748. --data-raw '{
  1749. "query": "test",
  1750. "retrieval_model": {
  1751. "search_method": "keyword_search",
  1752. "reranking_enable": false,
  1753. "reranking_mode": null,
  1754. "reranking_model": {
  1755. "reranking_provider_name": "",
  1756. "reranking_model_name": ""
  1757. },
  1758. "weights": null,
  1759. "top_k": 2,
  1760. "score_threshold_enabled": false,
  1761. "score_threshold": null
  1762. }
  1763. }'
  1764. ```
  1765. </CodeGroup>
  1766. <CodeGroup title="Response">
  1767. ```json {{ title: 'Response' }}
  1768. {
  1769. "query": {
  1770. "content": "test"
  1771. },
  1772. "records": [
  1773. {
  1774. "segment": {
  1775. "id": "7fa6f24f-8679-48b3-bc9d-bdf28d73f218",
  1776. "position": 1,
  1777. "document_id": "a8c6c36f-9f5d-4d7a-8472-f5d7b75d71d2",
  1778. "content": "Operation guide",
  1779. "answer": null,
  1780. "word_count": 847,
  1781. "tokens": 280,
  1782. "keywords": [
  1783. "install",
  1784. "java",
  1785. "base",
  1786. "scripts",
  1787. "jdk",
  1788. "manual",
  1789. "internal",
  1790. "opens",
  1791. "add",
  1792. "vmoptions"
  1793. ],
  1794. "index_node_id": "39dd8443-d960-45a8-bb46-7275ad7fbc8e",
  1795. "index_node_hash": "0189157697b3c6a418ccf8264a09699f25858975578f3467c76d6bfc94df1d73",
  1796. "hit_count": 0,
  1797. "enabled": true,
  1798. "disabled_at": null,
  1799. "disabled_by": null,
  1800. "status": "completed",
  1801. "created_by": "dbcb1ab5-90c8-41a7-8b78-73b235eb6f6f",
  1802. "created_at": 1728734540,
  1803. "indexing_at": 1728734552,
  1804. "completed_at": 1728734584,
  1805. "error": null,
  1806. "stopped_at": null,
  1807. "document": {
  1808. "id": "a8c6c36f-9f5d-4d7a-8472-f5d7b75d71d2",
  1809. "data_source_type": "upload_file",
  1810. "name": "readme.txt",
  1811. }
  1812. },
  1813. "score": 3.730463140527718e-05,
  1814. "tsne_position": null
  1815. }
  1816. ]
  1817. }
  1818. ```
  1819. </CodeGroup>
  1820. </Col>
  1821. </Row>
  1822. <hr className='ml-0 mr-0' />
  1823. <Heading
  1824. url='/datasets/{dataset_id}/metadata'
  1825. method='POST'
  1826. title='Create a Knowledge Metadata'
  1827. name='#create_metadata'
  1828. />
  1829. <Row>
  1830. <Col>
  1831. ### Path
  1832. <Properties>
  1833. <Property name='dataset_id' type='string' key='dataset_id'>
  1834. Knowledge ID
  1835. </Property>
  1836. </Properties>
  1837. ### Request Body
  1838. <Properties>
  1839. <Property name='segment' type='object' key='segment'>
  1840. - <code>type</code> (string) Metadata type, required
  1841. - <code>name</code> (string) Metadata name, required
  1842. </Property>
  1843. </Properties>
  1844. </Col>
  1845. <Col sticky>
  1846. <CodeGroup
  1847. title="Request"
  1848. tag="POST"
  1849. label="/datasets/{dataset_id}/metadata"
  1850. targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/metadata' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json'\\\n--data-raw '{"type": "string", "name": "test"}'`}
  1851. >
  1852. ```bash {{ title: 'cURL' }}
  1853. ```
  1854. </CodeGroup>
  1855. <CodeGroup title="Response">
  1856. ```json {{ title: 'Response' }}
  1857. {
  1858. "id": "abc",
  1859. "type": "string",
  1860. "name": "test",
  1861. }
  1862. ```
  1863. </CodeGroup>
  1864. </Col>
  1865. </Row>
  1866. <hr className='ml-0 mr-0' />
  1867. <Heading
  1868. url='/datasets/{dataset_id}/metadata/{metadata_id}'
  1869. method='PATCH'
  1870. title='Update a Knowledge Metadata'
  1871. name='#update_metadata'
  1872. />
  1873. <Row>
  1874. <Col>
  1875. ### Path
  1876. <Properties>
  1877. <Property name='dataset_id' type='string' key='dataset_id'>
  1878. Knowledge ID
  1879. </Property>
  1880. <Property name='metadata_id' type='string' key='metadata_id'>
  1881. Metadata ID
  1882. </Property>
  1883. </Properties>
  1884. ### Request Body
  1885. <Properties>
  1886. <Property name='segment' type='object' key='segment'>
  1887. - <code>name</code> (string) Metadata name, required
  1888. </Property>
  1889. </Properties>
  1890. </Col>
  1891. <Col sticky>
  1892. <CodeGroup
  1893. title="Request"
  1894. tag="PATCH"
  1895. label="/datasets/{dataset_id}/metadata/{metadata_id}"
  1896. targetCode={`curl --location --request PATCH '${props.apiBaseUrl}/datasets/{dataset_id}/metadata/{metadata_id}' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json'\\\n--data-raw '{"name": "test"}'`}
  1897. >
  1898. ```bash {{ title: 'cURL' }}
  1899. ```
  1900. </CodeGroup>
  1901. <CodeGroup title="Response">
  1902. ```json {{ title: 'Response' }}
  1903. {
  1904. "id": "abc",
  1905. "type": "string",
  1906. "name": "test",
  1907. }
  1908. ```
  1909. </CodeGroup>
  1910. </Col>
  1911. </Row>
  1912. <hr className='ml-0 mr-0' />
  1913. <Heading
  1914. url='/datasets/{dataset_id}/metadata/{metadata_id}'
  1915. method='DELETE'
  1916. title='Delete a Knowledge Metadata'
  1917. name='#delete_metadata'
  1918. />
  1919. <Row>
  1920. <Col>
  1921. ### Path
  1922. <Properties>
  1923. <Property name='dataset_id' type='string' key='dataset_id'>
  1924. Knowledge ID
  1925. </Property>
  1926. <Property name='metadata_id' type='string' key='metadata_id'>
  1927. Metadata ID
  1928. </Property>
  1929. </Properties>
  1930. </Col>
  1931. <Col sticky>
  1932. <CodeGroup
  1933. title="Request"
  1934. tag="DELETE"
  1935. label="/datasets/{dataset_id}/metadata/{metadata_id}"
  1936. targetCode={`curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/metadata/{metadata_id}' \\\n--header 'Authorization: Bearer {api_key}'`}
  1937. >
  1938. ```bash {{ title: 'cURL' }}
  1939. ```
  1940. </CodeGroup>
  1941. </Col>
  1942. </Row>
  1943. <hr className='ml-0 mr-0' />
  1944. <Heading
  1945. url='/datasets/{dataset_id}/metadata/built-in/{action}'
  1946. method='POST'
  1947. title='Disable Or Enable Built-in Metadata'
  1948. name='#toggle_metadata'
  1949. />
  1950. <Row>
  1951. <Col>
  1952. ### Path
  1953. <Properties>
  1954. <Property name='dataset_id' type='string' key='dataset_id'>
  1955. Knowledge ID
  1956. </Property>
  1957. <Property name='action' type='string' key='action'>
  1958. disable/enable
  1959. </Property>
  1960. </Properties>
  1961. </Col>
  1962. <Col sticky>
  1963. <CodeGroup
  1964. title="Request"
  1965. tag="POST"
  1966. label="/datasets/{dataset_id}/metadata/built-in/{action}"
  1967. targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/metadata/built-in/{action}' \\\n--header 'Authorization: Bearer {api_key}'`}
  1968. >
  1969. ```bash {{ title: 'cURL' }}
  1970. ```
  1971. </CodeGroup>
  1972. </Col>
  1973. </Row>
  1974. <hr className='ml-0 mr-0' />
  1975. <Heading
  1976. url='/datasets/{dataset_id}/documents/metadata'
  1977. method='POST'
  1978. title='Update Documents Metadata'
  1979. name='#update_documents_metadata'
  1980. />
  1981. <Row>
  1982. <Col>
  1983. ### Path
  1984. <Properties>
  1985. <Property name='dataset_id' type='string' key='dataset_id'>
  1986. Knowledge ID
  1987. </Property>
  1988. </Properties>
  1989. ### Request Body
  1990. <Properties>
  1991. <Property name='operation_data' type='object list' key='segments'>
  1992. - <code>document_id</code> (string) Document ID
  1993. - <code>metadata_list</code> (list) Metadata list
  1994. - <code>id</code> (string) Metadata ID
  1995. - <code>value</code> (string) Metadata value
  1996. - <code>name</code> (string) Metadata name
  1997. </Property>
  1998. </Properties>
  1999. </Col>
  2000. <Col sticky>
  2001. <CodeGroup
  2002. title="Request"
  2003. tag="POST"
  2004. label="/datasets/{dataset_id}/documents/metadata"
  2005. targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/metadata' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json'\\\n--data-raw '{"operation_data": [{"document_id": "document_id", "metadata_list": [{"id": "id", "value": "value", "name": "name"}]}]}'`}
  2006. >
  2007. ```bash {{ title: 'cURL' }}
  2008. ```
  2009. </CodeGroup>
  2010. </Col>
  2011. </Row>
  2012. <hr className='ml-0 mr-0' />
  2013. <Heading
  2014. url='/datasets/{dataset_id}/metadata'
  2015. method='GET'
  2016. title='Get Knowledge Metadata List'
  2017. name='#dataset_metadata_list'
  2018. />
  2019. <Row>
  2020. <Col>
  2021. ### Params
  2022. <Properties>
  2023. <Property name='dataset_id' type='string' key='dataset_id'>
  2024. Knowledge ID
  2025. </Property>
  2026. </Properties>
  2027. </Col>
  2028. <Col sticky>
  2029. <CodeGroup
  2030. title="Request"
  2031. tag="GET"
  2032. label="/datasets/{dataset_id}/metadata"
  2033. targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/metadata' \\\n--header 'Authorization: Bearer {api_key}'`}
  2034. >
  2035. ```bash {{ title: 'cURL' }}
  2036. ```
  2037. </CodeGroup>
  2038. <CodeGroup title="Response">
  2039. ```json {{ title: 'Response' }}
  2040. {
  2041. "doc_metadata": [
  2042. {
  2043. "id": "",
  2044. "name": "name",
  2045. "type": "string",
  2046. "use_count": 0,
  2047. },
  2048. ...
  2049. ],
  2050. "built_in_field_enabled": true
  2051. }
  2052. ```
  2053. </CodeGroup>
  2054. </Col>
  2055. </Row>
  2056. <hr className='ml-0 mr-0' />
  2057. <Heading
  2058. url='/workspaces/current/models/model-types/text-embedding'
  2059. method='GET'
  2060. title='Get available embedding models'
  2061. name='#model_type_list'
  2062. />
  2063. <Row>
  2064. <Col>
  2065. ### Query
  2066. <Properties>
  2067. </Properties>
  2068. </Col>
  2069. <Col sticky>
  2070. <CodeGroup
  2071. title="Request"
  2072. tag="GET"
  2073. label="/datasets/{dataset_id}"
  2074. targetCode={`curl --location --location --request GET '${props.apiBaseUrl}/workspaces/current/models/model-types/text-embedding' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' `}
  2075. >
  2076. ```bash {{ title: 'cURL' }}
  2077. curl --location --request GET '${props.apiBaseUrl}/workspaces/current/models/model-types/text-embedding' \
  2078. --header 'Authorization: Bearer {api_key}' \
  2079. --header 'Content-Type: application/json' \
  2080. ```
  2081. </CodeGroup>
  2082. <CodeGroup title="Response">
  2083. ```json {{ title: 'Response' }}
  2084. {
  2085. "data": [
  2086. {
  2087. "provider": "zhipuai",
  2088. "label": {
  2089. "zh_Hans": "智谱 AI",
  2090. "en_US": "ZHIPU AI"
  2091. },
  2092. "icon_small": {
  2093. "zh_Hans": "http://127.0.0.1:5001/console/api/workspaces/current/model-providers/zhipuai/icon_small/zh_Hans",
  2094. "en_US": "http://127.0.0.1:5001/console/api/workspaces/current/model-providers/zhipuai/icon_small/en_US"
  2095. },
  2096. "icon_large": {
  2097. "zh_Hans": "http://127.0.0.1:5001/console/api/workspaces/current/model-providers/zhipuai/icon_large/zh_Hans",
  2098. "en_US": "http://127.0.0.1:5001/console/api/workspaces/current/model-providers/zhipuai/icon_large/en_US"
  2099. },
  2100. "status": "active",
  2101. "models": [
  2102. {
  2103. "model": "embedding-3",
  2104. "label": {
  2105. "zh_Hans": "embedding-3",
  2106. "en_US": "embedding-3"
  2107. },
  2108. "model_type": "text-embedding",
  2109. "features": null,
  2110. "fetch_from": "predefined-model",
  2111. "model_properties": {
  2112. "context_size": 8192
  2113. },
  2114. "deprecated": false,
  2115. "status": "active",
  2116. "load_balancing_enabled": false
  2117. },
  2118. {
  2119. "model": "embedding-2",
  2120. "label": {
  2121. "zh_Hans": "embedding-2",
  2122. "en_US": "embedding-2"
  2123. },
  2124. "model_type": "text-embedding",
  2125. "features": null,
  2126. "fetch_from": "predefined-model",
  2127. "model_properties": {
  2128. "context_size": 8192
  2129. },
  2130. "deprecated": false,
  2131. "status": "active",
  2132. "load_balancing_enabled": false
  2133. },
  2134. {
  2135. "model": "text_embedding",
  2136. "label": {
  2137. "zh_Hans": "text_embedding",
  2138. "en_US": "text_embedding"
  2139. },
  2140. "model_type": "text-embedding",
  2141. "features": null,
  2142. "fetch_from": "predefined-model",
  2143. "model_properties": {
  2144. "context_size": 512
  2145. },
  2146. "deprecated": false,
  2147. "status": "active",
  2148. "load_balancing_enabled": false
  2149. }
  2150. ]
  2151. }
  2152. ]
  2153. }
  2154. ```
  2155. </CodeGroup>
  2156. </Col>
  2157. </Row>
  2158. <hr className='ml-0 mr-0' />
  2159. <Row>
  2160. <Col>
  2161. ### Error message
  2162. <Properties>
  2163. <Property name='code' type='string' key='code'>
  2164. Error code
  2165. </Property>
  2166. </Properties>
  2167. <Properties>
  2168. <Property name='status' type='number' key='status'>
  2169. Error status
  2170. </Property>
  2171. </Properties>
  2172. <Properties>
  2173. <Property name='message' type='string' key='message'>
  2174. Error message
  2175. </Property>
  2176. </Properties>
  2177. </Col>
  2178. <Col>
  2179. <CodeGroup title="Example">
  2180. ```json {{ title: 'Response' }}
  2181. {
  2182. "code": "no_file_uploaded",
  2183. "message": "Please upload your file.",
  2184. "status": 400
  2185. }
  2186. ```
  2187. </CodeGroup>
  2188. </Col>
  2189. </Row>
  2190. <table className="max-w-auto border-collapse border border-slate-400" style={{ maxWidth: 'none', width: 'auto' }}>
  2191. <thead style={{ background: '#f9fafc' }}>
  2192. <tr>
  2193. <th className="p-2 border border-slate-300">code</th>
  2194. <th className="p-2 border border-slate-300">status</th>
  2195. <th className="p-2 border border-slate-300">message</th>
  2196. </tr>
  2197. </thead>
  2198. <tbody>
  2199. <tr>
  2200. <td className="p-2 border border-slate-300">no_file_uploaded</td>
  2201. <td className="p-2 border border-slate-300">400</td>
  2202. <td className="p-2 border border-slate-300">Please upload your file.</td>
  2203. </tr>
  2204. <tr>
  2205. <td className="p-2 border border-slate-300">too_many_files</td>
  2206. <td className="p-2 border border-slate-300">400</td>
  2207. <td className="p-2 border border-slate-300">Only one file is allowed.</td>
  2208. </tr>
  2209. <tr>
  2210. <td className="p-2 border border-slate-300">file_too_large</td>
  2211. <td className="p-2 border border-slate-300">413</td>
  2212. <td className="p-2 border border-slate-300">File size exceeded.</td>
  2213. </tr>
  2214. <tr>
  2215. <td className="p-2 border border-slate-300">unsupported_file_type</td>
  2216. <td className="p-2 border border-slate-300">415</td>
  2217. <td className="p-2 border border-slate-300">File type not allowed.</td>
  2218. </tr>
  2219. <tr>
  2220. <td className="p-2 border border-slate-300">high_quality_dataset_only</td>
  2221. <td className="p-2 border border-slate-300">400</td>
  2222. <td className="p-2 border border-slate-300">Current operation only supports 'high-quality' datasets.</td>
  2223. </tr>
  2224. <tr>
  2225. <td className="p-2 border border-slate-300">dataset_not_initialized</td>
  2226. <td className="p-2 border border-slate-300">400</td>
  2227. <td className="p-2 border border-slate-300">The dataset is still being initialized or indexing. Please wait a moment.</td>
  2228. </tr>
  2229. <tr>
  2230. <td className="p-2 border border-slate-300">archived_document_immutable</td>
  2231. <td className="p-2 border border-slate-300">403</td>
  2232. <td className="p-2 border border-slate-300">The archived document is not editable.</td>
  2233. </tr>
  2234. <tr>
  2235. <td className="p-2 border border-slate-300">dataset_name_duplicate</td>
  2236. <td className="p-2 border border-slate-300">409</td>
  2237. <td className="p-2 border border-slate-300">The dataset name already exists. Please modify your dataset name.</td>
  2238. </tr>
  2239. <tr>
  2240. <td className="p-2 border border-slate-300">invalid_action</td>
  2241. <td className="p-2 border border-slate-300">400</td>
  2242. <td className="p-2 border border-slate-300">Invalid action.</td>
  2243. </tr>
  2244. <tr>
  2245. <td className="p-2 border border-slate-300">document_already_finished</td>
  2246. <td className="p-2 border border-slate-300">400</td>
  2247. <td className="p-2 border border-slate-300">The document has been processed. Please refresh the page or go to the document details.</td>
  2248. </tr>
  2249. <tr>
  2250. <td className="p-2 border border-slate-300">document_indexing</td>
  2251. <td className="p-2 border border-slate-300">400</td>
  2252. <td className="p-2 border border-slate-300">The document is being processed and cannot be edited.</td>
  2253. </tr>
  2254. <tr>
  2255. <td className="p-2 border border-slate-300">invalid_metadata</td>
  2256. <td className="p-2 border border-slate-300">400</td>
  2257. <td className="p-2 border border-slate-300">The metadata content is incorrect. Please check and verify.</td>
  2258. </tr>
  2259. </tbody>
  2260. </table>
  2261. <div className="pb-4" />