選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

template.en.mdx 98KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945
  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}'
  1082. method='GET'
  1083. title='Get Document Detail'
  1084. name='#get-document-detail'
  1085. />
  1086. <Row>
  1087. <Col>
  1088. Get a document's detail.
  1089. ### Path
  1090. - `dataset_id` (string) Dataset ID
  1091. - `document_id` (string) Document ID
  1092. ### Query
  1093. - `metadata` (string) Metadata filter, can be `all`, `only`, or `without`. Default is `all`.
  1094. ### Response
  1095. Returns the document's detail.
  1096. </Col>
  1097. <Col sticky>
  1098. ### Request Example
  1099. <CodeGroup title="Request" tag="GET" label="/datasets/{dataset_id}/documents/{document_id}" targetCode={`curl -X GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}' \\\n-H 'Authorization: Bearer {api_key}'`}>
  1100. ```bash {{ title: 'cURL' }}
  1101. curl -X GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}' \
  1102. -H 'Authorization: Bearer {api_key}'
  1103. ```
  1104. </CodeGroup>
  1105. ### Response Example
  1106. <CodeGroup title="Response">
  1107. ```json {{ title: 'Response' }}
  1108. {
  1109. "id": "f46ae30c-5c11-471b-96d0-464f5f32a7b2",
  1110. "position": 1,
  1111. "data_source_type": "upload_file",
  1112. "data_source_info": {
  1113. "upload_file": {
  1114. ...
  1115. }
  1116. },
  1117. "dataset_process_rule_id": "24b99906-845e-499f-9e3c-d5565dd6962c",
  1118. "dataset_process_rule": {
  1119. "mode": "hierarchical",
  1120. "rules": {
  1121. "pre_processing_rules": [
  1122. {
  1123. "id": "remove_extra_spaces",
  1124. "enabled": true
  1125. },
  1126. {
  1127. "id": "remove_urls_emails",
  1128. "enabled": false
  1129. }
  1130. ],
  1131. "segmentation": {
  1132. "separator": "**********page_ending**********",
  1133. "max_tokens": 1024,
  1134. "chunk_overlap": 0
  1135. },
  1136. "parent_mode": "paragraph",
  1137. "subchunk_segmentation": {
  1138. "separator": "\n",
  1139. "max_tokens": 512,
  1140. "chunk_overlap": 0
  1141. }
  1142. }
  1143. },
  1144. "document_process_rule": {
  1145. "id": "24b99906-845e-499f-9e3c-d5565dd6962c",
  1146. "dataset_id": "48a0db76-d1a9-46c1-ae35-2baaa919a8a9",
  1147. "mode": "hierarchical",
  1148. "rules": {
  1149. "pre_processing_rules": [
  1150. {
  1151. "id": "remove_extra_spaces",
  1152. "enabled": true
  1153. },
  1154. {
  1155. "id": "remove_urls_emails",
  1156. "enabled": false
  1157. }
  1158. ],
  1159. "segmentation": {
  1160. "separator": "**********page_ending**********",
  1161. "max_tokens": 1024,
  1162. "chunk_overlap": 0
  1163. },
  1164. "parent_mode": "paragraph",
  1165. "subchunk_segmentation": {
  1166. "separator": "\n",
  1167. "max_tokens": 512,
  1168. "chunk_overlap": 0
  1169. }
  1170. }
  1171. },
  1172. "name": "xxxx",
  1173. "created_from": "web",
  1174. "created_by": "17f71940-a7b5-4c77-b60f-2bd645c1ffa0",
  1175. "created_at": 1750464191,
  1176. "tokens": null,
  1177. "indexing_status": "waiting",
  1178. "completed_at": null,
  1179. "updated_at": 1750464191,
  1180. "indexing_latency": null,
  1181. "error": null,
  1182. "enabled": true,
  1183. "disabled_at": null,
  1184. "disabled_by": null,
  1185. "archived": false,
  1186. "segment_count": 0,
  1187. "average_segment_length": 0,
  1188. "hit_count": null,
  1189. "display_status": "queuing",
  1190. "doc_form": "hierarchical_model",
  1191. "doc_language": "Chinese Simplified"
  1192. }
  1193. ```
  1194. </CodeGroup>
  1195. </Col>
  1196. </Row>
  1197. ___
  1198. <hr className='ml-0 mr-0' />
  1199. <Heading
  1200. url='/datasets/{dataset_id}/documents/status/{action}'
  1201. method='PATCH'
  1202. title='Update Document Status'
  1203. name='#batch_document_status'
  1204. />
  1205. <Row>
  1206. <Col>
  1207. ### Path
  1208. <Properties>
  1209. <Property name='dataset_id' type='string' key='dataset_id'>
  1210. Knowledge ID
  1211. </Property>
  1212. <Property name='action' type='string' key='action'>
  1213. - `enable` - Enable document
  1214. - `disable` - Disable document
  1215. - `archive` - Archive document
  1216. - `un_archive` - Unarchive document
  1217. </Property>
  1218. </Properties>
  1219. ### Request Body
  1220. <Properties>
  1221. <Property name='document_ids' type='array[string]' key='document_ids'>
  1222. List of document IDs
  1223. </Property>
  1224. </Properties>
  1225. </Col>
  1226. <Col sticky>
  1227. <CodeGroup
  1228. title="Request"
  1229. tag="PATCH"
  1230. label="/datasets/{dataset_id}/documents/status/{action}"
  1231. targetCode={`curl --location --request PATCH '${props.apiBaseUrl}/datasets/{dataset_id}/documents/status/{action}' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "document_ids": ["doc-id-1", "doc-id-2"]\n}'`}
  1232. >
  1233. ```bash {{ title: 'cURL' }}
  1234. curl --location --request PATCH '${props.apiBaseUrl}/datasets/{dataset_id}/documents/status/{action}' \
  1235. --header 'Authorization: Bearer {api_key}' \
  1236. --header 'Content-Type: application/json' \
  1237. --data-raw '{
  1238. "document_ids": ["doc-id-1", "doc-id-2"]
  1239. }'
  1240. ```
  1241. </CodeGroup>
  1242. <CodeGroup title="Response">
  1243. ```json {{ title: 'Response' }}
  1244. {
  1245. "result": "success"
  1246. }
  1247. ```
  1248. </CodeGroup>
  1249. </Col>
  1250. </Row>
  1251. <hr className='ml-0 mr-0' />
  1252. <Heading
  1253. url='/datasets/{dataset_id}/documents/{document_id}/segments'
  1254. method='POST'
  1255. title='Add Chunks to a Document'
  1256. name='#create_new_segment'
  1257. />
  1258. <Row>
  1259. <Col>
  1260. ### Path
  1261. <Properties>
  1262. <Property name='dataset_id' type='string' key='dataset_id'>
  1263. Knowledge ID
  1264. </Property>
  1265. <Property name='document_id' type='string' key='document_id'>
  1266. Document ID
  1267. </Property>
  1268. </Properties>
  1269. ### Request Body
  1270. <Properties>
  1271. <Property name='segments' type='object list' key='segments'>
  1272. - <code>content</code> (text) Text content / question content, required
  1273. - <code>answer</code> (text) Answer content, if the mode of the knowledge is Q&A mode, pass the value (optional)
  1274. - <code>keywords</code> (list) Keywords (optional)
  1275. </Property>
  1276. </Properties>
  1277. </Col>
  1278. <Col sticky>
  1279. <CodeGroup
  1280. title="Request"
  1281. tag="POST"
  1282. label="/datasets/{dataset_id}/documents/{document_id}/segments"
  1283. 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"]}]}'`}
  1284. >
  1285. ```bash {{ title: 'cURL' }}
  1286. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments' \
  1287. --header 'Authorization: Bearer {api_key}' \
  1288. --header 'Content-Type: application/json' \
  1289. --data-raw '{
  1290. "segments": [
  1291. {
  1292. "content": "1",
  1293. "answer": "1",
  1294. "keywords": ["a"]
  1295. }
  1296. ]
  1297. }'
  1298. ```
  1299. </CodeGroup>
  1300. <CodeGroup title="Response">
  1301. ```json {{ title: 'Response' }}
  1302. {
  1303. "data": [{
  1304. "id": "",
  1305. "position": 1,
  1306. "document_id": "",
  1307. "content": "1",
  1308. "answer": "1",
  1309. "word_count": 25,
  1310. "tokens": 0,
  1311. "keywords": [
  1312. "a"
  1313. ],
  1314. "index_node_id": "",
  1315. "index_node_hash": "",
  1316. "hit_count": 0,
  1317. "enabled": true,
  1318. "disabled_at": null,
  1319. "disabled_by": null,
  1320. "status": "completed",
  1321. "created_by": "",
  1322. "created_at": 1695312007,
  1323. "indexing_at": 1695312007,
  1324. "completed_at": 1695312007,
  1325. "error": null,
  1326. "stopped_at": null
  1327. }],
  1328. "doc_form": "text_model"
  1329. }
  1330. ```
  1331. </CodeGroup>
  1332. </Col>
  1333. </Row>
  1334. <hr className='ml-0 mr-0' />
  1335. <Heading
  1336. url='/datasets/{dataset_id}/documents/{document_id}/segments'
  1337. method='GET'
  1338. title='Get Chunks from a Document'
  1339. name='#get_segment'
  1340. />
  1341. <Row>
  1342. <Col>
  1343. ### Path
  1344. <Properties>
  1345. <Property name='dataset_id' type='string' key='dataset_id'>
  1346. Knowledge ID
  1347. </Property>
  1348. <Property name='document_id' type='string' key='document_id'>
  1349. Document ID
  1350. </Property>
  1351. </Properties>
  1352. ### Query
  1353. <Properties>
  1354. <Property name='keyword' type='string' key='keyword'>
  1355. Keyword (optional)
  1356. </Property>
  1357. <Property name='status' type='string' key='status'>
  1358. Search status, completed
  1359. </Property>
  1360. <Property name='page' type='string' key='page'>
  1361. Page number (optional)
  1362. </Property>
  1363. <Property name='limit' type='string' key='limit'>
  1364. Number of items returned, default 20, range 1-100 (optional)
  1365. </Property>
  1366. </Properties>
  1367. </Col>
  1368. <Col sticky>
  1369. <CodeGroup
  1370. title="Request"
  1371. tag="GET"
  1372. label="/datasets/{dataset_id}/documents/{document_id}/segments"
  1373. 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'`}
  1374. >
  1375. ```bash {{ title: 'cURL' }}
  1376. curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments' \
  1377. --header 'Authorization: Bearer {api_key}' \
  1378. --header 'Content-Type: application/json'
  1379. ```
  1380. </CodeGroup>
  1381. <CodeGroup title="Response">
  1382. ```json {{ title: 'Response' }}
  1383. {
  1384. "data": [{
  1385. "id": "",
  1386. "position": 1,
  1387. "document_id": "",
  1388. "content": "1",
  1389. "answer": "1",
  1390. "word_count": 25,
  1391. "tokens": 0,
  1392. "keywords": [
  1393. "a"
  1394. ],
  1395. "index_node_id": "",
  1396. "index_node_hash": "",
  1397. "hit_count": 0,
  1398. "enabled": true,
  1399. "disabled_at": null,
  1400. "disabled_by": null,
  1401. "status": "completed",
  1402. "created_by": "",
  1403. "created_at": 1695312007,
  1404. "indexing_at": 1695312007,
  1405. "completed_at": 1695312007,
  1406. "error": null,
  1407. "stopped_at": null
  1408. }],
  1409. "doc_form": "text_model",
  1410. "has_more": false,
  1411. "limit": 20,
  1412. "total": 9,
  1413. "page": 1
  1414. }
  1415. ```
  1416. </CodeGroup>
  1417. </Col>
  1418. </Row>
  1419. <hr className='ml-0 mr-0' />
  1420. <Heading
  1421. url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}'
  1422. method='GET'
  1423. title='Get a Chunk Details in a Document'
  1424. name='#view_document_chunk'
  1425. />
  1426. <Row>
  1427. <Col>
  1428. Get details of a specific document segment in the specified knowledge base
  1429. ### Path
  1430. <Properties>
  1431. <Property name='dataset_id' type='string' key='dataset_id'>
  1432. Knowledge Base ID
  1433. </Property>
  1434. <Property name='document_id' type='string' key='document_id'>
  1435. Document ID
  1436. </Property>
  1437. <Property name='segment_id' type='string' key='segment_id'>
  1438. Segment ID
  1439. </Property>
  1440. </Properties>
  1441. </Col>
  1442. <Col sticky>
  1443. <CodeGroup
  1444. title="Request"
  1445. tag="GET"
  1446. label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}"
  1447. targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}' \\\n--header 'Authorization: Bearer {api_key}'`}
  1448. >
  1449. ```bash {{ title: 'cURL' }}
  1450. curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}' \
  1451. --header 'Authorization: Bearer {api_key}'
  1452. ```
  1453. </CodeGroup>
  1454. <CodeGroup title="Response">
  1455. ```json {{ title: 'Response' }}
  1456. {
  1457. "data": {
  1458. "id": "chunk_id",
  1459. "position": 2,
  1460. "document_id": "document_id",
  1461. "content": "Segment content text",
  1462. "sign_content": "Signature content text",
  1463. "answer": "Answer content (if in Q&A mode)",
  1464. "word_count": 470,
  1465. "tokens": 382,
  1466. "keywords": ["keyword1", "keyword2"],
  1467. "index_node_id": "index_node_id",
  1468. "index_node_hash": "index_node_hash",
  1469. "hit_count": 0,
  1470. "enabled": true,
  1471. "status": "completed",
  1472. "created_by": "creator_id",
  1473. "created_at": creation_timestamp,
  1474. "updated_at": update_timestamp,
  1475. "indexing_at": indexing_timestamp,
  1476. "completed_at": completion_timestamp,
  1477. "error": null,
  1478. "child_chunks": []
  1479. },
  1480. "doc_form": "text_model"
  1481. }
  1482. ```
  1483. </CodeGroup>
  1484. </Col>
  1485. </Row>
  1486. <hr className='ml-0 mr-0' />
  1487. <Heading
  1488. url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}'
  1489. method='DELETE'
  1490. title='Delete a Chunk in a Document'
  1491. name='#delete_segment'
  1492. />
  1493. <Row>
  1494. <Col>
  1495. ### Path
  1496. <Properties>
  1497. <Property name='dataset_id' type='string' key='dataset_id'>
  1498. Knowledge ID
  1499. </Property>
  1500. <Property name='document_id' type='string' key='document_id'>
  1501. Document ID
  1502. </Property>
  1503. <Property name='segment_id' type='string' key='segment_id'>
  1504. Document Segment ID
  1505. </Property>
  1506. </Properties>
  1507. </Col>
  1508. <Col sticky>
  1509. <CodeGroup
  1510. title="Request"
  1511. tag="DELETE"
  1512. label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}"
  1513. 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'`}
  1514. >
  1515. ```bash {{ title: 'cURL' }}
  1516. curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}' \
  1517. --header 'Authorization: Bearer {api_key}' \
  1518. --header 'Content-Type: application/json'
  1519. ```
  1520. </CodeGroup>
  1521. <CodeGroup title="Response">
  1522. ```text {{ title: 'Response' }}
  1523. 204 No Content
  1524. ```
  1525. </CodeGroup>
  1526. </Col>
  1527. </Row>
  1528. <hr className='ml-0 mr-0' />
  1529. <Heading
  1530. url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}'
  1531. method='POST'
  1532. title='Update a Chunk in a Document'
  1533. name='#update_segment'
  1534. />
  1535. <Row>
  1536. <Col>
  1537. ### POST
  1538. <Properties>
  1539. <Property name='dataset_id' type='string' key='dataset_id'>
  1540. Knowledge ID
  1541. </Property>
  1542. <Property name='document_id' type='string' key='document_id'>
  1543. Document ID
  1544. </Property>
  1545. <Property name='segment_id' type='string' key='segment_id'>
  1546. Document Segment ID
  1547. </Property>
  1548. </Properties>
  1549. ### Request Body
  1550. <Properties>
  1551. <Property name='segment' type='object' key='segment'>
  1552. - <code>content</code> (text) Text content / question content, required
  1553. - <code>answer</code> (text) Answer content, passed if the knowledge is in Q&A mode (optional)
  1554. - <code>keywords</code> (list) Keyword (optional)
  1555. - <code>enabled</code> (bool) False / true (optional)
  1556. - <code>regenerate_child_chunks</code> (bool) Whether to regenerate child chunks (optional)
  1557. </Property>
  1558. </Properties>
  1559. </Col>
  1560. <Col sticky>
  1561. <CodeGroup
  1562. title="Request"
  1563. tag="POST"
  1564. label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}"
  1565. 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}}'`}
  1566. >
  1567. ```bash {{ title: 'cURL' }}
  1568. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}' \
  1569. --header 'Content-Type: application/json' \
  1570. --data-raw '{
  1571. "segment": {
  1572. "content": "1",
  1573. "answer": "1",
  1574. "keywords": ["a"],
  1575. "enabled": false
  1576. }
  1577. }'
  1578. ```
  1579. </CodeGroup>
  1580. <CodeGroup title="Response">
  1581. ```json {{ title: 'Response' }}
  1582. {
  1583. "data": {
  1584. "id": "",
  1585. "position": 1,
  1586. "document_id": "",
  1587. "content": "1",
  1588. "answer": "1",
  1589. "word_count": 25,
  1590. "tokens": 0,
  1591. "keywords": [
  1592. "a"
  1593. ],
  1594. "index_node_id": "",
  1595. "index_node_hash": "",
  1596. "hit_count": 0,
  1597. "enabled": true,
  1598. "disabled_at": null,
  1599. "disabled_by": null,
  1600. "status": "completed",
  1601. "created_by": "",
  1602. "created_at": 1695312007,
  1603. "indexing_at": 1695312007,
  1604. "completed_at": 1695312007,
  1605. "error": null,
  1606. "stopped_at": null
  1607. },
  1608. "doc_form": "text_model"
  1609. }
  1610. ```
  1611. </CodeGroup>
  1612. </Col>
  1613. </Row>
  1614. <hr className='ml-0 mr-0' />
  1615. <Heading
  1616. url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks'
  1617. method='POST'
  1618. title='Create Child Chunk'
  1619. name='#create_child_chunk'
  1620. />
  1621. <Row>
  1622. <Col>
  1623. ### Path
  1624. <Properties>
  1625. <Property name='dataset_id' type='string' key='dataset_id'>
  1626. Knowledge ID
  1627. </Property>
  1628. <Property name='document_id' type='string' key='document_id'>
  1629. Document ID
  1630. </Property>
  1631. <Property name='segment_id' type='string' key='segment_id'>
  1632. Segment ID
  1633. </Property>
  1634. </Properties>
  1635. ### Request Body
  1636. <Properties>
  1637. <Property name='content' type='string' key='content'>
  1638. Child chunk content
  1639. </Property>
  1640. </Properties>
  1641. </Col>
  1642. <Col sticky>
  1643. <CodeGroup
  1644. title="Request"
  1645. tag="POST"
  1646. label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks"
  1647. 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"}'`}
  1648. >
  1649. ```bash {{ title: 'cURL' }}
  1650. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks' \
  1651. --header 'Authorization: Bearer {api_key}' \
  1652. --header 'Content-Type: application/json' \
  1653. --data-raw '{
  1654. "content": "Child chunk content"
  1655. }'
  1656. ```
  1657. </CodeGroup>
  1658. <CodeGroup title="Response">
  1659. ```json {{ title: 'Response' }}
  1660. {
  1661. "data": {
  1662. "id": "",
  1663. "segment_id": "",
  1664. "content": "Child chunk content",
  1665. "word_count": 25,
  1666. "tokens": 0,
  1667. "index_node_id": "",
  1668. "index_node_hash": "",
  1669. "status": "completed",
  1670. "created_by": "",
  1671. "created_at": 1695312007,
  1672. "indexing_at": 1695312007,
  1673. "completed_at": 1695312007,
  1674. "error": null,
  1675. "stopped_at": null
  1676. }
  1677. }
  1678. ```
  1679. </CodeGroup>
  1680. </Col>
  1681. </Row>
  1682. <hr className='ml-0 mr-0' />
  1683. <Heading
  1684. url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks'
  1685. method='GET'
  1686. title='Get Child Chunks'
  1687. name='#get_child_chunks'
  1688. />
  1689. <Row>
  1690. <Col>
  1691. ### Path
  1692. <Properties>
  1693. <Property name='dataset_id' type='string' key='dataset_id'>
  1694. Knowledge ID
  1695. </Property>
  1696. <Property name='document_id' type='string' key='document_id'>
  1697. Document ID
  1698. </Property>
  1699. <Property name='segment_id' type='string' key='segment_id'>
  1700. Segment ID
  1701. </Property>
  1702. </Properties>
  1703. ### Query
  1704. <Properties>
  1705. <Property name='keyword' type='string' key='keyword'>
  1706. Search keyword (optional)
  1707. </Property>
  1708. <Property name='page' type='integer' key='page'>
  1709. Page number (optional, default: 1)
  1710. </Property>
  1711. <Property name='limit' type='integer' key='limit'>
  1712. Items per page (optional, default: 20, max: 100)
  1713. </Property>
  1714. </Properties>
  1715. </Col>
  1716. <Col sticky>
  1717. <CodeGroup
  1718. title="Request"
  1719. tag="GET"
  1720. label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks"
  1721. 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}'`}
  1722. >
  1723. ```bash {{ title: 'cURL' }}
  1724. curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks?page=1&limit=20' \
  1725. --header 'Authorization: Bearer {api_key}'
  1726. ```
  1727. </CodeGroup>
  1728. <CodeGroup title="Response">
  1729. ```json {{ title: 'Response' }}
  1730. {
  1731. "data": [{
  1732. "id": "",
  1733. "segment_id": "",
  1734. "content": "Child chunk content",
  1735. "word_count": 25,
  1736. "tokens": 0,
  1737. "index_node_id": "",
  1738. "index_node_hash": "",
  1739. "status": "completed",
  1740. "created_by": "",
  1741. "created_at": 1695312007,
  1742. "indexing_at": 1695312007,
  1743. "completed_at": 1695312007,
  1744. "error": null,
  1745. "stopped_at": null
  1746. }],
  1747. "total": 1,
  1748. "total_pages": 1,
  1749. "page": 1,
  1750. "limit": 20
  1751. }
  1752. ```
  1753. </CodeGroup>
  1754. </Col>
  1755. </Row>
  1756. <hr className='ml-0 mr-0' />
  1757. <Heading
  1758. url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}'
  1759. method='DELETE'
  1760. title='Delete Child Chunk'
  1761. name='#delete_child_chunk'
  1762. />
  1763. <Row>
  1764. <Col>
  1765. ### Path
  1766. <Properties>
  1767. <Property name='dataset_id' type='string' key='dataset_id'>
  1768. Knowledge ID
  1769. </Property>
  1770. <Property name='document_id' type='string' key='document_id'>
  1771. Document ID
  1772. </Property>
  1773. <Property name='segment_id' type='string' key='segment_id'>
  1774. Segment ID
  1775. </Property>
  1776. <Property name='child_chunk_id' type='string' key='child_chunk_id'>
  1777. Child Chunk ID
  1778. </Property>
  1779. </Properties>
  1780. </Col>
  1781. <Col sticky>
  1782. <CodeGroup
  1783. title="Request"
  1784. tag="DELETE"
  1785. label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}"
  1786. targetCode={`curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/segments/{segment_id}/child_chunks/{child_chunk_id}' \\\n--header 'Authorization: Bearer {api_key}'`}
  1787. >
  1788. ```bash {{ title: 'cURL' }}
  1789. curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/segments/{segment_id}/child_chunks/{child_chunk_id}' \
  1790. --header 'Authorization: Bearer {api_key}'
  1791. ```
  1792. </CodeGroup>
  1793. <CodeGroup title="Response">
  1794. ```text {{ title: 'Response' }}
  1795. 204 No Content
  1796. ```
  1797. </CodeGroup>
  1798. </Col>
  1799. </Row>
  1800. <hr className='ml-0 mr-0' />
  1801. <Heading
  1802. url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}'
  1803. method='PATCH'
  1804. title='Update Child Chunk'
  1805. name='#update_child_chunk'
  1806. />
  1807. <Row>
  1808. <Col>
  1809. ### Path
  1810. <Properties>
  1811. <Property name='dataset_id' type='string' key='dataset_id'>
  1812. Knowledge ID
  1813. </Property>
  1814. <Property name='document_id' type='string' key='document_id'>
  1815. Document ID
  1816. </Property>
  1817. <Property name='segment_id' type='string' key='segment_id'>
  1818. Segment ID
  1819. </Property>
  1820. <Property name='child_chunk_id' type='string' key='child_chunk_id'>
  1821. Child Chunk ID
  1822. </Property>
  1823. </Properties>
  1824. ### Request Body
  1825. <Properties>
  1826. <Property name='content' type='string' key='content'>
  1827. Child chunk content
  1828. </Property>
  1829. </Properties>
  1830. </Col>
  1831. <Col sticky>
  1832. <CodeGroup
  1833. title="Request"
  1834. tag="PATCH"
  1835. label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}"
  1836. 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"}'`}
  1837. >
  1838. ```bash {{ title: 'cURL' }}
  1839. curl --location --request PATCH '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}' \
  1840. --header 'Authorization: Bearer {api_key}' \
  1841. --header 'Content-Type: application/json' \
  1842. --data-raw '{
  1843. "content": "Updated child chunk content"
  1844. }'
  1845. ```
  1846. </CodeGroup>
  1847. <CodeGroup title="Response">
  1848. ```json {{ title: 'Response' }}
  1849. {
  1850. "data": {
  1851. "id": "",
  1852. "segment_id": "",
  1853. "content": "Updated child chunk content",
  1854. "word_count": 25,
  1855. "tokens": 0,
  1856. "index_node_id": "",
  1857. "index_node_hash": "",
  1858. "status": "completed",
  1859. "created_by": "",
  1860. "created_at": 1695312007,
  1861. "indexing_at": 1695312007,
  1862. "completed_at": 1695312007,
  1863. "error": null,
  1864. "stopped_at": null
  1865. }
  1866. }
  1867. ```
  1868. </CodeGroup>
  1869. </Col>
  1870. </Row>
  1871. <hr className='ml-0 mr-0' />
  1872. <Heading
  1873. url='/datasets/{dataset_id}/documents/{document_id}/upload-file'
  1874. method='GET'
  1875. title='Get Upload File'
  1876. name='#get_upload_file'
  1877. />
  1878. <Row>
  1879. <Col>
  1880. ### Path
  1881. <Properties>
  1882. <Property name='dataset_id' type='string' key='dataset_id'>
  1883. Knowledge ID
  1884. </Property>
  1885. <Property name='document_id' type='string' key='document_id'>
  1886. Document ID
  1887. </Property>
  1888. </Properties>
  1889. </Col>
  1890. <Col sticky>
  1891. <CodeGroup
  1892. title="Request"
  1893. tag="GET"
  1894. label="/datasets/{dataset_id}/documents/{document_id}/upload-file"
  1895. 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'`}
  1896. >
  1897. ```bash {{ title: 'cURL' }}
  1898. curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/upload-file' \
  1899. --header 'Authorization: Bearer {api_key}' \
  1900. --header 'Content-Type: application/json'
  1901. ```
  1902. </CodeGroup>
  1903. <CodeGroup title="Response">
  1904. ```json {{ title: 'Response' }}
  1905. {
  1906. "id": "file_id",
  1907. "name": "file_name",
  1908. "size": 1024,
  1909. "extension": "txt",
  1910. "url": "preview_url",
  1911. "download_url": "download_url",
  1912. "mime_type": "text/plain",
  1913. "created_by": "user_id",
  1914. "created_at": 1728734540,
  1915. }
  1916. ```
  1917. </CodeGroup>
  1918. </Col>
  1919. </Row>
  1920. <hr className='ml-0 mr-0' />
  1921. <Heading
  1922. url='/datasets/{dataset_id}/retrieve'
  1923. method='POST'
  1924. title='Retrieve Chunks from a Knowledge Base'
  1925. name='#dataset_retrieval'
  1926. />
  1927. <Row>
  1928. <Col>
  1929. ### Path
  1930. <Properties>
  1931. <Property name='dataset_id' type='string' key='dataset_id'>
  1932. Knowledge ID
  1933. </Property>
  1934. </Properties>
  1935. ### Request Body
  1936. <Properties>
  1937. <Property name='query' type='string' key='query'>
  1938. Query keyword
  1939. </Property>
  1940. <Property name='retrieval_model' type='object' key='retrieval_model'>
  1941. Retrieval parameters (optional, if not filled, it will be recalled according to the default method)
  1942. - <code>search_method</code> (text) Search method: One of the following four keywords is required
  1943. - <code>keyword_search</code> Keyword search
  1944. - <code>semantic_search</code> Semantic search
  1945. - <code>full_text_search</code> Full-text search
  1946. - <code>hybrid_search</code> Hybrid search
  1947. - <code>reranking_enable</code> (bool) Whether to enable reranking, required if the search mode is semantic_search or hybrid_search (optional)
  1948. - <code>reranking_mode</code> (object) Rerank model configuration, required if reranking is enabled
  1949. - <code>reranking_provider_name</code> (string) Rerank model provider
  1950. - <code>reranking_model_name</code> (string) Rerank model name
  1951. - <code>weights</code> (float) Semantic search weight setting in hybrid search mode
  1952. - <code>top_k</code> (integer) Number of results to return (optional)
  1953. - <code>score_threshold_enabled</code> (bool) Whether to enable score threshold
  1954. - <code>score_threshold</code> (float) Score threshold
  1955. - <code>metadata_filtering_conditions</code> (object) Metadata filtering conditions
  1956. - <code>logical_operator</code> (string) Logical operator: <code>and</code> | <code>or</code>
  1957. - <code>conditions</code> (array[object]) Conditions list
  1958. - <code>name</code> (string) Metadata field name
  1959. - <code>comparison_operator</code> (string) Comparison operator, allowed values:
  1960. - String comparison:
  1961. - <code>contains</code>: Contains
  1962. - <code>not contains</code>: Does not contain
  1963. - <code>start with</code>: Starts with
  1964. - <code>end with</code>: Ends with
  1965. - <code>is</code>: Equals
  1966. - <code>is not</code>: Does not equal
  1967. - <code>empty</code>: Is empty
  1968. - <code>not empty</code>: Is not empty
  1969. - Numeric comparison:
  1970. - <code>=</code>: Equals
  1971. - <code>≠</code>: Does not equal
  1972. - <code>></code>: Greater than
  1973. - <code>< </code>: Less than
  1974. - <code>≥</code>: Greater than or equal
  1975. - <code>≤</code>: Less than or equal
  1976. - Time comparison:
  1977. - <code>before</code>: Before
  1978. - <code>after</code>: After
  1979. - <code>value</code> (string|number|null) Comparison value
  1980. </Property>
  1981. <Property name='external_retrieval_model' type='object' key='external_retrieval_model'>
  1982. Unused field
  1983. </Property>
  1984. </Properties>
  1985. </Col>
  1986. <Col sticky>
  1987. <CodeGroup
  1988. title="Request"
  1989. tag="POST"
  1990. label="/datasets/{dataset_id}/retrieve"
  1991. 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 '{
  1992. "query": "test",
  1993. "retrieval_model": {
  1994. "search_method": "keyword_search",
  1995. "reranking_enable": false,
  1996. "reranking_mode": null,
  1997. "reranking_model": {
  1998. "reranking_provider_name": "",
  1999. "reranking_model_name": ""
  2000. },
  2001. "weights": null,
  2002. "top_k": 1,
  2003. "score_threshold_enabled": false,
  2004. "score_threshold": null,
  2005. "metadata_filtering_conditions": {
  2006. "logical_operator": "and",
  2007. "conditions": [
  2008. {
  2009. "name": "document_name",
  2010. "comparison_operator": "contains",
  2011. "value": "test"
  2012. }
  2013. ]
  2014. }
  2015. }
  2016. }'`}
  2017. >
  2018. ```bash {{ title: 'cURL' }}
  2019. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/retrieve' \
  2020. --header 'Authorization: Bearer {api_key}' \
  2021. --header 'Content-Type: application/json' \
  2022. --data-raw '{
  2023. "query": "test",
  2024. "retrieval_model": {
  2025. "search_method": "keyword_search",
  2026. "reranking_enable": false,
  2027. "reranking_mode": null,
  2028. "reranking_model": {
  2029. "reranking_provider_name": "",
  2030. "reranking_model_name": ""
  2031. },
  2032. "weights": null,
  2033. "top_k": 2,
  2034. "score_threshold_enabled": false,
  2035. "score_threshold": null
  2036. }
  2037. }'
  2038. ```
  2039. </CodeGroup>
  2040. <CodeGroup title="Response">
  2041. ```json {{ title: 'Response' }}
  2042. {
  2043. "query": {
  2044. "content": "test"
  2045. },
  2046. "records": [
  2047. {
  2048. "segment": {
  2049. "id": "7fa6f24f-8679-48b3-bc9d-bdf28d73f218",
  2050. "position": 1,
  2051. "document_id": "a8c6c36f-9f5d-4d7a-8472-f5d7b75d71d2",
  2052. "content": "Operation guide",
  2053. "answer": null,
  2054. "word_count": 847,
  2055. "tokens": 280,
  2056. "keywords": [
  2057. "install",
  2058. "java",
  2059. "base",
  2060. "scripts",
  2061. "jdk",
  2062. "manual",
  2063. "internal",
  2064. "opens",
  2065. "add",
  2066. "vmoptions"
  2067. ],
  2068. "index_node_id": "39dd8443-d960-45a8-bb46-7275ad7fbc8e",
  2069. "index_node_hash": "0189157697b3c6a418ccf8264a09699f25858975578f3467c76d6bfc94df1d73",
  2070. "hit_count": 0,
  2071. "enabled": true,
  2072. "disabled_at": null,
  2073. "disabled_by": null,
  2074. "status": "completed",
  2075. "created_by": "dbcb1ab5-90c8-41a7-8b78-73b235eb6f6f",
  2076. "created_at": 1728734540,
  2077. "indexing_at": 1728734552,
  2078. "completed_at": 1728734584,
  2079. "error": null,
  2080. "stopped_at": null,
  2081. "document": {
  2082. "id": "a8c6c36f-9f5d-4d7a-8472-f5d7b75d71d2",
  2083. "data_source_type": "upload_file",
  2084. "name": "readme.txt",
  2085. }
  2086. },
  2087. "score": 3.730463140527718e-05,
  2088. "tsne_position": null
  2089. }
  2090. ]
  2091. }
  2092. ```
  2093. </CodeGroup>
  2094. </Col>
  2095. </Row>
  2096. <hr className='ml-0 mr-0' />
  2097. <Heading
  2098. url='/datasets/{dataset_id}/metadata'
  2099. method='POST'
  2100. title='Create a Knowledge Metadata'
  2101. name='#create_metadata'
  2102. />
  2103. <Row>
  2104. <Col>
  2105. ### Path
  2106. <Properties>
  2107. <Property name='dataset_id' type='string' key='dataset_id'>
  2108. Knowledge ID
  2109. </Property>
  2110. </Properties>
  2111. ### Request Body
  2112. <Properties>
  2113. <Property name='segment' type='object' key='segment'>
  2114. - <code>type</code> (string) Metadata type, required
  2115. - <code>name</code> (string) Metadata name, required
  2116. </Property>
  2117. </Properties>
  2118. </Col>
  2119. <Col sticky>
  2120. <CodeGroup
  2121. title="Request"
  2122. tag="POST"
  2123. label="/datasets/{dataset_id}/metadata"
  2124. 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"}'`}
  2125. >
  2126. ```bash {{ title: 'cURL' }}
  2127. ```
  2128. </CodeGroup>
  2129. <CodeGroup title="Response">
  2130. ```json {{ title: 'Response' }}
  2131. {
  2132. "id": "abc",
  2133. "type": "string",
  2134. "name": "test",
  2135. }
  2136. ```
  2137. </CodeGroup>
  2138. </Col>
  2139. </Row>
  2140. <hr className='ml-0 mr-0' />
  2141. <Heading
  2142. url='/datasets/{dataset_id}/metadata/{metadata_id}'
  2143. method='PATCH'
  2144. title='Update a Knowledge Metadata'
  2145. name='#update_metadata'
  2146. />
  2147. <Row>
  2148. <Col>
  2149. ### Path
  2150. <Properties>
  2151. <Property name='dataset_id' type='string' key='dataset_id'>
  2152. Knowledge ID
  2153. </Property>
  2154. <Property name='metadata_id' type='string' key='metadata_id'>
  2155. Metadata ID
  2156. </Property>
  2157. </Properties>
  2158. ### Request Body
  2159. <Properties>
  2160. <Property name='segment' type='object' key='segment'>
  2161. - <code>name</code> (string) Metadata name, required
  2162. </Property>
  2163. </Properties>
  2164. </Col>
  2165. <Col sticky>
  2166. <CodeGroup
  2167. title="Request"
  2168. tag="PATCH"
  2169. label="/datasets/{dataset_id}/metadata/{metadata_id}"
  2170. 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"}'`}
  2171. >
  2172. ```bash {{ title: 'cURL' }}
  2173. ```
  2174. </CodeGroup>
  2175. <CodeGroup title="Response">
  2176. ```json {{ title: 'Response' }}
  2177. {
  2178. "id": "abc",
  2179. "type": "string",
  2180. "name": "test",
  2181. }
  2182. ```
  2183. </CodeGroup>
  2184. </Col>
  2185. </Row>
  2186. <hr className='ml-0 mr-0' />
  2187. <Heading
  2188. url='/datasets/{dataset_id}/metadata/{metadata_id}'
  2189. method='DELETE'
  2190. title='Delete a Knowledge Metadata'
  2191. name='#delete_metadata'
  2192. />
  2193. <Row>
  2194. <Col>
  2195. ### Path
  2196. <Properties>
  2197. <Property name='dataset_id' type='string' key='dataset_id'>
  2198. Knowledge ID
  2199. </Property>
  2200. <Property name='metadata_id' type='string' key='metadata_id'>
  2201. Metadata ID
  2202. </Property>
  2203. </Properties>
  2204. </Col>
  2205. <Col sticky>
  2206. <CodeGroup
  2207. title="Request"
  2208. tag="DELETE"
  2209. label="/datasets/{dataset_id}/metadata/{metadata_id}"
  2210. targetCode={`curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/metadata/{metadata_id}' \\\n--header 'Authorization: Bearer {api_key}'`}
  2211. >
  2212. ```bash {{ title: 'cURL' }}
  2213. ```
  2214. </CodeGroup>
  2215. </Col>
  2216. </Row>
  2217. <hr className='ml-0 mr-0' />
  2218. <Heading
  2219. url='/datasets/{dataset_id}/metadata/built-in/{action}'
  2220. method='POST'
  2221. title='Disable Or Enable Built-in Metadata'
  2222. name='#toggle_metadata'
  2223. />
  2224. <Row>
  2225. <Col>
  2226. ### Path
  2227. <Properties>
  2228. <Property name='dataset_id' type='string' key='dataset_id'>
  2229. Knowledge ID
  2230. </Property>
  2231. <Property name='action' type='string' key='action'>
  2232. disable/enable
  2233. </Property>
  2234. </Properties>
  2235. </Col>
  2236. <Col sticky>
  2237. <CodeGroup
  2238. title="Request"
  2239. tag="POST"
  2240. label="/datasets/{dataset_id}/metadata/built-in/{action}"
  2241. targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/metadata/built-in/{action}' \\\n--header 'Authorization: Bearer {api_key}'`}
  2242. >
  2243. ```bash {{ title: 'cURL' }}
  2244. ```
  2245. </CodeGroup>
  2246. </Col>
  2247. </Row>
  2248. <hr className='ml-0 mr-0' />
  2249. <Heading
  2250. url='/datasets/{dataset_id}/documents/metadata'
  2251. method='POST'
  2252. title='Update Documents Metadata'
  2253. name='#update_documents_metadata'
  2254. />
  2255. <Row>
  2256. <Col>
  2257. ### Path
  2258. <Properties>
  2259. <Property name='dataset_id' type='string' key='dataset_id'>
  2260. Knowledge ID
  2261. </Property>
  2262. </Properties>
  2263. ### Request Body
  2264. <Properties>
  2265. <Property name='operation_data' type='object list' key='segments'>
  2266. - <code>document_id</code> (string) Document ID
  2267. - <code>metadata_list</code> (list) Metadata list
  2268. - <code>id</code> (string) Metadata ID
  2269. - <code>value</code> (string) Metadata value
  2270. - <code>name</code> (string) Metadata name
  2271. </Property>
  2272. </Properties>
  2273. </Col>
  2274. <Col sticky>
  2275. <CodeGroup
  2276. title="Request"
  2277. tag="POST"
  2278. label="/datasets/{dataset_id}/documents/metadata"
  2279. 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"}]}]}'`}
  2280. >
  2281. ```bash {{ title: 'cURL' }} </CodeGroup>
  2282. </Col>
  2283. </Row>
  2284. <hr className='ml-0 mr-0' />
  2285. <Heading
  2286. url='/datasets/{dataset_id}/metadata'
  2287. method='GET'
  2288. title='Get Knowledge Metadata List'
  2289. name='#dataset_metadata_list'
  2290. />
  2291. <Row>
  2292. <Col>
  2293. ### Params
  2294. <Properties>
  2295. <Property name='dataset_id' type='string' key='dataset_id'>
  2296. Knowledge ID
  2297. </Property>
  2298. </Properties>
  2299. </Col>
  2300. <Col sticky>
  2301. <CodeGroup
  2302. title="Request"
  2303. tag="GET"
  2304. label="/datasets/{dataset_id}/metadata"
  2305. targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/metadata' \\\n--header 'Authorization: Bearer {api_key}'`}
  2306. >
  2307. ```bash {{ title: 'cURL' }}
  2308. ```
  2309. </CodeGroup>
  2310. <CodeGroup title="Response">
  2311. ```json {{ title: 'Response' }}
  2312. {
  2313. "doc_metadata": [
  2314. {
  2315. "id": "",
  2316. "name": "name",
  2317. "type": "string",
  2318. "use_count": 0,
  2319. },
  2320. ...
  2321. ],
  2322. "built_in_field_enabled": true
  2323. }
  2324. ```
  2325. </CodeGroup>
  2326. </Col>
  2327. </Row>
  2328. <hr className='ml-0 mr-0' />
  2329. <Heading
  2330. url='/workspaces/current/models/model-types/text-embedding'
  2331. method='GET'
  2332. title='Get available embedding models'
  2333. name='#model_type_list'
  2334. />
  2335. <Row>
  2336. <Col>
  2337. ### Query
  2338. <Properties>
  2339. </Properties>
  2340. </Col>
  2341. <Col sticky>
  2342. <CodeGroup
  2343. title="Request"
  2344. tag="GET"
  2345. label="/datasets/{dataset_id}"
  2346. 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' `}
  2347. >
  2348. ```bash {{ title: 'cURL' }}
  2349. curl --location --request GET '${props.apiBaseUrl}/workspaces/current/models/model-types/text-embedding' \
  2350. --header 'Authorization: Bearer {api_key}' \
  2351. --header 'Content-Type: application/json' \
  2352. ```
  2353. </CodeGroup>
  2354. <CodeGroup title="Response">
  2355. ```json {{ title: 'Response' }}
  2356. {
  2357. "data": [
  2358. {
  2359. "provider": "zhipuai",
  2360. "label": {
  2361. "zh_Hans": "智谱 AI",
  2362. "en_US": "ZHIPU AI"
  2363. },
  2364. "icon_small": {
  2365. "zh_Hans": "http://127.0.0.1:5001/console/api/workspaces/current/model-providers/zhipuai/icon_small/zh_Hans",
  2366. "en_US": "http://127.0.0.1:5001/console/api/workspaces/current/model-providers/zhipuai/icon_small/en_US"
  2367. },
  2368. "icon_large": {
  2369. "zh_Hans": "http://127.0.0.1:5001/console/api/workspaces/current/model-providers/zhipuai/icon_large/zh_Hans",
  2370. "en_US": "http://127.0.0.1:5001/console/api/workspaces/current/model-providers/zhipuai/icon_large/en_US"
  2371. },
  2372. "status": "active",
  2373. "models": [
  2374. {
  2375. "model": "embedding-3",
  2376. "label": {
  2377. "zh_Hans": "embedding-3",
  2378. "en_US": "embedding-3"
  2379. },
  2380. "model_type": "text-embedding",
  2381. "features": null,
  2382. "fetch_from": "predefined-model",
  2383. "model_properties": {
  2384. "context_size": 8192
  2385. },
  2386. "deprecated": false,
  2387. "status": "active",
  2388. "load_balancing_enabled": false
  2389. },
  2390. {
  2391. "model": "embedding-2",
  2392. "label": {
  2393. "zh_Hans": "embedding-2",
  2394. "en_US": "embedding-2"
  2395. },
  2396. "model_type": "text-embedding",
  2397. "features": null,
  2398. "fetch_from": "predefined-model",
  2399. "model_properties": {
  2400. "context_size": 8192
  2401. },
  2402. "deprecated": false,
  2403. "status": "active",
  2404. "load_balancing_enabled": false
  2405. },
  2406. {
  2407. "model": "text_embedding",
  2408. "label": {
  2409. "zh_Hans": "text_embedding",
  2410. "en_US": "text_embedding"
  2411. },
  2412. "model_type": "text-embedding",
  2413. "features": null,
  2414. "fetch_from": "predefined-model",
  2415. "model_properties": {
  2416. "context_size": 512
  2417. },
  2418. "deprecated": false,
  2419. "status": "active",
  2420. "load_balancing_enabled": false
  2421. }
  2422. ]
  2423. }
  2424. ]
  2425. }
  2426. ```
  2427. </CodeGroup>
  2428. </Col>
  2429. </Row>
  2430. <hr className='ml-0 mr-0' />
  2431. Okay, I will translate the Chinese text in your document while keeping all formatting and code content unchanged.
  2432. <Heading
  2433. url='/datasets/tags'
  2434. method='POST'
  2435. title='Create New Knowledge Base Type Tag'
  2436. name='#create_new_knowledge_tag'
  2437. />
  2438. <Row>
  2439. <Col>
  2440. ### Request Body
  2441. <Properties>
  2442. <Property name='name' type='string'>
  2443. (text) New tag name, required, maximum length 50
  2444. </Property>
  2445. </Properties>
  2446. </Col>
  2447. <Col sticky>
  2448. <CodeGroup
  2449. title="Request"
  2450. tag="POST"
  2451. label="/datasets/tags"
  2452. targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/tags' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"name": "testtag1"}'`}
  2453. >
  2454. ```bash {{ title: 'cURL' }}
  2455. curl --location --request POST '${props.apiBaseUrl}/datasets/tags' \
  2456. --header 'Authorization: Bearer {api_key}' \
  2457. --header 'Content-Type: application/json' \
  2458. --data-raw '{"name": "testtag1"}'
  2459. ```
  2460. </CodeGroup>
  2461. <CodeGroup title="Response">
  2462. ```json {{ title: 'Response' }}
  2463. {
  2464. "id": "eddb66c2-04a1-4e3a-8cb2-75abd01e12a6",
  2465. "name": "testtag1",
  2466. "type": "knowledge",
  2467. "binding_count": 0
  2468. }
  2469. ```
  2470. </CodeGroup>
  2471. </Col>
  2472. </Row>
  2473. <hr className='ml-0 mr-0' />
  2474. <Heading
  2475. url='/datasets/tags'
  2476. method='GET'
  2477. title='Get Knowledge Base Type Tags'
  2478. name='#get_knowledge_type_tags'
  2479. />
  2480. <Row>
  2481. <Col>
  2482. ### Request Body
  2483. </Col>
  2484. <Col sticky>
  2485. <CodeGroup
  2486. title="Request"
  2487. tag="GET"
  2488. label="/datasets/tags"
  2489. targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets/tags' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json'`}
  2490. >
  2491. ```bash {{ title: 'cURL' }}
  2492. curl --location --request GET '${props.apiBaseUrl}/datasets/tags' \
  2493. --header 'Authorization: Bearer {api_key}' \
  2494. --header 'Content-Type: application/json'
  2495. ```
  2496. </CodeGroup>
  2497. <CodeGroup title="Response">
  2498. ```json {{ title: 'Response' }}
  2499. [
  2500. {
  2501. "id": "39d6934c-ed36-463d-b4a7-377fa1503dc0",
  2502. "name": "testtag1",
  2503. "type": "knowledge",
  2504. "binding_count": "0"
  2505. },
  2506. ...
  2507. ]
  2508. ```
  2509. </CodeGroup>
  2510. </Col>
  2511. </Row>
  2512. <hr className='ml-0 mr-0' />
  2513. <Heading
  2514. url='/datasets/tags'
  2515. method='PATCH'
  2516. title='Modify Knowledge Base Type Tag Name'
  2517. name='#modify_knowledge_tag_name'
  2518. />
  2519. <Row>
  2520. <Col>
  2521. ### Request Body
  2522. <Properties>
  2523. <Property name='name' type='string'>
  2524. (text) Modified tag name, required, maximum length 50
  2525. </Property>
  2526. <Property name='tag_id' type='string'>
  2527. (text) Tag ID, required
  2528. </Property>
  2529. </Properties>
  2530. </Col>
  2531. <Col sticky>
  2532. <CodeGroup
  2533. title="Request"
  2534. tag="PATCH"
  2535. label="/datasets/tags"
  2536. targetCode={`curl --location --request PATCH '${props.apiBaseUrl}/datasets/tags' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"name": "testtag2", "tag_id": "e1a0a3db-ee34-4e04-842a-81555d5316fd"}`}
  2537. >
  2538. ```bash {{ title: 'cURL' }}
  2539. curl --location --request PATCH '${props.apiBaseUrl}/datasets/tags' \
  2540. --header 'Authorization: Bearer {api_key}' \
  2541. --header 'Content-Type: application/json' \
  2542. --data-raw '{"name": "testtag2", "tag_id": "e1a0a3db-ee34-4e04-842a-81555d5316fd"}'
  2543. ```
  2544. </CodeGroup>
  2545. <CodeGroup title="Response">
  2546. ```json {{ title: 'Response' }}
  2547. {
  2548. "id": "eddb66c2-04a1-4e3a-8cb2-75abd01e12a6",
  2549. "name": "tag-renamed",
  2550. "type": "knowledge",
  2551. "binding_count": 0
  2552. }
  2553. ```
  2554. </CodeGroup>
  2555. </Col>
  2556. </Row>
  2557. <hr className='ml-0 mr-0' />
  2558. <Heading
  2559. url='/datasets/tags'
  2560. method='DELETE'
  2561. title='Delete Knowledge Base Type Tag'
  2562. name='#delete_knowledge_tag'
  2563. />
  2564. <Row>
  2565. <Col>
  2566. ### Request Body
  2567. <Properties>
  2568. <Property name='tag_id' type='string'>
  2569. (text) Tag ID, required
  2570. </Property>
  2571. </Properties>
  2572. </Col>
  2573. <Col sticky>
  2574. <CodeGroup
  2575. title="Request"
  2576. tag="DELETE"
  2577. label="/datasets/tags"
  2578. targetCode={`curl --location --request DELETE '${props.apiBaseUrl}/datasets/tags' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{ "tag_id": "e1a0a3db-ee34-4e04-842a-81555d5316fd"}`}
  2579. >
  2580. ```bash {{ title: 'cURL' }}
  2581. curl --location --request DELETE '${props.apiBaseUrl}/datasets/tags' \
  2582. --header 'Authorization: Bearer {api_key}' \
  2583. --header 'Content-Type: application/json' \
  2584. --data-raw '{"tag_id": "e1a0a3db-ee34-4e04-842a-81555d5316fd"}'
  2585. ```
  2586. </CodeGroup>
  2587. <CodeGroup title="Response">
  2588. ```json {{ title: 'Response' }}
  2589. {"result": "success"}
  2590. ```
  2591. </CodeGroup>
  2592. </Col>
  2593. </Row>
  2594. <hr className='ml-0 mr-0' />
  2595. <Heading
  2596. url='/datasets/tags/binding'
  2597. method='POST'
  2598. title='Bind Dataset to Knowledge Base Type Tag'
  2599. name='#bind_dataset_to_knowledge_tag'
  2600. />
  2601. <Row>
  2602. <Col>
  2603. ### Request Body
  2604. <Properties>
  2605. <Property name='tag_ids' type='list'>
  2606. (list) List of Tag IDs, required
  2607. </Property>
  2608. <Property name='target_id' type='string'>
  2609. (text) Dataset ID, required
  2610. </Property>
  2611. </Properties>
  2612. </Col>
  2613. <Col sticky>
  2614. <CodeGroup
  2615. title="Request"
  2616. tag="POST"
  2617. label="/datasets/tags/binding"
  2618. targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/tags/binding' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"tag_ids": ["65cc29be-d072-4e26-adf4-2f727644da29","1e5348f3-d3ff-42b8-a1b7-0a86d518001a"], "target_id": "a932ea9f-fae1-4b2c-9b65-71c56e2cacd6"}'`}
  2619. >
  2620. ```bash {{ title: 'cURL' }}
  2621. curl --location --request POST '${props.apiBaseUrl}/datasets/tags/binding' \
  2622. --header 'Authorization: Bearer {api_key}' \
  2623. --header 'Content-Type: application/json' \
  2624. --data-raw '{"tag_ids": ["65cc29be-d072-4e26-adf4-2f727644da29","1e5348f3-d3ff-42b8-a1b7-0a86d518001a"], "target_id": "a932ea9f-fae1-4b2c-9b65-71c56e2cacd6"}'
  2625. ```
  2626. </CodeGroup>
  2627. <CodeGroup title="Response">
  2628. ```json {{ title: 'Response' }}
  2629. {"result": "success"}
  2630. ```
  2631. </CodeGroup>
  2632. </Col>
  2633. </Row>
  2634. <hr className='ml-0 mr-0' />
  2635. <Heading
  2636. url='/datasets/tags/unbinding'
  2637. method='POST'
  2638. title='Unbind Dataset and Knowledge Base Type Tag'
  2639. name='#unbind_dataset_and_knowledge_tag'
  2640. />
  2641. <Row>
  2642. <Col>
  2643. ### Request Body
  2644. <Properties>
  2645. <Property name='tag_id' type='string'>
  2646. (text) Tag ID, required
  2647. </Property>
  2648. <Property name='target_id' type='string'>
  2649. (text) Dataset ID, required
  2650. </Property>
  2651. </Properties>
  2652. </Col>
  2653. <Col sticky>
  2654. <CodeGroup
  2655. title="Request"
  2656. tag="POST"
  2657. label="/datasets/tags/unbinding"
  2658. targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/tags/unbinding' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"tag_id": "1e5348f3-d3ff-42b8-a1b7-0a86d518001a", "target_id": "a932ea9f-fae1-4b2c-9b65-71c56e2cacd6"}'`}
  2659. >
  2660. ```bash {{ title: 'cURL' }}
  2661. curl --location --request POST '${props.apiBaseUrl}/datasets/tags/unbinding' \
  2662. --header 'Authorization: Bearer {api_key}' \
  2663. --header 'Content-Type: application/json' \
  2664. --data-raw '{"tag_id": "1e5348f3-d3ff-42b8-a1b7-0a86d518001a", "target_id": "a932ea9f-fae1-4b2c-9b65-71c56e2cacd6"}'
  2665. ```
  2666. </CodeGroup>
  2667. <CodeGroup title="Response">
  2668. ```json {{ title: 'Response' }}
  2669. {"result": "success"}
  2670. ```
  2671. </CodeGroup>
  2672. </Col>
  2673. </Row>
  2674. <hr className='ml-0 mr-0' />
  2675. <Heading
  2676. url='/datasets/<uuid:dataset_id>/tags'
  2677. method='POST'
  2678. title='Query Tags Bound to a Dataset'
  2679. name='#query_dataset_tags'
  2680. />
  2681. <Row>
  2682. <Col>
  2683. ### Path
  2684. <Properties>
  2685. <Property name='dataset_id' type='string'>
  2686. (text) Dataset ID
  2687. </Property>
  2688. </Properties>
  2689. </Col>
  2690. <Col sticky>
  2691. <CodeGroup
  2692. title="Request"
  2693. tag="POST"
  2694. label="/datasets/<uuid:dataset_id>/tags"
  2695. targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/<uuid:dataset_id>/tags' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n`}
  2696. >
  2697. ```bash {{ title: 'cURL' }}
  2698. curl --location --request POST '${props.apiBaseUrl}/datasets/<uuid:dataset_id>/tags' \
  2699. --header 'Authorization: Bearer {api_key}' \
  2700. --header 'Content-Type: application/json' \
  2701. ```
  2702. </CodeGroup>
  2703. <CodeGroup title="Response">
  2704. ```json {{ title: 'Response' }}
  2705. {
  2706. "data":
  2707. [
  2708. {"id": "4a601f4f-f8a2-4166-ae7c-58c3b252a524",
  2709. "name": "123"
  2710. },
  2711. ...
  2712. ],
  2713. "total": 3
  2714. }
  2715. ```
  2716. </CodeGroup>
  2717. </Col>
  2718. </Row>
  2719. <hr className='ml-0 mr-0' />
  2720. <Row>
  2721. <Col>
  2722. ### Error message
  2723. <Properties>
  2724. <Property name='code' type='string' key='code'>
  2725. Error code
  2726. </Property>
  2727. </Properties>
  2728. <Properties>
  2729. <Property name='status' type='number' key='status'>
  2730. Error status
  2731. </Property>
  2732. </Properties>
  2733. <Properties>
  2734. <Property name='message' type='string' key='message'>
  2735. Error message
  2736. </Property>
  2737. </Properties>
  2738. </Col>
  2739. <Col>
  2740. <CodeGroup title="Example">
  2741. ```json {{ title: 'Response' }}
  2742. {
  2743. "code": "no_file_uploaded",
  2744. "message": "Please upload your file.",
  2745. "status": 400
  2746. }
  2747. ```
  2748. </CodeGroup>
  2749. </Col>
  2750. </Row>
  2751. <table className="max-w-auto border-collapse border border-slate-400" style={{ maxWidth: 'none', width: 'auto' }}>
  2752. <thead style={{ background: '#f9fafc' }}>
  2753. <tr>
  2754. <th className="p-2 border border-slate-300">code</th>
  2755. <th className="p-2 border border-slate-300">status</th>
  2756. <th className="p-2 border border-slate-300">message</th>
  2757. </tr>
  2758. </thead>
  2759. <tbody>
  2760. <tr>
  2761. <td className="p-2 border border-slate-300">no_file_uploaded</td>
  2762. <td className="p-2 border border-slate-300">400</td>
  2763. <td className="p-2 border border-slate-300">Please upload your file.</td>
  2764. </tr>
  2765. <tr>
  2766. <td className="p-2 border border-slate-300">too_many_files</td>
  2767. <td className="p-2 border border-slate-300">400</td>
  2768. <td className="p-2 border border-slate-300">Only one file is allowed.</td>
  2769. </tr>
  2770. <tr>
  2771. <td className="p-2 border border-slate-300">file_too_large</td>
  2772. <td className="p-2 border border-slate-300">413</td>
  2773. <td className="p-2 border border-slate-300">File size exceeded.</td>
  2774. </tr>
  2775. <tr>
  2776. <td className="p-2 border border-slate-300">unsupported_file_type</td>
  2777. <td className="p-2 border border-slate-300">415</td>
  2778. <td className="p-2 border border-slate-300">File type not allowed.</td>
  2779. </tr>
  2780. <tr>
  2781. <td className="p-2 border border-slate-300">high_quality_dataset_only</td>
  2782. <td className="p-2 border border-slate-300">400</td>
  2783. <td className="p-2 border border-slate-300">Current operation only supports 'high-quality' datasets.</td>
  2784. </tr>
  2785. <tr>
  2786. <td className="p-2 border border-slate-300">dataset_not_initialized</td>
  2787. <td className="p-2 border border-slate-300">400</td>
  2788. <td className="p-2 border border-slate-300">The dataset is still being initialized or indexing. Please wait a moment.</td>
  2789. </tr>
  2790. <tr>
  2791. <td className="p-2 border border-slate-300">archived_document_immutable</td>
  2792. <td className="p-2 border border-slate-300">403</td>
  2793. <td className="p-2 border border-slate-300">The archived document is not editable.</td>
  2794. </tr>
  2795. <tr>
  2796. <td className="p-2 border border-slate-300">dataset_name_duplicate</td>
  2797. <td className="p-2 border border-slate-300">409</td>
  2798. <td className="p-2 border border-slate-300">The dataset name already exists. Please modify your dataset name.</td>
  2799. </tr>
  2800. <tr>
  2801. <td className="p-2 border border-slate-300">invalid_action</td>
  2802. <td className="p-2 border border-slate-300">400</td>
  2803. <td className="p-2 border border-slate-300">Invalid action.</td>
  2804. </tr>
  2805. <tr>
  2806. <td className="p-2 border border-slate-300">document_already_finished</td>
  2807. <td className="p-2 border border-slate-300">400</td>
  2808. <td className="p-2 border border-slate-300">The document has been processed. Please refresh the page or go to the document details.</td>
  2809. </tr>
  2810. <tr>
  2811. <td className="p-2 border border-slate-300">document_indexing</td>
  2812. <td className="p-2 border border-slate-300">400</td>
  2813. <td className="p-2 border border-slate-300">The document is being processed and cannot be edited.</td>
  2814. </tr>
  2815. <tr>
  2816. <td className="p-2 border border-slate-300">invalid_metadata</td>
  2817. <td className="p-2 border border-slate-300">400</td>
  2818. <td className="p-2 border border-slate-300">The metadata content is incorrect. Please check and verify.</td>
  2819. </tr>
  2820. </tbody>
  2821. </table>
  2822. <div className="pb-4" />