You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

template.ja.mdx 92KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597
  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. # ナレッジ API
  8. <div>
  9. ### 認証
  10. Dify のサービス API は `API-Key` を使用して認証します。
  11. 開発者は、`API-Key` をクライアント側で共有または保存するのではなく、バックエンドに保存することを推奨します。これにより、`API-Key` の漏洩による財産損失を防ぐことができます。
  12. すべての API リクエストには、以下のように **`Authorization`** HTTP ヘッダーに `API-Key` を含める必要があります:
  13. <CodeGroup title="コード">
  14. ```javascript
  15. Authorization: Bearer {API_KEY}
  16. ```
  17. </CodeGroup>
  18. </div>
  19. <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
  20. <Heading
  21. url='/datasets/{dataset_id}/document/create-by-text'
  22. method='POST'
  23. title='テキストからドキュメントを作成'
  24. name='#create-by-text'
  25. />
  26. <Row>
  27. <Col>
  28. この API は既存のナレッジに基づいており、このナレッジを基にテキストを使用して新しいドキュメントを作成します。
  29. ### パス
  30. <Properties>
  31. <Property name='dataset_id' type='string' key='dataset_id'>
  32. ナレッジ ID
  33. </Property>
  34. </Properties>
  35. ### リクエストボディ
  36. <Properties>
  37. <Property name='name' type='string' key='name'>
  38. ドキュメント名
  39. </Property>
  40. <Property name='text' type='string' key='text'>
  41. ドキュメント内容
  42. </Property>
  43. <Property name='indexing_technique' type='string' key='indexing_technique'>
  44. インデックスモード
  45. - <code>high_quality</code> 高品質: 埋め込みモデルを使用してベクトルデータベースインデックスを構築
  46. - <code>economy</code> 経済: キーワードテーブルインデックスの反転インデックスを構築
  47. </Property>
  48. <Property name='doc_form' type='string' key='doc_form'>
  49. インデックス化された内容の形式
  50. - <code>text_model</code> テキストドキュメントは直接埋め込まれます; `economy` モードではこの形式がデフォルト
  51. - <code>hierarchical_model</code> 親子モード
  52. - <code>qa_model</code> Q&A モード: 分割されたドキュメントの質問と回答ペアを生成し、質問を埋め込みます
  53. </Property>
  54. <Property name='doc_language' type='string' key='doc_language'>
  55. Q&A モードでは、ドキュメントの言語を指定します。例: <code>English</code>, <code>Chinese</code>
  56. </Property>
  57. <Property name='process_rule' type='object' key='process_rule'>
  58. 処理ルール
  59. - <code>mode</code> (string) クリーニング、セグメンテーションモード、自動 / カスタム
  60. - <code>rules</code> (object) カスタムルール (自動モードでは、このフィールドは空)
  61. - <code>pre_processing_rules</code> (array[object]) 前処理ルール
  62. - <code>id</code> (string) 前処理ルールの一意識別子
  63. - 列挙
  64. - <code>remove_extra_spaces</code> 連続するスペース、改行、タブを置換
  65. - <code>remove_urls_emails</code> URL、メールアドレスを削除
  66. - <code>enabled</code> (bool) このルールを選択するかどうか。ドキュメント ID が渡されない場合、デフォルト値を表します。
  67. - <code>segmentation</code> (object) セグメンテーションルール
  68. - <code>separator</code> カスタムセグメント識別子。現在は 1 つの区切り文字のみ設定可能。デフォルトは \n
  69. - <code>max_tokens</code> 最大長 (トークン) デフォルトは 1000
  70. - <code>parent_mode</code> 親チャンクの検索モード: <code>full-doc</code> 全文検索 / <code>paragraph</code> 段落検索
  71. - <code>subchunk_segmentation</code> (object) 子チャンクルール
  72. - <code>separator</code> セグメンテーション識別子。現在は 1 つの区切り文字のみ許可。デフォルトは <code>***</code>
  73. - <code>max_tokens</code> 最大長 (トークン) は親チャンクの長さより短いことを検証する必要があります
  74. - <code>chunk_overlap</code> 隣接するチャンク間の重なりを定義 (オプション)
  75. </Property>
  76. <PropertyInstruction>ナレッジベースにパラメータが設定されていない場合、最初のアップロードには以下のパラメータを提供する必要があります。提供されない場合、デフォルトパラメータが使用されます。</PropertyInstruction>
  77. <Property name='retrieval_model' type='object' key='retrieval_model'>
  78. 検索モデル
  79. - <code>search_method</code> (string) 検索方法
  80. - <code>hybrid_search</code> ハイブリッド検索
  81. - <code>semantic_search</code> セマンティック検索
  82. - <code>full_text_search</code> 全文検索
  83. - <code>reranking_enable</code> (bool) 再ランキングを有効にするかどうか
  84. - <code>reranking_mode</code> (object) 再ランキングモデル構成
  85. - <code>reranking_provider_name</code> (string) 再ランキングモデルプロバイダー
  86. - <code>reranking_model_name</code> (string) 再ランキングモデル名
  87. - <code>top_k</code> (int) 返される結果の数
  88. - <code>score_threshold_enabled</code> (bool) スコア閾値を有効にするかどうか
  89. - <code>score_threshold</code> (float) スコア閾値
  90. </Property>
  91. <Property name='embedding_model' type='string' key='embedding_model'>
  92. 埋め込みモデル名
  93. </Property>
  94. <Property name='embedding_model_provider' type='string' key='embedding_model_provider'>
  95. 埋め込みモデルプロバイダー
  96. </Property>
  97. </Properties>
  98. </Col>
  99. <Col sticky>
  100. <CodeGroup
  101. title="リクエスト"
  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="レスポンス">
  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 style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
  154. <Heading
  155. url='/datasets/{dataset_id}/document/create-by-file'
  156. method='POST'
  157. title='ファイルからドキュメントを作成'
  158. name='#create-by-file'
  159. />
  160. <Row>
  161. <Col>
  162. この API は既存のナレッジに基づいており、このナレッジを基にファイルを使用して新しいドキュメントを作成します。
  163. ### パス
  164. <Properties>
  165. <Property name='dataset_id' type='string' key='dataset_id'>
  166. ナレッジ ID
  167. </Property>
  168. </Properties>
  169. ### リクエストボディ
  170. <Properties>
  171. <Property name='data' type='multipart/form-data json string' key='data'>
  172. - <code>original_document_id</code> 元のドキュメント ID (オプション)
  173. - ドキュメントを再アップロードまたはクリーニングとセグメンテーション構成を変更するために使用されます。欠落している情報は元のドキュメントからコピーされます。
  174. - 元のドキュメントはアーカイブされたドキュメントであってはなりません。
  175. - original_document_id が渡された場合、更新操作が実行されます。process_rule は入力可能な項目です。入力されない場合、元のドキュメントのセグメンテーション方法がデフォルトで使用されます。
  176. - original_document_id が渡されない場合、新しい操作が実行され、process_rule が必要です。
  177. - <code>indexing_technique</code> インデックスモード
  178. - <code>high_quality</code> 高品質:埋め込みモデルを使用してベクトルデータベースインデックスを構築
  179. - <code>economy</code> 経済:キーワードテーブルインデックスの反転インデックスを構築
  180. - <code>doc_form</code> インデックス化された内容の形式
  181. - <code>text_model</code> テキストドキュメントは直接埋め込まれます; `economy` モードではこの形式がデフォルト
  182. - <code>hierarchical_model</code> 親子モード
  183. - <code>qa_model</code> Q&A モード:分割されたドキュメントの質問と回答ペアを生成し、質問を埋め込みます
  184. - <code>doc_language</code> Q&A モードでは、ドキュメントの言語を指定します。例:<code>English</code>, <code>Chinese</code>
  185. - <code>process_rule</code> 処理ルール
  186. - <code>mode</code> (string) クリーニング、セグメンテーションモード、自動 / カスタム
  187. - <code>rules</code> (object) カスタムルール (自動モードでは、このフィールドは空)
  188. - <code>pre_processing_rules</code> (array[object]) 前処理ルール
  189. - <code>id</code> (string) 前処理ルールの一意識別子
  190. - 列挙
  191. - <code>remove_extra_spaces</code> 連続するスペース、改行、タブを置換
  192. - <code>remove_urls_emails</code> URL、メールアドレスを削除
  193. - <code>enabled</code> (bool) このルールを選択するかどうか。ドキュメント ID が渡されない場合、デフォルト値を表します。
  194. - <code>segmentation</code> (object) セグメンテーションルール
  195. - <code>separator</code> カスタムセグメント識別子。現在は 1 つの区切り文字のみ設定可能。デフォルトは \n
  196. - <code>max_tokens</code> 最大長 (トークン) デフォルトは 1000
  197. - <code>parent_mode</code> 親チャンクの検索モード:<code>full-doc</code> 全文検索 / <code>paragraph</code> 段落検索
  198. - <code>subchunk_segmentation</code> (object) 子チャンクルール
  199. - <code>separator</code> セグメンテーション識別子。現在は 1 つの区切り文字のみ許可。デフォルトは <code>***</code>
  200. - <code>max_tokens</code> 最大長 (トークン) は親チャンクの長さより短いことを検証する必要があります
  201. - <code>chunk_overlap</code> 隣接するチャンク間の重なりを定義 (オプション)
  202. </Property>
  203. <Property name='file' type='multipart/form-data' key='file'>
  204. アップロードする必要があるファイル。
  205. </Property>
  206. <PropertyInstruction>ナレッジベースにパラメータが設定されていない場合、最初のアップロードには以下のパラメータを提供する必要があります。提供されない場合、デフォルトパラメータが使用されます。</PropertyInstruction>
  207. <Property name='retrieval_model' type='object' key='retrieval_model'>
  208. 検索モデル
  209. - <code>search_method</code> (string) 検索方法
  210. - <code>hybrid_search</code> ハイブリッド検索
  211. - <code>semantic_search</code> セマンティック検索
  212. - <code>full_text_search</code> 全文検索
  213. - <code>reranking_enable</code> (bool) 再ランキングを有効にするかどうか
  214. - <code>reranking_mode</code> (object) 再ランキングモデル構成
  215. - <code>reranking_provider_name</code> (string) 再ランキングモデルプロバイダー
  216. - <code>reranking_model_name</code> (string) 再ランキングモデル名
  217. - <code>top_k</code> (int) 返される結果の数
  218. - <code>score_threshold_enabled</code> (bool) スコア閾値を有効にするかどうか
  219. - <code>score_threshold</code> (float) スコア閾値
  220. </Property>
  221. <Property name='embedding_model' type='string' key='embedding_model'>
  222. 埋め込みモデル名
  223. </Property>
  224. <Property name='embedding_model_provider' type='string' key='embedding_model_provider'>
  225. 埋め込みモデルプロバイダー
  226. </Property>
  227. </Properties>
  228. </Col>
  229. <Col sticky>
  230. <CodeGroup
  231. title="リクエスト"
  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="レスポンス">
  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 style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
  277. <Heading
  278. url='/datasets'
  279. method='POST'
  280. title='空のナレッジベースを作成'
  281. name='#create_empty_dataset'
  282. />
  283. <Row>
  284. <Col>
  285. ### リクエストボディ
  286. <Properties>
  287. <Property name='name' type='string' key='name'>
  288. ナレッジ名
  289. </Property>
  290. <Property name='description' type='string' key='description'>
  291. ナレッジの説明 (オプション)
  292. </Property>
  293. <Property name='indexing_technique' type='string' key='indexing_technique'>
  294. インデックス技術 (オプション)
  295. - <code>high_quality</code> 高品質
  296. - <code>economy</code> 経済
  297. </Property>
  298. <Property name='permission' type='string' key='permission'>
  299. 権限
  300. - <code>only_me</code> 自分のみ
  301. - <code>all_team_members</code> すべてのチームメンバー
  302. - <code>partial_members</code> 一部のメンバー
  303. </Property>
  304. <Property name='provider' type='string' key='provider'>
  305. プロバイダー (オプション、デフォルト:vendor)
  306. - <code>vendor</code> ベンダー
  307. - <code>external</code> 外部ナレッジ
  308. </Property>
  309. <Property name='external_knowledge_api_id' type='str' key='external_knowledge_api_id'>
  310. 外部ナレッジ API ID (オプション)
  311. </Property>
  312. <Property name='external_knowledge_id' type='str' key='external_knowledge_id'>
  313. 外部ナレッジ ID (オプション)
  314. </Property>
  315. <Property name='embedding_model' type='str' key='embedding_model'>
  316. 埋め込みモデル名(任意)
  317. </Property>
  318. <Property name='embedding_model_provider' type='str' key='embedding_model_provider'>
  319. 埋め込みモデルのプロバイダ名(任意)
  320. </Property>
  321. <Property name='retrieval_model' type='object' key='retrieval_model'>
  322. 検索モデル(任意)
  323. - <code>search_method</code> (文字列) 検索方法
  324. - <code>hybrid_search</code> ハイブリッド検索
  325. - <code>semantic_search</code> セマンティック検索
  326. - <code>full_text_search</code> 全文検索
  327. - <code>reranking_enable</code> (ブール値) リランキングを有効にするかどうか
  328. - <code>reranking_model</code> (オブジェクト) リランクモデルの設定
  329. - <code>reranking_provider_name</code> (文字列) リランクモデルのプロバイダ
  330. - <code>reranking_model_name</code> (文字列) リランクモデル名
  331. - <code>top_k</code> (整数) 返される結果の数
  332. - <code>score_threshold_enabled</code> (ブール値) スコア閾値を有効にするかどうか
  333. - <code>score_threshold</code> (浮動小数点数) スコア閾値
  334. </Property>
  335. </Properties>
  336. </Col>
  337. <Col sticky>
  338. <CodeGroup
  339. title="リクエスト"
  340. tag="POST"
  341. label="/datasets"
  342. 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"}'`}
  343. >
  344. ```bash {{ title: 'cURL' }}
  345. curl --location --request POST '${apiBaseUrl}/v1/datasets' \
  346. --header 'Authorization: Bearer {api_key}' \
  347. --header 'Content-Type: application/json' \
  348. --data-raw '{
  349. "name": "name",
  350. "permission": "only_me"
  351. }'
  352. ```
  353. </CodeGroup>
  354. <CodeGroup title="レスポンス">
  355. ```json {{ title: 'Response' }}
  356. {
  357. "id": "",
  358. "name": "name",
  359. "description": null,
  360. "provider": "vendor",
  361. "permission": "only_me",
  362. "data_source_type": null,
  363. "indexing_technique": null,
  364. "app_count": 0,
  365. "document_count": 0,
  366. "word_count": 0,
  367. "created_by": "",
  368. "created_at": 1695636173,
  369. "updated_by": "",
  370. "updated_at": 1695636173,
  371. "embedding_model": null,
  372. "embedding_model_provider": null,
  373. "embedding_available": null
  374. }
  375. ```
  376. </CodeGroup>
  377. </Col>
  378. </Row>
  379. <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
  380. <Heading
  381. url='/datasets'
  382. method='GET'
  383. title='ナレッジベースリストを取得'
  384. name='#dataset_list'
  385. />
  386. <Row>
  387. <Col>
  388. ### クエリ
  389. <Properties>
  390. <Property name='keyword' type='string' key='keyword'>
  391. 検索キーワード、オプション
  392. </Property>
  393. <Property name='tag_ids' type='array[string]' key='tag_ids'>
  394. タグ ID リスト、オプション
  395. </Property>
  396. <Property name='page' type='string' key='page'>
  397. ページ番号、オプション、デフォルト 1
  398. </Property>
  399. <Property name='limit' type='string' key='limit'>
  400. 返されるアイテム数、オプション、デフォルト 20、範囲 1-100
  401. </Property>
  402. <Property name='include_all' type='boolean' key='include_all'>
  403. すべてのデータセットを含めるかどうか(所有者のみ有効)、オプション、デフォルトは false
  404. </Property>
  405. </Properties>
  406. </Col>
  407. <Col sticky>
  408. <CodeGroup
  409. title="リクエスト"
  410. tag="GET"
  411. label="/datasets"
  412. targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets?page=1&limit=20' \\\n--header 'Authorization: Bearer {api_key}'`}
  413. >
  414. ```bash {{ title: 'cURL' }}
  415. curl --location --request GET '${props.apiBaseUrl}/datasets?page=1&limit=20' \
  416. --header 'Authorization: Bearer {api_key}'
  417. ```
  418. </CodeGroup>
  419. <CodeGroup title="レスポンス">
  420. ```json {{ title: 'Response' }}
  421. {
  422. "data": [
  423. {
  424. "id": "",
  425. "name": "name",
  426. "description": "desc",
  427. "permission": "only_me",
  428. "data_source_type": "upload_file",
  429. "indexing_technique": "",
  430. "app_count": 2,
  431. "document_count": 10,
  432. "word_count": 1200,
  433. "created_by": "",
  434. "created_at": "",
  435. "updated_by": "",
  436. "updated_at": ""
  437. },
  438. ...
  439. ],
  440. "has_more": true,
  441. "limit": 20,
  442. "total": 50,
  443. "page": 1
  444. }
  445. ```
  446. </CodeGroup>
  447. </Col>
  448. </Row>
  449. <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
  450. <Heading
  451. url='/datasets/{dataset_id}'
  452. method='DELETE'
  453. title='ナレッジベースを削除'
  454. name='#delete_dataset'
  455. />
  456. <Row>
  457. <Col>
  458. ### パラメータ
  459. <Properties>
  460. <Property name='dataset_id' type='string' key='dataset_id'>
  461. ナレッジ ID
  462. </Property>
  463. </Properties>
  464. </Col>
  465. <Col sticky>
  466. <CodeGroup
  467. title="リクエスト"
  468. tag="DELETE"
  469. label="/datasets/{dataset_id}"
  470. targetCode={`curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}' \\\n--header 'Authorization: Bearer {api_key}'`}
  471. >
  472. ```bash {{ title: 'cURL' }}
  473. curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}' \
  474. --header 'Authorization: Bearer {api_key}'
  475. ```
  476. </CodeGroup>
  477. <CodeGroup title="レスポンス">
  478. ```text {{ title: 'レスポンス' }}
  479. 204 No Content
  480. ```
  481. </CodeGroup>
  482. </Col>
  483. </Row>
  484. <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
  485. <Heading
  486. url='/datasets/{dataset_id}/documents/{document_id}/update-by-text'
  487. method='POST'
  488. title='テキストでドキュメントを更新'
  489. name='#update-by-text'
  490. />
  491. <Row>
  492. <Col>
  493. この API は既存のナレッジに基づいており、このナレッジを基にテキストを使用してドキュメントを更新します。
  494. ### パス
  495. <Properties>
  496. <Property name='dataset_id' type='string' key='dataset_id'>
  497. ナレッジ ID
  498. </Property>
  499. <Property name='document_id' type='string' key='document_id'>
  500. ドキュメント ID
  501. </Property>
  502. </Properties>
  503. ### リクエストボディ
  504. <Properties>
  505. <Property name='name' type='string' key='name'>
  506. ドキュメント名 (オプション)
  507. </Property>
  508. <Property name='text' type='string' key='text'>
  509. ドキュメント内容 (オプション)
  510. </Property>
  511. <Property name='process_rule' type='object' key='process_rule'>
  512. 処理ルール
  513. - <code>mode</code> (string) クリーニング、セグメンテーションモード、自動 / カスタム
  514. - <code>rules</code> (object) カスタムルール (自動モードでは、このフィールドは空)
  515. - <code>pre_processing_rules</code> (array[object]) 前処理ルール
  516. - <code>id</code> (string) 前処理ルールの一意識別子
  517. - 列挙
  518. - <code>remove_extra_spaces</code> 連続するスペース、改行、タブを置換
  519. - <code>remove_urls_emails</code> URL、メールアドレスを削除
  520. - <code>enabled</code> (bool) このルールを選択するかどうか。ドキュメント ID が渡されない場合、デフォルト値を表します。
  521. - <code>segmentation</code> (object) セグメンテーションルール
  522. - <code>separator</code> カスタムセグメント識別子。現在は 1 つの区切り文字のみ設定可能。デフォルトは \n
  523. - <code>max_tokens</code> 最大長 (トークン) デフォルトは 1000
  524. - <code>parent_mode</code> 親チャンクの検索モード: <code>full-doc</code> 全文検索 / <code>paragraph</code> 段落検索
  525. - <code>subchunk_segmentation</code> (object) 子チャンクルール
  526. - <code>separator</code> セグメンテーション識別子。現在は 1 つの区切り文字のみ許可。デフォルトは <code>***</code>
  527. - <code>max_tokens</code> 最大長 (トークン) は親チャンクの長さより短いことを検証する必要があります
  528. - <code>chunk_overlap</code> 隣接するチャンク間の重なりを定義 (オプション)
  529. </Property>
  530. </Properties>
  531. </Col>
  532. <Col sticky>
  533. <CodeGroup
  534. title="リクエスト"
  535. tag="POST"
  536. label="/datasets/{dataset_id}/documents/{document_id}/update-by-text"
  537. 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"}'`}
  538. >
  539. ```bash {{ title: 'cURL' }}
  540. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/update-by-text' \
  541. --header 'Authorization: Bearer {api_key}' \
  542. --header 'Content-Type: application/json' \
  543. --data-raw '{
  544. "name": "name",
  545. "text": "text"
  546. }'
  547. ```
  548. </CodeGroup>
  549. <CodeGroup title="レスポンス">
  550. ```json {{ title: 'Response' }}
  551. {
  552. "document": {
  553. "id": "",
  554. "position": 1,
  555. "data_source_type": "upload_file",
  556. "data_source_info": {
  557. "upload_file_id": ""
  558. },
  559. "dataset_process_rule_id": "",
  560. "name": "name.txt",
  561. "created_from": "api",
  562. "created_by": "",
  563. "created_at": 1695308667,
  564. "tokens": 0,
  565. "indexing_status": "waiting",
  566. "error": null,
  567. "enabled": true,
  568. "disabled_at": null,
  569. "disabled_by": null,
  570. "archived": false,
  571. "display_status": "queuing",
  572. "word_count": 0,
  573. "hit_count": 0,
  574. "doc_form": "text_model"
  575. },
  576. "batch": ""
  577. }
  578. ```
  579. </CodeGroup>
  580. </Col>
  581. </Row>
  582. <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
  583. <Heading
  584. url='/datasets/{dataset_id}/documents/{document_id}/update-by-file'
  585. method='POST'
  586. title='ファイルでドキュメントを更新'
  587. name='#update-by-file'
  588. />
  589. <Row>
  590. <Col>
  591. この API は既存のナレッジに基づいており、このナレッジを基にファイルを使用してドキュメントを更新します。
  592. ### パス
  593. <Properties>
  594. <Property name='dataset_id' type='string' key='dataset_id'>
  595. ナレッジ ID
  596. </Property>
  597. <Property name='document_id' type='string' key='document_id'>
  598. ドキュメント ID
  599. </Property>
  600. </Properties>
  601. ### リクエストボディ
  602. <Properties>
  603. <Property name='name' type='string' key='name'>
  604. ドキュメント名 (オプション)
  605. </Property>
  606. <Property name='file' type='multipart/form-data' key='file'>
  607. アップロードするファイル
  608. </Property>
  609. <Property name='process_rule' type='object' key='process_rule'>
  610. 処理ルール
  611. - <code>mode</code> (string) クリーニング、セグメンテーションモード、自動 / カスタム
  612. - <code>rules</code> (object) カスタムルール (自動モードでは、このフィールドは空)
  613. - <code>pre_processing_rules</code> (array[object]) 前処理ルール
  614. - <code>id</code> (string) 前処理ルールの一意識別子
  615. - 列挙
  616. - <code>remove_extra_spaces</code> 連続するスペース、改行、タブを置換
  617. - <code>remove_urls_emails</code> URL、メールアドレスを削除
  618. - <code>enabled</code> (bool) このルールを選択するかどうか。ドキュメント ID が渡されない場合、デフォルト値を表します。
  619. - <code>segmentation</code> (object) セグメンテーションルール
  620. - <code>separator</code> カスタムセグメント識別子。現在は 1 つの区切り文字のみ設定可能。デフォルトは \n
  621. - <code>max_tokens</code> 最大長 (トークン) デフォルトは 1000
  622. - <code>parent_mode</code> 親チャンクの検索モード: <code>full-doc</code> 全文検索 / <code>paragraph</code> 段落検索
  623. - <code>subchunk_segmentation</code> (object) 子チャンクルール
  624. - <code>separator</code> セグメンテーション識別子。現在は 1 つの区切り文字のみ許可。デフォルトは <code>***</code>
  625. - <code>max_tokens</code> 最大長 (トークン) は親チャンクの長さより短いことを検証する必要があります
  626. - <code>chunk_overlap</code> 隣接するチャンク間の重なりを定義 (オプション)
  627. </Property>
  628. </Properties>
  629. </Col>
  630. <Col sticky>
  631. <CodeGroup
  632. title="リクエスト"
  633. tag="POST"
  634. label="/datasets/{dataset_id}/documents/{document_id}/update-by-file"
  635. 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"'`}
  636. >
  637. ```bash {{ title: 'cURL' }}
  638. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/update-by-file' \
  639. --header 'Authorization: Bearer {api_key}' \
  640. --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' \
  641. --form 'file=@"/path/to/file"'
  642. ```
  643. </CodeGroup>
  644. <CodeGroup title="レスポンス">
  645. ```json {{ title: 'Response' }}
  646. {
  647. "document": {
  648. "id": "",
  649. "position": 1,
  650. "data_source_type": "upload_file",
  651. "data_source_info": {
  652. "upload_file_id": ""
  653. },
  654. "dataset_process_rule_id": "",
  655. "name": "Dify.txt",
  656. "created_from": "api",
  657. "created_by": "",
  658. "created_at": 1695308667,
  659. "tokens": 0,
  660. "indexing_status": "waiting",
  661. "error": null,
  662. "enabled": true,
  663. "disabled_at": null,
  664. "disabled_by": null,
  665. "archived": false,
  666. "display_status": "queuing",
  667. "word_count": 0,
  668. "hit_count": 0,
  669. "doc_form": "text_model"
  670. },
  671. "batch": "20230921150427533684"
  672. }
  673. ```
  674. </CodeGroup>
  675. </Col>
  676. </Row>
  677. <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
  678. <Heading
  679. url='/datasets/{dataset_id}/documents/{batch}/indexing-status'
  680. method='GET'
  681. title='ドキュメントの埋め込みステータス (進行状況) を取得'
  682. name='#indexing_status'
  683. />
  684. <Row>
  685. <Col>
  686. ### パラメータ
  687. <Properties>
  688. <Property name='dataset_id' type='string' key='dataset_id'>
  689. ナレッジ ID
  690. </Property>
  691. <Property name='batch' type='string' key='batch'>
  692. アップロードされたドキュメントのバッチ番号
  693. </Property>
  694. </Properties>
  695. </Col>
  696. <Col sticky>
  697. <CodeGroup
  698. title="リクエスト"
  699. tag="GET"
  700. label="/datasets/{dataset_id}/documents/{batch}/indexing-status"
  701. targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{batch}/indexing-status' \\\n--header 'Authorization: Bearer {api_key}'`}
  702. >
  703. ```bash {{ title: 'cURL' }}
  704. curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{batch}/indexing-status' \
  705. --header 'Authorization: Bearer {api_key}' \
  706. ```
  707. </CodeGroup>
  708. <CodeGroup title="レスポンス">
  709. ```json {{ title: 'Response' }}
  710. {
  711. "data":[{
  712. "id": "",
  713. "indexing_status": "indexing",
  714. "processing_started_at": 1681623462.0,
  715. "parsing_completed_at": 1681623462.0,
  716. "cleaning_completed_at": 1681623462.0,
  717. "splitting_completed_at": 1681623462.0,
  718. "completed_at": null,
  719. "paused_at": null,
  720. "error": null,
  721. "stopped_at": null,
  722. "completed_segments": 24,
  723. "total_segments": 100
  724. }]
  725. }
  726. ```
  727. </CodeGroup>
  728. </Col>
  729. </Row>
  730. <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
  731. <Heading
  732. url='/datasets/{dataset_id}/documents/{document_id}'
  733. method='DELETE'
  734. title='ドキュメントを削除'
  735. name='#delete_document'
  736. />
  737. <Row>
  738. <Col>
  739. ### パス
  740. <Properties>
  741. <Property name='dataset_id' type='string' key='dataset_id'>
  742. ナレッジ ID
  743. </Property>
  744. <Property name='document_id' type='string' key='document_id'>
  745. ドキュメント ID
  746. </Property>
  747. </Properties>
  748. </Col>
  749. <Col sticky>
  750. <CodeGroup
  751. title="リクエスト"
  752. tag="DELETE"
  753. label="/datasets/{dataset_id}/documents/{document_id}"
  754. targetCode={`curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}' \\\n--header 'Authorization: Bearer {api_key}'`}
  755. >
  756. ```bash {{ title: 'cURL' }}
  757. curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}' \
  758. --header 'Authorization: Bearer {api_key}' \
  759. ```
  760. </CodeGroup>
  761. <CodeGroup title="レスポンス">
  762. ```text {{ title: 'レスポンス' }}
  763. 204 No Content
  764. ```
  765. </CodeGroup>
  766. </Col>
  767. </Row>
  768. <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
  769. <Heading
  770. url='/datasets/{dataset_id}/documents'
  771. method='GET'
  772. title='ナレッジベースのドキュメントリストを取得'
  773. name='#dataset_document_list'
  774. />
  775. <Row>
  776. <Col>
  777. ### パス
  778. <Properties>
  779. <Property name='dataset_id' type='string' key='dataset_id'>
  780. ナレッジ ID
  781. </Property>
  782. </Properties>
  783. ### クエリ
  784. <Properties>
  785. <Property name='keyword' type='string' key='keyword'>
  786. 検索キーワード、現在はドキュメント名のみ検索 (オプション)
  787. </Property>
  788. <Property name='page' type='string' key='page'>
  789. ページ番号 (オプション)
  790. </Property>
  791. <Property name='limit' type='string' key='limit'>
  792. 返されるアイテム数、デフォルトは 20、範囲は 1-100 (オプション)
  793. </Property>
  794. </Properties>
  795. </Col>
  796. <Col sticky>
  797. <CodeGroup
  798. title="リクエスト"
  799. tag="GET"
  800. label="/datasets/{dataset_id}/documents"
  801. targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents' \\\n--header 'Authorization: Bearer {api_key}'`}
  802. >
  803. ```bash {{ title: 'cURL' }}
  804. curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents' \
  805. --header 'Authorization: Bearer {api_key}' \
  806. ```
  807. </CodeGroup>
  808. <CodeGroup title="レスポンス">
  809. ```json {{ title: 'Response' }}
  810. {
  811. "data": [
  812. {
  813. "id": "",
  814. "position": 1,
  815. "data_source_type": "file_upload",
  816. "data_source_info": null,
  817. "dataset_process_rule_id": null,
  818. "name": "dify",
  819. "created_from": "",
  820. "created_by": "",
  821. "created_at": 1681623639,
  822. "tokens": 0,
  823. "indexing_status": "waiting",
  824. "error": null,
  825. "enabled": true,
  826. "disabled_at": null,
  827. "disabled_by": null,
  828. "archived": false
  829. },
  830. ],
  831. "has_more": false,
  832. "limit": 20,
  833. "total": 9,
  834. "page": 1
  835. }
  836. ```
  837. </CodeGroup>
  838. </Col>
  839. </Row>
  840. <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
  841. <Heading
  842. url='/datasets/{dataset_id}/documents/{document_id}'
  843. method='GET'
  844. title='ドキュメントの詳細を取得'
  845. name='#get-document-detail'
  846. />
  847. <Row>
  848. <Col>
  849. ドキュメントの詳細を取得.
  850. ### Path
  851. - `dataset_id` (string) ナレッジベースID
  852. - `document_id` (string) ドキュメントID
  853. ### Query
  854. - `metadata` (string) metadataのフィルター条件 `all`、`only`、または`without`。デフォルトは `all`。
  855. ### Response
  856. ナレッジベースドキュメントの詳細を返す.
  857. </Col>
  858. <Col sticky>
  859. ### Request Example
  860. <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}'`}>
  861. ```bash {{ title: 'cURL' }}
  862. curl -X GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}' \
  863. -H 'Authorization: Bearer {api_key}'
  864. ```
  865. </CodeGroup>
  866. ### Response Example
  867. <CodeGroup title="Response">
  868. ```json {{ title: 'Response' }}
  869. {
  870. "id": "f46ae30c-5c11-471b-96d0-464f5f32a7b2",
  871. "position": 1,
  872. "data_source_type": "upload_file",
  873. "data_source_info": {
  874. "upload_file": {
  875. ...
  876. }
  877. },
  878. "dataset_process_rule_id": "24b99906-845e-499f-9e3c-d5565dd6962c",
  879. "dataset_process_rule": {
  880. "mode": "hierarchical",
  881. "rules": {
  882. "pre_processing_rules": [
  883. {
  884. "id": "remove_extra_spaces",
  885. "enabled": true
  886. },
  887. {
  888. "id": "remove_urls_emails",
  889. "enabled": false
  890. }
  891. ],
  892. "segmentation": {
  893. "separator": "**********page_ending**********",
  894. "max_tokens": 1024,
  895. "chunk_overlap": 0
  896. },
  897. "parent_mode": "paragraph",
  898. "subchunk_segmentation": {
  899. "separator": "\n",
  900. "max_tokens": 512,
  901. "chunk_overlap": 0
  902. }
  903. }
  904. },
  905. "document_process_rule": {
  906. "id": "24b99906-845e-499f-9e3c-d5565dd6962c",
  907. "dataset_id": "48a0db76-d1a9-46c1-ae35-2baaa919a8a9",
  908. "mode": "hierarchical",
  909. "rules": {
  910. "pre_processing_rules": [
  911. {
  912. "id": "remove_extra_spaces",
  913. "enabled": true
  914. },
  915. {
  916. "id": "remove_urls_emails",
  917. "enabled": false
  918. }
  919. ],
  920. "segmentation": {
  921. "separator": "**********page_ending**********",
  922. "max_tokens": 1024,
  923. "chunk_overlap": 0
  924. },
  925. "parent_mode": "paragraph",
  926. "subchunk_segmentation": {
  927. "separator": "\n",
  928. "max_tokens": 512,
  929. "chunk_overlap": 0
  930. }
  931. }
  932. },
  933. "name": "xxxx",
  934. "created_from": "web",
  935. "created_by": "17f71940-a7b5-4c77-b60f-2bd645c1ffa0",
  936. "created_at": 1750464191,
  937. "tokens": null,
  938. "indexing_status": "waiting",
  939. "completed_at": null,
  940. "updated_at": 1750464191,
  941. "indexing_latency": null,
  942. "error": null,
  943. "enabled": true,
  944. "disabled_at": null,
  945. "disabled_by": null,
  946. "archived": false,
  947. "segment_count": 0,
  948. "average_segment_length": 0,
  949. "hit_count": null,
  950. "display_status": "queuing",
  951. "doc_form": "hierarchical_model",
  952. "doc_language": "Chinese Simplified"
  953. }
  954. ```
  955. </CodeGroup>
  956. </Col>
  957. </Row>
  958. ___
  959. <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
  960. <Heading
  961. url='/datasets/{dataset_id}/documents/status/{action}'
  962. method='PATCH'
  963. title='ドキュメントステータスの更新'
  964. name='#batch_document_status'
  965. />
  966. <Row>
  967. <Col>
  968. ### パス
  969. <Properties>
  970. <Property name='dataset_id' type='string' key='dataset_id'>
  971. ナレッジ ID
  972. </Property>
  973. <Property name='action' type='string' key='action'>
  974. - `enable` - ドキュメントを有効化
  975. - `disable` - ドキュメントを無効化
  976. - `archive` - ドキュメントをアーカイブ
  977. - `un_archive` - ドキュメントのアーカイブを解除
  978. </Property>
  979. </Properties>
  980. ### リクエストボディ
  981. <Properties>
  982. <Property name='document_ids' type='array[string]' key='document_ids'>
  983. ドキュメントIDのリスト
  984. </Property>
  985. </Properties>
  986. </Col>
  987. <Col sticky>
  988. <CodeGroup
  989. title="リクエスト"
  990. tag="PATCH"
  991. label="/datasets/{dataset_id}/documents/status/{action}"
  992. 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}'`}
  993. >
  994. ```bash {{ title: 'cURL' }}
  995. curl --location --request PATCH '${props.apiBaseUrl}/datasets/{dataset_id}/documents/status/{action}' \
  996. --header 'Authorization: Bearer {api_key}' \
  997. --header 'Content-Type: application/json' \
  998. --data-raw '{
  999. "document_ids": ["doc-id-1", "doc-id-2"]
  1000. }'
  1001. ```
  1002. </CodeGroup>
  1003. <CodeGroup title="レスポンス">
  1004. ```json {{ title: 'Response' }}
  1005. {
  1006. "result": "success"
  1007. }
  1008. ```
  1009. </CodeGroup>
  1010. </Col>
  1011. </Row>
  1012. <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
  1013. <Heading
  1014. url='/datasets/{dataset_id}/documents/{document_id}/segments'
  1015. method='POST'
  1016. title='ドキュメントにチャンクを追加'
  1017. name='#create_new_segment'
  1018. />
  1019. <Row>
  1020. <Col>
  1021. ### パス
  1022. <Properties>
  1023. <Property name='dataset_id' type='string' key='dataset_id'>
  1024. ナレッジ ID
  1025. </Property>
  1026. <Property name='document_id' type='string' key='document_id'>
  1027. ドキュメント ID
  1028. </Property>
  1029. </Properties>
  1030. ### リクエストボディ
  1031. <Properties>
  1032. <Property name='segments' type='object list' key='segments'>
  1033. - <code>content</code> (text) テキスト内容 / 質問内容、必須
  1034. - <code>answer</code> (text) 回答内容、ナレッジのモードが Q&A モードの場合に値を渡します (オプション)
  1035. - <code>keywords</code> (list) キーワード (オプション)
  1036. </Property>
  1037. </Properties>
  1038. </Col>
  1039. <Col sticky>
  1040. <CodeGroup
  1041. title="リクエスト"
  1042. tag="POST"
  1043. label="/datasets/{dataset_id}/documents/{document_id}/segments"
  1044. 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"]}]}'`}
  1045. >
  1046. ```bash {{ title: 'cURL' }}
  1047. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments' \
  1048. --header 'Authorization: Bearer {api_key}' \
  1049. --header 'Content-Type: application/json' \
  1050. --data-raw '{
  1051. "segments": [
  1052. {
  1053. "content": "1",
  1054. "answer": "1",
  1055. "keywords": ["a"]
  1056. }
  1057. ]
  1058. }'
  1059. ```
  1060. </CodeGroup>
  1061. <CodeGroup title="レスポンス">
  1062. ```json {{ title: 'Response' }}
  1063. {
  1064. "data": [{
  1065. "id": "",
  1066. "position": 1,
  1067. "document_id": "",
  1068. "content": "1",
  1069. "answer": "1",
  1070. "word_count": 25,
  1071. "tokens": 0,
  1072. "keywords": [
  1073. "a"
  1074. ],
  1075. "index_node_id": "",
  1076. "index_node_hash": "",
  1077. "hit_count": 0,
  1078. "enabled": true,
  1079. "disabled_at": null,
  1080. "disabled_by": null,
  1081. "status": "completed",
  1082. "created_by": "",
  1083. "created_at": 1695312007,
  1084. "indexing_at": 1695312007,
  1085. "completed_at": 1695312007,
  1086. "error": null,
  1087. "stopped_at": null
  1088. }],
  1089. "doc_form": "text_model"
  1090. }
  1091. ```
  1092. </CodeGroup>
  1093. </Col>
  1094. </Row>
  1095. <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
  1096. <Heading
  1097. url='/datasets/{dataset_id}/documents/{document_id}/segments'
  1098. method='GET'
  1099. title='ドキュメントからチャンクを取得'
  1100. name='#get_segment'
  1101. />
  1102. <Row>
  1103. <Col>
  1104. ### パス
  1105. <Properties>
  1106. <Property name='dataset_id' type='string' key='dataset_id'>
  1107. ナレッジ ID
  1108. </Property>
  1109. <Property name='document_id' type='string' key='document_id'>
  1110. ドキュメント ID
  1111. </Property>
  1112. </Properties>
  1113. ### クエリ
  1114. <Properties>
  1115. <Property name='keyword' type='string' key='keyword'>
  1116. キーワード (オプション)
  1117. </Property>
  1118. <Property name='status' type='string' key='status'>
  1119. 検索ステータス、completed
  1120. </Property>
  1121. <Property name='page' type='string' key='page'>
  1122. ページ番号 (オプション)
  1123. </Property>
  1124. <Property name='limit' type='string' key='limit'>
  1125. 返されるアイテム数、デフォルトは 20、範囲は 1-100 (オプション)
  1126. </Property>
  1127. </Properties>
  1128. </Col>
  1129. <Col sticky>
  1130. <CodeGroup
  1131. title="リクエスト"
  1132. tag="GET"
  1133. label="/datasets/{dataset_id}/documents/{document_id}/segments"
  1134. 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'`}
  1135. >
  1136. ```bash {{ title: 'cURL' }}
  1137. curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments' \
  1138. --header 'Authorization: Bearer {api_key}' \
  1139. --header 'Content-Type: application/json'
  1140. ```
  1141. </CodeGroup>
  1142. <CodeGroup title="レスポンス">
  1143. ```json {{ title: 'Response' }}
  1144. {
  1145. "data": [{
  1146. "id": "",
  1147. "position": 1,
  1148. "document_id": "",
  1149. "content": "1",
  1150. "answer": "1",
  1151. "word_count": 25,
  1152. "tokens": 0,
  1153. "keywords": [
  1154. "a"
  1155. ],
  1156. "index_node_id": "",
  1157. "index_node_hash": "",
  1158. "hit_count": 0,
  1159. "enabled": true,
  1160. "disabled_at": null,
  1161. "disabled_by": null,
  1162. "status": "completed",
  1163. "created_by": "",
  1164. "created_at": 1695312007,
  1165. "indexing_at": 1695312007,
  1166. "completed_at": 1695312007,
  1167. "error": null,
  1168. "stopped_at": null
  1169. }],
  1170. "doc_form": "text_model",
  1171. "has_more": false,
  1172. "limit": 20,
  1173. "total": 9,
  1174. "page": 1
  1175. }
  1176. ```
  1177. </CodeGroup>
  1178. </Col>
  1179. </Row>
  1180. <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
  1181. <Heading
  1182. url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}'
  1183. method='GET'
  1184. title='ドキュメントセグメントの詳細を表示'
  1185. name='#view_document_segment'
  1186. />
  1187. <Row>
  1188. <Col>
  1189. 指定されたナレッジベース内の特定のドキュメントセグメントの詳細を表示します
  1190. ### パス
  1191. <Properties>
  1192. <Property name='dataset_id' type='string' key='dataset_id'>
  1193. ナレッジベースID
  1194. </Property>
  1195. <Property name='document_id' type='string' key='document_id'>
  1196. ドキュメントID
  1197. </Property>
  1198. <Property name='segment_id' type='string' key='segment_id'>
  1199. セグメントID
  1200. </Property>
  1201. </Properties>
  1202. </Col>
  1203. <Col sticky>
  1204. <CodeGroup
  1205. title="リクエスト"
  1206. tag="GET"
  1207. label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}"
  1208. targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}' \\\n--header 'Authorization: Bearer {api_key}'`}
  1209. >
  1210. ```bash {{ title: 'cURL' }}
  1211. curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}' \
  1212. --header 'Authorization: Bearer {api_key}'
  1213. ```
  1214. </CodeGroup>
  1215. <CodeGroup title="レスポンス">
  1216. ```json {{ title: 'Response' }}
  1217. {
  1218. "data": {
  1219. "id": "セグメントID",
  1220. "position": 2,
  1221. "document_id": "ドキュメントID",
  1222. "content": "セグメント内容テキスト",
  1223. "sign_content": "署名内容テキスト",
  1224. "answer": "回答内容(Q&Aモードの場合)",
  1225. "word_count": 470,
  1226. "tokens": 382,
  1227. "keywords": ["キーワード1", "キーワード2"],
  1228. "index_node_id": "インデックスノードID",
  1229. "index_node_hash": "インデックスノードハッシュ",
  1230. "hit_count": 0,
  1231. "enabled": true,
  1232. "status": "completed",
  1233. "created_by": "作成者ID",
  1234. "created_at": 作成タイムスタンプ,
  1235. "updated_at": 更新タイムスタンプ,
  1236. "indexing_at": インデックス作成タイムスタンプ,
  1237. "completed_at": 完了タイムスタンプ,
  1238. "error": null,
  1239. "child_chunks": []
  1240. },
  1241. "doc_form": "text_model"
  1242. }
  1243. ```
  1244. </CodeGroup>
  1245. </Col>
  1246. </Row>
  1247. <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
  1248. <Heading
  1249. method='DELETE'
  1250. title='ドキュメント内のチャンクを削除'
  1251. name='#delete_segment'
  1252. />
  1253. <Row>
  1254. <Col>
  1255. ### パス
  1256. <Properties>
  1257. <Property name='dataset_id' type='string' key='dataset_id'>
  1258. ナレッジ ID
  1259. </Property>
  1260. <Property name='document_id' type='string' key='document_id'>
  1261. ドキュメント ID
  1262. </Property>
  1263. <Property name='segment_id' type='string' key='segment_id'>
  1264. ドキュメントセグメント ID
  1265. </Property>
  1266. </Properties>
  1267. </Col>
  1268. <Col sticky>
  1269. <CodeGroup
  1270. title="リクエスト"
  1271. tag="DELETE"
  1272. label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}"
  1273. 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'`}
  1274. >
  1275. ```bash {{ title: 'cURL' }}
  1276. curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}' \
  1277. --header 'Authorization: Bearer {api_key}' \
  1278. --header 'Content-Type: application/json'
  1279. ```
  1280. </CodeGroup>
  1281. <CodeGroup title="レスポンス">
  1282. ```text {{ title: 'レスポンス' }}
  1283. 204 No Content
  1284. ```
  1285. </CodeGroup>
  1286. </Col>
  1287. </Row>
  1288. <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
  1289. <Heading
  1290. method='POST'
  1291. title='ドキュメント内のチャンクを更新'
  1292. name='#update_segment'
  1293. />
  1294. <Row>
  1295. <Col>
  1296. ### POST
  1297. <Properties>
  1298. <Property name='dataset_id' type='string' key='dataset_id'>
  1299. ナレッジ ID
  1300. </Property>
  1301. <Property name='document_id' type='string' key='document_id'>
  1302. ドキュメント ID
  1303. </Property>
  1304. <Property name='segment_id' type='string' key='segment_id'>
  1305. ドキュメントセグメント ID
  1306. </Property>
  1307. </Properties>
  1308. ### リクエストボディ
  1309. <Properties>
  1310. <Property name='segment' type='object' key='segment'>
  1311. - <code>content</code> (text) テキスト内容 / 質問内容、必須
  1312. - <code>answer</code> (text) 回答内容、ナレッジが Q&A モードの場合に値を渡します (オプション)
  1313. - <code>keywords</code> (list) キーワード (オプション)
  1314. - <code>enabled</code> (bool) False / true (オプション)
  1315. - <code>regenerate_child_chunks</code> (bool) 子チャンクを再生成するかどうか (オプション)
  1316. </Property>
  1317. </Properties>
  1318. </Col>
  1319. <Col sticky>
  1320. <CodeGroup
  1321. title="リクエスト"
  1322. tag="POST"
  1323. label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}"
  1324. 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}}'`}
  1325. >
  1326. ```bash {{ title: 'cURL' }}
  1327. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}' \
  1328. --header 'Content-Type: application/json' \
  1329. --data-raw '{
  1330. "segment": {
  1331. "content": "1",
  1332. "answer": "1",
  1333. "keywords": ["a"],
  1334. "enabled": false
  1335. }
  1336. }'
  1337. ```
  1338. </CodeGroup>
  1339. <CodeGroup title="レスポンス">
  1340. ```json {{ title: 'Response' }}
  1341. {
  1342. "data": {
  1343. "id": "",
  1344. "position": 1,
  1345. "document_id": "",
  1346. "content": "1",
  1347. "answer": "1",
  1348. "word_count": 25,
  1349. "tokens": 0,
  1350. "keywords": [
  1351. "a"
  1352. ],
  1353. "index_node_id": "",
  1354. "index_node_hash": "",
  1355. "hit_count": 0,
  1356. "enabled": true,
  1357. "disabled_at": null,
  1358. "disabled_by": null,
  1359. "status": "completed",
  1360. "created_by": "",
  1361. "created_at": 1695312007,
  1362. "indexing_at": 1695312007,
  1363. "completed_at": 1695312007,
  1364. "error": null,
  1365. "stopped_at": null
  1366. },
  1367. "doc_form": "text_model"
  1368. }
  1369. ```
  1370. </CodeGroup>
  1371. </Col>
  1372. </Row>
  1373. <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
  1374. <Heading
  1375. url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks'
  1376. method='POST'
  1377. title='子チャンクを作成'
  1378. name='#create_child_chunk'
  1379. />
  1380. <Row>
  1381. <Col>
  1382. ### パス
  1383. <Properties>
  1384. <Property name='dataset_id' type='string' key='dataset_id'>
  1385. ナレッジ ID
  1386. </Property>
  1387. <Property name='document_id' type='string' key='document_id'>
  1388. ドキュメント ID
  1389. </Property>
  1390. <Property name='segment_id' type='string' key='segment_id'>
  1391. セグメント ID
  1392. </Property>
  1393. </Properties>
  1394. ### リクエストボディ
  1395. <Properties>
  1396. <Property name='content' type='string' key='content'>
  1397. 子チャンクの内容
  1398. </Property>
  1399. </Properties>
  1400. </Col>
  1401. <Col sticky>
  1402. <CodeGroup
  1403. title="リクエスト"
  1404. tag="POST"
  1405. label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks"
  1406. 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"}'`}
  1407. >
  1408. ```bash {{ title: 'cURL' }}
  1409. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks' \
  1410. --header 'Authorization: Bearer {api_key}' \
  1411. --header 'Content-Type: application/json' \
  1412. --data-raw '{
  1413. "content": "Child chunk content"
  1414. }'
  1415. ```
  1416. </CodeGroup>
  1417. <CodeGroup title="レスポンス">
  1418. ```json {{ title: 'Response' }}
  1419. {
  1420. "data": {
  1421. "id": "",
  1422. "segment_id": "",
  1423. "content": "Child chunk content",
  1424. "word_count": 25,
  1425. "tokens": 0,
  1426. "index_node_id": "",
  1427. "index_node_hash": "",
  1428. "status": "completed",
  1429. "created_by": "",
  1430. "created_at": 1695312007,
  1431. "indexing_at": 1695312007,
  1432. "completed_at": 1695312007,
  1433. "error": null,
  1434. "stopped_at": null
  1435. }
  1436. }
  1437. ```
  1438. </CodeGroup>
  1439. </Col>
  1440. </Row>
  1441. <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
  1442. <Heading
  1443. url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks'
  1444. method='GET'
  1445. title='子チャンクを取得'
  1446. name='#get_child_chunks'
  1447. />
  1448. <Row>
  1449. <Col>
  1450. ### パス
  1451. <Properties>
  1452. <Property name='dataset_id' type='string' key='dataset_id'>
  1453. ナレッジ ID
  1454. </Property>
  1455. <Property name='document_id' type='string' key='document_id'>
  1456. ドキュメント ID
  1457. </Property>
  1458. <Property name='segment_id' type='string' key='segment_id'>
  1459. セグメント ID
  1460. </Property>
  1461. </Properties>
  1462. ### クエリ
  1463. <Properties>
  1464. <Property name='keyword' type='string' key='keyword'>
  1465. 検索キーワード (オプション)
  1466. </Property>
  1467. <Property name='page' type='integer' key='page'>
  1468. ページ番号 (オプション、デフォルト: 1)
  1469. </Property>
  1470. <Property name='limit' type='integer' key='limit'>
  1471. ページあたりのアイテム数 (オプション、デフォルト: 20、最大: 100)
  1472. </Property>
  1473. </Properties>
  1474. </Col>
  1475. <Col sticky>
  1476. <CodeGroup
  1477. title="リクエスト"
  1478. tag="GET"
  1479. label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks"
  1480. 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}'`}
  1481. >
  1482. ```bash {{ title: 'cURL' }}
  1483. curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks?page=1&limit=20' \
  1484. --header 'Authorization: Bearer {api_key}'
  1485. ```
  1486. </CodeGroup>
  1487. <CodeGroup title="レスポンス">
  1488. ```json {{ title: 'Response' }}
  1489. {
  1490. "data": [{
  1491. "id": "",
  1492. "segment_id": "",
  1493. "content": "Child chunk content",
  1494. "word_count": 25,
  1495. "tokens": 0,
  1496. "index_node_id": "",
  1497. "index_node_hash": "",
  1498. "status": "completed",
  1499. "created_by": "",
  1500. "created_at": 1695312007,
  1501. "indexing_at": 1695312007,
  1502. "completed_at": 1695312007,
  1503. "error": null,
  1504. "stopped_at": null
  1505. }],
  1506. "total": 1,
  1507. "total_pages": 1,
  1508. "page": 1,
  1509. "limit": 20
  1510. }
  1511. ```
  1512. </CodeGroup>
  1513. </Col>
  1514. </Row>
  1515. <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
  1516. <Heading
  1517. url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}'
  1518. method='DELETE'
  1519. title='子チャンクを削除'
  1520. name='#delete_child_chunk'
  1521. />
  1522. <Row>
  1523. <Col>
  1524. ### パス
  1525. <Properties>
  1526. <Property name='dataset_id' type='string' key='dataset_id'>
  1527. ナレッジ ID
  1528. </Property>
  1529. <Property name='document_id' type='string' key='document_id'>
  1530. ドキュメント ID
  1531. </Property>
  1532. <Property name='segment_id' type='string' key='segment_id'>
  1533. セグメント ID
  1534. </Property>
  1535. <Property name='child_chunk_id' type='string' key='child_chunk_id'>
  1536. 子チャンク ID
  1537. </Property>
  1538. </Properties>
  1539. </Col>
  1540. <Col sticky>
  1541. <CodeGroup
  1542. title="リクエスト"
  1543. tag="DELETE"
  1544. label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}"
  1545. targetCode={`curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}' \\\n--header 'Authorization: Bearer {api_key}'`}
  1546. >
  1547. ```bash {{ title: 'cURL' }}
  1548. curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}' \
  1549. --header 'Authorization: Bearer {api_key}'
  1550. ```
  1551. </CodeGroup>
  1552. <CodeGroup title="レスポンス">
  1553. ```text {{ title: 'レスポンス' }}
  1554. 204 No Content
  1555. ```
  1556. </CodeGroup>
  1557. </Col>
  1558. </Row>
  1559. <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
  1560. <Heading
  1561. url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}'
  1562. method='PATCH'
  1563. title='子チャンクを更新'
  1564. name='#update_child_chunk'
  1565. />
  1566. <Row>
  1567. <Col>
  1568. ### パス
  1569. <Properties>
  1570. <Property name='dataset_id' type='string' key='dataset_id'>
  1571. ナレッジ ID
  1572. </Property>
  1573. <Property name='document_id' type='string' key='document_id'>
  1574. ドキュメント ID
  1575. </Property>
  1576. <Property name='segment_id' type='string' key='segment_id'>
  1577. セグメント ID
  1578. </Property>
  1579. <Property name='child_chunk_id' type='string' key='child_chunk_id'>
  1580. 子チャンク ID
  1581. </Property>
  1582. </Properties>
  1583. ### リクエストボディ
  1584. <Properties>
  1585. <Property name='content' type='string' key='content'>
  1586. 子チャンクの内容
  1587. </Property>
  1588. </Properties>
  1589. </Col>
  1590. <Col sticky>
  1591. <CodeGroup
  1592. title="リクエスト"
  1593. tag="PATCH"
  1594. label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}"
  1595. 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"}'`}
  1596. >
  1597. ```bash {{ title: 'cURL' }}
  1598. curl --location --request PATCH '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}' \
  1599. --header 'Authorization: Bearer {api_key}' \
  1600. --header 'Content-Type: application/json' \
  1601. --data-raw '{
  1602. "content": "Updated child chunk content"
  1603. }'
  1604. ```
  1605. </CodeGroup>
  1606. <CodeGroup title="レスポンス">
  1607. ```json {{ title: 'Response' }}
  1608. {
  1609. "data": {
  1610. "id": "",
  1611. "segment_id": "",
  1612. "content": "Updated child chunk content",
  1613. "word_count": 25,
  1614. "tokens": 0,
  1615. "index_node_id": "",
  1616. "index_node_hash": "",
  1617. "status": "completed",
  1618. "created_by": "",
  1619. "created_at": 1695312007,
  1620. "indexing_at": 1695312007,
  1621. "completed_at": 1695312007,
  1622. "error": null,
  1623. "stopped_at": null
  1624. }
  1625. }
  1626. ```
  1627. </CodeGroup>
  1628. </Col>
  1629. </Row>
  1630. <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
  1631. <Heading
  1632. url='/datasets/{dataset_id}/documents/{document_id}/upload-file'
  1633. method='GET'
  1634. title='アップロードファイルを取得'
  1635. name='#get_upload_file'
  1636. />
  1637. <Row>
  1638. <Col>
  1639. ### パス
  1640. <Properties>
  1641. <Property name='dataset_id' type='string' key='dataset_id'>
  1642. ナレッジ ID
  1643. </Property>
  1644. <Property name='document_id' type='string' key='document_id'>
  1645. ドキュメント ID
  1646. </Property>
  1647. </Properties>
  1648. </Col>
  1649. <Col sticky>
  1650. <CodeGroup
  1651. title="リクエスト"
  1652. tag="GET"
  1653. label="/datasets/{dataset_id}/documents/{document_id}/upload-file"
  1654. 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'`}
  1655. >
  1656. ```bash {{ title: 'cURL' }}
  1657. curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/upload-file' \
  1658. --header 'Authorization: Bearer {api_key}' \
  1659. --header 'Content-Type: application/json'
  1660. ```
  1661. </CodeGroup>
  1662. <CodeGroup title="レスポンス">
  1663. ```json {{ title: 'Response' }}
  1664. {
  1665. "id": "file_id",
  1666. "name": "file_name",
  1667. "size": 1024,
  1668. "extension": "txt",
  1669. "url": "preview_url",
  1670. "download_url": "download_url",
  1671. "mime_type": "text/plain",
  1672. "created_by": "user_id",
  1673. "created_at": 1728734540,
  1674. }
  1675. ```
  1676. </CodeGroup>
  1677. </Col>
  1678. </Row>
  1679. <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
  1680. <Heading
  1681. url='/datasets/{dataset_id}/retrieve'
  1682. method='POST'
  1683. title='ナレッジベースからチャンクを取得'
  1684. name='#dataset_retrieval'
  1685. />
  1686. <Row>
  1687. <Col>
  1688. ### パス
  1689. <Properties>
  1690. <Property name='dataset_id' type='string' key='dataset_id'>
  1691. ナレッジ ID
  1692. </Property>
  1693. </Properties>
  1694. ### リクエストボディ
  1695. <Properties>
  1696. <Property name='query' type='string' key='query'>
  1697. クエリキーワード
  1698. </Property>
  1699. <Property name='retrieval_model' type='object' key='retrieval_model'>
  1700. 検索パラメータ(オプション、入力されない場合はデフォルトの方法でリコールされます)
  1701. - <code>search_method</code> (text) 検索方法: 以下の4つのキーワードのいずれかが必要です
  1702. - <code>keyword_search</code> キーワード検索
  1703. - <code>semantic_search</code> セマンティック検索
  1704. - <code>full_text_search</code> 全文検索
  1705. - <code>hybrid_search</code> ハイブリッド検索
  1706. - <code>reranking_enable</code> (bool) 再ランキングを有効にするかどうか、検索モードがsemantic_searchまたはhybrid_searchの場合に必須(オプション)
  1707. - <code>reranking_mode</code> (object) 再ランキングモデル構成、再ランキングが有効な場合に必須
  1708. - <code>reranking_provider_name</code> (string) 再ランキングモデルプロバイダー
  1709. - <code>reranking_model_name</code> (string) 再ランキングモデル名
  1710. - <code>weights</code> (float) ハイブリッド検索モードでのセマンティック検索の重み設定
  1711. - <code>top_k</code> (integer) 返される結果の数(オプション)
  1712. - <code>score_threshold_enabled</code> (bool) スコア閾値を有効にするかどうか
  1713. - <code>score_threshold</code> (float) スコア閾値
  1714. - <code>metadata_filtering_conditions</code> (object) メタデータフィルタリング条件
  1715. - <code>logical_operator</code> (string) 論理演算子: <code>and</code> | <code>or</code>
  1716. - <code>conditions</code> (array[object]) 条件リスト
  1717. - <code>name</code> (string) メタデータフィールド名
  1718. - <code>comparison_operator</code> (string) 比較演算子、許可される値:
  1719. - 文字列比較:
  1720. - <code>contains</code>: 含む
  1721. - <code>not contains</code>: 含まない
  1722. - <code>start with</code>: で始まる
  1723. - <code>end with</code>: で終わる
  1724. - <code>is</code>: 等しい
  1725. - <code>is not</code>: 等しくない
  1726. - <code>empty</code>: 空
  1727. - <code>not empty</code>: 空でない
  1728. - 数値比較:
  1729. - <code>=</code>: 等しい
  1730. - <code>≠</code>: 等しくない
  1731. - <code>></code>: より大きい
  1732. - <code>< </code>: より小さい
  1733. - <code>≥</code>: 以上
  1734. - <code>≤</code>: 以下
  1735. - 時間比較:
  1736. - <code>before</code>: より前
  1737. - <code>after</code>: より後
  1738. - <code>value</code> (string|number|null) 比較値
  1739. </Property>
  1740. <Property name='external_retrieval_model' type='object' key='external_retrieval_model'>
  1741. 未使用フィールド
  1742. </Property>
  1743. </Properties>
  1744. </Col>
  1745. <Col sticky>
  1746. <CodeGroup
  1747. title="リクエスト"
  1748. tag="POST"
  1749. label="/datasets/{dataset_id}/retrieve"
  1750. 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 '{
  1751. "query": "test",
  1752. "retrieval_model": {
  1753. "search_method": "keyword_search",
  1754. "reranking_enable": false,
  1755. "reranking_mode": null,
  1756. "reranking_model": {
  1757. "reranking_provider_name": "",
  1758. "reranking_model_name": ""
  1759. },
  1760. "weights": null,
  1761. "top_k": 1,
  1762. "score_threshold_enabled": false,
  1763. "score_threshold": null,
  1764. "metadata_filtering_conditions": {
  1765. "logical_operator": "and",
  1766. "conditions": [
  1767. {
  1768. "name": "document_name",
  1769. "comparison_operator": "contains",
  1770. "value": "test"
  1771. }
  1772. ]
  1773. }
  1774. }
  1775. }'`}
  1776. >
  1777. ```bash {{ title: 'cURL' }}
  1778. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/retrieve' \
  1779. --header 'Authorization: Bearer {api_key}' \
  1780. --header 'Content-Type: application/json' \
  1781. --data-raw '{
  1782. "query": "test",
  1783. "retrieval_model": {
  1784. "search_method": "keyword_search",
  1785. "reranking_enable": false,
  1786. "reranking_mode": null,
  1787. "reranking_model": {
  1788. "reranking_provider_name": "",
  1789. "reranking_model_name": ""
  1790. },
  1791. "weights": null,
  1792. "top_k": 2,
  1793. "score_threshold_enabled": false,
  1794. "score_threshold": null
  1795. }
  1796. }'
  1797. ```
  1798. </CodeGroup>
  1799. <CodeGroup title="レスポンス">
  1800. ```json {{ title: 'Response' }}
  1801. {
  1802. "query": {
  1803. "content": "test"
  1804. },
  1805. "records": [
  1806. {
  1807. "segment": {
  1808. "id": "7fa6f24f-8679-48b3-bc9d-bdf28d73f218",
  1809. "position": 1,
  1810. "document_id": "a8c6c36f-9f5d-4d7a-8472-f5d7b75d71d2",
  1811. "content": "Operation guide",
  1812. "answer": null,
  1813. "word_count": 847,
  1814. "tokens": 280,
  1815. "keywords": [
  1816. "install",
  1817. "java",
  1818. "base",
  1819. "scripts",
  1820. "jdk",
  1821. "manual",
  1822. "internal",
  1823. "opens",
  1824. "add",
  1825. "vmoptions"
  1826. ],
  1827. "index_node_id": "39dd8443-d960-45a8-bb46-7275ad7fbc8e",
  1828. "index_node_hash": "0189157697b3c6a418ccf8264a09699f25858975578f3467c76d6bfc94df1d73",
  1829. "hit_count": 0,
  1830. "enabled": true,
  1831. "disabled_at": null,
  1832. "disabled_by": null,
  1833. "status": "completed",
  1834. "created_by": "dbcb1ab5-90c8-41a7-8b78-73b235eb6f6f",
  1835. "created_at": 1728734540,
  1836. "indexing_at": 1728734552,
  1837. "completed_at": 1728734584,
  1838. "error": null,
  1839. "stopped_at": null,
  1840. "document": {
  1841. "id": "a8c6c36f-9f5d-4d7a-8472-f5d7b75d71d2",
  1842. "data_source_type": "upload_file",
  1843. "name": "readme.txt",
  1844. }
  1845. },
  1846. "score": 3.730463140527718e-05,
  1847. "tsne_position": null
  1848. }
  1849. ]
  1850. }
  1851. ```
  1852. </CodeGroup>
  1853. </Col>
  1854. </Row>
  1855. <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
  1856. <Heading
  1857. url='/datasets/{dataset_id}/metadata'
  1858. method='POST'
  1859. title='ナレッジメタデータを作成'
  1860. name='#create_metadata'
  1861. />
  1862. <Row>
  1863. <Col>
  1864. ### パス
  1865. <Properties>
  1866. <Property name='dataset_id' type='string' key='dataset_id'>
  1867. ナレッジ ID
  1868. </Property>
  1869. </Properties>
  1870. ### リクエストボディ
  1871. <Properties>
  1872. <Property name='segment' type='object' key='segment'>
  1873. - <code>type</code> (string) メタデータの種類、必須
  1874. - <code>name</code> (string) メタデータの名前、必須
  1875. </Property>
  1876. </Properties>
  1877. </Col>
  1878. <Col sticky>
  1879. <CodeGroup
  1880. title="リクエスト"
  1881. tag="POST"
  1882. label="/datasets/{dataset_id}/metadata"
  1883. 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"}'`}
  1884. >
  1885. ```bash {{ title: 'cURL' }}
  1886. ```
  1887. </CodeGroup>
  1888. <CodeGroup title="レスポンス">
  1889. ```json {{ title: 'Response' }}
  1890. {
  1891. "id": "abc",
  1892. "type": "string",
  1893. "name": "test",
  1894. }
  1895. ```
  1896. </CodeGroup>
  1897. </Col>
  1898. </Row>
  1899. <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
  1900. <Heading
  1901. url='/datasets/{dataset_id}/metadata/{metadata_id}'
  1902. method='PATCH'
  1903. title='ナレッジメタデータを更新'
  1904. name='#update_metadata'
  1905. />
  1906. <Row>
  1907. <Col>
  1908. ### パス
  1909. <Properties>
  1910. <Property name='dataset_id' type='string' key='dataset_id'>
  1911. ナレッジ ID
  1912. </Property>
  1913. <Property name='metadata_id' type='string' key='metadata_id'>
  1914. メタデータ ID
  1915. </Property>
  1916. </Properties>
  1917. ### リクエストボディ
  1918. <Properties>
  1919. <Property name='segment' type='object' key='segment'>
  1920. - <code>name</code> (string) メタデータの名前、必須
  1921. </Property>
  1922. </Properties>
  1923. </Col>
  1924. <Col sticky>
  1925. <CodeGroup
  1926. title="リクエスト"
  1927. tag="PATCH"
  1928. label="/datasets/{dataset_id}/metadata/{metadata_id}"
  1929. 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"}'`}
  1930. >
  1931. ```bash {{ title: 'cURL' }}
  1932. ```
  1933. </CodeGroup>
  1934. <CodeGroup title="レスポンス">
  1935. ```json {{ title: 'Response' }}
  1936. {
  1937. "id": "abc",
  1938. "type": "string",
  1939. "name": "test",
  1940. }
  1941. ```
  1942. </CodeGroup>
  1943. </Col>
  1944. </Row>
  1945. <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
  1946. <Heading
  1947. url='/datasets/{dataset_id}/metadata/{metadata_id}'
  1948. method='DELETE'
  1949. title='ナレッジメタデータを削除'
  1950. name='#delete_metadata'
  1951. />
  1952. <Row>
  1953. <Col>
  1954. ### パス
  1955. <Properties>
  1956. <Property name='dataset_id' type='string' key='dataset_id'>
  1957. ナレッジ ID
  1958. </Property>
  1959. <Property name='metadata_id' type='string' key='metadata_id'>
  1960. メタデータ ID
  1961. </Property>
  1962. </Properties>
  1963. </Col>
  1964. <Col sticky>
  1965. <CodeGroup
  1966. title="リクエスト"
  1967. tag="DELETE"
  1968. label="/datasets/{dataset_id}/metadata/{metadata_id}"
  1969. targetCode={`curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/metadata/{metadata_id}' \\\n--header 'Authorization: Bearer {api_key}'`}
  1970. >
  1971. ```bash {{ title: 'cURL' }}
  1972. ```
  1973. </CodeGroup>
  1974. </Col>
  1975. </Row>
  1976. <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
  1977. <Heading
  1978. url='/datasets/{dataset_id}/metadata/built-in/{action}'
  1979. method='POST'
  1980. title='組み込みメタデータを無効化または有効化'
  1981. name='#toggle_metadata'
  1982. />
  1983. <Row>
  1984. <Col>
  1985. ### パス
  1986. <Properties>
  1987. <Property name='dataset_id' type='string' key='dataset_id'>
  1988. ナレッジ ID
  1989. </Property>
  1990. <Property name='action' type='string' key='action'>
  1991. disable/enable
  1992. </Property>
  1993. </Properties>
  1994. </Col>
  1995. <Col sticky>
  1996. <CodeGroup
  1997. title="リクエスト"
  1998. tag="POST"
  1999. label="/datasets/{dataset_id}/metadata/built-in/{action}"
  2000. targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/metadata/built-in/{action}' \\\n--header 'Authorization: Bearer {api_key}'`}
  2001. >
  2002. ```bash {{ title: 'cURL' }}
  2003. ```
  2004. </CodeGroup>
  2005. </Col>
  2006. </Row>
  2007. <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
  2008. <Heading
  2009. url='/datasets/{dataset_id}/documents/metadata'
  2010. method='POST'
  2011. title='ドキュメントメタデータを更新'
  2012. name='#update_documents_metadata'
  2013. />
  2014. <Row>
  2015. <Col>
  2016. ### パス
  2017. <Properties>
  2018. <Property name='dataset_id' type='string' key='dataset_id'>
  2019. ナレッジ ID
  2020. </Property>
  2021. </Properties>
  2022. ### リクエストボディ
  2023. <Properties>
  2024. <Property name='operation_data' type='object list' key='segments'>
  2025. - <code>document_id</code> (string) ドキュメント ID
  2026. - <code>metadata_list</code> (list) メタデータリスト
  2027. - <code>id</code> (string) メタデータ ID
  2028. - <code>value</code> (string) メタデータの値
  2029. - <code>name</code> (string) メタデータの名前
  2030. </Property>
  2031. </Properties>
  2032. </Col>
  2033. <Col sticky>
  2034. <CodeGroup
  2035. title="リクエスト"
  2036. tag="POST"
  2037. label="/datasets/{dataset_id}/documents/metadata"
  2038. 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"}]}]}'`}
  2039. >
  2040. ```bash {{ title: 'cURL' }}
  2041. ```
  2042. </CodeGroup>
  2043. </Col>
  2044. </Row>
  2045. <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
  2046. <Heading
  2047. url='/datasets/{dataset_id}/metadata'
  2048. method='GET'
  2049. title='ナレッジメタデータリストを取得'
  2050. name='#dataset_metadata_list'
  2051. />
  2052. <Row>
  2053. <Col>
  2054. ### パス
  2055. <Properties>
  2056. <Property name='dataset_id' type='string' key='dataset_id'>
  2057. ナレッジ ID
  2058. </Property>
  2059. </Properties>
  2060. </Col>
  2061. <Col sticky>
  2062. <CodeGroup
  2063. title="リクエスト"
  2064. tag="GET"
  2065. label="/datasets/{dataset_id}/metadata"
  2066. targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/metadata' \\\n--header 'Authorization: Bearer {api_key}'`}
  2067. >
  2068. ```bash {{ title: 'cURL' }}
  2069. ```
  2070. </CodeGroup>
  2071. <CodeGroup title="レスポンス">
  2072. ```json {{ title: 'Response' }}
  2073. {
  2074. "doc_metadata": [
  2075. {
  2076. "id": "",
  2077. "name": "name",
  2078. "type": "string",
  2079. "use_count": 0,
  2080. },
  2081. ...
  2082. ],
  2083. "built_in_field_enabled": true
  2084. }
  2085. ```
  2086. </CodeGroup>
  2087. </Col>
  2088. </Row>
  2089. <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
  2090. <Heading
  2091. url='/datasets/tags'
  2092. method='POST'
  2093. title='ナレッジベースタイプタグの新規作成'
  2094. name='#create_new_knowledge_tag'
  2095. />
  2096. <Row>
  2097. <Col>
  2098. ### Request Body
  2099. <Properties>
  2100. <Property name='name' type='string'>
  2101. (text) 新しいタグ名、必須、最大長 50 文字
  2102. </Property>
  2103. </Properties>
  2104. </Col>
  2105. <Col sticky>
  2106. <CodeGroup
  2107. title="Request"
  2108. tag="POST"
  2109. label="/datasets/tags"
  2110. 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"}'`}
  2111. >
  2112. ```bash {{ title: 'cURL' }}
  2113. curl --location --request POST '${props.apiBaseUrl}/datasets/tags' \
  2114. --header 'Authorization: Bearer {api_key}' \
  2115. --header 'Content-Type: application/json' \
  2116. --data-raw '{"name": "testtag1"}'
  2117. ```
  2118. </CodeGroup>
  2119. <CodeGroup title="Response">
  2120. ```json {{ title: 'Response' }}
  2121. {
  2122. "id": "eddb66c2-04a1-4e3a-8cb2-75abd01e12a6",
  2123. "name": "testtag1",
  2124. "type": "knowledge",
  2125. "binding_count": 0
  2126. }
  2127. ```
  2128. </CodeGroup>
  2129. </Col>
  2130. </Row>
  2131. <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
  2132. <Heading
  2133. url='/datasets/tags'
  2134. method='GET'
  2135. title='ナレッジベースタイプタグの取得'
  2136. name='#get_knowledge_type_tags'
  2137. />
  2138. <Row>
  2139. <Col>
  2140. ### Request Body
  2141. </Col>
  2142. <Col sticky>
  2143. <CodeGroup
  2144. title="Request"
  2145. tag="GET"
  2146. label="/datasets/tags"
  2147. targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets/tags' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json'`}
  2148. >
  2149. ```bash {{ title: 'cURL' }}
  2150. curl --location --request GET '${props.apiBaseUrl}/datasets/tags' \
  2151. --header 'Authorization: Bearer {api_key}' \
  2152. --header 'Content-Type: application/json'
  2153. ```
  2154. </CodeGroup>
  2155. <CodeGroup title="Response">
  2156. ```json {{ title: 'Response' }}
  2157. [
  2158. {
  2159. "id": "39d6934c-ed36-463d-b4a7-377fa1503dc0",
  2160. "name": "testtag1",
  2161. "type": "knowledge",
  2162. "binding_count": "0"
  2163. },
  2164. ...
  2165. ]
  2166. ```
  2167. </CodeGroup>
  2168. </Col>
  2169. </Row>
  2170. <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
  2171. <Heading
  2172. url='/datasets/tags'
  2173. method='PATCH'
  2174. title='ナレッジベースタイプタグ名の変更'
  2175. name='#modify_knowledge_tag_name'
  2176. />
  2177. <Row>
  2178. <Col>
  2179. ### Request Body
  2180. <Properties>
  2181. <Property name='name' type='string'>
  2182. (text) 変更後のタグ名、必須、最大長 50 文字
  2183. </Property>
  2184. <Property name='tag_id' type='string'>
  2185. (text) タグ ID、必須
  2186. </Property>
  2187. </Properties>
  2188. </Col>
  2189. <Col sticky>
  2190. <CodeGroup
  2191. title="Request"
  2192. tag="PATCH"
  2193. label="/datasets/tags"
  2194. 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"}`}
  2195. >
  2196. ```bash {{ title: 'cURL' }}
  2197. curl --location --request PATCH '${props.apiBaseUrl}/datasets/tags' \
  2198. --header 'Authorization: Bearer {api_key}' \
  2199. --header 'Content-Type: application/json' \
  2200. --data-raw '{"name": "testtag2", "tag_id": "e1a0a3db-ee34-4e04-842a-81555d5316fd"}'
  2201. ```
  2202. </CodeGroup>
  2203. <CodeGroup title="Response">
  2204. ```json {{ title: 'Response' }}
  2205. {
  2206. "id": "eddb66c2-04a1-4e3a-8cb2-75abd01e12a6",
  2207. "name": "tag-renamed",
  2208. "type": "knowledge",
  2209. "binding_count": 0
  2210. }
  2211. ```
  2212. </CodeGroup>
  2213. </Col>
  2214. </Row>
  2215. <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
  2216. <Heading
  2217. url='/datasets/tags'
  2218. method='DELETE'
  2219. title='ナレッジベースタイプタグの削除'
  2220. name='#delete_knowledge_tag'
  2221. />
  2222. <Row>
  2223. <Col>
  2224. ### Request Body
  2225. <Properties>
  2226. <Property name='tag_id' type='string'>
  2227. (text) タグ ID、必須
  2228. </Property>
  2229. </Properties>
  2230. </Col>
  2231. <Col sticky>
  2232. <CodeGroup
  2233. title="Request"
  2234. tag="DELETE"
  2235. label="/datasets/tags"
  2236. 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"}`}
  2237. >
  2238. ```bash {{ title: 'cURL' }}
  2239. curl --location --request DELETE '${props.apiBaseUrl}/datasets/tags' \
  2240. --header 'Authorization: Bearer {api_key}' \
  2241. --header 'Content-Type: application/json' \
  2242. --data-raw '{"tag_id": "e1a0a3db-ee34-4e04-842a-81555d5316fd"}'
  2243. ```
  2244. </CodeGroup>
  2245. <CodeGroup title="Response">
  2246. ```json {{ title: 'Response' }}
  2247. {"result": "success"}
  2248. ```
  2249. </CodeGroup>
  2250. </Col>
  2251. </Row>
  2252. <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
  2253. <Heading
  2254. url='/datasets/tags/binding'
  2255. method='POST'
  2256. title='ナレッジベースをナレッジベースタイプタグに紐付け'
  2257. name='#bind_dataset_to_knowledge_tag'
  2258. />
  2259. <Row>
  2260. <Col>
  2261. ### Request Body
  2262. <Properties>
  2263. <Property name='tag_ids' type='list'>
  2264. (list) タグ ID リスト、必須
  2265. </Property>
  2266. <Property name='target_id' type='string'>
  2267. (text) ナレッジベース ID、必須
  2268. </Property>
  2269. </Properties>
  2270. </Col>
  2271. <Col sticky>
  2272. <CodeGroup
  2273. title="Request"
  2274. tag="POST"
  2275. label="/datasets/tags/binding"
  2276. 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"}'`}
  2277. >
  2278. ```bash {{ title: 'cURL' }}
  2279. curl --location --request POST '${props.apiBaseUrl}/datasets/tags/binding' \
  2280. --header 'Authorization: Bearer {api_key}' \
  2281. --header 'Content-Type: application/json' \
  2282. --data-raw '{"tag_ids": ["65cc29be-d072-4e26-adf4-2f727644da29","1e5348f3-d3ff-42b8-a1b7-0a86d518001a"], "target_id": "a932ea9f-fae1-4b2c-9b65-71c56e2cacd6"}'
  2283. ```
  2284. </CodeGroup>
  2285. <CodeGroup title="Response">
  2286. ```json {{ title: 'Response' }}
  2287. {"result": "success"}
  2288. ```
  2289. </CodeGroup>
  2290. </Col>
  2291. </Row>
  2292. <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
  2293. <Heading
  2294. url='/datasets/tags/unbinding'
  2295. method='POST'
  2296. title='ナレッジベースとナレッジベースタイプタグの紐付け解除'
  2297. name='#unbind_dataset_and_knowledge_tag'
  2298. />
  2299. <Row>
  2300. <Col>
  2301. ### Request Body
  2302. <Properties>
  2303. <Property name='tag_id' type='string'>
  2304. (text) タグ ID、必須
  2305. </Property>
  2306. <Property name='target_id' type='string'>
  2307. (text) ナレッジベース ID、必須
  2308. </Property>
  2309. </Properties>
  2310. </Col>
  2311. <Col sticky>
  2312. <CodeGroup
  2313. title="Request"
  2314. tag="POST"
  2315. label="/datasets/tags/unbinding"
  2316. 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"}'`}
  2317. >
  2318. ```bash {{ title: 'cURL' }}
  2319. curl --location --request POST '${props.apiBaseUrl}/datasets/tags/unbinding' \
  2320. --header 'Authorization: Bearer {api_key}' \
  2321. --header 'Content-Type: application/json' \
  2322. --data-raw '{"tag_id": "1e5348f3-d3ff-42b8-a1b7-0a86d518001a", "target_id": "a932ea9f-fae1-4b2c-9b65-71c56e2cacd6"}'
  2323. ```
  2324. </CodeGroup>
  2325. <CodeGroup title="Response">
  2326. ```json {{ title: 'Response' }}
  2327. {"result": "success"}
  2328. ```
  2329. </CodeGroup>
  2330. </Col>
  2331. </Row>
  2332. <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
  2333. <Heading
  2334. url='/datasets/<uuid:dataset_id>/tags'
  2335. method='POST'
  2336. title='ナレッジベースに紐付けられたタグの照会'
  2337. name='#query_dataset_tags'
  2338. />
  2339. <Row>
  2340. <Col>
  2341. ### Path
  2342. <Properties>
  2343. <Property name='dataset_id' type='string'>
  2344. (text) ナレッジベース ID
  2345. </Property>
  2346. </Properties>
  2347. </Col>
  2348. <Col sticky>
  2349. <CodeGroup
  2350. title="Request"
  2351. tag="POST"
  2352. label="/datasets/<uuid:dataset_id>/tags"
  2353. 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`}
  2354. >
  2355. ```bash {{ title: 'cURL' }}
  2356. curl --location --request POST '${props.apiBaseUrl}/datasets/<uuid:dataset_id>/tags' \
  2357. --header 'Authorization: Bearer {api_key}' \
  2358. --header 'Content-Type: application/json' \
  2359. ```
  2360. </CodeGroup>
  2361. <CodeGroup title="Response">
  2362. ```json {{ title: 'Response' }}
  2363. {
  2364. "data":
  2365. [
  2366. {"id": "4a601f4f-f8a2-4166-ae7c-58c3b252a524",
  2367. "name": "123"
  2368. },
  2369. ...
  2370. ],
  2371. "total": 3
  2372. }
  2373. ```
  2374. </CodeGroup>
  2375. </Col>
  2376. </Row>
  2377. <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
  2378. <Row>
  2379. <Col>
  2380. ### エラーメッセージ
  2381. <Properties>
  2382. <Property name='code' type='string' key='code'>
  2383. エラーコード
  2384. </Property>
  2385. </Properties>
  2386. <Properties>
  2387. <Property name='status' type='number' key='status'>
  2388. エラーステータス
  2389. </Property>
  2390. </Properties>
  2391. <Properties>
  2392. <Property name='message' type='string' key='message'>
  2393. エラーメッセージ
  2394. </Property>
  2395. </Properties>
  2396. </Col>
  2397. <Col>
  2398. <CodeGroup title="例">
  2399. ```json {{ title: 'Response' }}
  2400. {
  2401. "code": "no_file_uploaded",
  2402. "message": "Please upload your file.",
  2403. "status": 400
  2404. }
  2405. ```
  2406. </CodeGroup>
  2407. </Col>
  2408. </Row>
  2409. <table className="max-w-auto border-collapse border border-slate-400" style={{ maxWidth: 'none', width: 'auto' }}>
  2410. <thead style={{ background: '#f9fafc' }}>
  2411. <tr>
  2412. <th className="p-2 border border-slate-300">code</th>
  2413. <th className="p-2 border border-slate-300">status</th>
  2414. <th className="p-2 border border-slate-300">message</th>
  2415. </tr>
  2416. </thead>
  2417. <tbody>
  2418. <tr>
  2419. <td className="p-2 border border-slate-300">no_file_uploaded</td>
  2420. <td className="p-2 border border-slate-300">400</td>
  2421. <td className="p-2 border border-slate-300">Please upload your file.</td>
  2422. </tr>
  2423. <tr>
  2424. <td className="p-2 border border-slate-300">too_many_files</td>
  2425. <td className="p-2 border border-slate-300">400</td>
  2426. <td className="p-2 border border-slate-300">Only one file is allowed.</td>
  2427. </tr>
  2428. <tr>
  2429. <td className="p-2 border border-slate-300">file_too_large</td>
  2430. <td className="p-2 border border-slate-300">413</td>
  2431. <td className="p-2 border border-slate-300">File size exceeded.</td>
  2432. </tr>
  2433. <tr>
  2434. <td className="p-2 border border-slate-300">unsupported_file_type</td>
  2435. <td className="p-2 border border-slate-300">415</td>
  2436. <td className="p-2 border border-slate-300">File type not allowed.</td>
  2437. </tr>
  2438. <tr>
  2439. <td className="p-2 border border-slate-300">high_quality_dataset_only</td>
  2440. <td className="p-2 border border-slate-300">400</td>
  2441. <td className="p-2 border border-slate-300">Current operation only supports 'high-quality' datasets.</td>
  2442. </tr>
  2443. <tr>
  2444. <td className="p-2 border border-slate-300">dataset_not_initialized</td>
  2445. <td className="p-2 border border-slate-300">400</td>
  2446. <td className="p-2 border border-slate-300">The dataset is still being initialized or indexing. Please wait a moment.</td>
  2447. </tr>
  2448. <tr>
  2449. <td className="p-2 border border-slate-300">archived_document_immutable</td>
  2450. <td className="p-2 border border-slate-300">403</td>
  2451. <td className="p-2 border border-slate-300">The archived document is not editable.</td>
  2452. </tr>
  2453. <tr>
  2454. <td className="p-2 border border-slate-300">dataset_name_duplicate</td>
  2455. <td className="p-2 border border-slate-300">409</td>
  2456. <td className="p-2 border border-slate-300">The dataset name already exists. Please modify your dataset name.</td>
  2457. </tr>
  2458. <tr>
  2459. <td className="p-2 border border-slate-300">invalid_action</td>
  2460. <td className="p-2 border border-slate-300">400</td>
  2461. <td className="p-2 border border-slate-300">Invalid action.</td>
  2462. </tr>
  2463. <tr>
  2464. <td className="p-2 border border-slate-300">document_already_finished</td>
  2465. <td className="p-2 border border-slate-300">400</td>
  2466. <td className="p-2 border border-slate-300">The document has been processed. Please refresh the page or go to the document details.</td>
  2467. </tr>
  2468. <tr>
  2469. <td className="p-2 border border-slate-300">document_indexing</td>
  2470. <td className="p-2 border border-slate-300">400</td>
  2471. <td className="p-2 border border-slate-300">The document is being processed and cannot be edited.</td>
  2472. </tr>
  2473. <tr>
  2474. <td className="p-2 border border-slate-300">invalid_metadata</td>
  2475. <td className="p-2 border border-slate-300">400</td>
  2476. <td className="p-2 border border-slate-300">The metadata content is incorrect. Please check and verify.</td>
  2477. </tr>
  2478. </tbody>
  2479. </table>
  2480. <div className="pb-4" />