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 85KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415
  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 className='ml-0 mr-0' />
  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 className='ml-0 mr-0' />
  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 className='ml-0 mr-0' />
  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 className='ml-0 mr-0' />
  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 className='ml-0 mr-0' />
  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 className='ml-0 mr-0' />
  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 className='ml-0 mr-0' />
  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 className='ml-0 mr-0' />
  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 className='ml-0 mr-0' />
  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 className='ml-0 mr-0' />
  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 className='ml-0 mr-0' />
  841. <Heading
  842. url='/datasets/{dataset_id}/documents/{document_id}/segments'
  843. method='POST'
  844. title='ドキュメントにチャンクを追加'
  845. name='#create_new_segment'
  846. />
  847. <Row>
  848. <Col>
  849. ### パス
  850. <Properties>
  851. <Property name='dataset_id' type='string' key='dataset_id'>
  852. ナレッジ ID
  853. </Property>
  854. <Property name='document_id' type='string' key='document_id'>
  855. ドキュメント ID
  856. </Property>
  857. </Properties>
  858. ### リクエストボディ
  859. <Properties>
  860. <Property name='segments' type='object list' key='segments'>
  861. - <code>content</code> (text) テキスト内容 / 質問内容、必須
  862. - <code>answer</code> (text) 回答内容、ナレッジのモードが Q&A モードの場合に値を渡します (オプション)
  863. - <code>keywords</code> (list) キーワード (オプション)
  864. </Property>
  865. </Properties>
  866. </Col>
  867. <Col sticky>
  868. <CodeGroup
  869. title="リクエスト"
  870. tag="POST"
  871. label="/datasets/{dataset_id}/documents/{document_id}/segments"
  872. 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"]}]}'`}
  873. >
  874. ```bash {{ title: 'cURL' }}
  875. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments' \
  876. --header 'Authorization: Bearer {api_key}' \
  877. --header 'Content-Type: application/json' \
  878. --data-raw '{
  879. "segments": [
  880. {
  881. "content": "1",
  882. "answer": "1",
  883. "keywords": ["a"]
  884. }
  885. ]
  886. }'
  887. ```
  888. </CodeGroup>
  889. <CodeGroup title="レスポンス">
  890. ```json {{ title: 'Response' }}
  891. {
  892. "data": [{
  893. "id": "",
  894. "position": 1,
  895. "document_id": "",
  896. "content": "1",
  897. "answer": "1",
  898. "word_count": 25,
  899. "tokens": 0,
  900. "keywords": [
  901. "a"
  902. ],
  903. "index_node_id": "",
  904. "index_node_hash": "",
  905. "hit_count": 0,
  906. "enabled": true,
  907. "disabled_at": null,
  908. "disabled_by": null,
  909. "status": "completed",
  910. "created_by": "",
  911. "created_at": 1695312007,
  912. "indexing_at": 1695312007,
  913. "completed_at": 1695312007,
  914. "error": null,
  915. "stopped_at": null
  916. }],
  917. "doc_form": "text_model"
  918. }
  919. ```
  920. </CodeGroup>
  921. </Col>
  922. </Row>
  923. <hr className='ml-0 mr-0' />
  924. <Heading
  925. url='/datasets/{dataset_id}/documents/{document_id}/segments'
  926. method='GET'
  927. title='ドキュメントからチャンクを取得'
  928. name='#get_segment'
  929. />
  930. <Row>
  931. <Col>
  932. ### パス
  933. <Properties>
  934. <Property name='dataset_id' type='string' key='dataset_id'>
  935. ナレッジ ID
  936. </Property>
  937. <Property name='document_id' type='string' key='document_id'>
  938. ドキュメント ID
  939. </Property>
  940. </Properties>
  941. ### クエリ
  942. <Properties>
  943. <Property name='keyword' type='string' key='keyword'>
  944. キーワード (オプション)
  945. </Property>
  946. <Property name='status' type='string' key='status'>
  947. 検索ステータス、completed
  948. </Property>
  949. <Property name='page' type='string' key='page'>
  950. ページ番号 (オプション)
  951. </Property>
  952. <Property name='limit' type='string' key='limit'>
  953. 返されるアイテム数、デフォルトは 20、範囲は 1-100 (オプション)
  954. </Property>
  955. </Properties>
  956. </Col>
  957. <Col sticky>
  958. <CodeGroup
  959. title="リクエスト"
  960. tag="GET"
  961. label="/datasets/{dataset_id}/documents/{document_id}/segments"
  962. 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'`}
  963. >
  964. ```bash {{ title: 'cURL' }}
  965. curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments' \
  966. --header 'Authorization: Bearer {api_key}' \
  967. --header 'Content-Type: application/json'
  968. ```
  969. </CodeGroup>
  970. <CodeGroup title="レスポンス">
  971. ```json {{ title: 'Response' }}
  972. {
  973. "data": [{
  974. "id": "",
  975. "position": 1,
  976. "document_id": "",
  977. "content": "1",
  978. "answer": "1",
  979. "word_count": 25,
  980. "tokens": 0,
  981. "keywords": [
  982. "a"
  983. ],
  984. "index_node_id": "",
  985. "index_node_hash": "",
  986. "hit_count": 0,
  987. "enabled": true,
  988. "disabled_at": null,
  989. "disabled_by": null,
  990. "status": "completed",
  991. "created_by": "",
  992. "created_at": 1695312007,
  993. "indexing_at": 1695312007,
  994. "completed_at": 1695312007,
  995. "error": null,
  996. "stopped_at": null
  997. }],
  998. "doc_form": "text_model",
  999. "has_more": false,
  1000. "limit": 20,
  1001. "total": 9,
  1002. "page": 1
  1003. }
  1004. ```
  1005. </CodeGroup>
  1006. </Col>
  1007. </Row>
  1008. <hr className='ml-0 mr-0' />
  1009. <Heading
  1010. url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}'
  1011. method='GET'
  1012. title='ドキュメントセグメントの詳細を表示'
  1013. name='#view_document_segment'
  1014. />
  1015. <Row>
  1016. <Col>
  1017. 指定されたナレッジベース内の特定のドキュメントセグメントの詳細を表示します
  1018. ### パス
  1019. <Properties>
  1020. <Property name='dataset_id' type='string' key='dataset_id'>
  1021. ナレッジベースID
  1022. </Property>
  1023. <Property name='document_id' type='string' key='document_id'>
  1024. ドキュメントID
  1025. </Property>
  1026. <Property name='segment_id' type='string' key='segment_id'>
  1027. セグメントID
  1028. </Property>
  1029. </Properties>
  1030. </Col>
  1031. <Col sticky>
  1032. <CodeGroup
  1033. title="リクエスト"
  1034. tag="GET"
  1035. label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}"
  1036. targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}' \\\n--header 'Authorization: Bearer {api_key}'`}
  1037. >
  1038. ```bash {{ title: 'cURL' }}
  1039. curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}' \
  1040. --header 'Authorization: Bearer {api_key}'
  1041. ```
  1042. </CodeGroup>
  1043. <CodeGroup title="レスポンス">
  1044. ```json {{ title: 'Response' }}
  1045. {
  1046. "data": {
  1047. "id": "セグメントID",
  1048. "position": 2,
  1049. "document_id": "ドキュメントID",
  1050. "content": "セグメント内容テキスト",
  1051. "sign_content": "署名内容テキスト",
  1052. "answer": "回答内容(Q&Aモードの場合)",
  1053. "word_count": 470,
  1054. "tokens": 382,
  1055. "keywords": ["キーワード1", "キーワード2"],
  1056. "index_node_id": "インデックスノードID",
  1057. "index_node_hash": "インデックスノードハッシュ",
  1058. "hit_count": 0,
  1059. "enabled": true,
  1060. "status": "completed",
  1061. "created_by": "作成者ID",
  1062. "created_at": 作成タイムスタンプ,
  1063. "updated_at": 更新タイムスタンプ,
  1064. "indexing_at": インデックス作成タイムスタンプ,
  1065. "completed_at": 完了タイムスタンプ,
  1066. "error": null,
  1067. "child_chunks": []
  1068. },
  1069. "doc_form": "text_model"
  1070. }
  1071. ```
  1072. </CodeGroup>
  1073. </Col>
  1074. </Row>
  1075. <hr className='ml-0 mr-0' />
  1076. <Heading
  1077. method='DELETE'
  1078. title='ドキュメント内のチャンクを削除'
  1079. name='#delete_segment'
  1080. />
  1081. <Row>
  1082. <Col>
  1083. ### パス
  1084. <Properties>
  1085. <Property name='dataset_id' type='string' key='dataset_id'>
  1086. ナレッジ ID
  1087. </Property>
  1088. <Property name='document_id' type='string' key='document_id'>
  1089. ドキュメント ID
  1090. </Property>
  1091. <Property name='segment_id' type='string' key='segment_id'>
  1092. ドキュメントセグメント ID
  1093. </Property>
  1094. </Properties>
  1095. </Col>
  1096. <Col sticky>
  1097. <CodeGroup
  1098. title="リクエスト"
  1099. tag="DELETE"
  1100. label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}"
  1101. 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'`}
  1102. >
  1103. ```bash {{ title: 'cURL' }}
  1104. curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}' \
  1105. --header 'Authorization: Bearer {api_key}' \
  1106. --header 'Content-Type: application/json'
  1107. ```
  1108. </CodeGroup>
  1109. <CodeGroup title="レスポンス">
  1110. ```text {{ title: 'レスポンス' }}
  1111. 204 No Content
  1112. ```
  1113. </CodeGroup>
  1114. </Col>
  1115. </Row>
  1116. <hr className='ml-0 mr-0' />
  1117. <Heading
  1118. method='POST'
  1119. title='ドキュメント内のチャンクを更新'
  1120. name='#update_segment'
  1121. />
  1122. <Row>
  1123. <Col>
  1124. ### POST
  1125. <Properties>
  1126. <Property name='dataset_id' type='string' key='dataset_id'>
  1127. ナレッジ ID
  1128. </Property>
  1129. <Property name='document_id' type='string' key='document_id'>
  1130. ドキュメント ID
  1131. </Property>
  1132. <Property name='segment_id' type='string' key='segment_id'>
  1133. ドキュメントセグメント ID
  1134. </Property>
  1135. </Properties>
  1136. ### リクエストボディ
  1137. <Properties>
  1138. <Property name='segment' type='object' key='segment'>
  1139. - <code>content</code> (text) テキスト内容 / 質問内容、必須
  1140. - <code>answer</code> (text) 回答内容、ナレッジが Q&A モードの場合に値を渡します (オプション)
  1141. - <code>keywords</code> (list) キーワード (オプション)
  1142. - <code>enabled</code> (bool) False / true (オプション)
  1143. - <code>regenerate_child_chunks</code> (bool) 子チャンクを再生成するかどうか (オプション)
  1144. </Property>
  1145. </Properties>
  1146. </Col>
  1147. <Col sticky>
  1148. <CodeGroup
  1149. title="リクエスト"
  1150. tag="POST"
  1151. label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}"
  1152. 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}}'`}
  1153. >
  1154. ```bash {{ title: 'cURL' }}
  1155. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}' \
  1156. --header 'Content-Type: application/json' \
  1157. --data-raw '{
  1158. "segment": {
  1159. "content": "1",
  1160. "answer": "1",
  1161. "keywords": ["a"],
  1162. "enabled": false
  1163. }
  1164. }'
  1165. ```
  1166. </CodeGroup>
  1167. <CodeGroup title="レスポンス">
  1168. ```json {{ title: 'Response' }}
  1169. {
  1170. "data": {
  1171. "id": "",
  1172. "position": 1,
  1173. "document_id": "",
  1174. "content": "1",
  1175. "answer": "1",
  1176. "word_count": 25,
  1177. "tokens": 0,
  1178. "keywords": [
  1179. "a"
  1180. ],
  1181. "index_node_id": "",
  1182. "index_node_hash": "",
  1183. "hit_count": 0,
  1184. "enabled": true,
  1185. "disabled_at": null,
  1186. "disabled_by": null,
  1187. "status": "completed",
  1188. "created_by": "",
  1189. "created_at": 1695312007,
  1190. "indexing_at": 1695312007,
  1191. "completed_at": 1695312007,
  1192. "error": null,
  1193. "stopped_at": null
  1194. },
  1195. "doc_form": "text_model"
  1196. }
  1197. ```
  1198. </CodeGroup>
  1199. </Col>
  1200. </Row>
  1201. <hr className='ml-0 mr-0' />
  1202. <Heading
  1203. url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks'
  1204. method='POST'
  1205. title='子チャンクを作成'
  1206. name='#create_child_chunk'
  1207. />
  1208. <Row>
  1209. <Col>
  1210. ### パス
  1211. <Properties>
  1212. <Property name='dataset_id' type='string' key='dataset_id'>
  1213. ナレッジ ID
  1214. </Property>
  1215. <Property name='document_id' type='string' key='document_id'>
  1216. ドキュメント ID
  1217. </Property>
  1218. <Property name='segment_id' type='string' key='segment_id'>
  1219. セグメント ID
  1220. </Property>
  1221. </Properties>
  1222. ### リクエストボディ
  1223. <Properties>
  1224. <Property name='content' type='string' key='content'>
  1225. 子チャンクの内容
  1226. </Property>
  1227. </Properties>
  1228. </Col>
  1229. <Col sticky>
  1230. <CodeGroup
  1231. title="リクエスト"
  1232. tag="POST"
  1233. label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks"
  1234. 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"}'`}
  1235. >
  1236. ```bash {{ title: 'cURL' }}
  1237. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks' \
  1238. --header 'Authorization: Bearer {api_key}' \
  1239. --header 'Content-Type: application/json' \
  1240. --data-raw '{
  1241. "content": "Child chunk content"
  1242. }'
  1243. ```
  1244. </CodeGroup>
  1245. <CodeGroup title="レスポンス">
  1246. ```json {{ title: 'Response' }}
  1247. {
  1248. "data": {
  1249. "id": "",
  1250. "segment_id": "",
  1251. "content": "Child chunk content",
  1252. "word_count": 25,
  1253. "tokens": 0,
  1254. "index_node_id": "",
  1255. "index_node_hash": "",
  1256. "status": "completed",
  1257. "created_by": "",
  1258. "created_at": 1695312007,
  1259. "indexing_at": 1695312007,
  1260. "completed_at": 1695312007,
  1261. "error": null,
  1262. "stopped_at": null
  1263. }
  1264. }
  1265. ```
  1266. </CodeGroup>
  1267. </Col>
  1268. </Row>
  1269. <hr className='ml-0 mr-0' />
  1270. <Heading
  1271. url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks'
  1272. method='GET'
  1273. title='子チャンクを取得'
  1274. name='#get_child_chunks'
  1275. />
  1276. <Row>
  1277. <Col>
  1278. ### パス
  1279. <Properties>
  1280. <Property name='dataset_id' type='string' key='dataset_id'>
  1281. ナレッジ ID
  1282. </Property>
  1283. <Property name='document_id' type='string' key='document_id'>
  1284. ドキュメント ID
  1285. </Property>
  1286. <Property name='segment_id' type='string' key='segment_id'>
  1287. セグメント ID
  1288. </Property>
  1289. </Properties>
  1290. ### クエリ
  1291. <Properties>
  1292. <Property name='keyword' type='string' key='keyword'>
  1293. 検索キーワード (オプション)
  1294. </Property>
  1295. <Property name='page' type='integer' key='page'>
  1296. ページ番号 (オプション、デフォルト: 1)
  1297. </Property>
  1298. <Property name='limit' type='integer' key='limit'>
  1299. ページあたりのアイテム数 (オプション、デフォルト: 20、最大: 100)
  1300. </Property>
  1301. </Properties>
  1302. </Col>
  1303. <Col sticky>
  1304. <CodeGroup
  1305. title="リクエスト"
  1306. tag="GET"
  1307. label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks"
  1308. 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}'`}
  1309. >
  1310. ```bash {{ title: 'cURL' }}
  1311. curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks?page=1&limit=20' \
  1312. --header 'Authorization: Bearer {api_key}'
  1313. ```
  1314. </CodeGroup>
  1315. <CodeGroup title="レスポンス">
  1316. ```json {{ title: 'Response' }}
  1317. {
  1318. "data": [{
  1319. "id": "",
  1320. "segment_id": "",
  1321. "content": "Child chunk content",
  1322. "word_count": 25,
  1323. "tokens": 0,
  1324. "index_node_id": "",
  1325. "index_node_hash": "",
  1326. "status": "completed",
  1327. "created_by": "",
  1328. "created_at": 1695312007,
  1329. "indexing_at": 1695312007,
  1330. "completed_at": 1695312007,
  1331. "error": null,
  1332. "stopped_at": null
  1333. }],
  1334. "total": 1,
  1335. "total_pages": 1,
  1336. "page": 1,
  1337. "limit": 20
  1338. }
  1339. ```
  1340. </CodeGroup>
  1341. </Col>
  1342. </Row>
  1343. <hr className='ml-0 mr-0' />
  1344. <Heading
  1345. url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}'
  1346. method='DELETE'
  1347. title='子チャンクを削除'
  1348. name='#delete_child_chunk'
  1349. />
  1350. <Row>
  1351. <Col>
  1352. ### パス
  1353. <Properties>
  1354. <Property name='dataset_id' type='string' key='dataset_id'>
  1355. ナレッジ ID
  1356. </Property>
  1357. <Property name='document_id' type='string' key='document_id'>
  1358. ドキュメント ID
  1359. </Property>
  1360. <Property name='segment_id' type='string' key='segment_id'>
  1361. セグメント ID
  1362. </Property>
  1363. <Property name='child_chunk_id' type='string' key='child_chunk_id'>
  1364. 子チャンク ID
  1365. </Property>
  1366. </Properties>
  1367. </Col>
  1368. <Col sticky>
  1369. <CodeGroup
  1370. title="リクエスト"
  1371. tag="DELETE"
  1372. label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}"
  1373. targetCode={`curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/segments/{segment_id}/child_chunks/{child_chunk_id}' \\\n--header 'Authorization: Bearer {api_key}'`}
  1374. >
  1375. ```bash {{ title: 'cURL' }}
  1376. curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/segments/{segment_id}/child_chunks/{child_chunk_id}' \
  1377. --header 'Authorization: Bearer {api_key}'
  1378. ```
  1379. </CodeGroup>
  1380. <CodeGroup title="レスポンス">
  1381. ```text {{ title: 'レスポンス' }}
  1382. 204 No Content
  1383. ```
  1384. </CodeGroup>
  1385. </Col>
  1386. </Row>
  1387. <hr className='ml-0 mr-0' />
  1388. <Heading
  1389. url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}'
  1390. method='PATCH'
  1391. title='子チャンクを更新'
  1392. name='#update_child_chunk'
  1393. />
  1394. <Row>
  1395. <Col>
  1396. ### パス
  1397. <Properties>
  1398. <Property name='dataset_id' type='string' key='dataset_id'>
  1399. ナレッジ ID
  1400. </Property>
  1401. <Property name='document_id' type='string' key='document_id'>
  1402. ドキュメント ID
  1403. </Property>
  1404. <Property name='segment_id' type='string' key='segment_id'>
  1405. セグメント ID
  1406. </Property>
  1407. <Property name='child_chunk_id' type='string' key='child_chunk_id'>
  1408. 子チャンク ID
  1409. </Property>
  1410. </Properties>
  1411. ### リクエストボディ
  1412. <Properties>
  1413. <Property name='content' type='string' key='content'>
  1414. 子チャンクの内容
  1415. </Property>
  1416. </Properties>
  1417. </Col>
  1418. <Col sticky>
  1419. <CodeGroup
  1420. title="リクエスト"
  1421. tag="PATCH"
  1422. label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}"
  1423. 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"}'`}
  1424. >
  1425. ```bash {{ title: 'cURL' }}
  1426. curl --location --request PATCH '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}' \
  1427. --header 'Authorization: Bearer {api_key}' \
  1428. --header 'Content-Type: application/json' \
  1429. --data-raw '{
  1430. "content": "Updated child chunk content"
  1431. }'
  1432. ```
  1433. </CodeGroup>
  1434. <CodeGroup title="レスポンス">
  1435. ```json {{ title: 'Response' }}
  1436. {
  1437. "data": {
  1438. "id": "",
  1439. "segment_id": "",
  1440. "content": "Updated child chunk content",
  1441. "word_count": 25,
  1442. "tokens": 0,
  1443. "index_node_id": "",
  1444. "index_node_hash": "",
  1445. "status": "completed",
  1446. "created_by": "",
  1447. "created_at": 1695312007,
  1448. "indexing_at": 1695312007,
  1449. "completed_at": 1695312007,
  1450. "error": null,
  1451. "stopped_at": null
  1452. }
  1453. }
  1454. ```
  1455. </CodeGroup>
  1456. </Col>
  1457. </Row>
  1458. <hr className='ml-0 mr-0' />
  1459. <Heading
  1460. url='/datasets/{dataset_id}/documents/{document_id}/upload-file'
  1461. method='GET'
  1462. title='アップロードファイルを取得'
  1463. name='#get_upload_file'
  1464. />
  1465. <Row>
  1466. <Col>
  1467. ### パス
  1468. <Properties>
  1469. <Property name='dataset_id' type='string' key='dataset_id'>
  1470. ナレッジ ID
  1471. </Property>
  1472. <Property name='document_id' type='string' key='document_id'>
  1473. ドキュメント ID
  1474. </Property>
  1475. </Properties>
  1476. </Col>
  1477. <Col sticky>
  1478. <CodeGroup
  1479. title="リクエスト"
  1480. tag="GET"
  1481. label="/datasets/{dataset_id}/documents/{document_id}/upload-file"
  1482. 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'`}
  1483. >
  1484. ```bash {{ title: 'cURL' }}
  1485. curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/upload-file' \
  1486. --header 'Authorization: Bearer {api_key}' \
  1487. --header 'Content-Type: application/json'
  1488. ```
  1489. </CodeGroup>
  1490. <CodeGroup title="レスポンス">
  1491. ```json {{ title: 'Response' }}
  1492. {
  1493. "id": "file_id",
  1494. "name": "file_name",
  1495. "size": 1024,
  1496. "extension": "txt",
  1497. "url": "preview_url",
  1498. "download_url": "download_url",
  1499. "mime_type": "text/plain",
  1500. "created_by": "user_id",
  1501. "created_at": 1728734540,
  1502. }
  1503. ```
  1504. </CodeGroup>
  1505. </Col>
  1506. </Row>
  1507. <hr className='ml-0 mr-0' />
  1508. <Heading
  1509. url='/datasets/{dataset_id}/retrieve'
  1510. method='POST'
  1511. title='ナレッジベースからチャンクを取得'
  1512. name='#dataset_retrieval'
  1513. />
  1514. <Row>
  1515. <Col>
  1516. ### パス
  1517. <Properties>
  1518. <Property name='dataset_id' type='string' key='dataset_id'>
  1519. ナレッジ ID
  1520. </Property>
  1521. </Properties>
  1522. ### リクエストボディ
  1523. <Properties>
  1524. <Property name='query' type='string' key='query'>
  1525. クエリキーワード
  1526. </Property>
  1527. <Property name='retrieval_model' type='object' key='retrieval_model'>
  1528. 検索パラメータ(オプション、入力されない場合はデフォルトの方法でリコールされます)
  1529. - <code>search_method</code> (text) 検索方法: 以下の4つのキーワードのいずれかが必要です
  1530. - <code>keyword_search</code> キーワード検索
  1531. - <code>semantic_search</code> セマンティック検索
  1532. - <code>full_text_search</code> 全文検索
  1533. - <code>hybrid_search</code> ハイブリッド検索
  1534. - <code>reranking_enable</code> (bool) 再ランキングを有効にするかどうか、検索モードがsemantic_searchまたはhybrid_searchの場合に必須(オプション)
  1535. - <code>reranking_mode</code> (object) 再ランキングモデル構成、再ランキングが有効な場合に必須
  1536. - <code>reranking_provider_name</code> (string) 再ランキングモデルプロバイダー
  1537. - <code>reranking_model_name</code> (string) 再ランキングモデル名
  1538. - <code>weights</code> (float) ハイブリッド検索モードでのセマンティック検索の重み設定
  1539. - <code>top_k</code> (integer) 返される結果の数(オプション)
  1540. - <code>score_threshold_enabled</code> (bool) スコア閾値を有効にするかどうか
  1541. - <code>score_threshold</code> (float) スコア閾値
  1542. - <code>metadata_filtering_conditions</code> (object) メタデータフィルタリング条件
  1543. - <code>logical_operator</code> (string) 論理演算子: <code>and</code> | <code>or</code>
  1544. - <code>conditions</code> (array[object]) 条件リスト
  1545. - <code>name</code> (string) メタデータフィールド名
  1546. - <code>comparison_operator</code> (string) 比較演算子、許可される値:
  1547. - 文字列比較:
  1548. - <code>contains</code>: 含む
  1549. - <code>not contains</code>: 含まない
  1550. - <code>start with</code>: で始まる
  1551. - <code>end with</code>: で終わる
  1552. - <code>is</code>: 等しい
  1553. - <code>is not</code>: 等しくない
  1554. - <code>empty</code>: 空
  1555. - <code>not empty</code>: 空でない
  1556. - 数値比較:
  1557. - <code>=</code>: 等しい
  1558. - <code>≠</code>: 等しくない
  1559. - <code>></code>: より大きい
  1560. - <code>< </code>: より小さい
  1561. - <code>≥</code>: 以上
  1562. - <code>≤</code>: 以下
  1563. - 時間比較:
  1564. - <code>before</code>: より前
  1565. - <code>after</code>: より後
  1566. - <code>value</code> (string|number|null) 比較値
  1567. </Property>
  1568. <Property name='external_retrieval_model' type='object' key='external_retrieval_model'>
  1569. 未使用フィールド
  1570. </Property>
  1571. </Properties>
  1572. </Col>
  1573. <Col sticky>
  1574. <CodeGroup
  1575. title="リクエスト"
  1576. tag="POST"
  1577. label="/datasets/{dataset_id}/retrieve"
  1578. 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 '{
  1579. "query": "test",
  1580. "retrieval_model": {
  1581. "search_method": "keyword_search",
  1582. "reranking_enable": false,
  1583. "reranking_mode": null,
  1584. "reranking_model": {
  1585. "reranking_provider_name": "",
  1586. "reranking_model_name": ""
  1587. },
  1588. "weights": null,
  1589. "top_k": 1,
  1590. "score_threshold_enabled": false,
  1591. "score_threshold": null,
  1592. "metadata_filtering_conditions": {
  1593. "logical_operator": "and",
  1594. "conditions": [
  1595. {
  1596. "name": "document_name",
  1597. "comparison_operator": "contains",
  1598. "value": "test"
  1599. }
  1600. ]
  1601. }
  1602. }
  1603. }'`}
  1604. >
  1605. ```bash {{ title: 'cURL' }}
  1606. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/retrieve' \
  1607. --header 'Authorization: Bearer {api_key}' \
  1608. --header 'Content-Type: application/json' \
  1609. --data-raw '{
  1610. "query": "test",
  1611. "retrieval_model": {
  1612. "search_method": "keyword_search",
  1613. "reranking_enable": false,
  1614. "reranking_mode": null,
  1615. "reranking_model": {
  1616. "reranking_provider_name": "",
  1617. "reranking_model_name": ""
  1618. },
  1619. "weights": null,
  1620. "top_k": 2,
  1621. "score_threshold_enabled": false,
  1622. "score_threshold": null
  1623. }
  1624. }'
  1625. ```
  1626. </CodeGroup>
  1627. <CodeGroup title="レスポンス">
  1628. ```json {{ title: 'Response' }}
  1629. {
  1630. "query": {
  1631. "content": "test"
  1632. },
  1633. "records": [
  1634. {
  1635. "segment": {
  1636. "id": "7fa6f24f-8679-48b3-bc9d-bdf28d73f218",
  1637. "position": 1,
  1638. "document_id": "a8c6c36f-9f5d-4d7a-8472-f5d7b75d71d2",
  1639. "content": "Operation guide",
  1640. "answer": null,
  1641. "word_count": 847,
  1642. "tokens": 280,
  1643. "keywords": [
  1644. "install",
  1645. "java",
  1646. "base",
  1647. "scripts",
  1648. "jdk",
  1649. "manual",
  1650. "internal",
  1651. "opens",
  1652. "add",
  1653. "vmoptions"
  1654. ],
  1655. "index_node_id": "39dd8443-d960-45a8-bb46-7275ad7fbc8e",
  1656. "index_node_hash": "0189157697b3c6a418ccf8264a09699f25858975578f3467c76d6bfc94df1d73",
  1657. "hit_count": 0,
  1658. "enabled": true,
  1659. "disabled_at": null,
  1660. "disabled_by": null,
  1661. "status": "completed",
  1662. "created_by": "dbcb1ab5-90c8-41a7-8b78-73b235eb6f6f",
  1663. "created_at": 1728734540,
  1664. "indexing_at": 1728734552,
  1665. "completed_at": 1728734584,
  1666. "error": null,
  1667. "stopped_at": null,
  1668. "document": {
  1669. "id": "a8c6c36f-9f5d-4d7a-8472-f5d7b75d71d2",
  1670. "data_source_type": "upload_file",
  1671. "name": "readme.txt",
  1672. }
  1673. },
  1674. "score": 3.730463140527718e-05,
  1675. "tsne_position": null
  1676. }
  1677. ]
  1678. }
  1679. ```
  1680. </CodeGroup>
  1681. </Col>
  1682. </Row>
  1683. <hr className='ml-0 mr-0' />
  1684. <Heading
  1685. url='/datasets/{dataset_id}/metadata'
  1686. method='POST'
  1687. title='ナレッジメタデータを作成'
  1688. name='#create_metadata'
  1689. />
  1690. <Row>
  1691. <Col>
  1692. ### パス
  1693. <Properties>
  1694. <Property name='dataset_id' type='string' key='dataset_id'>
  1695. ナレッジ ID
  1696. </Property>
  1697. </Properties>
  1698. ### リクエストボディ
  1699. <Properties>
  1700. <Property name='segment' type='object' key='segment'>
  1701. - <code>type</code> (string) メタデータの種類、必須
  1702. - <code>name</code> (string) メタデータの名前、必須
  1703. </Property>
  1704. </Properties>
  1705. </Col>
  1706. <Col sticky>
  1707. <CodeGroup
  1708. title="リクエスト"
  1709. tag="POST"
  1710. label="/datasets/{dataset_id}/metadata"
  1711. 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"}'`}
  1712. >
  1713. ```bash {{ title: 'cURL' }}
  1714. ```
  1715. </CodeGroup>
  1716. <CodeGroup title="レスポンス">
  1717. ```json {{ title: 'Response' }}
  1718. {
  1719. "id": "abc",
  1720. "type": "string",
  1721. "name": "test",
  1722. }
  1723. ```
  1724. </CodeGroup>
  1725. </Col>
  1726. </Row>
  1727. <hr className='ml-0 mr-0' />
  1728. <Heading
  1729. url='/datasets/{dataset_id}/metadata/{metadata_id}'
  1730. method='PATCH'
  1731. title='ナレッジメタデータを更新'
  1732. name='#update_metadata'
  1733. />
  1734. <Row>
  1735. <Col>
  1736. ### パス
  1737. <Properties>
  1738. <Property name='dataset_id' type='string' key='dataset_id'>
  1739. ナレッジ ID
  1740. </Property>
  1741. <Property name='metadata_id' type='string' key='metadata_id'>
  1742. メタデータ ID
  1743. </Property>
  1744. </Properties>
  1745. ### リクエストボディ
  1746. <Properties>
  1747. <Property name='segment' type='object' key='segment'>
  1748. - <code>name</code> (string) メタデータの名前、必須
  1749. </Property>
  1750. </Properties>
  1751. </Col>
  1752. <Col sticky>
  1753. <CodeGroup
  1754. title="リクエスト"
  1755. tag="PATCH"
  1756. label="/datasets/{dataset_id}/metadata/{metadata_id}"
  1757. 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"}'`}
  1758. >
  1759. ```bash {{ title: 'cURL' }}
  1760. ```
  1761. </CodeGroup>
  1762. <CodeGroup title="レスポンス">
  1763. ```json {{ title: 'Response' }}
  1764. {
  1765. "id": "abc",
  1766. "type": "string",
  1767. "name": "test",
  1768. }
  1769. ```
  1770. </CodeGroup>
  1771. </Col>
  1772. </Row>
  1773. <hr className='ml-0 mr-0' />
  1774. <Heading
  1775. url='/datasets/{dataset_id}/metadata/{metadata_id}'
  1776. method='DELETE'
  1777. title='ナレッジメタデータを削除'
  1778. name='#delete_metadata'
  1779. />
  1780. <Row>
  1781. <Col>
  1782. ### パス
  1783. <Properties>
  1784. <Property name='dataset_id' type='string' key='dataset_id'>
  1785. ナレッジ ID
  1786. </Property>
  1787. <Property name='metadata_id' type='string' key='metadata_id'>
  1788. メタデータ ID
  1789. </Property>
  1790. </Properties>
  1791. </Col>
  1792. <Col sticky>
  1793. <CodeGroup
  1794. title="リクエスト"
  1795. tag="DELETE"
  1796. label="/datasets/{dataset_id}/metadata/{metadata_id}"
  1797. targetCode={`curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/metadata/{metadata_id}' \\\n--header 'Authorization: Bearer {api_key}'`}
  1798. >
  1799. ```bash {{ title: 'cURL' }}
  1800. ```
  1801. </CodeGroup>
  1802. </Col>
  1803. </Row>
  1804. <hr className='ml-0 mr-0' />
  1805. <Heading
  1806. url='/datasets/{dataset_id}/metadata/built-in/{action}'
  1807. method='POST'
  1808. title='組み込みメタデータを無効化または有効化'
  1809. name='#toggle_metadata'
  1810. />
  1811. <Row>
  1812. <Col>
  1813. ### パス
  1814. <Properties>
  1815. <Property name='dataset_id' type='string' key='dataset_id'>
  1816. ナレッジ ID
  1817. </Property>
  1818. <Property name='action' type='string' key='action'>
  1819. disable/enable
  1820. </Property>
  1821. </Properties>
  1822. </Col>
  1823. <Col sticky>
  1824. <CodeGroup
  1825. title="リクエスト"
  1826. tag="POST"
  1827. label="/datasets/{dataset_id}/metadata/built-in/{action}"
  1828. targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/metadata/built-in/{action}' \\\n--header 'Authorization: Bearer {api_key}'`}
  1829. >
  1830. ```bash {{ title: 'cURL' }}
  1831. ```
  1832. </CodeGroup>
  1833. </Col>
  1834. </Row>
  1835. <hr className='ml-0 mr-0' />
  1836. <Heading
  1837. url='/datasets/{dataset_id}/documents/metadata'
  1838. method='POST'
  1839. title='ドキュメントメタデータを更新'
  1840. name='#update_documents_metadata'
  1841. />
  1842. <Row>
  1843. <Col>
  1844. ### パス
  1845. <Properties>
  1846. <Property name='dataset_id' type='string' key='dataset_id'>
  1847. ナレッジ ID
  1848. </Property>
  1849. </Properties>
  1850. ### リクエストボディ
  1851. <Properties>
  1852. <Property name='operation_data' type='object list' key='segments'>
  1853. - <code>document_id</code> (string) ドキュメント ID
  1854. - <code>metadata_list</code> (list) メタデータリスト
  1855. - <code>id</code> (string) メタデータ ID
  1856. - <code>value</code> (string) メタデータの値
  1857. - <code>name</code> (string) メタデータの名前
  1858. </Property>
  1859. </Properties>
  1860. </Col>
  1861. <Col sticky>
  1862. <CodeGroup
  1863. title="リクエスト"
  1864. tag="POST"
  1865. label="/datasets/{dataset_id}/documents/metadata"
  1866. 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"}]}]}'`}
  1867. >
  1868. ```bash {{ title: 'cURL' }}
  1869. ```
  1870. </CodeGroup>
  1871. </Col>
  1872. </Row>
  1873. <hr className='ml-0 mr-0' />
  1874. <Heading
  1875. url='/datasets/{dataset_id}/metadata'
  1876. method='GET'
  1877. title='ナレッジメタデータリストを取得'
  1878. name='#dataset_metadata_list'
  1879. />
  1880. <Row>
  1881. <Col>
  1882. ### パス
  1883. <Properties>
  1884. <Property name='dataset_id' type='string' key='dataset_id'>
  1885. ナレッジ ID
  1886. </Property>
  1887. </Properties>
  1888. </Col>
  1889. <Col sticky>
  1890. <CodeGroup
  1891. title="リクエスト"
  1892. tag="GET"
  1893. label="/datasets/{dataset_id}/metadata"
  1894. targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/metadata' \\\n--header 'Authorization: Bearer {api_key}'`}
  1895. >
  1896. ```bash {{ title: 'cURL' }}
  1897. ```
  1898. </CodeGroup>
  1899. <CodeGroup title="レスポンス">
  1900. ```json {{ title: 'Response' }}
  1901. {
  1902. "doc_metadata": [
  1903. {
  1904. "id": "",
  1905. "name": "name",
  1906. "type": "string",
  1907. "use_count": 0,
  1908. },
  1909. ...
  1910. ],
  1911. "built_in_field_enabled": true
  1912. }
  1913. ```
  1914. </CodeGroup>
  1915. </Col>
  1916. </Row>
  1917. <hr className='ml-0 mr-0' />
  1918. <Heading
  1919. url='/datasets/tags'
  1920. method='POST'
  1921. title='ナレッジベースタイプタグの新規作成'
  1922. name='#create_new_knowledge_tag'
  1923. />
  1924. <Row>
  1925. <Col>
  1926. ### Request Body
  1927. <Properties>
  1928. <Property name='name' type='string'>
  1929. (text) 新しいタグ名、必須、最大長50文字
  1930. </Property>
  1931. </Properties>
  1932. </Col>
  1933. <Col sticky>
  1934. <CodeGroup
  1935. title="Request"
  1936. tag="POST"
  1937. label="/datasets/tags"
  1938. 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"}'`}
  1939. >
  1940. ```bash {{ title: 'cURL' }}
  1941. curl --location --request POST '${props.apiBaseUrl}/datasets/tags' \
  1942. --header 'Authorization: Bearer {api_key}' \
  1943. --header 'Content-Type: application/json' \
  1944. --data-raw '{"name": "testtag1"}'
  1945. ```
  1946. </CodeGroup>
  1947. <CodeGroup title="Response">
  1948. ```json {{ title: 'Response' }}
  1949. {
  1950. "id": "eddb66c2-04a1-4e3a-8cb2-75abd01e12a6",
  1951. "name": "testtag1",
  1952. "type": "knowledge",
  1953. "binding_count": 0
  1954. }
  1955. ```
  1956. </CodeGroup>
  1957. </Col>
  1958. </Row>
  1959. <hr className='ml-0 mr-0' />
  1960. <Heading
  1961. url='/datasets/tags'
  1962. method='GET'
  1963. title='ナレッジベースタイプタグの取得'
  1964. name='#get_knowledge_type_tags'
  1965. />
  1966. <Row>
  1967. <Col>
  1968. ### Request Body
  1969. </Col>
  1970. <Col sticky>
  1971. <CodeGroup
  1972. title="Request"
  1973. tag="GET"
  1974. label="/datasets/tags"
  1975. targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets/tags' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json'`}
  1976. >
  1977. ```bash {{ title: 'cURL' }}
  1978. curl --location --request GET '${props.apiBaseUrl}/datasets/tags' \
  1979. --header 'Authorization: Bearer {api_key}' \
  1980. --header 'Content-Type: application/json'
  1981. ```
  1982. </CodeGroup>
  1983. <CodeGroup title="Response">
  1984. ```json {{ title: 'Response' }}
  1985. [
  1986. {
  1987. "id": "39d6934c-ed36-463d-b4a7-377fa1503dc0",
  1988. "name": "testtag1",
  1989. "type": "knowledge",
  1990. "binding_count": "0"
  1991. },
  1992. ...
  1993. ]
  1994. ```
  1995. </CodeGroup>
  1996. </Col>
  1997. </Row>
  1998. <hr className='ml-0 mr-0' />
  1999. <Heading
  2000. url='/datasets/tags'
  2001. method='PATCH'
  2002. title='ナレッジベースタイプタグ名の変更'
  2003. name='#modify_knowledge_tag_name'
  2004. />
  2005. <Row>
  2006. <Col>
  2007. ### Request Body
  2008. <Properties>
  2009. <Property name='name' type='string'>
  2010. (text) 変更後のタグ名、必須、最大長50文字
  2011. </Property>
  2012. <Property name='tag_id' type='string'>
  2013. (text) タグID、必須
  2014. </Property>
  2015. </Properties>
  2016. </Col>
  2017. <Col sticky>
  2018. <CodeGroup
  2019. title="Request"
  2020. tag="PATCH"
  2021. label="/datasets/tags"
  2022. 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"}`}
  2023. >
  2024. ```bash {{ title: 'cURL' }}
  2025. curl --location --request PATCH '${props.apiBaseUrl}/datasets/tags' \
  2026. --header 'Authorization: Bearer {api_key}' \
  2027. --header 'Content-Type: application/json' \
  2028. --data-raw '{"name": "testtag2", "tag_id": "e1a0a3db-ee34-4e04-842a-81555d5316fd"}'
  2029. ```
  2030. </CodeGroup>
  2031. <CodeGroup title="Response">
  2032. ```json {{ title: 'Response' }}
  2033. {
  2034. "id": "eddb66c2-04a1-4e3a-8cb2-75abd01e12a6",
  2035. "name": "tag-renamed",
  2036. "type": "knowledge",
  2037. "binding_count": 0
  2038. }
  2039. ```
  2040. </CodeGroup>
  2041. </Col>
  2042. </Row>
  2043. <hr className='ml-0 mr-0' />
  2044. <Heading
  2045. url='/datasets/tags'
  2046. method='DELETE'
  2047. title='ナレッジベースタイプタグの削除'
  2048. name='#delete_knowledge_tag'
  2049. />
  2050. <Row>
  2051. <Col>
  2052. ### Request Body
  2053. <Properties>
  2054. <Property name='tag_id' type='string'>
  2055. (text) タグID、必須
  2056. </Property>
  2057. </Properties>
  2058. </Col>
  2059. <Col sticky>
  2060. <CodeGroup
  2061. title="Request"
  2062. tag="DELETE"
  2063. label="/datasets/tags"
  2064. 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"}`}
  2065. >
  2066. ```bash {{ title: 'cURL' }}
  2067. curl --location --request DELETE '${props.apiBaseUrl}/datasets/tags' \
  2068. --header 'Authorization: Bearer {api_key}' \
  2069. --header 'Content-Type: application/json' \
  2070. --data-raw '{"tag_id": "e1a0a3db-ee34-4e04-842a-81555d5316fd"}'
  2071. ```
  2072. </CodeGroup>
  2073. <CodeGroup title="Response">
  2074. ```json {{ title: 'Response' }}
  2075. {"result": "success"}
  2076. ```
  2077. </CodeGroup>
  2078. </Col>
  2079. </Row>
  2080. <hr className='ml-0 mr-0' />
  2081. <Heading
  2082. url='/datasets/tags/binding'
  2083. method='POST'
  2084. title='ナレッジベースをナレッジベースタイプタグに紐付け'
  2085. name='#bind_dataset_to_knowledge_tag'
  2086. />
  2087. <Row>
  2088. <Col>
  2089. ### Request Body
  2090. <Properties>
  2091. <Property name='tag_ids' type='list'>
  2092. (list) タグIDリスト、必須
  2093. </Property>
  2094. <Property name='target_id' type='string'>
  2095. (text) ナレッジベースID、必須
  2096. </Property>
  2097. </Properties>
  2098. </Col>
  2099. <Col sticky>
  2100. <CodeGroup
  2101. title="Request"
  2102. tag="POST"
  2103. label="/datasets/tags/binding"
  2104. 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"}'`}
  2105. >
  2106. ```bash {{ title: 'cURL' }}
  2107. curl --location --request POST '${props.apiBaseUrl}/datasets/tags/binding' \
  2108. --header 'Authorization: Bearer {api_key}' \
  2109. --header 'Content-Type: application/json' \
  2110. --data-raw '{"tag_ids": ["65cc29be-d072-4e26-adf4-2f727644da29","1e5348f3-d3ff-42b8-a1b7-0a86d518001a"], "target_id": "a932ea9f-fae1-4b2c-9b65-71c56e2cacd6"}'
  2111. ```
  2112. </CodeGroup>
  2113. <CodeGroup title="Response">
  2114. ```json {{ title: 'Response' }}
  2115. {"result": "success"}
  2116. ```
  2117. </CodeGroup>
  2118. </Col>
  2119. </Row>
  2120. <hr className='ml-0 mr-0' />
  2121. <Heading
  2122. url='/datasets/tags/unbinding'
  2123. method='POST'
  2124. title='ナレッジベースとナレッジベースタイプタグの紐付け解除'
  2125. name='#unbind_dataset_and_knowledge_tag'
  2126. />
  2127. <Row>
  2128. <Col>
  2129. ### Request Body
  2130. <Properties>
  2131. <Property name='tag_id' type='string'>
  2132. (text) タグID、必須
  2133. </Property>
  2134. <Property name='target_id' type='string'>
  2135. (text) ナレッジベースID、必須
  2136. </Property>
  2137. </Properties>
  2138. </Col>
  2139. <Col sticky>
  2140. <CodeGroup
  2141. title="Request"
  2142. tag="POST"
  2143. label="/datasets/tags/unbinding"
  2144. 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"}'`}
  2145. >
  2146. ```bash {{ title: 'cURL' }}
  2147. curl --location --request POST '${props.apiBaseUrl}/datasets/tags/unbinding' \
  2148. --header 'Authorization: Bearer {api_key}' \
  2149. --header 'Content-Type: application/json' \
  2150. --data-raw '{"tag_id": "1e5348f3-d3ff-42b8-a1b7-0a86d518001a", "target_id": "a932ea9f-fae1-4b2c-9b65-71c56e2cacd6"}'
  2151. ```
  2152. </CodeGroup>
  2153. <CodeGroup title="Response">
  2154. ```json {{ title: 'Response' }}
  2155. {"result": "success"}
  2156. ```
  2157. </CodeGroup>
  2158. </Col>
  2159. </Row>
  2160. <hr className='ml-0 mr-0' />
  2161. <Heading
  2162. url='/datasets/<uuid:dataset_id>/tags'
  2163. method='POST'
  2164. title='ナレッジベースに紐付けられたタグの照会'
  2165. name='#query_dataset_tags'
  2166. />
  2167. <Row>
  2168. <Col>
  2169. ### Path
  2170. <Properties>
  2171. <Property name='dataset_id' type='string'>
  2172. (text) ナレッジベースID
  2173. </Property>
  2174. </Properties>
  2175. </Col>
  2176. <Col sticky>
  2177. <CodeGroup
  2178. title="Request"
  2179. tag="POST"
  2180. label="/datasets/<uuid:dataset_id>/tags"
  2181. 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`}
  2182. >
  2183. ```bash {{ title: 'cURL' }}
  2184. curl --location --request POST '${props.apiBaseUrl}/datasets/<uuid:dataset_id>/tags' \
  2185. --header 'Authorization: Bearer {api_key}' \
  2186. --header 'Content-Type: application/json' \
  2187. ```
  2188. </CodeGroup>
  2189. <CodeGroup title="Response">
  2190. ```json {{ title: 'Response' }}
  2191. {
  2192. "data":
  2193. [
  2194. {"id": "4a601f4f-f8a2-4166-ae7c-58c3b252a524",
  2195. "name": "123"
  2196. },
  2197. ...
  2198. ],
  2199. "total": 3
  2200. }
  2201. ```
  2202. </CodeGroup>
  2203. </Col>
  2204. </Row>
  2205. <hr className='ml-0 mr-0' />
  2206. <Row>
  2207. <Col>
  2208. ### エラーメッセージ
  2209. <Properties>
  2210. <Property name='code' type='string' key='code'>
  2211. エラーコード
  2212. </Property>
  2213. </Properties>
  2214. <Properties>
  2215. <Property name='status' type='number' key='status'>
  2216. エラーステータス
  2217. </Property>
  2218. </Properties>
  2219. <Properties>
  2220. <Property name='message' type='string' key='message'>
  2221. エラーメッセージ
  2222. </Property>
  2223. </Properties>
  2224. </Col>
  2225. <Col>
  2226. <CodeGroup title="例">
  2227. ```json {{ title: 'Response' }}
  2228. {
  2229. "code": "no_file_uploaded",
  2230. "message": "Please upload your file.",
  2231. "status": 400
  2232. }
  2233. ```
  2234. </CodeGroup>
  2235. </Col>
  2236. </Row>
  2237. <table className="max-w-auto border-collapse border border-slate-400" style={{ maxWidth: 'none', width: 'auto' }}>
  2238. <thead style={{ background: '#f9fafc' }}>
  2239. <tr>
  2240. <th className="p-2 border border-slate-300">code</th>
  2241. <th className="p-2 border border-slate-300">status</th>
  2242. <th className="p-2 border border-slate-300">message</th>
  2243. </tr>
  2244. </thead>
  2245. <tbody>
  2246. <tr>
  2247. <td className="p-2 border border-slate-300">no_file_uploaded</td>
  2248. <td className="p-2 border border-slate-300">400</td>
  2249. <td className="p-2 border border-slate-300">Please upload your file.</td>
  2250. </tr>
  2251. <tr>
  2252. <td className="p-2 border border-slate-300">too_many_files</td>
  2253. <td className="p-2 border border-slate-300">400</td>
  2254. <td className="p-2 border border-slate-300">Only one file is allowed.</td>
  2255. </tr>
  2256. <tr>
  2257. <td className="p-2 border border-slate-300">file_too_large</td>
  2258. <td className="p-2 border border-slate-300">413</td>
  2259. <td className="p-2 border border-slate-300">File size exceeded.</td>
  2260. </tr>
  2261. <tr>
  2262. <td className="p-2 border border-slate-300">unsupported_file_type</td>
  2263. <td className="p-2 border border-slate-300">415</td>
  2264. <td className="p-2 border border-slate-300">File type not allowed.</td>
  2265. </tr>
  2266. <tr>
  2267. <td className="p-2 border border-slate-300">high_quality_dataset_only</td>
  2268. <td className="p-2 border border-slate-300">400</td>
  2269. <td className="p-2 border border-slate-300">Current operation only supports 'high-quality' datasets.</td>
  2270. </tr>
  2271. <tr>
  2272. <td className="p-2 border border-slate-300">dataset_not_initialized</td>
  2273. <td className="p-2 border border-slate-300">400</td>
  2274. <td className="p-2 border border-slate-300">The dataset is still being initialized or indexing. Please wait a moment.</td>
  2275. </tr>
  2276. <tr>
  2277. <td className="p-2 border border-slate-300">archived_document_immutable</td>
  2278. <td className="p-2 border border-slate-300">403</td>
  2279. <td className="p-2 border border-slate-300">The archived document is not editable.</td>
  2280. </tr>
  2281. <tr>
  2282. <td className="p-2 border border-slate-300">dataset_name_duplicate</td>
  2283. <td className="p-2 border border-slate-300">409</td>
  2284. <td className="p-2 border border-slate-300">The dataset name already exists. Please modify your dataset name.</td>
  2285. </tr>
  2286. <tr>
  2287. <td className="p-2 border border-slate-300">invalid_action</td>
  2288. <td className="p-2 border border-slate-300">400</td>
  2289. <td className="p-2 border border-slate-300">Invalid action.</td>
  2290. </tr>
  2291. <tr>
  2292. <td className="p-2 border border-slate-300">document_already_finished</td>
  2293. <td className="p-2 border border-slate-300">400</td>
  2294. <td className="p-2 border border-slate-300">The document has been processed. Please refresh the page or go to the document details.</td>
  2295. </tr>
  2296. <tr>
  2297. <td className="p-2 border border-slate-300">document_indexing</td>
  2298. <td className="p-2 border border-slate-300">400</td>
  2299. <td className="p-2 border border-slate-300">The document is being processed and cannot be edited.</td>
  2300. </tr>
  2301. <tr>
  2302. <td className="p-2 border border-slate-300">invalid_metadata</td>
  2303. <td className="p-2 border border-slate-300">400</td>
  2304. <td className="p-2 border border-slate-300">The metadata content is incorrect. Please check and verify.</td>
  2305. </tr>
  2306. </tbody>
  2307. </table>
  2308. <div className="pb-4" />