Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

template.ja.mdx 72KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011
  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_provider_name' type='str' key='embedding_provider_name'>
  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: 'Response' }}
  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. ```json {{ title: 'Response' }}
  763. {
  764. "result": "success"
  765. }
  766. ```
  767. </CodeGroup>
  768. </Col>
  769. </Row>
  770. <hr className='ml-0 mr-0' />
  771. <Heading
  772. url='/datasets/{dataset_id}/documents'
  773. method='GET'
  774. title='ナレッジベースのドキュメントリストを取得'
  775. name='#dataset_document_list'
  776. />
  777. <Row>
  778. <Col>
  779. ### パス
  780. <Properties>
  781. <Property name='dataset_id' type='string' key='dataset_id'>
  782. ナレッジ ID
  783. </Property>
  784. </Properties>
  785. ### クエリ
  786. <Properties>
  787. <Property name='keyword' type='string' key='keyword'>
  788. 検索キーワード、現在はドキュメント名のみ検索 (オプション)
  789. </Property>
  790. <Property name='page' type='string' key='page'>
  791. ページ番号 (オプション)
  792. </Property>
  793. <Property name='limit' type='string' key='limit'>
  794. 返されるアイテム数、デフォルトは 20、範囲は 1-100 (オプション)
  795. </Property>
  796. </Properties>
  797. </Col>
  798. <Col sticky>
  799. <CodeGroup
  800. title="リクエスト"
  801. tag="GET"
  802. label="/datasets/{dataset_id}/documents"
  803. targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents' \\\n--header 'Authorization: Bearer {api_key}'`}
  804. >
  805. ```bash {{ title: 'cURL' }}
  806. curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents' \
  807. --header 'Authorization: Bearer {api_key}' \
  808. ```
  809. </CodeGroup>
  810. <CodeGroup title="レスポンス">
  811. ```json {{ title: 'Response' }}
  812. {
  813. "data": [
  814. {
  815. "id": "",
  816. "position": 1,
  817. "data_source_type": "file_upload",
  818. "data_source_info": null,
  819. "dataset_process_rule_id": null,
  820. "name": "dify",
  821. "created_from": "",
  822. "created_by": "",
  823. "created_at": 1681623639,
  824. "tokens": 0,
  825. "indexing_status": "waiting",
  826. "error": null,
  827. "enabled": true,
  828. "disabled_at": null,
  829. "disabled_by": null,
  830. "archived": false
  831. },
  832. ],
  833. "has_more": false,
  834. "limit": 20,
  835. "total": 9,
  836. "page": 1
  837. }
  838. ```
  839. </CodeGroup>
  840. </Col>
  841. </Row>
  842. <hr className='ml-0 mr-0' />
  843. <Heading
  844. url='/datasets/{dataset_id}/documents/{document_id}/segments'
  845. method='POST'
  846. title='ドキュメントにチャンクを追加'
  847. name='#create_new_segment'
  848. />
  849. <Row>
  850. <Col>
  851. ### パス
  852. <Properties>
  853. <Property name='dataset_id' type='string' key='dataset_id'>
  854. ナレッジ ID
  855. </Property>
  856. <Property name='document_id' type='string' key='document_id'>
  857. ドキュメント ID
  858. </Property>
  859. </Properties>
  860. ### リクエストボディ
  861. <Properties>
  862. <Property name='segments' type='object list' key='segments'>
  863. - <code>content</code> (text) テキスト内容 / 質問内容、必須
  864. - <code>answer</code> (text) 回答内容、ナレッジのモードが Q&A モードの場合に値を渡します (オプション)
  865. - <code>keywords</code> (list) キーワード (オプション)
  866. </Property>
  867. </Properties>
  868. </Col>
  869. <Col sticky>
  870. <CodeGroup
  871. title="リクエスト"
  872. tag="POST"
  873. label="/datasets/{dataset_id}/documents/{document_id}/segments"
  874. 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"]}]}'`}
  875. >
  876. ```bash {{ title: 'cURL' }}
  877. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments' \
  878. --header 'Authorization: Bearer {api_key}' \
  879. --header 'Content-Type: application/json' \
  880. --data-raw '{
  881. "segments": [
  882. {
  883. "content": "1",
  884. "answer": "1",
  885. "keywords": ["a"]
  886. }
  887. ]
  888. }'
  889. ```
  890. </CodeGroup>
  891. <CodeGroup title="レスポンス">
  892. ```json {{ title: 'Response' }}
  893. {
  894. "data": [{
  895. "id": "",
  896. "position": 1,
  897. "document_id": "",
  898. "content": "1",
  899. "answer": "1",
  900. "word_count": 25,
  901. "tokens": 0,
  902. "keywords": [
  903. "a"
  904. ],
  905. "index_node_id": "",
  906. "index_node_hash": "",
  907. "hit_count": 0,
  908. "enabled": true,
  909. "disabled_at": null,
  910. "disabled_by": null,
  911. "status": "completed",
  912. "created_by": "",
  913. "created_at": 1695312007,
  914. "indexing_at": 1695312007,
  915. "completed_at": 1695312007,
  916. "error": null,
  917. "stopped_at": null
  918. }],
  919. "doc_form": "text_model"
  920. }
  921. ```
  922. </CodeGroup>
  923. </Col>
  924. </Row>
  925. <hr className='ml-0 mr-0' />
  926. <Heading
  927. url='/datasets/{dataset_id}/documents/{document_id}/segments'
  928. method='GET'
  929. title='ドキュメントからチャンクを取得'
  930. name='#get_segment'
  931. />
  932. <Row>
  933. <Col>
  934. ### パス
  935. <Properties>
  936. <Property name='dataset_id' type='string' key='dataset_id'>
  937. ナレッジ ID
  938. </Property>
  939. <Property name='document_id' type='string' key='document_id'>
  940. ドキュメント ID
  941. </Property>
  942. </Properties>
  943. ### クエリ
  944. <Properties>
  945. <Property name='keyword' type='string' key='keyword'>
  946. キーワード (オプション)
  947. </Property>
  948. <Property name='status' type='string' key='status'>
  949. 検索ステータス、completed
  950. </Property>
  951. <Property name='page' type='string' key='page'>
  952. ページ番号 (オプション)
  953. </Property>
  954. <Property name='limit' type='string' key='limit'>
  955. 返されるアイテム数、デフォルトは 20、範囲は 1-100 (オプション)
  956. </Property>
  957. </Properties>
  958. </Col>
  959. <Col sticky>
  960. <CodeGroup
  961. title="リクエスト"
  962. tag="GET"
  963. label="/datasets/{dataset_id}/documents/{document_id}/segments"
  964. 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'`}
  965. >
  966. ```bash {{ title: 'cURL' }}
  967. curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments' \
  968. --header 'Authorization: Bearer {api_key}' \
  969. --header 'Content-Type: application/json'
  970. ```
  971. </CodeGroup>
  972. <CodeGroup title="レスポンス">
  973. ```json {{ title: 'Response' }}
  974. {
  975. "data": [{
  976. "id": "",
  977. "position": 1,
  978. "document_id": "",
  979. "content": "1",
  980. "answer": "1",
  981. "word_count": 25,
  982. "tokens": 0,
  983. "keywords": [
  984. "a"
  985. ],
  986. "index_node_id": "",
  987. "index_node_hash": "",
  988. "hit_count": 0,
  989. "enabled": true,
  990. "disabled_at": null,
  991. "disabled_by": null,
  992. "status": "completed",
  993. "created_by": "",
  994. "created_at": 1695312007,
  995. "indexing_at": 1695312007,
  996. "completed_at": 1695312007,
  997. "error": null,
  998. "stopped_at": null
  999. }],
  1000. "doc_form": "text_model",
  1001. "has_more": false,
  1002. "limit": 20,
  1003. "total": 9,
  1004. "page": 1
  1005. }
  1006. ```
  1007. </CodeGroup>
  1008. </Col>
  1009. </Row>
  1010. <hr className='ml-0 mr-0' />
  1011. <Heading
  1012. url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}'
  1013. method='DELETE'
  1014. title='ドキュメント内のチャンクを削除'
  1015. name='#delete_segment'
  1016. />
  1017. <Row>
  1018. <Col>
  1019. ### パス
  1020. <Properties>
  1021. <Property name='dataset_id' type='string' key='dataset_id'>
  1022. ナレッジ ID
  1023. </Property>
  1024. <Property name='document_id' type='string' key='document_id'>
  1025. ドキュメント ID
  1026. </Property>
  1027. <Property name='segment_id' type='string' key='segment_id'>
  1028. ドキュメントセグメント ID
  1029. </Property>
  1030. </Properties>
  1031. </Col>
  1032. <Col sticky>
  1033. <CodeGroup
  1034. title="リクエスト"
  1035. tag="DELETE"
  1036. label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}"
  1037. 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'`}
  1038. >
  1039. ```bash {{ title: 'cURL' }}
  1040. curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}' \
  1041. --header 'Authorization: Bearer {api_key}' \
  1042. --header 'Content-Type: application/json'
  1043. ```
  1044. </CodeGroup>
  1045. <CodeGroup title="レスポンス">
  1046. ```json {{ title: 'Response' }}
  1047. {
  1048. "result": "success"
  1049. }
  1050. ```
  1051. </CodeGroup>
  1052. </Col>
  1053. </Row>
  1054. <hr className='ml-0 mr-0' />
  1055. <Heading
  1056. url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}'
  1057. method='POST'
  1058. title='ドキュメント内のチャンクを更新'
  1059. name='#update_segment'
  1060. />
  1061. <Row>
  1062. <Col>
  1063. ### POST
  1064. <Properties>
  1065. <Property name='dataset_id' type='string' key='dataset_id'>
  1066. ナレッジ ID
  1067. </Property>
  1068. <Property name='document_id' type='string' key='document_id'>
  1069. ドキュメント ID
  1070. </Property>
  1071. <Property name='segment_id' type='string' key='segment_id'>
  1072. ドキュメントセグメント ID
  1073. </Property>
  1074. </Properties>
  1075. ### リクエストボディ
  1076. <Properties>
  1077. <Property name='segment' type='object' key='segment'>
  1078. - <code>content</code> (text) テキスト内容 / 質問内容、必須
  1079. - <code>answer</code> (text) 回答内容、ナレッジが Q&A モードの場合に値を渡します (オプション)
  1080. - <code>keywords</code> (list) キーワード (オプション)
  1081. - <code>enabled</code> (bool) False / true (オプション)
  1082. - <code>regenerate_child_chunks</code> (bool) 子チャンクを再生成するかどうか (オプション)
  1083. </Property>
  1084. </Properties>
  1085. </Col>
  1086. <Col sticky>
  1087. <CodeGroup
  1088. title="リクエスト"
  1089. tag="POST"
  1090. label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}"
  1091. 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}}'`}
  1092. >
  1093. ```bash {{ title: 'cURL' }}
  1094. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}' \
  1095. --header 'Content-Type: application/json' \
  1096. --data-raw '{
  1097. "segment": {
  1098. "content": "1",
  1099. "answer": "1",
  1100. "keywords": ["a"],
  1101. "enabled": false
  1102. }
  1103. }'
  1104. ```
  1105. </CodeGroup>
  1106. <CodeGroup title="レスポンス">
  1107. ```json {{ title: 'Response' }}
  1108. {
  1109. "data": {
  1110. "id": "",
  1111. "position": 1,
  1112. "document_id": "",
  1113. "content": "1",
  1114. "answer": "1",
  1115. "word_count": 25,
  1116. "tokens": 0,
  1117. "keywords": [
  1118. "a"
  1119. ],
  1120. "index_node_id": "",
  1121. "index_node_hash": "",
  1122. "hit_count": 0,
  1123. "enabled": true,
  1124. "disabled_at": null,
  1125. "disabled_by": null,
  1126. "status": "completed",
  1127. "created_by": "",
  1128. "created_at": 1695312007,
  1129. "indexing_at": 1695312007,
  1130. "completed_at": 1695312007,
  1131. "error": null,
  1132. "stopped_at": null
  1133. },
  1134. "doc_form": "text_model"
  1135. }
  1136. ```
  1137. </CodeGroup>
  1138. </Col>
  1139. </Row>
  1140. <hr className='ml-0 mr-0' />
  1141. <Heading
  1142. url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks'
  1143. method='POST'
  1144. title='子チャンクを作成'
  1145. name='#create_child_chunk'
  1146. />
  1147. <Row>
  1148. <Col>
  1149. ### パス
  1150. <Properties>
  1151. <Property name='dataset_id' type='string' key='dataset_id'>
  1152. ナレッジ ID
  1153. </Property>
  1154. <Property name='document_id' type='string' key='document_id'>
  1155. ドキュメント ID
  1156. </Property>
  1157. <Property name='segment_id' type='string' key='segment_id'>
  1158. セグメント ID
  1159. </Property>
  1160. </Properties>
  1161. ### リクエストボディ
  1162. <Properties>
  1163. <Property name='content' type='string' key='content'>
  1164. 子チャンクの内容
  1165. </Property>
  1166. </Properties>
  1167. </Col>
  1168. <Col sticky>
  1169. <CodeGroup
  1170. title="リクエスト"
  1171. tag="POST"
  1172. label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks"
  1173. 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"}'`}
  1174. >
  1175. ```bash {{ title: 'cURL' }}
  1176. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks' \
  1177. --header 'Authorization: Bearer {api_key}' \
  1178. --header 'Content-Type: application/json' \
  1179. --data-raw '{
  1180. "content": "Child chunk content"
  1181. }'
  1182. ```
  1183. </CodeGroup>
  1184. <CodeGroup title="レスポンス">
  1185. ```json {{ title: 'Response' }}
  1186. {
  1187. "data": {
  1188. "id": "",
  1189. "segment_id": "",
  1190. "content": "Child chunk content",
  1191. "word_count": 25,
  1192. "tokens": 0,
  1193. "index_node_id": "",
  1194. "index_node_hash": "",
  1195. "status": "completed",
  1196. "created_by": "",
  1197. "created_at": 1695312007,
  1198. "indexing_at": 1695312007,
  1199. "completed_at": 1695312007,
  1200. "error": null,
  1201. "stopped_at": null
  1202. }
  1203. }
  1204. ```
  1205. </CodeGroup>
  1206. </Col>
  1207. </Row>
  1208. <hr className='ml-0 mr-0' />
  1209. <Heading
  1210. url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks'
  1211. method='GET'
  1212. title='子チャンクを取得'
  1213. name='#get_child_chunks'
  1214. />
  1215. <Row>
  1216. <Col>
  1217. ### パス
  1218. <Properties>
  1219. <Property name='dataset_id' type='string' key='dataset_id'>
  1220. ナレッジ ID
  1221. </Property>
  1222. <Property name='document_id' type='string' key='document_id'>
  1223. ドキュメント ID
  1224. </Property>
  1225. <Property name='segment_id' type='string' key='segment_id'>
  1226. セグメント ID
  1227. </Property>
  1228. </Properties>
  1229. ### クエリ
  1230. <Properties>
  1231. <Property name='keyword' type='string' key='keyword'>
  1232. 検索キーワード (オプション)
  1233. </Property>
  1234. <Property name='page' type='integer' key='page'>
  1235. ページ番号 (オプション、デフォルト: 1)
  1236. </Property>
  1237. <Property name='limit' type='integer' key='limit'>
  1238. ページあたりのアイテム数 (オプション、デフォルト: 20、最大: 100)
  1239. </Property>
  1240. </Properties>
  1241. </Col>
  1242. <Col sticky>
  1243. <CodeGroup
  1244. title="リクエスト"
  1245. tag="GET"
  1246. label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks"
  1247. 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}'`}
  1248. >
  1249. ```bash {{ title: 'cURL' }}
  1250. curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks?page=1&limit=20' \
  1251. --header 'Authorization: Bearer {api_key}'
  1252. ```
  1253. </CodeGroup>
  1254. <CodeGroup title="レスポンス">
  1255. ```json {{ title: 'Response' }}
  1256. {
  1257. "data": [{
  1258. "id": "",
  1259. "segment_id": "",
  1260. "content": "Child chunk content",
  1261. "word_count": 25,
  1262. "tokens": 0,
  1263. "index_node_id": "",
  1264. "index_node_hash": "",
  1265. "status": "completed",
  1266. "created_by": "",
  1267. "created_at": 1695312007,
  1268. "indexing_at": 1695312007,
  1269. "completed_at": 1695312007,
  1270. "error": null,
  1271. "stopped_at": null
  1272. }],
  1273. "total": 1,
  1274. "total_pages": 1,
  1275. "page": 1,
  1276. "limit": 20
  1277. }
  1278. ```
  1279. </CodeGroup>
  1280. </Col>
  1281. </Row>
  1282. <hr className='ml-0 mr-0' />
  1283. <Heading
  1284. url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}'
  1285. method='DELETE'
  1286. title='子チャンクを削除'
  1287. name='#delete_child_chunk'
  1288. />
  1289. <Row>
  1290. <Col>
  1291. ### パス
  1292. <Properties>
  1293. <Property name='dataset_id' type='string' key='dataset_id'>
  1294. ナレッジ ID
  1295. </Property>
  1296. <Property name='document_id' type='string' key='document_id'>
  1297. ドキュメント ID
  1298. </Property>
  1299. <Property name='segment_id' type='string' key='segment_id'>
  1300. セグメント ID
  1301. </Property>
  1302. <Property name='child_chunk_id' type='string' key='child_chunk_id'>
  1303. 子チャンク ID
  1304. </Property>
  1305. </Properties>
  1306. </Col>
  1307. <Col sticky>
  1308. <CodeGroup
  1309. title="リクエスト"
  1310. tag="DELETE"
  1311. label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}"
  1312. targetCode={`curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/segments/{segment_id}/child_chunks/{child_chunk_id}' \\\n--header 'Authorization: Bearer {api_key}'`}
  1313. >
  1314. ```bash {{ title: 'cURL' }}
  1315. curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/segments/{segment_id}/child_chunks/{child_chunk_id}' \
  1316. --header 'Authorization: Bearer {api_key}'
  1317. ```
  1318. </CodeGroup>
  1319. <CodeGroup title="レスポンス">
  1320. ```json {{ title: 'Response' }}
  1321. {
  1322. "result": "success"
  1323. }
  1324. ```
  1325. </CodeGroup>
  1326. </Col>
  1327. </Row>
  1328. <hr className='ml-0 mr-0' />
  1329. <Heading
  1330. url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}'
  1331. method='PATCH'
  1332. title='子チャンクを更新'
  1333. name='#update_child_chunk'
  1334. />
  1335. <Row>
  1336. <Col>
  1337. ### パス
  1338. <Properties>
  1339. <Property name='dataset_id' type='string' key='dataset_id'>
  1340. ナレッジ ID
  1341. </Property>
  1342. <Property name='document_id' type='string' key='document_id'>
  1343. ドキュメント ID
  1344. </Property>
  1345. <Property name='segment_id' type='string' key='segment_id'>
  1346. セグメント ID
  1347. </Property>
  1348. <Property name='child_chunk_id' type='string' key='child_chunk_id'>
  1349. 子チャンク ID
  1350. </Property>
  1351. </Properties>
  1352. ### リクエストボディ
  1353. <Properties>
  1354. <Property name='content' type='string' key='content'>
  1355. 子チャンクの内容
  1356. </Property>
  1357. </Properties>
  1358. </Col>
  1359. <Col sticky>
  1360. <CodeGroup
  1361. title="リクエスト"
  1362. tag="PATCH"
  1363. label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}"
  1364. 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"}'`}
  1365. >
  1366. ```bash {{ title: 'cURL' }}
  1367. curl --location --request PATCH '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}' \
  1368. --header 'Authorization: Bearer {api_key}' \
  1369. --header 'Content-Type: application/json' \
  1370. --data-raw '{
  1371. "content": "Updated child chunk content"
  1372. }'
  1373. ```
  1374. </CodeGroup>
  1375. <CodeGroup title="レスポンス">
  1376. ```json {{ title: 'Response' }}
  1377. {
  1378. "data": {
  1379. "id": "",
  1380. "segment_id": "",
  1381. "content": "Updated child chunk content",
  1382. "word_count": 25,
  1383. "tokens": 0,
  1384. "index_node_id": "",
  1385. "index_node_hash": "",
  1386. "status": "completed",
  1387. "created_by": "",
  1388. "created_at": 1695312007,
  1389. "indexing_at": 1695312007,
  1390. "completed_at": 1695312007,
  1391. "error": null,
  1392. "stopped_at": null
  1393. }
  1394. }
  1395. ```
  1396. </CodeGroup>
  1397. </Col>
  1398. </Row>
  1399. <hr className='ml-0 mr-0' />
  1400. <Heading
  1401. url='/datasets/{dataset_id}/documents/{document_id}/upload-file'
  1402. method='GET'
  1403. title='アップロードファイルを取得'
  1404. name='#get_upload_file'
  1405. />
  1406. <Row>
  1407. <Col>
  1408. ### パス
  1409. <Properties>
  1410. <Property name='dataset_id' type='string' key='dataset_id'>
  1411. ナレッジ ID
  1412. </Property>
  1413. <Property name='document_id' type='string' key='document_id'>
  1414. ドキュメント ID
  1415. </Property>
  1416. </Properties>
  1417. </Col>
  1418. <Col sticky>
  1419. <CodeGroup
  1420. title="リクエスト"
  1421. tag="GET"
  1422. label="/datasets/{dataset_id}/documents/{document_id}/upload-file"
  1423. 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'`}
  1424. >
  1425. ```bash {{ title: 'cURL' }}
  1426. curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/upload-file' \
  1427. --header 'Authorization: Bearer {api_key}' \
  1428. --header 'Content-Type: application/json'
  1429. ```
  1430. </CodeGroup>
  1431. <CodeGroup title="レスポンス">
  1432. ```json {{ title: 'Response' }}
  1433. {
  1434. "id": "file_id",
  1435. "name": "file_name",
  1436. "size": 1024,
  1437. "extension": "txt",
  1438. "url": "preview_url",
  1439. "download_url": "download_url",
  1440. "mime_type": "text/plain",
  1441. "created_by": "user_id",
  1442. "created_at": 1728734540,
  1443. }
  1444. ```
  1445. </CodeGroup>
  1446. </Col>
  1447. </Row>
  1448. <hr className='ml-0 mr-0' />
  1449. <Heading
  1450. url='/datasets/{dataset_id}/retrieve'
  1451. method='POST'
  1452. title='ナレッジベースからチャンクを取得'
  1453. name='#dataset_retrieval'
  1454. />
  1455. <Row>
  1456. <Col>
  1457. ### パス
  1458. <Properties>
  1459. <Property name='dataset_id' type='string' key='dataset_id'>
  1460. ナレッジ ID
  1461. </Property>
  1462. </Properties>
  1463. ### リクエストボディ
  1464. <Properties>
  1465. <Property name='query' type='string' key='query'>
  1466. クエリキーワード
  1467. </Property>
  1468. <Property name='retrieval_model' type='object' key='retrieval_model'>
  1469. 検索モデル (オプション、入力されない場合はデフォルトの方法でリコールされます)
  1470. - <code>search_method</code> (text) 検索方法: 以下の 4 つのキーワードのいずれかが必要です
  1471. - <code>keyword_search</code> キーワード検索
  1472. - <code>semantic_search</code> セマンティック検索
  1473. - <code>full_text_search</code> 全文検索
  1474. - <code>hybrid_search</code> ハイブリッド検索
  1475. - <code>reranking_enable</code> (bool) 再ランキングを有効にするかどうか、検索モードが semantic_search または hybrid_search の場合に必須 (オプション)
  1476. - <code>reranking_mode</code> (object) 再ランキングモデル構成、再ランキングが有効な場合に必須
  1477. - <code>reranking_provider_name</code> (string) 再ランキングモデルプロバイダー
  1478. - <code>reranking_model_name</code> (string) 再ランキングモデル名
  1479. - <code>weights</code> (float) ハイブリッド検索モードでのセマンティック検索の重み設定
  1480. - <code>top_k</code> (integer) 返される結果の数 (オプション)
  1481. - <code>score_threshold_enabled</code> (bool) スコア閾値を有効にするかどうか
  1482. - <code>score_threshold</code> (float) スコア閾値
  1483. </Property>
  1484. <Property name='external_retrieval_model' type='object' key='external_retrieval_model'>
  1485. 未使用フィールド
  1486. </Property>
  1487. </Properties>
  1488. </Col>
  1489. <Col sticky>
  1490. <CodeGroup
  1491. title="リクエスト"
  1492. tag="POST"
  1493. label="/datasets/{dataset_id}/retrieve"
  1494. 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 '{
  1495. "query": "test",
  1496. "retrieval_model": {
  1497. "search_method": "keyword_search",
  1498. "reranking_enable": false,
  1499. "reranking_mode": null,
  1500. "reranking_model": {
  1501. "reranking_provider_name": "",
  1502. "reranking_model_name": ""
  1503. },
  1504. "weights": null,
  1505. "top_k": 1,
  1506. "score_threshold_enabled": false,
  1507. "score_threshold": null
  1508. }
  1509. }'`}
  1510. >
  1511. ```bash {{ title: 'cURL' }}
  1512. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/retrieve' \
  1513. --header 'Authorization: Bearer {api_key}' \
  1514. --header 'Content-Type: application/json' \
  1515. --data-raw '{
  1516. "query": "test",
  1517. "retrieval_model": {
  1518. "search_method": "keyword_search",
  1519. "reranking_enable": false,
  1520. "reranking_mode": null,
  1521. "reranking_model": {
  1522. "reranking_provider_name": "",
  1523. "reranking_model_name": ""
  1524. },
  1525. "weights": null,
  1526. "top_k": 2,
  1527. "score_threshold_enabled": false,
  1528. "score_threshold": null
  1529. }
  1530. }'
  1531. ```
  1532. </CodeGroup>
  1533. <CodeGroup title="レスポンス">
  1534. ```json {{ title: 'Response' }}
  1535. {
  1536. "query": {
  1537. "content": "test"
  1538. },
  1539. "records": [
  1540. {
  1541. "segment": {
  1542. "id": "7fa6f24f-8679-48b3-bc9d-bdf28d73f218",
  1543. "position": 1,
  1544. "document_id": "a8c6c36f-9f5d-4d7a-8472-f5d7b75d71d2",
  1545. "content": "Operation guide",
  1546. "answer": null,
  1547. "word_count": 847,
  1548. "tokens": 280,
  1549. "keywords": [
  1550. "install",
  1551. "java",
  1552. "base",
  1553. "scripts",
  1554. "jdk",
  1555. "manual",
  1556. "internal",
  1557. "opens",
  1558. "add",
  1559. "vmoptions"
  1560. ],
  1561. "index_node_id": "39dd8443-d960-45a8-bb46-7275ad7fbc8e",
  1562. "index_node_hash": "0189157697b3c6a418ccf8264a09699f25858975578f3467c76d6bfc94df1d73",
  1563. "hit_count": 0,
  1564. "enabled": true,
  1565. "disabled_at": null,
  1566. "disabled_by": null,
  1567. "status": "completed",
  1568. "created_by": "dbcb1ab5-90c8-41a7-8b78-73b235eb6f6f",
  1569. "created_at": 1728734540,
  1570. "indexing_at": 1728734552,
  1571. "completed_at": 1728734584,
  1572. "error": null,
  1573. "stopped_at": null,
  1574. "document": {
  1575. "id": "a8c6c36f-9f5d-4d7a-8472-f5d7b75d71d2",
  1576. "data_source_type": "upload_file",
  1577. "name": "readme.txt",
  1578. }
  1579. },
  1580. "score": 3.730463140527718e-05,
  1581. "tsne_position": null
  1582. }
  1583. ]
  1584. }
  1585. ```
  1586. </CodeGroup>
  1587. </Col>
  1588. </Row>
  1589. <hr className='ml-0 mr-0' />
  1590. <Heading
  1591. url='/datasets/{dataset_id}/metadata'
  1592. method='POST'
  1593. title='ナレッジメタデータを作成'
  1594. name='#create_metadata'
  1595. />
  1596. <Row>
  1597. <Col>
  1598. ### パス
  1599. <Properties>
  1600. <Property name='dataset_id' type='string' key='dataset_id'>
  1601. ナレッジ ID
  1602. </Property>
  1603. </Properties>
  1604. ### リクエストボディ
  1605. <Properties>
  1606. <Property name='segment' type='object' key='segment'>
  1607. - <code>type</code> (string) メタデータの種類、必須
  1608. - <code>name</code> (string) メタデータの名前、必須
  1609. </Property>
  1610. </Properties>
  1611. </Col>
  1612. <Col sticky>
  1613. <CodeGroup
  1614. title="リクエスト"
  1615. tag="POST"
  1616. label="/datasets/{dataset_id}/metadata"
  1617. 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"}'`}
  1618. >
  1619. ```bash {{ title: 'cURL' }}
  1620. ```
  1621. </CodeGroup>
  1622. <CodeGroup title="レスポンス">
  1623. ```json {{ title: 'Response' }}
  1624. {
  1625. "id": "abc",
  1626. "type": "string",
  1627. "name": "test",
  1628. }
  1629. ```
  1630. </CodeGroup>
  1631. </Col>
  1632. </Row>
  1633. <hr className='ml-0 mr-0' />
  1634. <Heading
  1635. url='/datasets/{dataset_id}/metadata/{metadata_id}'
  1636. method='PATCH'
  1637. title='ナレッジメタデータを更新'
  1638. name='#update_metadata'
  1639. />
  1640. <Row>
  1641. <Col>
  1642. ### パス
  1643. <Properties>
  1644. <Property name='dataset_id' type='string' key='dataset_id'>
  1645. ナレッジ ID
  1646. </Property>
  1647. <Property name='metadata_id' type='string' key='metadata_id'>
  1648. メタデータ ID
  1649. </Property>
  1650. </Properties>
  1651. ### リクエストボディ
  1652. <Properties>
  1653. <Property name='segment' type='object' key='segment'>
  1654. - <code>name</code> (string) メタデータの名前、必須
  1655. </Property>
  1656. </Properties>
  1657. </Col>
  1658. <Col sticky>
  1659. <CodeGroup
  1660. title="リクエスト"
  1661. tag="PATCH"
  1662. label="/datasets/{dataset_id}/metadata/{metadata_id}"
  1663. 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"}'`}
  1664. >
  1665. ```bash {{ title: 'cURL' }}
  1666. ```
  1667. </CodeGroup>
  1668. <CodeGroup title="レスポンス">
  1669. ```json {{ title: 'Response' }}
  1670. {
  1671. "id": "abc",
  1672. "type": "string",
  1673. "name": "test",
  1674. }
  1675. ```
  1676. </CodeGroup>
  1677. </Col>
  1678. </Row>
  1679. <hr className='ml-0 mr-0' />
  1680. <Heading
  1681. url='/datasets/{dataset_id}/metadata/{metadata_id}'
  1682. method='DELETE'
  1683. title='ナレッジメタデータを削除'
  1684. name='#delete_metadata'
  1685. />
  1686. <Row>
  1687. <Col>
  1688. ### パス
  1689. <Properties>
  1690. <Property name='dataset_id' type='string' key='dataset_id'>
  1691. ナレッジ ID
  1692. </Property>
  1693. <Property name='metadata_id' type='string' key='metadata_id'>
  1694. メタデータ ID
  1695. </Property>
  1696. </Properties>
  1697. </Col>
  1698. <Col sticky>
  1699. <CodeGroup
  1700. title="リクエスト"
  1701. tag="DELETE"
  1702. label="/datasets/{dataset_id}/metadata/{metadata_id}"
  1703. targetCode={`curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/metadata/{metadata_id}' \\\n--header 'Authorization: Bearer {api_key}'`}
  1704. >
  1705. ```bash {{ title: 'cURL' }}
  1706. ```
  1707. </CodeGroup>
  1708. </Col>
  1709. </Row>
  1710. <hr className='ml-0 mr-0' />
  1711. <Heading
  1712. url='/datasets/{dataset_id}/metadata/built-in/{action}'
  1713. method='POST'
  1714. title='組み込みメタデータを無効化または有効化'
  1715. name='#toggle_metadata'
  1716. />
  1717. <Row>
  1718. <Col>
  1719. ### パス
  1720. <Properties>
  1721. <Property name='dataset_id' type='string' key='dataset_id'>
  1722. ナレッジ ID
  1723. </Property>
  1724. <Property name='action' type='string' key='action'>
  1725. disable/enable
  1726. </Property>
  1727. </Properties>
  1728. </Col>
  1729. <Col sticky>
  1730. <CodeGroup
  1731. title="リクエスト"
  1732. tag="POST"
  1733. label="/datasets/{dataset_id}/metadata/built-in/{action}"
  1734. targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/metadata/built-in/{action}' \\\n--header 'Authorization: Bearer {api_key}'`}
  1735. >
  1736. ```bash {{ title: 'cURL' }}
  1737. ```
  1738. </CodeGroup>
  1739. </Col>
  1740. </Row>
  1741. <hr className='ml-0 mr-0' />
  1742. <Heading
  1743. url='/datasets/{dataset_id}/documents/metadata'
  1744. method='POST'
  1745. title='ドキュメントメタデータを更新'
  1746. name='#update_documents_metadata'
  1747. />
  1748. <Row>
  1749. <Col>
  1750. ### パス
  1751. <Properties>
  1752. <Property name='dataset_id' type='string' key='dataset_id'>
  1753. ナレッジ ID
  1754. </Property>
  1755. </Properties>
  1756. ### リクエストボディ
  1757. <Properties>
  1758. <Property name='operation_data' type='object list' key='segments'>
  1759. - <code>document_id</code> (string) ドキュメント ID
  1760. - <code>metadata_list</code> (list) メタデータリスト
  1761. - <code>id</code> (string) メタデータ ID
  1762. - <code>value</code> (string) メタデータの値
  1763. - <code>name</code> (string) メタデータの名前
  1764. </Property>
  1765. </Properties>
  1766. </Col>
  1767. <Col sticky>
  1768. <CodeGroup
  1769. title="リクエスト"
  1770. tag="POST"
  1771. label="/datasets/{dataset_id}/documents/metadata"
  1772. 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"}]}]}'`}
  1773. >
  1774. ```bash {{ title: 'cURL' }}
  1775. ```
  1776. </CodeGroup>
  1777. </Col>
  1778. </Row>
  1779. <hr className='ml-0 mr-0' />
  1780. <Heading
  1781. url='/datasets/{dataset_id}/metadata'
  1782. method='GET'
  1783. title='ナレッジメタデータリストを取得'
  1784. name='#dataset_metadata_list'
  1785. />
  1786. <Row>
  1787. <Col>
  1788. ### パス
  1789. <Properties>
  1790. <Property name='dataset_id' type='string' key='dataset_id'>
  1791. ナレッジ ID
  1792. </Property>
  1793. </Properties>
  1794. </Col>
  1795. <Col sticky>
  1796. <CodeGroup
  1797. title="リクエスト"
  1798. tag="GET"
  1799. label="/datasets/{dataset_id}/metadata"
  1800. targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/metadata' \\\n--header 'Authorization: Bearer {api_key}'`}
  1801. >
  1802. ```bash {{ title: 'cURL' }}
  1803. ```
  1804. </CodeGroup>
  1805. <CodeGroup title="レスポンス">
  1806. ```json {{ title: 'Response' }}
  1807. {
  1808. "doc_metadata": [
  1809. {
  1810. "id": "",
  1811. "name": "name",
  1812. "type": "string",
  1813. "use_count": 0,
  1814. },
  1815. ...
  1816. ],
  1817. "built_in_field_enabled": true
  1818. }
  1819. ```
  1820. </CodeGroup>
  1821. </Col>
  1822. </Row>
  1823. <hr className='ml-0 mr-0' />
  1824. <Row>
  1825. <Col>
  1826. ### エラーメッセージ
  1827. <Properties>
  1828. <Property name='code' type='string' key='code'>
  1829. エラーコード
  1830. </Property>
  1831. </Properties>
  1832. <Properties>
  1833. <Property name='status' type='number' key='status'>
  1834. エラーステータス
  1835. </Property>
  1836. </Properties>
  1837. <Properties>
  1838. <Property name='message' type='string' key='message'>
  1839. エラーメッセージ
  1840. </Property>
  1841. </Properties>
  1842. </Col>
  1843. <Col>
  1844. <CodeGroup title="例">
  1845. ```json {{ title: 'Response' }}
  1846. {
  1847. "code": "no_file_uploaded",
  1848. "message": "Please upload your file.",
  1849. "status": 400
  1850. }
  1851. ```
  1852. </CodeGroup>
  1853. </Col>
  1854. </Row>
  1855. <table className="max-w-auto border-collapse border border-slate-400" style={{ maxWidth: 'none', width: 'auto' }}>
  1856. <thead style={{ background: '#f9fafc' }}>
  1857. <tr>
  1858. <th className="p-2 border border-slate-300">code</th>
  1859. <th className="p-2 border border-slate-300">status</th>
  1860. <th className="p-2 border border-slate-300">message</th>
  1861. </tr>
  1862. </thead>
  1863. <tbody>
  1864. <tr>
  1865. <td className="p-2 border border-slate-300">no_file_uploaded</td>
  1866. <td className="p-2 border border-slate-300">400</td>
  1867. <td className="p-2 border border-slate-300">Please upload your file.</td>
  1868. </tr>
  1869. <tr>
  1870. <td className="p-2 border border-slate-300">too_many_files</td>
  1871. <td className="p-2 border border-slate-300">400</td>
  1872. <td className="p-2 border border-slate-300">Only one file is allowed.</td>
  1873. </tr>
  1874. <tr>
  1875. <td className="p-2 border border-slate-300">file_too_large</td>
  1876. <td className="p-2 border border-slate-300">413</td>
  1877. <td className="p-2 border border-slate-300">File size exceeded.</td>
  1878. </tr>
  1879. <tr>
  1880. <td className="p-2 border border-slate-300">unsupported_file_type</td>
  1881. <td className="p-2 border border-slate-300">415</td>
  1882. <td className="p-2 border border-slate-300">File type not allowed.</td>
  1883. </tr>
  1884. <tr>
  1885. <td className="p-2 border border-slate-300">high_quality_dataset_only</td>
  1886. <td className="p-2 border border-slate-300">400</td>
  1887. <td className="p-2 border border-slate-300">Current operation only supports 'high-quality' datasets.</td>
  1888. </tr>
  1889. <tr>
  1890. <td className="p-2 border border-slate-300">dataset_not_initialized</td>
  1891. <td className="p-2 border border-slate-300">400</td>
  1892. <td className="p-2 border border-slate-300">The dataset is still being initialized or indexing. Please wait a moment.</td>
  1893. </tr>
  1894. <tr>
  1895. <td className="p-2 border border-slate-300">archived_document_immutable</td>
  1896. <td className="p-2 border border-slate-300">403</td>
  1897. <td className="p-2 border border-slate-300">The archived document is not editable.</td>
  1898. </tr>
  1899. <tr>
  1900. <td className="p-2 border border-slate-300">dataset_name_duplicate</td>
  1901. <td className="p-2 border border-slate-300">409</td>
  1902. <td className="p-2 border border-slate-300">The dataset name already exists. Please modify your dataset name.</td>
  1903. </tr>
  1904. <tr>
  1905. <td className="p-2 border border-slate-300">invalid_action</td>
  1906. <td className="p-2 border border-slate-300">400</td>
  1907. <td className="p-2 border border-slate-300">Invalid action.</td>
  1908. </tr>
  1909. <tr>
  1910. <td className="p-2 border border-slate-300">document_already_finished</td>
  1911. <td className="p-2 border border-slate-300">400</td>
  1912. <td className="p-2 border border-slate-300">The document has been processed. Please refresh the page or go to the document details.</td>
  1913. </tr>
  1914. <tr>
  1915. <td className="p-2 border border-slate-300">document_indexing</td>
  1916. <td className="p-2 border border-slate-300">400</td>
  1917. <td className="p-2 border border-slate-300">The document is being processed and cannot be edited.</td>
  1918. </tr>
  1919. <tr>
  1920. <td className="p-2 border border-slate-300">invalid_metadata</td>
  1921. <td className="p-2 border border-slate-300">400</td>
  1922. <td className="p-2 border border-slate-300">The metadata content is incorrect. Please check and verify.</td>
  1923. </tr>
  1924. </tbody>
  1925. </table>
  1926. <div className="pb-4" />