mirror of
https://github.com/langgenius/dify-docs.git
synced 2026-03-27 13:28:32 +07:00
* Batch update service apis * final check and add zh/ja docs * add temporary redirects for changed api links embedded in the product * Restore original operationIds to preserve SDK compatibility Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * complete the missing descriptions * correct the human input terminology --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
6657 lines
263 KiB
JSON
6657 lines
263 KiB
JSON
{
|
||
"openapi": "3.0.1",
|
||
"info": {
|
||
"title": "ナレッジAPI",
|
||
"description": "ナレッジベース、ドキュメント、チャンク、メタデータ、タグの管理(作成、取得、設定を含む)のための API です。**注意:**単一のナレッジベース API キーは、同じアカウント配下のすべての可視ナレッジベースを操作する権限を持ちます。データセキュリティにご注意ください。",
|
||
"version": "1.0.0"
|
||
},
|
||
"servers": [
|
||
{
|
||
"url": "{apiBaseUrl}",
|
||
"description": "Knowledge API のベース URL です。",
|
||
"variables": {
|
||
"apiBaseUrl": {
|
||
"default": "https://api.dify.ai/v1",
|
||
"description": "API の実際のベース URL"
|
||
}
|
||
}
|
||
}
|
||
],
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
}
|
||
],
|
||
"tags": [
|
||
{
|
||
"name": "データセット",
|
||
"description": "ナレッジベースの作成、設定、取得を含むナレッジベース管理の操作です。"
|
||
},
|
||
{
|
||
"name": "ドキュメント",
|
||
"description": "ナレッジベース内のドキュメントの作成、更新、管理のための操作です。"
|
||
},
|
||
{
|
||
"name": "チャンク",
|
||
"description": "ドキュメントチャンクと子チャンクの管理のための操作です。"
|
||
},
|
||
{
|
||
"name": "メタデータ",
|
||
"description": "ナレッジベースのメタデータフィールドとドキュメントメタデータ値の管理のための操作です。"
|
||
},
|
||
{
|
||
"name": "タグ管理",
|
||
"description": "ナレッジベースタグとタグバインディングの管理のための操作です。"
|
||
},
|
||
{
|
||
"name": "モデル",
|
||
"description": "利用可能なモデルを取得するための操作です。"
|
||
},
|
||
{
|
||
"name": "ナレッジパイプライン",
|
||
"description": "データソースプラグインとパイプライン実行を含むナレッジパイプラインの管理と実行のための操作です。"
|
||
}
|
||
],
|
||
"paths": {
|
||
"/datasets": {
|
||
"post": {
|
||
"tags": [
|
||
"データセット"
|
||
],
|
||
"summary": "空のナレッジベースを作成",
|
||
"description": "新しい空のナレッジベースを作成します。作成後、[テキストからドキュメントを作成](/api-reference/ドキュメント/テキストからドキュメントを作成) または [ファイルからドキュメントを作成](/api-reference/ドキュメント/ファイルからドキュメントを作成) を使用してドキュメントを追加します。",
|
||
"operationId": "createDataset",
|
||
"requestBody": {
|
||
"required": true,
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"required": [
|
||
"name"
|
||
],
|
||
"properties": {
|
||
"name": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 40,
|
||
"description": "ナレッジベース名。"
|
||
},
|
||
"description": {
|
||
"type": "string",
|
||
"maxLength": 400,
|
||
"default": "",
|
||
"description": "ナレッジベースの説明です。"
|
||
},
|
||
"indexing_technique": {
|
||
"type": "string",
|
||
"enum": [
|
||
"high_quality",
|
||
"economy"
|
||
],
|
||
"nullable": true,
|
||
"description": "`high_quality` は埋め込みモデルを使用した精密検索、`economy` はキーワードベースのインデキシングです。"
|
||
},
|
||
"permission": {
|
||
"type": "string",
|
||
"enum": [
|
||
"only_me",
|
||
"all_team_members",
|
||
"partial_members"
|
||
],
|
||
"default": "only_me",
|
||
"description": "このナレッジベースにアクセスできるユーザーを制御します。`only_me` は作成者のみに制限、`all_team_members` はワークスペース全体にアクセスを許可、`partial_members` は指定されたメンバーにアクセスを許可します。"
|
||
},
|
||
"provider": {
|
||
"type": "string",
|
||
"enum": [
|
||
"vendor",
|
||
"external"
|
||
],
|
||
"default": "vendor",
|
||
"description": "`vendor` は内部ナレッジベース、`external` は外部ナレッジベースです。"
|
||
},
|
||
"embedding_model": {
|
||
"type": "string",
|
||
"description": "埋め込みモデル名です。[利用可能なモデルを取得](/api-reference/モデル/利用可能なモデルを取得) で `model_type=text-embedding` を指定した際の `model` フィールドの値を使用します。"
|
||
},
|
||
"embedding_model_provider": {
|
||
"type": "string",
|
||
"description": "埋め込みモデルプロバイダーです。[利用可能なモデルを取得](/api-reference/モデル/利用可能なモデルを取得) で `model_type=text-embedding` を指定した際の `provider` フィールドの値を使用します。"
|
||
},
|
||
"retrieval_model": {
|
||
"$ref": "#/components/schemas/RetrievalModel",
|
||
"description": "検索モデルの設定です。このナレッジベースをクエリする際のチャンクの検索方法とランキング方法を制御します。"
|
||
},
|
||
"external_knowledge_api_id": {
|
||
"type": "string",
|
||
"description": "外部ナレッジ API 接続の ID です。"
|
||
},
|
||
"external_knowledge_id": {
|
||
"type": "string",
|
||
"description": "外部ナレッジベースの ID です。"
|
||
},
|
||
"summary_index_setting": {
|
||
"type": "object",
|
||
"nullable": true,
|
||
"description": "サマリーインデックスの設定です。",
|
||
"properties": {
|
||
"enable": {
|
||
"type": "boolean",
|
||
"description": "サマリーインデックスを有効にするかどうかです。"
|
||
},
|
||
"model_name": {
|
||
"type": "string",
|
||
"description": "要約生成に使用されるモデルの名前です。"
|
||
},
|
||
"model_provider_name": {
|
||
"type": "string",
|
||
"description": "要約生成モデルのプロバイダーです。"
|
||
},
|
||
"summary_prompt": {
|
||
"type": "string",
|
||
"description": "要約生成用のカスタムプロンプトテンプレートです。"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "ナレッジベースが正常に作成されました。",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/Dataset"
|
||
},
|
||
"examples": {
|
||
"success": {
|
||
"summary": "レスポンス例",
|
||
"value": {
|
||
"id": "c42e2a6e-40b3-4330-96f8-f1e4d768e8c9",
|
||
"name": "Product Documentation",
|
||
"description": "プロダクト API 技術ドキュメント",
|
||
"provider": "vendor",
|
||
"permission": "only_me",
|
||
"data_source_type": null,
|
||
"indexing_technique": "high_quality",
|
||
"app_count": 0,
|
||
"document_count": 0,
|
||
"word_count": 0,
|
||
"created_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4",
|
||
"author_name": "admin",
|
||
"created_at": 1741267200,
|
||
"updated_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4",
|
||
"updated_at": 1741267200,
|
||
"embedding_model": "text-embedding-3-small",
|
||
"embedding_model_provider": "openai",
|
||
"embedding_available": true,
|
||
"retrieval_model_dict": {
|
||
"search_method": "semantic_search",
|
||
"reranking_enable": false,
|
||
"reranking_mode": null,
|
||
"reranking_model": {
|
||
"reranking_provider_name": "",
|
||
"reranking_model_name": ""
|
||
},
|
||
"weights": null,
|
||
"top_k": 3,
|
||
"score_threshold_enabled": false,
|
||
"score_threshold": null
|
||
},
|
||
"tags": [],
|
||
"doc_form": "text_model",
|
||
"external_knowledge_info": null,
|
||
"external_retrieval_model": null,
|
||
"doc_metadata": [],
|
||
"built_in_field_enabled": true,
|
||
"pipeline_id": null,
|
||
"runtime_mode": null,
|
||
"chunk_structure": null,
|
||
"icon_info": null,
|
||
"summary_index_setting": null,
|
||
"is_published": false,
|
||
"total_documents": 0,
|
||
"total_available_documents": 0,
|
||
"enable_api": true,
|
||
"is_multimodal": false
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"409": {
|
||
"description": "`dataset_name_duplicate` : ナレッジベース名は既に存在します。名前を変更してください。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"dataset_name_duplicate": {
|
||
"summary": "dataset_name_duplicate",
|
||
"value": {
|
||
"status": 409,
|
||
"code": "dataset_name_duplicate",
|
||
"message": "The dataset name already exists. Please modify your dataset name."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"get": {
|
||
"tags": [
|
||
"データセット"
|
||
],
|
||
"summary": "ナレッジベースリストを取得",
|
||
"description": "ナレッジベースのページネーションリストを返します。キーワードとタグによるフィルタリングをサポートしています。",
|
||
"operationId": "listDatasets",
|
||
"parameters": [
|
||
{
|
||
"name": "page",
|
||
"in": "query",
|
||
"schema": {
|
||
"type": "integer",
|
||
"default": 1
|
||
},
|
||
"description": "取得するページ番号。"
|
||
},
|
||
{
|
||
"name": "limit",
|
||
"in": "query",
|
||
"schema": {
|
||
"type": "integer",
|
||
"default": 20
|
||
},
|
||
"description": "1 ページあたりの件数です。"
|
||
},
|
||
{
|
||
"name": "keyword",
|
||
"in": "query",
|
||
"schema": {
|
||
"type": "string"
|
||
},
|
||
"description": "名前でフィルタリングする検索キーワードです。"
|
||
},
|
||
{
|
||
"name": "include_all",
|
||
"in": "query",
|
||
"schema": {
|
||
"type": "boolean",
|
||
"default": false
|
||
},
|
||
"description": "権限に関係なくすべてのナレッジベースを含めるかどうかです。"
|
||
},
|
||
{
|
||
"name": "tag_ids",
|
||
"in": "query",
|
||
"schema": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "string"
|
||
}
|
||
},
|
||
"style": "form",
|
||
"explode": true,
|
||
"description": "フィルタリングに使用するタグ ID です。"
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "ナレッジベースのリストです。",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"type": "array",
|
||
"description": "ナレッジベースオブジェクトの配列です。",
|
||
"items": {
|
||
"$ref": "#/components/schemas/Dataset"
|
||
}
|
||
},
|
||
"has_more": {
|
||
"type": "boolean",
|
||
"description": "次のページにさらに項目が存在するかどうかです。"
|
||
},
|
||
"limit": {
|
||
"type": "integer",
|
||
"description": "1 ページあたりの件数です。"
|
||
},
|
||
"total": {
|
||
"type": "integer",
|
||
"description": "一致する項目の合計数です。"
|
||
},
|
||
"page": {
|
||
"type": "integer",
|
||
"description": "現在のページ番号です。"
|
||
}
|
||
}
|
||
},
|
||
"examples": {
|
||
"success": {
|
||
"summary": "レスポンス例",
|
||
"value": {
|
||
"data": [
|
||
{
|
||
"id": "c42e2a6e-40b3-4330-96f8-f1e4d768e8c9",
|
||
"name": "Product Documentation",
|
||
"description": "プロダクト API 技術ドキュメント",
|
||
"provider": "vendor",
|
||
"permission": "only_me",
|
||
"data_source_type": null,
|
||
"indexing_technique": "high_quality",
|
||
"app_count": 0,
|
||
"document_count": 0,
|
||
"word_count": 0,
|
||
"created_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4",
|
||
"author_name": "admin",
|
||
"created_at": 1741267200,
|
||
"updated_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4",
|
||
"updated_at": 1741267200,
|
||
"embedding_model": "text-embedding-3-small",
|
||
"embedding_model_provider": "openai",
|
||
"embedding_available": true,
|
||
"retrieval_model_dict": {
|
||
"search_method": "semantic_search",
|
||
"reranking_enable": false,
|
||
"reranking_mode": null,
|
||
"reranking_model": {
|
||
"reranking_provider_name": "",
|
||
"reranking_model_name": ""
|
||
},
|
||
"weights": null,
|
||
"top_k": 3,
|
||
"score_threshold_enabled": false,
|
||
"score_threshold": null
|
||
},
|
||
"tags": [],
|
||
"doc_form": "text_model",
|
||
"external_knowledge_info": null,
|
||
"external_retrieval_model": null,
|
||
"doc_metadata": [],
|
||
"built_in_field_enabled": true,
|
||
"pipeline_id": null,
|
||
"runtime_mode": null,
|
||
"chunk_structure": null,
|
||
"icon_info": null,
|
||
"summary_index_setting": null,
|
||
"is_published": false,
|
||
"total_documents": 0,
|
||
"total_available_documents": 0,
|
||
"enable_api": true,
|
||
"is_multimodal": false
|
||
}
|
||
],
|
||
"has_more": false,
|
||
"limit": 20,
|
||
"total": 1,
|
||
"page": 1
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/datasets/{dataset_id}": {
|
||
"get": {
|
||
"tags": [
|
||
"データセット"
|
||
],
|
||
"summary": "ナレッジベース詳細を取得",
|
||
"description": "特定のナレッジベースの詳細情報(埋め込みモデル、検索設定、ドキュメント統計を含む)を取得します。",
|
||
"operationId": "getDatasetDetail",
|
||
"parameters": [
|
||
{
|
||
"name": "dataset_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "ナレッジベース ID です。"
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "ナレッジベースの詳細です。",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/Dataset"
|
||
},
|
||
"examples": {
|
||
"success": {
|
||
"summary": "レスポンス例",
|
||
"value": {
|
||
"id": "c42e2a6e-40b3-4330-96f8-f1e4d768e8c9",
|
||
"name": "Product Documentation",
|
||
"description": "プロダクト API 技術ドキュメント",
|
||
"provider": "vendor",
|
||
"permission": "only_me",
|
||
"data_source_type": null,
|
||
"indexing_technique": "high_quality",
|
||
"app_count": 0,
|
||
"document_count": 0,
|
||
"word_count": 0,
|
||
"created_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4",
|
||
"author_name": "admin",
|
||
"created_at": 1741267200,
|
||
"updated_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4",
|
||
"updated_at": 1741267200,
|
||
"embedding_model": "text-embedding-3-small",
|
||
"embedding_model_provider": "openai",
|
||
"embedding_available": true,
|
||
"retrieval_model_dict": {
|
||
"search_method": "semantic_search",
|
||
"reranking_enable": false,
|
||
"reranking_mode": null,
|
||
"reranking_model": {
|
||
"reranking_provider_name": "",
|
||
"reranking_model_name": ""
|
||
},
|
||
"weights": null,
|
||
"top_k": 3,
|
||
"score_threshold_enabled": false,
|
||
"score_threshold": null
|
||
},
|
||
"tags": [],
|
||
"doc_form": "text_model",
|
||
"external_knowledge_info": null,
|
||
"external_retrieval_model": null,
|
||
"doc_metadata": [],
|
||
"built_in_field_enabled": true,
|
||
"pipeline_id": null,
|
||
"runtime_mode": null,
|
||
"chunk_structure": null,
|
||
"icon_info": null,
|
||
"summary_index_setting": null,
|
||
"is_published": false,
|
||
"total_documents": 0,
|
||
"total_available_documents": 0,
|
||
"enable_api": true,
|
||
"is_multimodal": false
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"403": {
|
||
"description": "`forbidden` : このナレッジベースにアクセスする権限がありません。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"forbidden": {
|
||
"summary": "forbidden",
|
||
"value": {
|
||
"status": 403,
|
||
"code": "forbidden",
|
||
"message": "Insufficient permissions to access this knowledge base."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"404": {
|
||
"description": "`not_found` : ナレッジベースが見つかりません。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"not_found": {
|
||
"summary": "not_found",
|
||
"value": {
|
||
"status": 404,
|
||
"code": "not_found",
|
||
"message": "Dataset not found."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"patch": {
|
||
"tags": [
|
||
"データセット"
|
||
],
|
||
"summary": "ナレッジベースを更新",
|
||
"description": "既存のナレッジベースの名前、説明、権限、または検索設定を更新します。リクエストボディで指定されたフィールドのみが更新されます。",
|
||
"operationId": "updateDataset",
|
||
"parameters": [
|
||
{
|
||
"name": "dataset_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "ナレッジベース ID です。"
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"name": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 40,
|
||
"description": "ナレッジベース名。"
|
||
},
|
||
"description": {
|
||
"type": "string",
|
||
"maxLength": 400,
|
||
"description": "ナレッジベースの説明です。"
|
||
},
|
||
"indexing_technique": {
|
||
"type": "string",
|
||
"enum": [
|
||
"high_quality",
|
||
"economy"
|
||
],
|
||
"nullable": true,
|
||
"description": "`high_quality` は埋め込みモデルを使用した精密検索、`economy` はキーワードベースのインデキシングです。"
|
||
},
|
||
"permission": {
|
||
"type": "string",
|
||
"enum": [
|
||
"only_me",
|
||
"all_team_members",
|
||
"partial_members"
|
||
],
|
||
"description": "このナレッジベースにアクセスできるユーザーを制御します。`only_me` は作成者のみに制限、`all_team_members` はワークスペース全体にアクセスを許可、`partial_members` は指定されたメンバーにアクセスを許可します。"
|
||
},
|
||
"embedding_model": {
|
||
"type": "string",
|
||
"description": "埋め込みモデル名です。[利用可能なモデルを取得](/api-reference/モデル/利用可能なモデルを取得) で `model_type=text-embedding` を指定した際の `model` フィールドの値を使用します。"
|
||
},
|
||
"embedding_model_provider": {
|
||
"type": "string",
|
||
"description": "埋め込みモデルプロバイダーです。[利用可能なモデルを取得](/api-reference/モデル/利用可能なモデルを取得) で `model_type=text-embedding` を指定した際の `provider` フィールドの値を使用します。"
|
||
},
|
||
"retrieval_model": {
|
||
"$ref": "#/components/schemas/RetrievalModel",
|
||
"description": "検索モデルの設定です。このナレッジベースをクエリする際のチャンクの検索方法とランキング方法を制御します。"
|
||
},
|
||
"partial_member_list": {
|
||
"type": "array",
|
||
"description": "`permission` が `partial_members` の場合にアクセス権を持つチームメンバーのリストです。",
|
||
"items": {
|
||
"type": "object",
|
||
"properties": {
|
||
"user_id": {
|
||
"type": "string",
|
||
"description": "アクセス権を付与するチームメンバーの ID です。"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"external_retrieval_model": {
|
||
"type": "object",
|
||
"description": "外部ナレッジベースの検索設定です。",
|
||
"properties": {
|
||
"top_k": {
|
||
"type": "integer",
|
||
"description": "返す結果の最大数です。"
|
||
},
|
||
"score_threshold": {
|
||
"type": "number",
|
||
"description": "結果フィルタリング用の最小関連性スコア閾値です。"
|
||
},
|
||
"score_threshold_enabled": {
|
||
"type": "boolean",
|
||
"description": "スコア閾値フィルタリングが有効かどうかです。"
|
||
}
|
||
}
|
||
},
|
||
"external_knowledge_id": {
|
||
"type": "string",
|
||
"description": "外部ナレッジベースの ID です。"
|
||
},
|
||
"external_knowledge_api_id": {
|
||
"type": "string",
|
||
"description": "外部ナレッジ API 接続の ID です。"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "ナレッジベースが正常に更新されました。",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/Dataset"
|
||
},
|
||
"examples": {
|
||
"success": {
|
||
"summary": "レスポンス例",
|
||
"value": {
|
||
"id": "c42e2a6e-40b3-4330-96f8-f1e4d768e8c9",
|
||
"name": "Product Documentation",
|
||
"description": "プロダクト API 技術ドキュメント",
|
||
"provider": "vendor",
|
||
"permission": "only_me",
|
||
"data_source_type": null,
|
||
"indexing_technique": "high_quality",
|
||
"app_count": 0,
|
||
"document_count": 0,
|
||
"word_count": 0,
|
||
"created_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4",
|
||
"author_name": "admin",
|
||
"created_at": 1741267200,
|
||
"updated_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4",
|
||
"updated_at": 1741267200,
|
||
"embedding_model": "text-embedding-3-small",
|
||
"embedding_model_provider": "openai",
|
||
"embedding_available": true,
|
||
"retrieval_model_dict": {
|
||
"search_method": "semantic_search",
|
||
"reranking_enable": false,
|
||
"reranking_mode": null,
|
||
"reranking_model": {
|
||
"reranking_provider_name": "",
|
||
"reranking_model_name": ""
|
||
},
|
||
"weights": null,
|
||
"top_k": 3,
|
||
"score_threshold_enabled": false,
|
||
"score_threshold": null
|
||
},
|
||
"tags": [],
|
||
"doc_form": "text_model",
|
||
"external_knowledge_info": null,
|
||
"external_retrieval_model": null,
|
||
"doc_metadata": [],
|
||
"built_in_field_enabled": true,
|
||
"pipeline_id": null,
|
||
"runtime_mode": null,
|
||
"chunk_structure": null,
|
||
"icon_info": null,
|
||
"summary_index_setting": null,
|
||
"is_published": false,
|
||
"total_documents": 0,
|
||
"total_available_documents": 0,
|
||
"enable_api": true,
|
||
"is_multimodal": false
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"403": {
|
||
"description": "`forbidden` : このナレッジベースにアクセスする権限がありません。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"forbidden": {
|
||
"summary": "forbidden",
|
||
"value": {
|
||
"status": 403,
|
||
"code": "forbidden",
|
||
"message": "Insufficient permissions to access this knowledge base."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"404": {
|
||
"description": "`not_found` : ナレッジベースが見つかりません。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"not_found": {
|
||
"summary": "not_found",
|
||
"value": {
|
||
"status": 404,
|
||
"code": "not_found",
|
||
"message": "Dataset not found."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"delete": {
|
||
"tags": [
|
||
"データセット"
|
||
],
|
||
"summary": "ナレッジベースを削除",
|
||
"description": "ナレッジベースとそのすべてのドキュメントを完全に削除します。対象のナレッジベースはどのアプリケーションでも使用されていない必要があります。",
|
||
"operationId": "deleteDataset",
|
||
"parameters": [
|
||
{
|
||
"name": "dataset_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "ナレッジベース ID です。"
|
||
}
|
||
],
|
||
"responses": {
|
||
"204": {
|
||
"description": "Success."
|
||
},
|
||
"404": {
|
||
"description": "`not_found` : ナレッジベースが見つかりません。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"not_found": {
|
||
"summary": "not_found",
|
||
"value": {
|
||
"status": 404,
|
||
"code": "not_found",
|
||
"message": "Dataset not found."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"409": {
|
||
"description": "`dataset_in_use` : このナレッジベースは一部のアプリで使用されています。削除する前にアプリから削除してください。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"dataset_in_use": {
|
||
"summary": "dataset_in_use",
|
||
"value": {
|
||
"status": 409,
|
||
"code": "dataset_in_use",
|
||
"message": "The dataset is being used by some apps. Please remove the dataset from the apps before deleting it."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/datasets/{dataset_id}/document/create-by-text": {
|
||
"post": {
|
||
"tags": [
|
||
"ドキュメント"
|
||
],
|
||
"summary": "テキストからドキュメントを作成",
|
||
"description": "テキストコンテンツからドキュメントを作成します。ドキュメントは非同期で処理されます——返された `batch` ID を [ドキュメント埋め込みステータス(進捗)を取得](/api-reference/ドキュメント/ドキュメント埋め込みステータス(進捗)を取得) で使用して進捗を追跡します。",
|
||
"operationId": "createDocumentFromText",
|
||
"parameters": [
|
||
{
|
||
"name": "dataset_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "ナレッジベース ID です。"
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"required": [
|
||
"name",
|
||
"text"
|
||
],
|
||
"properties": {
|
||
"name": {
|
||
"type": "string",
|
||
"description": "ドキュメント名です。"
|
||
},
|
||
"text": {
|
||
"type": "string",
|
||
"description": "ドキュメントのテキスト内容です。"
|
||
},
|
||
"indexing_technique": {
|
||
"type": "string",
|
||
"enum": [
|
||
"high_quality",
|
||
"economy"
|
||
],
|
||
"description": "ナレッジベースに最初のドキュメントを追加する際に必須です。以降のドキュメントでは省略するとナレッジベースのインデックス方式を継承します。`high_quality` は埋め込みモデルによる精密検索、`economy` はキーワードベースのインデックスを使用します。"
|
||
},
|
||
"doc_form": {
|
||
"type": "string",
|
||
"enum": [
|
||
"text_model",
|
||
"hierarchical_model",
|
||
"qa_model"
|
||
],
|
||
"default": "text_model",
|
||
"description": "`text_model` は標準テキストチャンキング、`hierarchical_model` は親子チャンク構造、`qa_model` は質問・回答ペアの抽出です。"
|
||
},
|
||
"doc_language": {
|
||
"type": "string",
|
||
"default": "English",
|
||
"description": "処理最適化のためのドキュメント言語です。"
|
||
},
|
||
"process_rule": {
|
||
"type": "object",
|
||
"description": "チャンキングの処理ルールです。",
|
||
"required": [
|
||
"mode"
|
||
],
|
||
"properties": {
|
||
"mode": {
|
||
"type": "string",
|
||
"enum": [
|
||
"automatic",
|
||
"custom",
|
||
"hierarchical"
|
||
],
|
||
"description": "処理モードです。`automatic` は組み込みルールを使用、`custom` は手動設定が可能、`hierarchical` は親子チャンク構造を有効にします(`doc_form: hierarchical_model` と組み合わせて使用)。"
|
||
},
|
||
"rules": {
|
||
"type": "object",
|
||
"properties": {
|
||
"pre_processing_rules": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "object",
|
||
"properties": {
|
||
"id": {
|
||
"type": "string",
|
||
"enum": [
|
||
"remove_stopwords",
|
||
"remove_extra_spaces",
|
||
"remove_urls_emails"
|
||
],
|
||
"description": "ルール識別子です。"
|
||
},
|
||
"enabled": {
|
||
"type": "boolean",
|
||
"description": "この前処理ルールが有効かどうかです。"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"segmentation": {
|
||
"type": "object",
|
||
"properties": {
|
||
"separator": {
|
||
"type": "string",
|
||
"default": "\n",
|
||
"description": "テキスト分割用のカスタムセパレーターです。"
|
||
},
|
||
"max_tokens": {
|
||
"type": "integer",
|
||
"description": "チャンクあたりの最大トークン数です。"
|
||
},
|
||
"chunk_overlap": {
|
||
"type": "integer",
|
||
"default": 0,
|
||
"description": "チャンク間のトークンオーバーラップです。"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"retrieval_model": {
|
||
"$ref": "#/components/schemas/RetrievalModel",
|
||
"description": "検索モデルの設定です。このナレッジベースをクエリする際のチャンクの検索方法とランキング方法を制御します。"
|
||
},
|
||
"embedding_model": {
|
||
"type": "string",
|
||
"description": "埋め込みモデル名です。[利用可能なモデルを取得](/api-reference/モデル/利用可能なモデルを取得) で `model_type=text-embedding` を指定した際の `model` フィールドの値を使用します。"
|
||
},
|
||
"embedding_model_provider": {
|
||
"type": "string",
|
||
"description": "埋め込みモデルプロバイダーです。[利用可能なモデルを取得](/api-reference/モデル/利用可能なモデルを取得) で `model_type=text-embedding` を指定した際の `provider` フィールドの値を使用します。"
|
||
},
|
||
"original_document_id": {
|
||
"type": "string",
|
||
"description": "バージョン管理用の元ドキュメント ID です。"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "ドキュメントが正常に作成されました。",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"document": {
|
||
"$ref": "#/components/schemas/Document"
|
||
},
|
||
"batch": {
|
||
"type": "string",
|
||
"description": "インデックス進捗を追跡するためのバッチ ID です。"
|
||
}
|
||
}
|
||
},
|
||
"examples": {
|
||
"success": {
|
||
"summary": "レスポンス例",
|
||
"value": {
|
||
"document": {
|
||
"id": "a8e0e5b5-78c6-4130-a5ce-25feb0e0b4ac",
|
||
"position": 1,
|
||
"data_source_type": "upload_file",
|
||
"data_source_info": {
|
||
"upload_file_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
|
||
},
|
||
"data_source_detail_dict": {
|
||
"upload_file": {
|
||
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
|
||
"name": "guide.txt",
|
||
"size": 2048,
|
||
"extension": "txt",
|
||
"mime_type": "text/plain",
|
||
"created_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4",
|
||
"created_at": 1741267200
|
||
}
|
||
},
|
||
"dataset_process_rule_id": "e1f2a3b4-c5d6-7890-ef12-345678901234",
|
||
"name": "guide.txt",
|
||
"created_from": "api",
|
||
"created_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4",
|
||
"created_at": 1741267200,
|
||
"tokens": 0,
|
||
"indexing_status": "indexing",
|
||
"error": null,
|
||
"enabled": true,
|
||
"disabled_at": null,
|
||
"disabled_by": null,
|
||
"archived": false,
|
||
"display_status": "indexing",
|
||
"word_count": 0,
|
||
"hit_count": 0,
|
||
"doc_form": "text_model",
|
||
"doc_metadata": [],
|
||
"summary_index_status": null,
|
||
"need_summary": false
|
||
},
|
||
"batch": "20250306150245647595"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "- `provider_not_initialize` : 有効なモデルプロバイダーの認証情報が見つかりません。設定 → モデルプロバイダーで認証情報を完了してください。\n- `invalid_param` : ナレッジベースが存在しません。/ indexing_technique は必須です。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"provider_not_initialize": {
|
||
"summary": "provider_not_initialize",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "provider_not_initialize",
|
||
"message": "No valid model provider credentials found. Please go to Settings -> Model Provider to complete your provider credentials."
|
||
}
|
||
},
|
||
"invalid_param_dataset": {
|
||
"summary": "invalid_param",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "invalid_param",
|
||
"message": "Dataset does not exist."
|
||
}
|
||
},
|
||
"invalid_param_indexing": {
|
||
"summary": "invalid_param",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "invalid_param",
|
||
"message": "indexing_technique is required."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/datasets/{dataset_id}/document/create-by-file": {
|
||
"post": {
|
||
"tags": [
|
||
"ドキュメント"
|
||
],
|
||
"summary": "ファイルからドキュメントを作成",
|
||
"description": "ファイルをアップロードしてドキュメントを作成します。一般的なドキュメント形式(PDF、TXT、DOCX など)をサポートしています。処理は非同期で行われます——返された `batch` ID を [ドキュメント埋め込みステータス(進捗)を取得](/api-reference/ドキュメント/ドキュメント埋め込みステータス(進捗)を取得) で使用して進捗を追跡します。",
|
||
"operationId": "createDocumentFromFile",
|
||
"parameters": [
|
||
{
|
||
"name": "dataset_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "ナレッジベース ID です。"
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"content": {
|
||
"multipart/form-data": {
|
||
"schema": {
|
||
"type": "object",
|
||
"required": [
|
||
"file"
|
||
],
|
||
"properties": {
|
||
"file": {
|
||
"type": "string",
|
||
"format": "binary",
|
||
"description": "アップロードするファイルです。"
|
||
},
|
||
"data": {
|
||
"type": "string",
|
||
"description": "設定情報を含む JSON 文字列です。[テキストからドキュメントを作成](/api-reference/ドキュメント/テキストからドキュメントを作成) と同じフィールド(`indexing_technique`、`doc_form`、`doc_language`、`process_rule`、`retrieval_model`、`embedding_model`、`embedding_model_provider`)を受け付けますが、`name` と `text` は除きます。",
|
||
"example": "{\"indexing_technique\":\"high_quality\",\"doc_form\":\"text_model\",\"doc_language\":\"English\",\"process_rule\":{\"mode\":\"automatic\"}}"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "ドキュメントが正常に作成されました。",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"document": {
|
||
"$ref": "#/components/schemas/Document"
|
||
},
|
||
"batch": {
|
||
"type": "string",
|
||
"description": "インデックス進捗を追跡するためのバッチ ID です。"
|
||
}
|
||
}
|
||
},
|
||
"examples": {
|
||
"success": {
|
||
"summary": "レスポンス例",
|
||
"value": {
|
||
"document": {
|
||
"id": "a8e0e5b5-78c6-4130-a5ce-25feb0e0b4ac",
|
||
"position": 1,
|
||
"data_source_type": "upload_file",
|
||
"data_source_info": {
|
||
"upload_file_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
|
||
},
|
||
"data_source_detail_dict": {
|
||
"upload_file": {
|
||
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
|
||
"name": "guide.txt",
|
||
"size": 2048,
|
||
"extension": "txt",
|
||
"mime_type": "text/plain",
|
||
"created_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4",
|
||
"created_at": 1741267200
|
||
}
|
||
},
|
||
"dataset_process_rule_id": "e1f2a3b4-c5d6-7890-ef12-345678901234",
|
||
"name": "guide.txt",
|
||
"created_from": "api",
|
||
"created_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4",
|
||
"created_at": 1741267200,
|
||
"tokens": 0,
|
||
"indexing_status": "indexing",
|
||
"error": null,
|
||
"enabled": true,
|
||
"disabled_at": null,
|
||
"disabled_by": null,
|
||
"archived": false,
|
||
"display_status": "indexing",
|
||
"word_count": 0,
|
||
"hit_count": 0,
|
||
"doc_form": "text_model",
|
||
"doc_metadata": [],
|
||
"summary_index_status": null,
|
||
"need_summary": false
|
||
},
|
||
"batch": "20250306150245647595"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "- `no_file_uploaded` : ファイルをアップロードしてください。\n- `too_many_files` : ファイルは 1 つのみ許可されています。\n- `filename_not_exists_error` : 指定されたファイル名が存在しません。\n- `provider_not_initialize` : 有効なモデルプロバイダーの認証情報が見つかりません。設定 → モデルプロバイダーで認証情報を完了してください。\n- `invalid_param` : ナレッジベースが存在しない、外部データセットは非対応、ファイルが大きすぎる、サポートされていないファイルタイプ、または必須フィールドが不足しています。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"no_file_uploaded": {
|
||
"summary": "no_file_uploaded",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "no_file_uploaded",
|
||
"message": "Please upload your file."
|
||
}
|
||
},
|
||
"too_many_files": {
|
||
"summary": "too_many_files",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "too_many_files",
|
||
"message": "Only one file is allowed."
|
||
}
|
||
},
|
||
"filename_not_exists_error": {
|
||
"summary": "filename_not_exists_error",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "filename_not_exists_error",
|
||
"message": "The specified filename does not exist."
|
||
}
|
||
},
|
||
"provider_not_initialize": {
|
||
"summary": "provider_not_initialize",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "provider_not_initialize",
|
||
"message": "No valid model provider credentials found. Please go to Settings -> Model Provider to complete your provider credentials."
|
||
}
|
||
},
|
||
"invalid_param_dataset": {
|
||
"summary": "invalid_param (dataset)",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "invalid_param",
|
||
"message": "Dataset does not exist."
|
||
}
|
||
},
|
||
"invalid_param_external": {
|
||
"summary": "invalid_param (external)",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "invalid_param",
|
||
"message": "External datasets are not supported."
|
||
}
|
||
},
|
||
"invalid_param_file_too_large": {
|
||
"summary": "invalid_param (file_too_large)",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "invalid_param",
|
||
"message": "File size exceeded."
|
||
}
|
||
},
|
||
"invalid_param_unsupported_file_type": {
|
||
"summary": "invalid_param (unsupported_file_type)",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "invalid_param",
|
||
"message": "File type not allowed."
|
||
}
|
||
},
|
||
"invalid_param_indexing": {
|
||
"summary": "invalid_param (indexing_technique)",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "invalid_param",
|
||
"message": "indexing_technique is required."
|
||
}
|
||
},
|
||
"invalid_param_process_rule": {
|
||
"summary": "invalid_param (process_rule)",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "invalid_param",
|
||
"message": "process_rule is required."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/datasets/{dataset_id}/documents": {
|
||
"get": {
|
||
"tags": [
|
||
"ドキュメント"
|
||
],
|
||
"summary": "ナレッジベースのドキュメントリストを取得",
|
||
"description": "ナレッジベース内のドキュメントのページネーションされた一覧を返します。キーワードやインデックスステータスによるフィルタリングをサポートしています。",
|
||
"operationId": "listDocuments",
|
||
"parameters": [
|
||
{
|
||
"name": "dataset_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "ナレッジベース ID です。"
|
||
},
|
||
{
|
||
"name": "page",
|
||
"in": "query",
|
||
"schema": {
|
||
"type": "integer",
|
||
"default": 1
|
||
},
|
||
"description": "取得するページ番号。"
|
||
},
|
||
{
|
||
"name": "limit",
|
||
"in": "query",
|
||
"schema": {
|
||
"type": "integer",
|
||
"default": 20
|
||
},
|
||
"description": "1 ページあたりの項目数です。サーバーの上限は `100` です。"
|
||
},
|
||
{
|
||
"name": "keyword",
|
||
"in": "query",
|
||
"schema": {
|
||
"type": "string"
|
||
},
|
||
"description": "ドキュメント名でフィルタリングするための検索キーワードです。"
|
||
},
|
||
{
|
||
"name": "status",
|
||
"in": "query",
|
||
"schema": {
|
||
"type": "string",
|
||
"enum": [
|
||
"queuing",
|
||
"indexing",
|
||
"paused",
|
||
"error",
|
||
"available",
|
||
"disabled",
|
||
"archived"
|
||
]
|
||
},
|
||
"description": "表示ステータスでフィルタリングします。"
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "ドキュメントのリストです。",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"type": "array",
|
||
"description": "ナレッジベースオブジェクトの配列です。",
|
||
"items": {
|
||
"$ref": "#/components/schemas/Document"
|
||
}
|
||
},
|
||
"has_more": {
|
||
"type": "boolean",
|
||
"description": "次のページにさらに項目が存在するかどうかです。"
|
||
},
|
||
"limit": {
|
||
"type": "integer",
|
||
"description": "1 ページあたりの件数です。"
|
||
},
|
||
"total": {
|
||
"type": "integer",
|
||
"description": "一致する項目の合計数です。"
|
||
},
|
||
"page": {
|
||
"type": "integer",
|
||
"description": "現在のページ番号です。"
|
||
}
|
||
}
|
||
},
|
||
"examples": {
|
||
"success": {
|
||
"summary": "レスポンス例",
|
||
"value": {
|
||
"data": [
|
||
{
|
||
"id": "a8e0e5b5-78c6-4130-a5ce-25feb0e0b4ac",
|
||
"position": 1,
|
||
"data_source_type": "upload_file",
|
||
"data_source_info": {
|
||
"upload_file_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
|
||
},
|
||
"data_source_detail_dict": {
|
||
"upload_file": {
|
||
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
|
||
"name": "guide.txt",
|
||
"size": 2048,
|
||
"extension": "txt",
|
||
"mime_type": "text/plain",
|
||
"created_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4",
|
||
"created_at": 1741267200
|
||
}
|
||
},
|
||
"dataset_process_rule_id": "e1f2a3b4-c5d6-7890-ef12-345678901234",
|
||
"name": "guide.txt",
|
||
"created_from": "api",
|
||
"created_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4",
|
||
"created_at": 1741267200,
|
||
"tokens": 512,
|
||
"indexing_status": "completed",
|
||
"error": null,
|
||
"enabled": true,
|
||
"disabled_at": null,
|
||
"disabled_by": null,
|
||
"archived": false,
|
||
"display_status": "available",
|
||
"word_count": 350,
|
||
"hit_count": 0,
|
||
"doc_form": "text_model",
|
||
"doc_metadata": [],
|
||
"summary_index_status": null,
|
||
"need_summary": false
|
||
}
|
||
],
|
||
"has_more": false,
|
||
"limit": 20,
|
||
"total": 1,
|
||
"page": 1
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"404": {
|
||
"description": "`not_found` : ナレッジベースが見つかりません。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"not_found": {
|
||
"summary": "not_found",
|
||
"value": {
|
||
"status": 404,
|
||
"code": "not_found",
|
||
"message": "Dataset not found."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/datasets/{dataset_id}/documents/{document_id}": {
|
||
"get": {
|
||
"tags": [
|
||
"ドキュメント"
|
||
],
|
||
"summary": "ドキュメント詳細を取得",
|
||
"description": "特定のドキュメントの詳細情報(インデックスステータス、メタデータ、処理統計を含む)を取得します。",
|
||
"operationId": "getDocumentDetail",
|
||
"parameters": [
|
||
{
|
||
"name": "dataset_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "ナレッジベース ID です。"
|
||
},
|
||
{
|
||
"name": "document_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "Document ID."
|
||
},
|
||
{
|
||
"name": "metadata",
|
||
"in": "query",
|
||
"schema": {
|
||
"type": "string",
|
||
"enum": [
|
||
"all",
|
||
"only",
|
||
"without"
|
||
],
|
||
"default": "all"
|
||
},
|
||
"description": "`all` はメタデータを含むすべてのフィールドを返します。`only` は `id`、`doc_type`、`doc_metadata` のみを返します。`without` は `doc_metadata` を除くすべてのフィールドを返します。"
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "ドキュメントの詳細です。レスポンスの形式は `metadata` クエリパラメータによって異なります。`metadata` が `only` の場合、`id`、`doc_type`、`doc_metadata` のみが返されます。`metadata` が `without` の場合、`doc_type` と `doc_metadata` は省略されます。",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"id": {
|
||
"type": "string",
|
||
"description": "ドキュメント識別子です。"
|
||
},
|
||
"position": {
|
||
"type": "integer",
|
||
"description": "ナレッジベース内の位置インデックスです。"
|
||
},
|
||
"data_source_type": {
|
||
"type": "string",
|
||
"description": "ドキュメントのアップロード方法です。ファイルアップロードの場合は `upload_file`、Notion インポートの場合は `notion_import` です。"
|
||
},
|
||
"data_source_info": {
|
||
"type": "object",
|
||
"description": "生データソース情報です。"
|
||
},
|
||
"dataset_process_rule_id": {
|
||
"type": "string",
|
||
"description": "このドキュメントに適用された処理ルールの ID です。"
|
||
},
|
||
"dataset_process_rule": {
|
||
"type": "object",
|
||
"description": "ナレッジベースレベルの処理ルール設定です。"
|
||
},
|
||
"document_process_rule": {
|
||
"type": "object",
|
||
"description": "ドキュメントレベルの処理ルール設定です。"
|
||
},
|
||
"name": {
|
||
"type": "string",
|
||
"description": "ドキュメント名です。"
|
||
},
|
||
"created_from": {
|
||
"type": "string",
|
||
"description": "ドキュメントの作成元です。API で作成した場合は `api`、UI で作成した場合は `web` です。"
|
||
},
|
||
"created_by": {
|
||
"type": "string",
|
||
"description": "ドキュメントを作成したユーザーの ID です。"
|
||
},
|
||
"created_at": {
|
||
"type": "number",
|
||
"description": "ドキュメント作成の Unix タイムスタンプです。"
|
||
},
|
||
"tokens": {
|
||
"type": "integer",
|
||
"description": "ドキュメント内のトークン数です。"
|
||
},
|
||
"indexing_status": {
|
||
"type": "string",
|
||
"description": "現在のインデックスステータスです(例:`waiting`、`parsing`、`cleaning`、`splitting`、`indexing`、`completed`、`error`、`paused`)。"
|
||
},
|
||
"error": {
|
||
"type": "string",
|
||
"nullable": true,
|
||
"description": "インデックス作成が失敗した場合のエラーメッセージです。それ以外は `null` です。"
|
||
},
|
||
"enabled": {
|
||
"type": "boolean",
|
||
"description": "このドキュメントが検索に対して有効かどうかです。"
|
||
},
|
||
"disabled_at": {
|
||
"type": "number",
|
||
"nullable": true,
|
||
"description": "ドキュメントが無効化された Unix タイムスタンプです。有効な場合は `null` です。"
|
||
},
|
||
"disabled_by": {
|
||
"type": "string",
|
||
"nullable": true,
|
||
"description": "ドキュメントを無効化したユーザーの ID です。有効な場合は `null` です。"
|
||
},
|
||
"archived": {
|
||
"type": "boolean",
|
||
"description": "ドキュメントがアーカイブ済みかどうかです。"
|
||
},
|
||
"display_status": {
|
||
"type": "string",
|
||
"description": "UI 向けの表示用インデックスステータスです。"
|
||
},
|
||
"word_count": {
|
||
"type": "integer",
|
||
"description": "ドキュメントの合計単語数です。"
|
||
},
|
||
"hit_count": {
|
||
"type": "integer",
|
||
"description": "このドキュメントが検索された回数です。"
|
||
},
|
||
"doc_form": {
|
||
"type": "string",
|
||
"description": "ドキュメントのチャンキングモードです。`text_model` は標準テキスト、`hierarchical_model` は親子構造、`qa_model` は QA ペアを示します。"
|
||
},
|
||
"doc_language": {
|
||
"type": "string",
|
||
"description": "ドキュメント内容の言語です。"
|
||
},
|
||
"doc_type": {
|
||
"type": "string",
|
||
"nullable": true,
|
||
"description": "ドキュメントタイプの分類です。未設定の場合は `null` です。"
|
||
},
|
||
"doc_metadata": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "object",
|
||
"properties": {
|
||
"id": {
|
||
"type": "string",
|
||
"description": "メタデータフィールドの識別子です。"
|
||
},
|
||
"name": {
|
||
"type": "string",
|
||
"description": "メタデータフィールド名です。"
|
||
},
|
||
"type": {
|
||
"type": "string",
|
||
"description": "メタデータフィールドの種類です。"
|
||
},
|
||
"value": {
|
||
"type": "string",
|
||
"description": "このドキュメントのメタデータフィールド値。"
|
||
}
|
||
}
|
||
},
|
||
"description": "このドキュメントのカスタムメタデータキーバリューペア。"
|
||
},
|
||
"completed_at": {
|
||
"type": "number",
|
||
"nullable": true,
|
||
"description": "処理が完了した Unix タイムスタンプです。まだ完了していない場合は `null` です。"
|
||
},
|
||
"updated_at": {
|
||
"type": "number",
|
||
"nullable": true,
|
||
"description": "最終更新の Unix タイムスタンプです。更新されたことがない場合は `null` です。"
|
||
},
|
||
"indexing_latency": {
|
||
"type": "number",
|
||
"nullable": true,
|
||
"description": "インデックス作成にかかった時間(秒)です。未完了の場合は `null` です。"
|
||
},
|
||
"segment_count": {
|
||
"type": "integer",
|
||
"description": "ドキュメント内のチャンク数です。"
|
||
},
|
||
"average_segment_length": {
|
||
"type": "number",
|
||
"description": "チャンクの平均文字長です。"
|
||
},
|
||
"summary_index_status": {
|
||
"type": "string",
|
||
"nullable": true,
|
||
"description": "要約インデックスのステータスです。要約インデックスが有効でない場合は `null` です。"
|
||
},
|
||
"need_summary": {
|
||
"type": "boolean",
|
||
"description": "このドキュメントが要約生成を必要とするかどうかです。"
|
||
}
|
||
}
|
||
},
|
||
"examples": {
|
||
"success": {
|
||
"summary": "レスポンス例",
|
||
"value": {
|
||
"id": "a8e0e5b5-78c6-4130-a5ce-25feb0e0b4ac",
|
||
"position": 1,
|
||
"data_source_type": "upload_file",
|
||
"data_source_info": {
|
||
"upload_file_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
|
||
},
|
||
"dataset_process_rule_id": "e1f2a3b4-c5d6-7890-ef12-345678901234",
|
||
"dataset_process_rule": {
|
||
"id": "e1f2a3b4-c5d6-7890-ef12-345678901234",
|
||
"mode": "custom"
|
||
},
|
||
"document_process_rule": {
|
||
"mode": "custom",
|
||
"rules": {
|
||
"pre_processing_rules": [],
|
||
"segmentation": {
|
||
"separator": "###",
|
||
"max_tokens": 500,
|
||
"chunk_overlap": 50
|
||
}
|
||
}
|
||
},
|
||
"name": "guide.txt",
|
||
"created_from": "api",
|
||
"created_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4",
|
||
"created_at": 1741267200,
|
||
"tokens": 512,
|
||
"indexing_status": "completed",
|
||
"error": null,
|
||
"enabled": true,
|
||
"disabled_at": null,
|
||
"disabled_by": null,
|
||
"archived": false,
|
||
"display_status": "available",
|
||
"word_count": 350,
|
||
"hit_count": 0,
|
||
"doc_form": "text_model",
|
||
"doc_language": "English",
|
||
"doc_type": null,
|
||
"doc_metadata": [],
|
||
"completed_at": 1741267260,
|
||
"updated_at": 1741267260,
|
||
"indexing_latency": 60.0,
|
||
"segment_count": 5,
|
||
"average_segment_length": 70.0,
|
||
"summary_index_status": null,
|
||
"need_summary": false
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "`invalid_metadata` : 指定されたキーのメタデータ値が無効です。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"invalid_metadata": {
|
||
"summary": "invalid_metadata",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "invalid_metadata",
|
||
"message": "Invalid metadata value: {metadata_key}"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"403": {
|
||
"description": "`forbidden` : 権限がありません。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"forbidden": {
|
||
"summary": "forbidden",
|
||
"value": {
|
||
"status": 403,
|
||
"code": "forbidden",
|
||
"message": "No permission."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"404": {
|
||
"description": "`not_found` : ドキュメントが見つかりません。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"not_found": {
|
||
"summary": "not_found",
|
||
"value": {
|
||
"status": 404,
|
||
"code": "not_found",
|
||
"message": "Document not found."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"delete": {
|
||
"tags": [
|
||
"ドキュメント"
|
||
],
|
||
"summary": "ドキュメントを削除",
|
||
"description": "ナレッジベースからドキュメントとそのすべてのチャンクを完全に削除します。",
|
||
"operationId": "deleteDocument",
|
||
"parameters": [
|
||
{
|
||
"name": "dataset_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "ナレッジベース ID です。"
|
||
},
|
||
{
|
||
"name": "document_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "Document ID."
|
||
}
|
||
],
|
||
"responses": {
|
||
"204": {
|
||
"description": "Success."
|
||
},
|
||
"400": {
|
||
"description": "`document_indexing` : インデキシング中はドキュメントを削除できません。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"document_indexing": {
|
||
"summary": "document_indexing",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "document_indexing",
|
||
"message": "Cannot delete document during indexing."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"403": {
|
||
"description": "`archived_document_immutable` : アーカイブされたドキュメントは編集できません。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"archived_document_immutable": {
|
||
"summary": "archived_document_immutable",
|
||
"value": {
|
||
"status": 403,
|
||
"code": "archived_document_immutable",
|
||
"message": "The archived document is not editable."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"404": {
|
||
"description": "`not_found` : ドキュメントが存在しません。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"not_found": {
|
||
"summary": "not_found",
|
||
"value": {
|
||
"status": 404,
|
||
"code": "not_found",
|
||
"message": "Document Not Exists."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/datasets/{dataset_id}/documents/{document_id}/download": {
|
||
"get": {
|
||
"tags": [
|
||
"ドキュメント"
|
||
],
|
||
"summary": "ドキュメントをダウンロード",
|
||
"description": "ドキュメントの元のアップロードファイルの署名付きダウンロード URL を取得します。",
|
||
"operationId": "downloadDocumentJa",
|
||
"parameters": [
|
||
{
|
||
"name": "dataset_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "ナレッジベース ID です。"
|
||
},
|
||
{
|
||
"name": "document_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "Document ID."
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "ダウンロード URL が正常に生成されました。",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"url": {
|
||
"type": "string",
|
||
"description": "元のアップロードファイルをダウンロードするための署名付き URL です。"
|
||
}
|
||
}
|
||
},
|
||
"examples": {
|
||
"success": {
|
||
"summary": "レスポンス例",
|
||
"value": {
|
||
"url": "https://storage.example.com/datasets/documents/abc123/original-file.pdf?token=xyz789&expires=1741353600"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"403": {
|
||
"description": "`forbidden` : このドキュメントにアクセスする権限がありません。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"forbidden": {
|
||
"summary": "forbidden",
|
||
"value": {
|
||
"status": 403,
|
||
"code": "forbidden",
|
||
"message": "No permission."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"404": {
|
||
"description": "`not_found` : ドキュメントが見つかりません。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"not_found": {
|
||
"summary": "not_found",
|
||
"value": {
|
||
"status": 404,
|
||
"code": "not_found",
|
||
"message": "Document not found."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/datasets/{dataset_id}/documents/{batch}/indexing-status": {
|
||
"get": {
|
||
"tags": [
|
||
"ドキュメント"
|
||
],
|
||
"summary": "ドキュメント埋め込みステータス(進捗)を取得",
|
||
"description": "バッチ内のドキュメントのインデックス進捗を確認します。各ドキュメントの現在の処理段階とチャンク完了数を返します。`indexing_status` が `completed` または `error` に達するまでこのエンドポイントをポーリングしてください。ステータスは次の順序で進行します:`waiting` → `parsing` → `cleaning` → `splitting` → `indexing` → `completed`。",
|
||
"operationId": "getDocumentIndexingStatus",
|
||
"parameters": [
|
||
{
|
||
"name": "dataset_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "ナレッジベース ID です。"
|
||
},
|
||
{
|
||
"name": "batch",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string"
|
||
},
|
||
"description": "ドキュメント作成時に返されるバッチ ID です。"
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "バッチ内のドキュメントのインデックス状態です。",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "object",
|
||
"properties": {
|
||
"id": {
|
||
"type": "string",
|
||
"description": "ドキュメント識別子です。"
|
||
},
|
||
"indexing_status": {
|
||
"type": "string",
|
||
"description": "現在のインデックスステータスです:`waiting`、`parsing`、`cleaning`、`splitting`、`indexing`、`completed`、または `error`。"
|
||
},
|
||
"processing_started_at": {
|
||
"type": "number",
|
||
"description": "処理開始時の Unix タイムスタンプです。"
|
||
},
|
||
"parsing_completed_at": {
|
||
"type": "number",
|
||
"description": "パース完了時の Unix タイムスタンプです。"
|
||
},
|
||
"cleaning_completed_at": {
|
||
"type": "number",
|
||
"description": "クリーニング完了時の Unix タイムスタンプです。"
|
||
},
|
||
"splitting_completed_at": {
|
||
"type": "number",
|
||
"description": "分割完了時の Unix タイムスタンプです。"
|
||
},
|
||
"completed_at": {
|
||
"type": "number",
|
||
"description": "インデックス完了時の Unix タイムスタンプです。"
|
||
},
|
||
"paused_at": {
|
||
"type": "number",
|
||
"nullable": true,
|
||
"description": "インデキシングが一時停止されたタイムスタンプ。一時停止されていない場合は `null`。"
|
||
},
|
||
"error": {
|
||
"type": "string",
|
||
"nullable": true,
|
||
"description": "インデキシングが失敗した場合のエラーメッセージ。エラーがない場合は `null`。"
|
||
},
|
||
"stopped_at": {
|
||
"type": "number",
|
||
"nullable": true,
|
||
"description": "インデキシングが停止されたタイムスタンプ。停止されていない場合は `null`。"
|
||
},
|
||
"completed_segments": {
|
||
"type": "integer",
|
||
"description": "インデックス済みのチャンク数です。"
|
||
},
|
||
"total_segments": {
|
||
"type": "integer",
|
||
"description": "インデックス対象のチャンクの合計数です。"
|
||
}
|
||
}
|
||
},
|
||
"description": "インデキシングステータスエントリのリスト。"
|
||
}
|
||
}
|
||
},
|
||
"examples": {
|
||
"success": {
|
||
"summary": "レスポンス例",
|
||
"value": {
|
||
"data": [
|
||
{
|
||
"id": "a8e0e5b5-78c6-4130-a5ce-25feb0e0b4ac",
|
||
"indexing_status": "completed",
|
||
"processing_started_at": 1741267200,
|
||
"parsing_completed_at": 1741267200,
|
||
"cleaning_completed_at": 1741267200,
|
||
"splitting_completed_at": 1741267200,
|
||
"completed_at": 1741267200,
|
||
"paused_at": null,
|
||
"error": null,
|
||
"stopped_at": null,
|
||
"completed_segments": 5,
|
||
"total_segments": 5
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"404": {
|
||
"description": "`not_found` : ナレッジベースが見つかりません。/ ドキュメントが見つかりません。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"dataset_not_found": {
|
||
"summary": "not_found",
|
||
"value": {
|
||
"status": 404,
|
||
"code": "not_found",
|
||
"message": "Dataset not found."
|
||
}
|
||
},
|
||
"documents_not_found": {
|
||
"summary": "not_found",
|
||
"value": {
|
||
"status": 404,
|
||
"code": "not_found",
|
||
"message": "Documents not found."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/datasets/{dataset_id}/documents/{document_id}/update-by-text": {
|
||
"post": {
|
||
"tags": [
|
||
"ドキュメント"
|
||
],
|
||
"summary": "テキストでドキュメントを更新",
|
||
"description": "既存ドキュメントのテキストコンテンツ、名前、または処理設定を更新します。コンテンツが変更された場合はインデックスが再トリガーされます——返された `batch` ID を [ドキュメント埋め込みステータス(進捗)を取得](/api-reference/ドキュメント/ドキュメント埋め込みステータス(進捗)を取得) で使用して進捗を追跡します。",
|
||
"operationId": "updateDocumentByText",
|
||
"parameters": [
|
||
{
|
||
"name": "dataset_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "ナレッジベース ID です。"
|
||
},
|
||
{
|
||
"name": "document_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "Document ID."
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"name": {
|
||
"type": "string",
|
||
"description": "ドキュメント名です。`text` を指定する場合は必須です。"
|
||
},
|
||
"text": {
|
||
"type": "string",
|
||
"description": "ドキュメントのテキスト内容です。"
|
||
},
|
||
"process_rule": {
|
||
"type": "object",
|
||
"description": "チャンキングの処理ルールです。",
|
||
"required": [
|
||
"mode"
|
||
],
|
||
"properties": {
|
||
"mode": {
|
||
"type": "string",
|
||
"enum": [
|
||
"automatic",
|
||
"custom",
|
||
"hierarchical"
|
||
],
|
||
"description": "処理モードです。`automatic` は組み込みルールを使用、`custom` は手動設定が可能、`hierarchical` は親子チャンク構造を有効にします(`doc_form: hierarchical_model` と組み合わせて使用)。"
|
||
},
|
||
"rules": {
|
||
"type": "object",
|
||
"properties": {
|
||
"pre_processing_rules": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "object",
|
||
"properties": {
|
||
"id": {
|
||
"type": "string",
|
||
"enum": [
|
||
"remove_stopwords",
|
||
"remove_extra_spaces",
|
||
"remove_urls_emails"
|
||
],
|
||
"description": "ルール識別子です。"
|
||
},
|
||
"enabled": {
|
||
"type": "boolean",
|
||
"description": "この前処理ルールが有効かどうかです。"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"segmentation": {
|
||
"type": "object",
|
||
"properties": {
|
||
"separator": {
|
||
"type": "string",
|
||
"default": "\n",
|
||
"description": "テキスト分割用のカスタムセパレーターです。"
|
||
},
|
||
"max_tokens": {
|
||
"type": "integer",
|
||
"description": "チャンクあたりの最大トークン数です。"
|
||
},
|
||
"chunk_overlap": {
|
||
"type": "integer",
|
||
"default": 0,
|
||
"description": "チャンク間のトークンオーバーラップです。"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"doc_form": {
|
||
"type": "string",
|
||
"enum": [
|
||
"text_model",
|
||
"hierarchical_model",
|
||
"qa_model"
|
||
],
|
||
"default": "text_model",
|
||
"description": "`text_model` は標準テキストチャンキング、`hierarchical_model` は親子チャンク構造、`qa_model` は質問・回答ペアの抽出です。"
|
||
},
|
||
"doc_language": {
|
||
"type": "string",
|
||
"default": "English",
|
||
"description": "処理最適化のためのドキュメント言語です。"
|
||
},
|
||
"retrieval_model": {
|
||
"$ref": "#/components/schemas/RetrievalModel",
|
||
"description": "検索モデルの設定です。このナレッジベースをクエリする際のチャンクの検索方法とランキング方法を制御します。"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "ドキュメントが正常に更新されました。",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"document": {
|
||
"$ref": "#/components/schemas/Document"
|
||
},
|
||
"batch": {
|
||
"type": "string",
|
||
"description": "インデックス進捗を追跡するためのバッチ ID です。"
|
||
}
|
||
}
|
||
},
|
||
"examples": {
|
||
"success": {
|
||
"summary": "レスポンス例",
|
||
"value": {
|
||
"document": {
|
||
"id": "a8e0e5b5-78c6-4130-a5ce-25feb0e0b4ac",
|
||
"position": 1,
|
||
"data_source_type": "upload_file",
|
||
"data_source_info": {
|
||
"upload_file_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
|
||
},
|
||
"data_source_detail_dict": {
|
||
"upload_file": {
|
||
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
|
||
"name": "guide.txt",
|
||
"size": 2048,
|
||
"extension": "txt",
|
||
"mime_type": "text/plain",
|
||
"created_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4",
|
||
"created_at": 1741267200
|
||
}
|
||
},
|
||
"dataset_process_rule_id": "e1f2a3b4-c5d6-7890-ef12-345678901234",
|
||
"name": "guide.txt",
|
||
"created_from": "api",
|
||
"created_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4",
|
||
"created_at": 1741267200,
|
||
"tokens": 512,
|
||
"indexing_status": "completed",
|
||
"error": null,
|
||
"enabled": true,
|
||
"disabled_at": null,
|
||
"disabled_by": null,
|
||
"archived": false,
|
||
"display_status": "available",
|
||
"word_count": 350,
|
||
"hit_count": 0,
|
||
"doc_form": "text_model",
|
||
"doc_metadata": [],
|
||
"summary_index_status": null,
|
||
"need_summary": false
|
||
},
|
||
"batch": "20250306150245647595"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "- `provider_not_initialize` : 有効なモデルプロバイダーの認証情報が見つかりません。設定 → モデルプロバイダーで認証情報を完了してください。\n- `invalid_param` : ナレッジベースが存在しない、またはテキスト指定時は name が必須です。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"provider_not_initialize": {
|
||
"summary": "provider_not_initialize",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "provider_not_initialize",
|
||
"message": "No valid model provider credentials found. Please go to Settings -> Model Provider to complete your provider credentials."
|
||
}
|
||
},
|
||
"invalid_param_dataset": {
|
||
"summary": "invalid_param",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "invalid_param",
|
||
"message": "Dataset does not exist."
|
||
}
|
||
},
|
||
"invalid_param_name_required": {
|
||
"summary": "invalid_param (name required)",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "invalid_param",
|
||
"message": "name is required when text is provided."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/datasets/{dataset_id}/documents/{document_id}/update-by-file": {
|
||
"post": {
|
||
"tags": [
|
||
"ドキュメント"
|
||
],
|
||
"summary": "ファイルでドキュメントを更新",
|
||
"description": "新しいファイルをアップロードして既存のドキュメントを更新します。インデックスが再トリガーされます——返された `batch` ID を [ドキュメント埋め込みステータス(進捗)を取得](/api-reference/ドキュメント/ドキュメント埋め込みステータス(進捗)を取得) で使用して進捗を追跡します。",
|
||
"operationId": "updateDocumentByFile",
|
||
"parameters": [
|
||
{
|
||
"name": "dataset_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "ナレッジベース ID です。"
|
||
},
|
||
{
|
||
"name": "document_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "Document ID."
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"content": {
|
||
"multipart/form-data": {
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"file": {
|
||
"type": "string",
|
||
"format": "binary",
|
||
"description": "アップロードするファイルです。"
|
||
},
|
||
"data": {
|
||
"type": "string",
|
||
"description": "設定情報を含む JSON 文字列です。[テキストからドキュメントを作成](/api-reference/ドキュメント/テキストからドキュメントを作成) と同じフィールド(`indexing_technique`、`doc_form`、`doc_language`、`process_rule`、`retrieval_model`、`embedding_model`、`embedding_model_provider`)を受け付けますが、`name` と `text` は除きます。",
|
||
"example": "{\"indexing_technique\":\"high_quality\",\"doc_form\":\"text_model\",\"doc_language\":\"English\",\"process_rule\":{\"mode\":\"automatic\"}}"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "ドキュメントが正常に更新されました。",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"document": {
|
||
"$ref": "#/components/schemas/Document"
|
||
},
|
||
"batch": {
|
||
"type": "string",
|
||
"description": "インデックス進捗を追跡するためのバッチ ID です。"
|
||
}
|
||
}
|
||
},
|
||
"examples": {
|
||
"success": {
|
||
"summary": "レスポンス例",
|
||
"value": {
|
||
"document": {
|
||
"id": "a8e0e5b5-78c6-4130-a5ce-25feb0e0b4ac",
|
||
"position": 1,
|
||
"data_source_type": "upload_file",
|
||
"data_source_info": {
|
||
"upload_file_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
|
||
},
|
||
"data_source_detail_dict": {
|
||
"upload_file": {
|
||
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
|
||
"name": "guide.txt",
|
||
"size": 2048,
|
||
"extension": "txt",
|
||
"mime_type": "text/plain",
|
||
"created_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4",
|
||
"created_at": 1741267200
|
||
}
|
||
},
|
||
"dataset_process_rule_id": "e1f2a3b4-c5d6-7890-ef12-345678901234",
|
||
"name": "guide.txt",
|
||
"created_from": "api",
|
||
"created_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4",
|
||
"created_at": 1741267200,
|
||
"tokens": 512,
|
||
"indexing_status": "completed",
|
||
"error": null,
|
||
"enabled": true,
|
||
"disabled_at": null,
|
||
"disabled_by": null,
|
||
"archived": false,
|
||
"display_status": "available",
|
||
"word_count": 350,
|
||
"hit_count": 0,
|
||
"doc_form": "text_model",
|
||
"doc_metadata": [],
|
||
"summary_index_status": null,
|
||
"need_summary": false
|
||
},
|
||
"batch": "20250306150245647595"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "- `too_many_files` : ファイルは 1 つのみ許可されています。\n- `filename_not_exists_error` : 指定されたファイル名が存在しません。\n- `provider_not_initialize` : 有効なモデルプロバイダーの認証情報が見つかりません。設定 → モデルプロバイダーで認証情報を完了してください。\n- `invalid_param` : ナレッジベースが存在しない、外部データセットは非対応、ファイルが大きすぎる、またはサポートされていないファイルタイプです。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"too_many_files": {
|
||
"summary": "too_many_files",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "too_many_files",
|
||
"message": "Only one file is allowed."
|
||
}
|
||
},
|
||
"filename_not_exists_error": {
|
||
"summary": "filename_not_exists_error",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "filename_not_exists_error",
|
||
"message": "The specified filename does not exist."
|
||
}
|
||
},
|
||
"provider_not_initialize": {
|
||
"summary": "provider_not_initialize",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "provider_not_initialize",
|
||
"message": "No valid model provider credentials found. Please go to Settings -> Model Provider to complete your provider credentials."
|
||
}
|
||
},
|
||
"invalid_param_dataset": {
|
||
"summary": "invalid_param (dataset)",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "invalid_param",
|
||
"message": "Dataset does not exist."
|
||
}
|
||
},
|
||
"invalid_param_external": {
|
||
"summary": "invalid_param (external)",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "invalid_param",
|
||
"message": "External datasets are not supported."
|
||
}
|
||
},
|
||
"invalid_param_file_too_large": {
|
||
"summary": "invalid_param (file_too_large)",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "invalid_param",
|
||
"message": "File size exceeded."
|
||
}
|
||
},
|
||
"invalid_param_unsupported_file_type": {
|
||
"summary": "invalid_param (unsupported_file_type)",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "invalid_param",
|
||
"message": "File type not allowed."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/datasets/{dataset_id}/documents/download-zip": {
|
||
"post": {
|
||
"tags": [
|
||
"ドキュメント"
|
||
],
|
||
"summary": "ドキュメントを一括ダウンロード(ZIP)",
|
||
"description": "複数のアップロードファイルドキュメントを単一の ZIP アーカイブとしてダウンロードします。最大 `100` 件のドキュメント ID を受け付けます。",
|
||
"operationId": "downloadDocumentsZipJa",
|
||
"parameters": [
|
||
{
|
||
"name": "dataset_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "ナレッジベース ID です。"
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"required": [
|
||
"document_ids"
|
||
],
|
||
"properties": {
|
||
"document_ids": {
|
||
"type": "array",
|
||
"minItems": 1,
|
||
"maxItems": 100,
|
||
"items": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "ZIP アーカイブに含めるドキュメント ID の配列です。"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "リクエストされたドキュメントを含む ZIP アーカイブです。",
|
||
"content": {
|
||
"application/zip": {
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "binary",
|
||
"description": "ZIP アーカイブのバイナリストリームです。"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"403": {
|
||
"description": "`forbidden` : 権限が不足しています。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"forbidden": {
|
||
"summary": "forbidden",
|
||
"value": {
|
||
"status": 403,
|
||
"code": "forbidden",
|
||
"message": "Insufficient permissions."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"404": {
|
||
"description": "`not_found` : ドキュメントまたはナレッジベースが見つかりません。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"not_found": {
|
||
"summary": "not_found",
|
||
"value": {
|
||
"status": 404,
|
||
"code": "not_found",
|
||
"message": "Document not found."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/datasets/{dataset_id}/documents/status/{action}": {
|
||
"patch": {
|
||
"tags": [
|
||
"ドキュメント"
|
||
],
|
||
"summary": "ドキュメントステータスを一括更新",
|
||
"description": "複数のドキュメントを一括で有効化、無効化、アーカイブ、またはアーカイブ解除します。",
|
||
"operationId": "batchUpdateDocumentStatus",
|
||
"parameters": [
|
||
{
|
||
"name": "dataset_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "ナレッジベース ID です。"
|
||
},
|
||
{
|
||
"name": "action",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"enum": [
|
||
"enable",
|
||
"disable",
|
||
"archive",
|
||
"un_archive"
|
||
]
|
||
},
|
||
"description": "`enable` で有効化、`disable` で無効化、`archive` でアーカイブ、`un_archive` でアーカイブから復元します。"
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"required": [
|
||
"document_ids"
|
||
],
|
||
"properties": {
|
||
"document_ids": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "string"
|
||
},
|
||
"description": "更新するドキュメント ID のリストです。"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "ドキュメントが正常に更新されました。",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"result": {
|
||
"type": "string",
|
||
"description": "操作結果です。"
|
||
}
|
||
}
|
||
},
|
||
"examples": {
|
||
"success": {
|
||
"summary": "レスポンス例",
|
||
"value": {
|
||
"result": "success"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "`invalid_action` : 無効なアクションです。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"invalid_action": {
|
||
"summary": "invalid_action",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "invalid_action",
|
||
"message": "Invalid action."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"403": {
|
||
"description": "`forbidden` : 権限が不足しています。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"forbidden": {
|
||
"summary": "forbidden",
|
||
"value": {
|
||
"status": 403,
|
||
"code": "forbidden",
|
||
"message": "Insufficient permissions."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"404": {
|
||
"description": "`not_found` : ナレッジベースが見つかりません。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"not_found": {
|
||
"summary": "not_found",
|
||
"value": {
|
||
"status": 404,
|
||
"code": "not_found",
|
||
"message": "Dataset not found."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/datasets/{dataset_id}/documents/{document_id}/segments": {
|
||
"post": {
|
||
"tags": [
|
||
"チャンク"
|
||
],
|
||
"summary": "ドキュメントにチャンクを追加",
|
||
"description": "ドキュメント内に 1 つ以上のチャンクを作成します。各チャンクにはオプションのキーワードと回答フィールド(QA モードドキュメント用)を含めることができます。",
|
||
"operationId": "createSegments",
|
||
"parameters": [
|
||
{
|
||
"name": "dataset_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "ナレッジベース ID です。"
|
||
},
|
||
{
|
||
"name": "document_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "Document ID."
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"required": [
|
||
"segments"
|
||
],
|
||
"properties": {
|
||
"segments": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "object",
|
||
"properties": {
|
||
"content": {
|
||
"type": "string",
|
||
"description": "チャンクのテキスト内容です。"
|
||
},
|
||
"answer": {
|
||
"type": "string",
|
||
"description": "QA モードの回答内容です。"
|
||
},
|
||
"keywords": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "string"
|
||
},
|
||
"description": "チャンクのキーワードです。"
|
||
},
|
||
"attachment_ids": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "string"
|
||
},
|
||
"description": "添付ファイル ID です。"
|
||
}
|
||
}
|
||
},
|
||
"description": "作成するチャンクオブジェクトの配列です。"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "チャンクが正常に作成されました。",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/components/schemas/Segment"
|
||
},
|
||
"description": "作成されたチャンクのリスト。"
|
||
},
|
||
"doc_form": {
|
||
"type": "string",
|
||
"description": "このドキュメントが使用するドキュメントチャンキングモードです。"
|
||
}
|
||
}
|
||
},
|
||
"examples": {
|
||
"success": {
|
||
"summary": "レスポンス例",
|
||
"value": {
|
||
"data": [
|
||
{
|
||
"id": "f3d1c7be-9f3a-40d8-8eb8-3a1ef9c3f2c1",
|
||
"position": 1,
|
||
"document_id": "a8e0e5b5-78c6-4130-a5ce-25feb0e0b4ac",
|
||
"content": "Dify is an open-source LLM app development platform.",
|
||
"sign_content": "",
|
||
"answer": "",
|
||
"word_count": 9,
|
||
"tokens": 12,
|
||
"keywords": [
|
||
"dify",
|
||
"platform",
|
||
"llm"
|
||
],
|
||
"index_node_id": "a1b2c3d4-e5f6-7890-abcd-000000000001",
|
||
"index_node_hash": "abc123def456",
|
||
"hit_count": 0,
|
||
"enabled": true,
|
||
"disabled_at": null,
|
||
"disabled_by": null,
|
||
"status": "completed",
|
||
"created_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4",
|
||
"created_at": 1741267200,
|
||
"updated_at": 1741267200,
|
||
"updated_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4",
|
||
"indexing_at": 1741267200,
|
||
"completed_at": 1741267200,
|
||
"error": null,
|
||
"stopped_at": null,
|
||
"child_chunks": [],
|
||
"attachments": [],
|
||
"summary": null
|
||
}
|
||
],
|
||
"doc_form": "text_model"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"404": {
|
||
"description": "`not_found` : ドキュメントが完了していないか、無効になっています。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"not_found_not_completed": {
|
||
"summary": "not_found (not completed)",
|
||
"value": {
|
||
"status": 404,
|
||
"code": "not_found",
|
||
"message": "Document is not completed."
|
||
}
|
||
},
|
||
"not_found_disabled": {
|
||
"summary": "not_found (disabled)",
|
||
"value": {
|
||
"status": 404,
|
||
"code": "not_found",
|
||
"message": "Document is disabled."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"get": {
|
||
"tags": [
|
||
"チャンク"
|
||
],
|
||
"summary": "チャンク一覧を取得",
|
||
"description": "ドキュメント内のチャンクのページネーションリストを返します。キーワードとステータスによるフィルタリングをサポートしています。",
|
||
"operationId": "listSegments",
|
||
"parameters": [
|
||
{
|
||
"name": "dataset_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "ナレッジベース ID です。"
|
||
},
|
||
{
|
||
"name": "document_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "Document ID."
|
||
},
|
||
{
|
||
"name": "page",
|
||
"in": "query",
|
||
"schema": {
|
||
"type": "integer",
|
||
"default": 1
|
||
},
|
||
"description": "取得するページ番号。"
|
||
},
|
||
{
|
||
"name": "limit",
|
||
"in": "query",
|
||
"schema": {
|
||
"type": "integer",
|
||
"default": 20
|
||
},
|
||
"description": "1 ページあたりの項目数です。サーバーの上限は `100` です。"
|
||
},
|
||
{
|
||
"name": "status",
|
||
"in": "query",
|
||
"schema": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "string"
|
||
}
|
||
},
|
||
"style": "form",
|
||
"explode": true,
|
||
"description": "インデックスステータスでチャンクをフィルタリングします(例:`completed`、`indexing`、`error`)。"
|
||
},
|
||
{
|
||
"name": "keyword",
|
||
"in": "query",
|
||
"schema": {
|
||
"type": "string"
|
||
},
|
||
"description": "検索キーワードです。"
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "チャンクのリストです。",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/components/schemas/Segment"
|
||
},
|
||
"description": "チャンクのリスト。"
|
||
},
|
||
"doc_form": {
|
||
"type": "string",
|
||
"description": "このドキュメントが使用するドキュメントチャンキングモードです。"
|
||
},
|
||
"total": {
|
||
"type": "integer",
|
||
"description": "一致するチャンクの合計数です。"
|
||
},
|
||
"has_more": {
|
||
"type": "boolean",
|
||
"description": "次のページにさらに項目が存在するかどうかです。"
|
||
},
|
||
"limit": {
|
||
"type": "integer",
|
||
"description": "1 ページあたりの件数です。"
|
||
},
|
||
"page": {
|
||
"type": "integer",
|
||
"description": "現在のページ番号です。"
|
||
}
|
||
}
|
||
},
|
||
"examples": {
|
||
"success": {
|
||
"summary": "レスポンス例",
|
||
"value": {
|
||
"data": [
|
||
{
|
||
"id": "f3d1c7be-9f3a-40d8-8eb8-3a1ef9c3f2c1",
|
||
"position": 1,
|
||
"document_id": "a8e0e5b5-78c6-4130-a5ce-25feb0e0b4ac",
|
||
"content": "Dify is an open-source LLM app development platform.",
|
||
"sign_content": "",
|
||
"answer": "",
|
||
"word_count": 9,
|
||
"tokens": 12,
|
||
"keywords": [
|
||
"dify",
|
||
"platform",
|
||
"llm"
|
||
],
|
||
"index_node_id": "a1b2c3d4-e5f6-7890-abcd-000000000001",
|
||
"index_node_hash": "abc123def456",
|
||
"hit_count": 0,
|
||
"enabled": true,
|
||
"disabled_at": null,
|
||
"disabled_by": null,
|
||
"status": "completed",
|
||
"created_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4",
|
||
"created_at": 1741267200,
|
||
"updated_at": 1741267200,
|
||
"updated_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4",
|
||
"indexing_at": 1741267200,
|
||
"completed_at": 1741267200,
|
||
"error": null,
|
||
"stopped_at": null,
|
||
"child_chunks": [],
|
||
"attachments": [],
|
||
"summary": null
|
||
}
|
||
],
|
||
"doc_form": "text_model",
|
||
"total": 1,
|
||
"has_more": false,
|
||
"limit": 20,
|
||
"page": 1
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}": {
|
||
"get": {
|
||
"tags": [
|
||
"チャンク"
|
||
],
|
||
"summary": "ドキュメント内のチャンク詳細を取得",
|
||
"description": "特定のチャンクの詳細情報(内容、キーワード、インデックスステータスを含む)を取得します。",
|
||
"operationId": "getSegmentDetail",
|
||
"parameters": [
|
||
{
|
||
"name": "dataset_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "ナレッジベース ID です。"
|
||
},
|
||
{
|
||
"name": "document_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "Document ID."
|
||
},
|
||
{
|
||
"name": "segment_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "Chunk ID."
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "チャンクの詳細です。",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/components/schemas/Segment"
|
||
},
|
||
"doc_form": {
|
||
"type": "string",
|
||
"description": "このドキュメントが使用するドキュメントチャンキングモードです。"
|
||
}
|
||
}
|
||
},
|
||
"examples": {
|
||
"success": {
|
||
"summary": "レスポンス例",
|
||
"value": {
|
||
"data": {
|
||
"id": "f3d1c7be-9f3a-40d8-8eb8-3a1ef9c3f2c1",
|
||
"position": 1,
|
||
"document_id": "a8e0e5b5-78c6-4130-a5ce-25feb0e0b4ac",
|
||
"content": "Dify is an open-source LLM app development platform.",
|
||
"sign_content": "",
|
||
"answer": "",
|
||
"word_count": 9,
|
||
"tokens": 12,
|
||
"keywords": [
|
||
"dify",
|
||
"platform",
|
||
"llm"
|
||
],
|
||
"index_node_id": "a1b2c3d4-e5f6-7890-abcd-000000000001",
|
||
"index_node_hash": "abc123def456",
|
||
"hit_count": 0,
|
||
"enabled": true,
|
||
"disabled_at": null,
|
||
"disabled_by": null,
|
||
"status": "completed",
|
||
"created_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4",
|
||
"created_at": 1741267200,
|
||
"updated_at": 1741267200,
|
||
"updated_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4",
|
||
"indexing_at": 1741267200,
|
||
"completed_at": 1741267200,
|
||
"error": null,
|
||
"stopped_at": null,
|
||
"child_chunks": [],
|
||
"attachments": [],
|
||
"summary": null
|
||
},
|
||
"doc_form": "text_model"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"post": {
|
||
"tags": [
|
||
"チャンク"
|
||
],
|
||
"summary": "ドキュメント内のチャンクを更新",
|
||
"description": "チャンクのコンテンツ、キーワード、または回答を更新します。変更されたチャンクのインデックス作成が再トリガーされます。",
|
||
"operationId": "updateSegment",
|
||
"parameters": [
|
||
{
|
||
"name": "dataset_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "ナレッジベース ID です。"
|
||
},
|
||
{
|
||
"name": "document_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "Document ID."
|
||
},
|
||
{
|
||
"name": "segment_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "Chunk ID."
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"required": [
|
||
"segment"
|
||
],
|
||
"properties": {
|
||
"segment": {
|
||
"type": "object",
|
||
"properties": {
|
||
"content": {
|
||
"type": "string",
|
||
"description": "チャンクのテキスト内容です。"
|
||
},
|
||
"answer": {
|
||
"type": "string",
|
||
"description": "QA モードの回答内容です。"
|
||
},
|
||
"keywords": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "string"
|
||
},
|
||
"description": "チャンクのキーワードです。"
|
||
},
|
||
"enabled": {
|
||
"type": "boolean",
|
||
"description": "チャンクが有効かどうかです。"
|
||
},
|
||
"regenerate_child_chunks": {
|
||
"type": "boolean",
|
||
"default": false,
|
||
"description": "子チャンクを再生成するかどうかです。"
|
||
},
|
||
"attachment_ids": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "string"
|
||
},
|
||
"description": "添付ファイル ID です。"
|
||
},
|
||
"summary": {
|
||
"type": "string",
|
||
"nullable": true,
|
||
"description": "サマリーインデックスのサマリー内容です。"
|
||
}
|
||
},
|
||
"description": "更新するチャンクデータです。"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "チャンクが正常に更新されました。",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/components/schemas/Segment"
|
||
},
|
||
"doc_form": {
|
||
"type": "string",
|
||
"description": "このドキュメントが使用するドキュメントチャンキングモードです。"
|
||
}
|
||
}
|
||
},
|
||
"examples": {
|
||
"success": {
|
||
"summary": "レスポンス例",
|
||
"value": {
|
||
"data": {
|
||
"id": "f3d1c7be-9f3a-40d8-8eb8-3a1ef9c3f2c1",
|
||
"position": 1,
|
||
"document_id": "a8e0e5b5-78c6-4130-a5ce-25feb0e0b4ac",
|
||
"content": "Dify is an open-source LLM app development platform.",
|
||
"sign_content": "",
|
||
"answer": "",
|
||
"word_count": 9,
|
||
"tokens": 12,
|
||
"keywords": [
|
||
"dify",
|
||
"platform",
|
||
"llm"
|
||
],
|
||
"index_node_id": "a1b2c3d4-e5f6-7890-abcd-000000000001",
|
||
"index_node_hash": "abc123def456",
|
||
"hit_count": 0,
|
||
"enabled": true,
|
||
"disabled_at": null,
|
||
"disabled_by": null,
|
||
"status": "completed",
|
||
"created_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4",
|
||
"created_at": 1741267200,
|
||
"updated_at": 1741267200,
|
||
"updated_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4",
|
||
"indexing_at": 1741267200,
|
||
"completed_at": 1741267200,
|
||
"error": null,
|
||
"stopped_at": null,
|
||
"child_chunks": [],
|
||
"attachments": [],
|
||
"summary": null
|
||
},
|
||
"doc_form": "text_model"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"delete": {
|
||
"tags": [
|
||
"チャンク"
|
||
],
|
||
"summary": "ドキュメント内のチャンクを削除",
|
||
"description": "ドキュメントからチャンクを完全に削除します。",
|
||
"operationId": "deleteSegment",
|
||
"parameters": [
|
||
{
|
||
"name": "dataset_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "ナレッジベース ID です。"
|
||
},
|
||
{
|
||
"name": "document_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "Document ID."
|
||
},
|
||
{
|
||
"name": "segment_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "Chunk ID."
|
||
}
|
||
],
|
||
"responses": {
|
||
"204": {
|
||
"description": "Success."
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks": {
|
||
"post": {
|
||
"tags": [
|
||
"チャンク"
|
||
],
|
||
"summary": "子チャンクを作成",
|
||
"description": "親チャンクの下に子チャンクを作成します。`hierarchical_model` チャンキングモードを使用しているドキュメントでのみ利用可能です。",
|
||
"operationId": "createChildChunk",
|
||
"parameters": [
|
||
{
|
||
"name": "dataset_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "ナレッジベース ID です。"
|
||
},
|
||
{
|
||
"name": "document_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "Document ID."
|
||
},
|
||
{
|
||
"name": "segment_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "Chunk ID."
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"required": [
|
||
"content"
|
||
],
|
||
"properties": {
|
||
"content": {
|
||
"type": "string",
|
||
"description": "子チャンクのテキスト内容です。"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "子チャンクが正常に作成されました。",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/components/schemas/ChildChunk"
|
||
}
|
||
}
|
||
},
|
||
"examples": {
|
||
"success": {
|
||
"summary": "レスポンス例",
|
||
"value": {
|
||
"data": {
|
||
"id": "d7e8f9a0-1b2c-3d4e-5f6a-7b8c9d0e1f2a",
|
||
"segment_id": "f3d1c7be-9f3a-40d8-8eb8-3a1ef9c3f2c1",
|
||
"content": "Dify is an open-source platform.",
|
||
"position": 1,
|
||
"word_count": 6,
|
||
"type": "automatic",
|
||
"created_at": 1741267200,
|
||
"updated_at": 1741267200
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "`invalid_param` : 子チャンクインデックスの作成に失敗しました。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"invalid_param": {
|
||
"summary": "invalid_param",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "invalid_param",
|
||
"message": "Create child chunk index failed: {error details}"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"get": {
|
||
"tags": [
|
||
"チャンク"
|
||
],
|
||
"summary": "子チャンク一覧を取得",
|
||
"description": "特定の親チャンク配下の子チャンクのページネーションリストを返します。",
|
||
"operationId": "getChildChunks",
|
||
"parameters": [
|
||
{
|
||
"name": "dataset_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "ナレッジベース ID です。"
|
||
},
|
||
{
|
||
"name": "document_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "Document ID."
|
||
},
|
||
{
|
||
"name": "segment_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "Chunk ID."
|
||
},
|
||
{
|
||
"name": "page",
|
||
"in": "query",
|
||
"schema": {
|
||
"type": "integer",
|
||
"default": 1,
|
||
"minimum": 1
|
||
},
|
||
"description": "取得するページ番号。"
|
||
},
|
||
{
|
||
"name": "limit",
|
||
"in": "query",
|
||
"schema": {
|
||
"type": "integer",
|
||
"default": 20,
|
||
"minimum": 1
|
||
},
|
||
"description": "1 ページあたりの項目数です。サーバーの上限は `100` です。"
|
||
},
|
||
{
|
||
"name": "keyword",
|
||
"in": "query",
|
||
"schema": {
|
||
"type": "string"
|
||
},
|
||
"description": "検索キーワードです。"
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "子チャンクのリストです。",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/components/schemas/ChildChunk"
|
||
},
|
||
"description": "子チャンクのリスト。"
|
||
},
|
||
"total": {
|
||
"type": "integer",
|
||
"description": "子チャンクの合計数です。"
|
||
},
|
||
"total_pages": {
|
||
"type": "integer",
|
||
"description": "合計ページ数です。"
|
||
},
|
||
"page": {
|
||
"type": "integer",
|
||
"description": "現在のページ番号です。"
|
||
},
|
||
"limit": {
|
||
"type": "integer",
|
||
"description": "1 ページあたりの件数です。"
|
||
}
|
||
}
|
||
},
|
||
"examples": {
|
||
"success": {
|
||
"summary": "レスポンス例",
|
||
"value": {
|
||
"data": [
|
||
{
|
||
"id": "d7e8f9a0-1b2c-3d4e-5f6a-7b8c9d0e1f2a",
|
||
"segment_id": "f3d1c7be-9f3a-40d8-8eb8-3a1ef9c3f2c1",
|
||
"content": "Dify is an open-source platform.",
|
||
"position": 1,
|
||
"word_count": 6,
|
||
"type": "automatic",
|
||
"created_at": 1741267200,
|
||
"updated_at": 1741267200
|
||
}
|
||
],
|
||
"total": 1,
|
||
"total_pages": 1,
|
||
"page": 1,
|
||
"limit": 20
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}": {
|
||
"patch": {
|
||
"tags": [
|
||
"チャンク"
|
||
],
|
||
"summary": "子チャンクを更新",
|
||
"description": "既存の子チャンクのコンテンツを更新します。",
|
||
"operationId": "updateChildChunk",
|
||
"parameters": [
|
||
{
|
||
"name": "dataset_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "ナレッジベース ID です。"
|
||
},
|
||
{
|
||
"name": "document_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "Document ID."
|
||
},
|
||
{
|
||
"name": "segment_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "Chunk ID."
|
||
},
|
||
{
|
||
"name": "child_chunk_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "子チャンク ID です。"
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"required": [
|
||
"content"
|
||
],
|
||
"properties": {
|
||
"content": {
|
||
"type": "string",
|
||
"description": "子チャンクのテキスト内容です。"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "子チャンクが正常に更新されました。",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/components/schemas/ChildChunk"
|
||
}
|
||
}
|
||
},
|
||
"examples": {
|
||
"success": {
|
||
"summary": "レスポンス例",
|
||
"value": {
|
||
"data": {
|
||
"id": "d7e8f9a0-1b2c-3d4e-5f6a-7b8c9d0e1f2a",
|
||
"segment_id": "f3d1c7be-9f3a-40d8-8eb8-3a1ef9c3f2c1",
|
||
"content": "Dify is an open-source platform.",
|
||
"position": 1,
|
||
"word_count": 6,
|
||
"type": "automatic",
|
||
"created_at": 1741267200,
|
||
"updated_at": 1741267200
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "`invalid_param` : 子チャンクインデックスの更新に失敗しました。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"invalid_param": {
|
||
"summary": "invalid_param",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "invalid_param",
|
||
"message": "Create child chunk index failed: {error details}"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"delete": {
|
||
"tags": [
|
||
"チャンク"
|
||
],
|
||
"summary": "子チャンクを削除",
|
||
"description": "親チャンクから子チャンクを完全に削除します。",
|
||
"operationId": "deleteChildChunk",
|
||
"parameters": [
|
||
{
|
||
"name": "dataset_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "ナレッジベース ID です。"
|
||
},
|
||
{
|
||
"name": "document_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "Document ID."
|
||
},
|
||
{
|
||
"name": "segment_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "Chunk ID."
|
||
},
|
||
{
|
||
"name": "child_chunk_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "子チャンク ID です。"
|
||
}
|
||
],
|
||
"responses": {
|
||
"204": {
|
||
"description": "Success."
|
||
},
|
||
"400": {
|
||
"description": "`invalid_param` : 子チャンクインデックスの削除に失敗しました。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"invalid_param": {
|
||
"summary": "invalid_param",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "invalid_param",
|
||
"message": "Delete child chunk index failed: {error details}"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/datasets/{dataset_id}/retrieve": {
|
||
"post": {
|
||
"tags": [
|
||
"データセット"
|
||
],
|
||
"summary": "ナレッジベースからチャンクを取得 / テスト検索",
|
||
"description": "ナレッジベースに対して検索クエリを実行し、最も関連性の高いチャンクを取得します。このエンドポイントは本番環境の検索とテスト検索の両方に使用できます。",
|
||
"operationId": "retrieveSegments",
|
||
"parameters": [
|
||
{
|
||
"name": "dataset_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "ナレッジベース ID です。"
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"required": [
|
||
"query"
|
||
],
|
||
"properties": {
|
||
"query": {
|
||
"type": "string",
|
||
"maxLength": 250,
|
||
"description": "検索クエリテキストです。"
|
||
},
|
||
"retrieval_model": {
|
||
"$ref": "#/components/schemas/RetrievalModel",
|
||
"description": "検索モデルの設定です。このナレッジベースをクエリする際のチャンクの検索方法とランキング方法を制御します。"
|
||
},
|
||
"external_retrieval_model": {
|
||
"type": "object",
|
||
"description": "外部ナレッジベースの検索設定です。",
|
||
"properties": {
|
||
"top_k": {
|
||
"type": "integer",
|
||
"description": "返す結果の最大数です。"
|
||
},
|
||
"score_threshold": {
|
||
"type": "number",
|
||
"description": "結果フィルタリング用の最小関連性スコア閾値です。"
|
||
},
|
||
"score_threshold_enabled": {
|
||
"type": "boolean",
|
||
"description": "スコア閾値フィルタリングが有効かどうかです。"
|
||
}
|
||
}
|
||
},
|
||
"attachment_ids": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "string"
|
||
},
|
||
"nullable": true,
|
||
"description": "検索コンテキストに含める添付ファイル ID のリストです。"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "検索結果です。",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"query": {
|
||
"type": "object",
|
||
"description": "元のクエリオブジェクトです。",
|
||
"properties": {
|
||
"content": {
|
||
"type": "string",
|
||
"description": "クエリテキストです。"
|
||
}
|
||
}
|
||
},
|
||
"records": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "object",
|
||
"properties": {
|
||
"segment": {
|
||
"type": "object",
|
||
"description": "ナレッジベースから一致したチャンクです。",
|
||
"properties": {
|
||
"id": {
|
||
"type": "string",
|
||
"description": "チャンクの一意識別子です。"
|
||
},
|
||
"position": {
|
||
"type": "integer",
|
||
"description": "ドキュメント内のチャンクの位置。"
|
||
},
|
||
"document_id": {
|
||
"type": "string",
|
||
"description": "このチャンクが属するドキュメントの ID です。"
|
||
},
|
||
"content": {
|
||
"type": "string",
|
||
"description": "チャンクのテキスト内容です。"
|
||
},
|
||
"sign_content": {
|
||
"type": "string",
|
||
"description": "整合性検証用の署名付きコンテンツハッシュです。"
|
||
},
|
||
"answer": {
|
||
"type": "string",
|
||
"description": "回答コンテンツです。Q&A モードのドキュメントで使用されます。"
|
||
},
|
||
"word_count": {
|
||
"type": "integer",
|
||
"description": "チャンク内容の単語数です。"
|
||
},
|
||
"tokens": {
|
||
"type": "integer",
|
||
"description": "チャンク内容のトークン数です。"
|
||
},
|
||
"keywords": {
|
||
"type": "array",
|
||
"description": "キーワードベースの検索のためにこのチャンクに関連付けられたキーワードです。",
|
||
"items": {
|
||
"type": "string"
|
||
}
|
||
},
|
||
"index_node_id": {
|
||
"type": "string",
|
||
"description": "ベクトルストア内のインデックスノードの ID です。"
|
||
},
|
||
"index_node_hash": {
|
||
"type": "string",
|
||
"description": "インデックスされたコンテンツのハッシュです。変更の検出に使用されます。"
|
||
},
|
||
"hit_count": {
|
||
"type": "integer",
|
||
"description": "このチャンクが検索クエリでマッチした回数です。"
|
||
},
|
||
"enabled": {
|
||
"type": "boolean",
|
||
"description": "このチャンクが検索に対して有効かどうかです。"
|
||
},
|
||
"disabled_at": {
|
||
"type": "number",
|
||
"nullable": true,
|
||
"description": "チャンクが無効化されたタイムスタンプです。有効な場合は `null` です。"
|
||
},
|
||
"disabled_by": {
|
||
"type": "string",
|
||
"nullable": true,
|
||
"description": "チャンクを無効化したユーザーの ID です。有効な場合は `null` です。"
|
||
},
|
||
"status": {
|
||
"type": "string",
|
||
"description": "チャンクのインデックスステータスです。"
|
||
},
|
||
"created_by": {
|
||
"type": "string",
|
||
"description": "チャンクを作成したユーザーの ID です。"
|
||
},
|
||
"created_at": {
|
||
"type": "number",
|
||
"description": "作成タイムスタンプ(Unix エポック、秒単位)です。"
|
||
},
|
||
"indexing_at": {
|
||
"type": "number",
|
||
"nullable": true,
|
||
"description": "インデックス作成が開始されたタイムスタンプです。まだ開始されていない場合は `null` です。"
|
||
},
|
||
"completed_at": {
|
||
"type": "number",
|
||
"nullable": true,
|
||
"description": "インデックス作成が完了したタイムスタンプです。まだ完了していない場合は `null` です。"
|
||
},
|
||
"error": {
|
||
"type": "string",
|
||
"nullable": true,
|
||
"description": "インデックス作成が失敗した場合のエラーメッセージです。エラーなしの場合は `null` です。"
|
||
},
|
||
"stopped_at": {
|
||
"type": "number",
|
||
"nullable": true,
|
||
"description": "インデックス作成が停止されたタイムスタンプです。停止されていない場合は `null` です。"
|
||
},
|
||
"document": {
|
||
"type": "object",
|
||
"description": "マッチしたチャンクの親ドキュメント情報です。",
|
||
"properties": {
|
||
"id": {
|
||
"type": "string",
|
||
"description": "ドキュメントの一意識別子です。"
|
||
},
|
||
"data_source_type": {
|
||
"type": "string",
|
||
"description": "ドキュメントの作成方法です。"
|
||
},
|
||
"name": {
|
||
"type": "string",
|
||
"description": "ドキュメント名です。"
|
||
},
|
||
"doc_type": {
|
||
"type": "string",
|
||
"nullable": true,
|
||
"description": "ドキュメントタイプの分類です。未設定の場合は `null` です。"
|
||
},
|
||
"doc_metadata": {
|
||
"type": "object",
|
||
"nullable": true,
|
||
"description": "ドキュメントのメタデータ値です。メタデータが設定されていない場合は `null` です。"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"child_chunks": {
|
||
"type": "array",
|
||
"description": "階層インデックスを使用している場合、チャンク内でマッチした子チャンクです。",
|
||
"items": {
|
||
"type": "object",
|
||
"properties": {
|
||
"id": {
|
||
"type": "string",
|
||
"description": "子チャンクの一意識別子です。"
|
||
},
|
||
"content": {
|
||
"type": "string",
|
||
"description": "子チャンクのテキスト内容です。"
|
||
},
|
||
"position": {
|
||
"type": "integer",
|
||
"description": "親チャンク内の子チャンクの位置です。"
|
||
},
|
||
"score": {
|
||
"type": "number",
|
||
"description": "子チャンクの関連性スコアです。"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"score": {
|
||
"type": "number",
|
||
"description": "関連性スコアです。"
|
||
},
|
||
"tsne_position": {
|
||
"type": "object",
|
||
"nullable": true,
|
||
"description": "t-SNE 可視化の位置です。"
|
||
},
|
||
"files": {
|
||
"type": "array",
|
||
"description": "このチャンクに添付されたファイルです。",
|
||
"items": {
|
||
"type": "object",
|
||
"properties": {
|
||
"id": {
|
||
"type": "string",
|
||
"description": "添付ファイルの識別子です。"
|
||
},
|
||
"name": {
|
||
"type": "string",
|
||
"description": "元のファイル名です。"
|
||
},
|
||
"size": {
|
||
"type": "integer",
|
||
"description": "ファイルサイズ(バイト)。"
|
||
},
|
||
"extension": {
|
||
"type": "string",
|
||
"description": "ファイル拡張子。"
|
||
},
|
||
"mime_type": {
|
||
"type": "string",
|
||
"description": "ファイルの MIME タイプ。"
|
||
},
|
||
"source_url": {
|
||
"type": "string",
|
||
"description": "添付ファイルにアクセスする URL です。"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"summary": {
|
||
"type": "string",
|
||
"nullable": true,
|
||
"description": "要約インデックス経由で取得された場合の要約コンテンツです。"
|
||
}
|
||
}
|
||
},
|
||
"description": "一致した検索レコードのリスト。"
|
||
}
|
||
}
|
||
},
|
||
"examples": {
|
||
"success": {
|
||
"summary": "レスポンス例",
|
||
"value": {
|
||
"query": {
|
||
"content": "What is Dify?"
|
||
},
|
||
"records": [
|
||
{
|
||
"segment": {
|
||
"id": "f3d1c7be-9f3a-40d8-8eb8-3a1ef9c3f2c1",
|
||
"position": 1,
|
||
"document_id": "a8e0e5b5-78c6-4130-a5ce-25feb0e0b4ac",
|
||
"content": "Dify is an open-source LLM app development platform.",
|
||
"sign_content": "",
|
||
"answer": "",
|
||
"word_count": 9,
|
||
"tokens": 12,
|
||
"keywords": [
|
||
"dify",
|
||
"platform",
|
||
"llm"
|
||
],
|
||
"index_node_id": "a1b2c3d4-e5f6-7890-abcd-000000000001",
|
||
"index_node_hash": "abc123def456",
|
||
"hit_count": 1,
|
||
"enabled": true,
|
||
"disabled_at": null,
|
||
"disabled_by": null,
|
||
"status": "completed",
|
||
"created_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4",
|
||
"created_at": 1741267200,
|
||
"indexing_at": 1741267200,
|
||
"completed_at": 1741267200,
|
||
"error": null,
|
||
"stopped_at": null,
|
||
"document": {
|
||
"id": "a8e0e5b5-78c6-4130-a5ce-25feb0e0b4ac",
|
||
"data_source_type": "upload_file",
|
||
"name": "guide.txt",
|
||
"doc_type": null,
|
||
"doc_metadata": null
|
||
}
|
||
},
|
||
"child_chunks": [],
|
||
"score": 0.92,
|
||
"tsne_position": null,
|
||
"files": [],
|
||
"summary": null
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "- `dataset_not_initialized` : ナレッジベースはまだ初期化中またはインデキシング中です。しばらくお待ちください。\n- `provider_not_initialize` : 有効なモデルプロバイダーの認証情報が見つかりません。設定 → モデルプロバイダーで認証情報を完了してください。\n- `provider_quota_exceeded` : Your quota for Dify Hosted OpenAI has been exhausted. Please go to Settings -> Model Provider to complete your own provider credentials.\n- `model_currently_not_support` : Dify Hosted OpenAI trial currently not support the GPT-4 model.\n- `completion_request_error` : Completion request failed.\n- `invalid_param` : Invalid parameter value.",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"dataset_not_initialized": {
|
||
"summary": "dataset_not_initialized",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "dataset_not_initialized",
|
||
"message": "The dataset is still being initialized or indexing. Please wait a moment."
|
||
}
|
||
},
|
||
"provider_not_initialize": {
|
||
"summary": "provider_not_initialize",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "provider_not_initialize",
|
||
"message": "No valid model provider credentials found. Please go to Settings -> Model Provider to complete your provider credentials."
|
||
}
|
||
},
|
||
"provider_quota_exceeded": {
|
||
"summary": "provider_quota_exceeded",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "provider_quota_exceeded",
|
||
"message": "Your quota for Dify Hosted OpenAI has been exhausted. Please go to Settings -> Model Provider to complete your own provider credentials."
|
||
}
|
||
},
|
||
"model_currently_not_support": {
|
||
"summary": "model_currently_not_support",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "model_currently_not_support",
|
||
"message": "Dify Hosted OpenAI trial currently not support the GPT-4 model."
|
||
}
|
||
},
|
||
"completion_request_error": {
|
||
"summary": "completion_request_error",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "completion_request_error",
|
||
"message": "Completion request failed."
|
||
}
|
||
},
|
||
"invalid_param": {
|
||
"summary": "invalid_param",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "invalid_param",
|
||
"message": "Invalid parameter value."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"403": {
|
||
"description": "`forbidden` : 権限が不足しています。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"forbidden": {
|
||
"summary": "forbidden",
|
||
"value": {
|
||
"status": 403,
|
||
"code": "forbidden",
|
||
"message": "Insufficient permissions."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"404": {
|
||
"description": "`not_found` : ナレッジベースが見つかりません。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"not_found": {
|
||
"summary": "not_found",
|
||
"value": {
|
||
"status": 404,
|
||
"code": "not_found",
|
||
"message": "Dataset not found."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "`internal_server_error` : 検索中に内部エラーが発生しました。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"internal_server_error": {
|
||
"summary": "internal_server_error",
|
||
"value": {
|
||
"status": 500,
|
||
"code": "internal_server_error",
|
||
"message": "An internal error occurred."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/datasets/tags": {
|
||
"post": {
|
||
"tags": [
|
||
"タグ管理"
|
||
],
|
||
"summary": "ナレッジベースタグを作成",
|
||
"description": "ナレッジベースを整理するための新しいタグを作成します。",
|
||
"operationId": "createKnowledgeTag",
|
||
"requestBody": {
|
||
"required": true,
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"required": [
|
||
"name"
|
||
],
|
||
"properties": {
|
||
"name": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 50,
|
||
"description": "Tag name."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "タグが正常に作成されました。",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"id": {
|
||
"type": "string",
|
||
"description": "タグ識別子です。"
|
||
},
|
||
"name": {
|
||
"type": "string",
|
||
"description": "タグの表示名です。"
|
||
},
|
||
"type": {
|
||
"type": "string",
|
||
"description": "タグタイプです。ナレッジベースタグの場合は常に `knowledge` です。"
|
||
},
|
||
"binding_count": {
|
||
"type": "string",
|
||
"nullable": true,
|
||
"description": "このタグにバインドされたナレッジベースの数です。"
|
||
}
|
||
}
|
||
},
|
||
"examples": {
|
||
"success": {
|
||
"summary": "レスポンス例",
|
||
"value": {
|
||
"id": "f4b5c6d7-e8f9-0a1b-2c3d-4e5f6a7b8c9d",
|
||
"name": "Product Docs",
|
||
"type": "knowledge",
|
||
"binding_count": "0"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"get": {
|
||
"tags": [
|
||
"タグ管理"
|
||
],
|
||
"summary": "ナレッジベースタグリストを取得",
|
||
"description": "ワークスペース内のすべてのナレッジベースタグのリストを返します。",
|
||
"operationId": "getKnowledgeTags",
|
||
"responses": {
|
||
"200": {
|
||
"description": "タグのリストです。",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "object",
|
||
"properties": {
|
||
"id": {
|
||
"type": "string",
|
||
"description": "タグ識別子です。"
|
||
},
|
||
"name": {
|
||
"type": "string",
|
||
"description": "タグの表示名です。"
|
||
},
|
||
"type": {
|
||
"type": "string",
|
||
"description": "タグタイプです。ナレッジベースタグの場合は常に `knowledge` です。"
|
||
},
|
||
"binding_count": {
|
||
"type": "string",
|
||
"nullable": true,
|
||
"description": "このタグにバインドされたナレッジベースの数です。"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"examples": {
|
||
"success": {
|
||
"summary": "レスポンス例",
|
||
"value": [
|
||
{
|
||
"id": "f4b5c6d7-e8f9-0a1b-2c3d-4e5f6a7b8c9d",
|
||
"name": "Product Docs",
|
||
"type": "knowledge",
|
||
"binding_count": "0"
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"patch": {
|
||
"tags": [
|
||
"タグ管理"
|
||
],
|
||
"summary": "ナレッジベースタグを変更",
|
||
"description": "既存のナレッジベースタグの名前を変更します。",
|
||
"operationId": "updateKnowledgeTag",
|
||
"requestBody": {
|
||
"required": true,
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"required": [
|
||
"tag_id",
|
||
"name"
|
||
],
|
||
"properties": {
|
||
"tag_id": {
|
||
"type": "string",
|
||
"description": "更新するタグ ID です。"
|
||
},
|
||
"name": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 50,
|
||
"description": "新しいタグ名です。"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "タグが正常に更新されました。",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"id": {
|
||
"type": "string",
|
||
"description": "タグ識別子です。"
|
||
},
|
||
"name": {
|
||
"type": "string",
|
||
"description": "タグの表示名です。"
|
||
},
|
||
"type": {
|
||
"type": "string",
|
||
"description": "タグタイプです。ナレッジベースタグの場合は常に `knowledge` です。"
|
||
},
|
||
"binding_count": {
|
||
"type": "string",
|
||
"nullable": true,
|
||
"description": "このタグにバインドされたナレッジベースの数です。"
|
||
}
|
||
}
|
||
},
|
||
"examples": {
|
||
"success": {
|
||
"summary": "レスポンス例",
|
||
"value": {
|
||
"id": "f4b5c6d7-e8f9-0a1b-2c3d-4e5f6a7b8c9d",
|
||
"name": "Product Docs",
|
||
"type": "knowledge",
|
||
"binding_count": "0"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"delete": {
|
||
"tags": [
|
||
"タグ管理"
|
||
],
|
||
"summary": "ナレッジベースタグを削除",
|
||
"description": "ナレッジベースタグを完全に削除します。タグ付けされたナレッジベース自体は削除されません。",
|
||
"operationId": "deleteKnowledgeTag",
|
||
"requestBody": {
|
||
"required": true,
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"required": [
|
||
"tag_id"
|
||
],
|
||
"properties": {
|
||
"tag_id": {
|
||
"type": "string",
|
||
"description": "削除するタグ ID です。"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"204": {
|
||
"description": "Success."
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/datasets/tags/binding": {
|
||
"post": {
|
||
"tags": [
|
||
"タグ管理"
|
||
],
|
||
"summary": "タグをデータセットにバインド",
|
||
"description": "ナレッジベースに 1 つ以上のタグをバインドします。ナレッジベースには複数のタグを設定できます。",
|
||
"operationId": "bindTagsToDataset",
|
||
"requestBody": {
|
||
"required": true,
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"required": [
|
||
"tag_ids",
|
||
"target_id"
|
||
],
|
||
"properties": {
|
||
"tag_ids": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "string"
|
||
},
|
||
"minItems": 1,
|
||
"description": "バインドするタグ ID です。"
|
||
},
|
||
"target_id": {
|
||
"type": "string",
|
||
"description": "ナレッジベース ID です。"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"204": {
|
||
"description": "Success."
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/datasets/tags/unbinding": {
|
||
"post": {
|
||
"tags": [
|
||
"タグ管理"
|
||
],
|
||
"summary": "タグとデータセットのバインドを解除",
|
||
"description": "ナレッジベースからタグバインディングを削除します。",
|
||
"operationId": "unbindTagFromDataset",
|
||
"requestBody": {
|
||
"required": true,
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"required": [
|
||
"tag_id",
|
||
"target_id"
|
||
],
|
||
"properties": {
|
||
"tag_id": {
|
||
"type": "string",
|
||
"description": "バインド解除するタグ ID です。"
|
||
},
|
||
"target_id": {
|
||
"type": "string",
|
||
"description": "ナレッジベース ID です。"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"204": {
|
||
"description": "Success."
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/datasets/{dataset_id}/tags": {
|
||
"get": {
|
||
"tags": [
|
||
"タグ管理"
|
||
],
|
||
"summary": "ナレッジベースにバインドされたタグを取得",
|
||
"description": "特定のナレッジベースにバインドされたタグのリストを返します。",
|
||
"operationId": "queryDatasetTags",
|
||
"parameters": [
|
||
{
|
||
"name": "dataset_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "ナレッジベース ID です。"
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "ナレッジベースにバインドされたタグです。",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "object",
|
||
"properties": {
|
||
"id": {
|
||
"type": "string",
|
||
"description": "タグ識別子です。"
|
||
},
|
||
"name": {
|
||
"type": "string",
|
||
"description": "タグの表示名です。"
|
||
}
|
||
}
|
||
},
|
||
"description": "このナレッジベースにバインドされたタグのリスト。"
|
||
},
|
||
"total": {
|
||
"type": "integer",
|
||
"description": "このナレッジベースにバインドされたタグの合計数です。"
|
||
}
|
||
}
|
||
},
|
||
"examples": {
|
||
"success": {
|
||
"summary": "レスポンス例",
|
||
"value": {
|
||
"data": [
|
||
{
|
||
"id": "f4b5c6d7-e8f9-0a1b-2c3d-4e5f6a7b8c9d",
|
||
"name": "Product Docs"
|
||
}
|
||
],
|
||
"total": 1
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/datasets/{dataset_id}/metadata": {
|
||
"post": {
|
||
"tags": [
|
||
"メタデータ"
|
||
],
|
||
"summary": "メタデータフィールドを作成",
|
||
"description": "ナレッジベースのカスタムメタデータフィールドを作成します。メタデータフィールドを使用して、構造化された情報でドキュメントにアノテーションを付けることができます。",
|
||
"operationId": "createMetadataFieldJa",
|
||
"parameters": [
|
||
{
|
||
"name": "dataset_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "ナレッジベース ID です。"
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"required": [
|
||
"type",
|
||
"name"
|
||
],
|
||
"properties": {
|
||
"type": {
|
||
"type": "string",
|
||
"enum": [
|
||
"string",
|
||
"number",
|
||
"time"
|
||
],
|
||
"description": "`string` はテキスト値、`number` は数値、`time` は日付/時刻値です。"
|
||
},
|
||
"name": {
|
||
"type": "string",
|
||
"description": "メタデータフィールド名です。"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"201": {
|
||
"description": "メタデータフィールドが正常に作成されました。",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"id": {
|
||
"type": "string",
|
||
"description": "メタデータフィールドの識別子です。"
|
||
},
|
||
"name": {
|
||
"type": "string",
|
||
"description": "メタデータフィールド名です。"
|
||
},
|
||
"type": {
|
||
"type": "string",
|
||
"description": "メタデータフィールドの種類です。"
|
||
}
|
||
}
|
||
},
|
||
"examples": {
|
||
"success": {
|
||
"summary": "レスポンス例",
|
||
"value": {
|
||
"id": "b5c6d7e8-f9a0-1b2c-3d4e-5f6a7b8c9d0e",
|
||
"name": "author",
|
||
"type": "string"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"get": {
|
||
"tags": [
|
||
"メタデータ"
|
||
],
|
||
"summary": "メタデータフィールドリストを取得",
|
||
"description": "ナレッジベースのすべてのメタデータフィールド(カスタムおよび組み込みの両方)の一覧と、各フィールドを使用しているドキュメント数を返します。",
|
||
"operationId": "listMetadataFieldsJa",
|
||
"parameters": [
|
||
{
|
||
"name": "dataset_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "ナレッジベース ID です。"
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "ナレッジベースのメタデータフィールドです。",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"doc_metadata": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "object",
|
||
"properties": {
|
||
"id": {
|
||
"type": "string",
|
||
"description": "メタデータフィールドの識別子です。"
|
||
},
|
||
"name": {
|
||
"type": "string",
|
||
"description": "メタデータフィールド名です。"
|
||
},
|
||
"type": {
|
||
"type": "string",
|
||
"description": "メタデータフィールドの種類です。"
|
||
},
|
||
"count": {
|
||
"type": "integer",
|
||
"description": "このメタデータフィールドを使用しているドキュメント数です。"
|
||
}
|
||
}
|
||
},
|
||
"description": "メタデータフィールド定義のリスト。"
|
||
},
|
||
"built_in_field_enabled": {
|
||
"type": "boolean",
|
||
"description": "このナレッジベースで組み込みメタデータフィールドが有効かどうかです。"
|
||
}
|
||
}
|
||
},
|
||
"examples": {
|
||
"success": {
|
||
"summary": "レスポンス例",
|
||
"value": {
|
||
"doc_metadata": [
|
||
{
|
||
"id": "b5c6d7e8-f9a0-1b2c-3d4e-5f6a7b8c9d0e",
|
||
"name": "author",
|
||
"type": "string",
|
||
"count": 3
|
||
}
|
||
],
|
||
"built_in_field_enabled": true
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/datasets/{dataset_id}/metadata/{metadata_id}": {
|
||
"patch": {
|
||
"tags": [
|
||
"メタデータ"
|
||
],
|
||
"summary": "メタデータフィールドを更新",
|
||
"description": "カスタムメタデータフィールドの名前を変更します。",
|
||
"operationId": "updateMetadataFieldJa",
|
||
"parameters": [
|
||
{
|
||
"name": "dataset_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "ナレッジベース ID です。"
|
||
},
|
||
{
|
||
"name": "metadata_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "メタデータフィールド ID です。"
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"required": [
|
||
"name"
|
||
],
|
||
"properties": {
|
||
"name": {
|
||
"type": "string",
|
||
"description": "新しいメタデータフィールド名です。"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "メタデータフィールドが正常に更新されました。",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"id": {
|
||
"type": "string",
|
||
"description": "メタデータフィールドの識別子です。"
|
||
},
|
||
"name": {
|
||
"type": "string",
|
||
"description": "メタデータフィールド名です。"
|
||
},
|
||
"type": {
|
||
"type": "string",
|
||
"description": "メタデータフィールドの種類です。"
|
||
}
|
||
}
|
||
},
|
||
"examples": {
|
||
"success": {
|
||
"summary": "レスポンス例",
|
||
"value": {
|
||
"id": "b5c6d7e8-f9a0-1b2c-3d4e-5f6a7b8c9d0e",
|
||
"name": "author",
|
||
"type": "string"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"delete": {
|
||
"tags": [
|
||
"メタデータ"
|
||
],
|
||
"summary": "メタデータフィールドを削除",
|
||
"description": "カスタムメタデータフィールドを完全に削除します。このフィールドを使用しているドキュメントは、該当するメタデータ値を失います。",
|
||
"operationId": "deleteMetadataFieldJa",
|
||
"parameters": [
|
||
{
|
||
"name": "dataset_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "ナレッジベース ID です。"
|
||
},
|
||
{
|
||
"name": "metadata_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "メタデータフィールド ID です。"
|
||
}
|
||
],
|
||
"responses": {
|
||
"204": {
|
||
"description": "Success."
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/datasets/{dataset_id}/metadata/built-in": {
|
||
"get": {
|
||
"tags": [
|
||
"メタデータ"
|
||
],
|
||
"summary": "組み込みメタデータフィールドを取得",
|
||
"description": "システムが提供する組み込みメタデータフィールドの一覧を返します(例:ドキュメントタイプ、ソース URL)。",
|
||
"operationId": "getBuiltInMetadataFieldsJa",
|
||
"parameters": [
|
||
{
|
||
"name": "dataset_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "ナレッジベース ID です。"
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "組み込みメタデータフィールドです。",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"fields": {
|
||
"type": "array",
|
||
"description": "システム提供のメタデータフィールドのリストです。",
|
||
"items": {
|
||
"type": "object",
|
||
"properties": {
|
||
"name": {
|
||
"type": "string",
|
||
"description": "組み込みフィールド識別子です。`document_name` はドキュメントタイトル、`uploader` は作成者、`upload_date` は作成日時、`last_update_date` は最終更新日時、`source` はドキュメントの出典を示します。"
|
||
},
|
||
"type": {
|
||
"type": "string",
|
||
"description": "フィールドのデータ型です。テキスト値の場合は `string`、日時値の場合は `time` です。"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"examples": {
|
||
"success": {
|
||
"summary": "レスポンス例",
|
||
"value": {
|
||
"fields": [
|
||
{
|
||
"name": "document_name",
|
||
"type": "string"
|
||
},
|
||
{
|
||
"name": "uploader",
|
||
"type": "string"
|
||
},
|
||
{
|
||
"name": "upload_date",
|
||
"type": "time"
|
||
},
|
||
{
|
||
"name": "last_update_date",
|
||
"type": "time"
|
||
},
|
||
{
|
||
"name": "source",
|
||
"type": "string"
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/datasets/{dataset_id}/metadata/built-in/{action}": {
|
||
"post": {
|
||
"tags": [
|
||
"メタデータ"
|
||
],
|
||
"summary": "組み込みメタデータフィールドを更新",
|
||
"description": "ナレッジベースの組み込みメタデータフィールドを有効または無効にします。",
|
||
"operationId": "toggleBuiltInMetadataFieldJa",
|
||
"parameters": [
|
||
{
|
||
"name": "dataset_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "ナレッジベース ID です。"
|
||
},
|
||
{
|
||
"name": "action",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"enum": [
|
||
"enable",
|
||
"disable"
|
||
]
|
||
},
|
||
"description": "`enable` で内蔵メタデータフィールドを有効化、`disable` で無効化します。"
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "組み込みメタデータフィールドの切り替えに成功しました。",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"result": {
|
||
"type": "string",
|
||
"description": "操作結果です。"
|
||
}
|
||
}
|
||
},
|
||
"examples": {
|
||
"success": {
|
||
"summary": "レスポンス例",
|
||
"value": {
|
||
"result": "success"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/datasets/{dataset_id}/documents/metadata": {
|
||
"post": {
|
||
"tags": [
|
||
"メタデータ"
|
||
],
|
||
"summary": "ドキュメントメタデータを一括更新",
|
||
"description": "複数のドキュメントのメタデータ値を一括更新します。リクエスト内の各ドキュメントに指定されたメタデータのキーと値のペアが適用されます。",
|
||
"operationId": "batchUpdateDocumentMetadataJa",
|
||
"parameters": [
|
||
{
|
||
"name": "dataset_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "ナレッジベース ID です。"
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"required": [
|
||
"operation_data"
|
||
],
|
||
"properties": {
|
||
"operation_data": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "object",
|
||
"required": [
|
||
"document_id",
|
||
"metadata_list"
|
||
],
|
||
"properties": {
|
||
"document_id": {
|
||
"type": "string",
|
||
"description": "メタデータを更新するドキュメントの ID です。"
|
||
},
|
||
"metadata_list": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "object",
|
||
"required": [
|
||
"id",
|
||
"name"
|
||
],
|
||
"properties": {
|
||
"id": {
|
||
"type": "string",
|
||
"description": "メタデータフィールド ID です。"
|
||
},
|
||
"name": {
|
||
"type": "string",
|
||
"description": "メタデータフィールド名です。"
|
||
},
|
||
"value": {
|
||
"description": "メタデータ値。文字列、数値、または `null` を指定できます。"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"partial_update": {
|
||
"type": "boolean",
|
||
"default": false,
|
||
"description": "メタデータを部分的に更新し、未指定フィールドの既存の値を保持するかどうかです。"
|
||
}
|
||
}
|
||
},
|
||
"description": "ドキュメントメタデータの更新操作の配列です。各エントリはドキュメント ID をメタデータのキーと値のペアにマッピングします。"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "ドキュメントメタデータが正常に更新されました。",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"result": {
|
||
"type": "string",
|
||
"description": "操作結果です。"
|
||
}
|
||
}
|
||
},
|
||
"examples": {
|
||
"success": {
|
||
"summary": "レスポンス例",
|
||
"value": {
|
||
"result": "success"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/workspaces/current/models/model-types/{model_type}": {
|
||
"get": {
|
||
"tags": [
|
||
"モデル"
|
||
],
|
||
"summary": "利用可能なモデルを取得",
|
||
"description": "タイプ別に利用可能なモデルの一覧を取得します。主にナレッジベース設定用の `text-embedding` モデルと `rerank` モデルのクエリに使用します。",
|
||
"operationId": "getAvailableModelsJa",
|
||
"parameters": [
|
||
{
|
||
"name": "model_type",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"enum": [
|
||
"text-embedding",
|
||
"rerank",
|
||
"llm",
|
||
"tts",
|
||
"speech2text",
|
||
"moderation"
|
||
]
|
||
},
|
||
"description": "取得するモデルのタイプです。ナレッジベースの設定には、埋め込みモデルの場合は `text-embedding`、リランキングモデルの場合は `rerank` を使用します。"
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "指定された種類で利用可能なモデルです。",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"type": "array",
|
||
"description": "利用可能なモデルを持つモデルプロバイダーのリストです。",
|
||
"items": {
|
||
"type": "object",
|
||
"properties": {
|
||
"provider": {
|
||
"type": "string",
|
||
"description": "モデルプロバイダーの識別子です(例:`openai`、`cohere`)。"
|
||
},
|
||
"label": {
|
||
"type": "object",
|
||
"description": "プロバイダーのローカライズ表示名です。",
|
||
"properties": {
|
||
"en_US": {
|
||
"type": "string",
|
||
"description": "英語表示名。"
|
||
},
|
||
"zh_Hans": {
|
||
"type": "string",
|
||
"description": "中国語表示名。"
|
||
}
|
||
}
|
||
},
|
||
"icon_small": {
|
||
"type": "object",
|
||
"description": "プロバイダーの小アイコンの URL です。",
|
||
"properties": {
|
||
"en_US": {
|
||
"type": "string",
|
||
"description": "小アイコン URL。"
|
||
}
|
||
}
|
||
},
|
||
"icon_large": {
|
||
"type": "object",
|
||
"description": "プロバイダーの大アイコンの URL です。",
|
||
"properties": {
|
||
"en_US": {
|
||
"type": "string",
|
||
"description": "大アイコン URL。"
|
||
}
|
||
}
|
||
},
|
||
"status": {
|
||
"type": "string",
|
||
"description": "プロバイダーのステータスです。認証情報が設定済みで有効な場合は `active` です。"
|
||
},
|
||
"models": {
|
||
"type": "array",
|
||
"description": "このプロバイダーから利用可能なモデルのリストです。",
|
||
"items": {
|
||
"type": "object",
|
||
"properties": {
|
||
"model": {
|
||
"type": "string",
|
||
"description": "モデル識別子です。ナレッジベースの作成または更新時に `embedding_model` の値として使用します。"
|
||
},
|
||
"label": {
|
||
"type": "object",
|
||
"description": "モデルのローカライズ表示名です。",
|
||
"properties": {
|
||
"en_US": {
|
||
"type": "string",
|
||
"description": "英語モデル名。"
|
||
},
|
||
"zh_Hans": {
|
||
"type": "string",
|
||
"description": "中国語モデル名。"
|
||
}
|
||
}
|
||
},
|
||
"model_type": {
|
||
"type": "string",
|
||
"description": "モデルのタイプです。`model_type` パスパラメータと一致します。"
|
||
},
|
||
"features": {
|
||
"type": "array",
|
||
"nullable": true,
|
||
"description": "モデルがサポートする機能です。なしの場合は `null` です。",
|
||
"items": {
|
||
"type": "string"
|
||
}
|
||
},
|
||
"fetch_from": {
|
||
"type": "string",
|
||
"description": "モデル定義の取得元です。`predefined-model` は組み込みモデル、`customizable-model` はユーザー設定モデルを示します。"
|
||
},
|
||
"model_properties": {
|
||
"type": "object",
|
||
"description": "`context_size` などのモデル固有のプロパティです。"
|
||
},
|
||
"status": {
|
||
"type": "string",
|
||
"description": "モデルの利用可能ステータスです。使用可能な場合は `active` です。"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"examples": {
|
||
"success": {
|
||
"summary": "レスポンス例",
|
||
"value": {
|
||
"data": [
|
||
{
|
||
"provider": "openai",
|
||
"label": {
|
||
"en_US": "OpenAI",
|
||
"zh_Hans": "OpenAI"
|
||
},
|
||
"icon_small": {
|
||
"en_US": "https://example.com/openai-small.svg"
|
||
},
|
||
"icon_large": {
|
||
"en_US": "https://example.com/openai-large.svg"
|
||
},
|
||
"status": "active",
|
||
"models": [
|
||
{
|
||
"model": "text-embedding-3-small",
|
||
"label": {
|
||
"en_US": "text-embedding-3-small",
|
||
"zh_Hans": "text-embedding-3-small"
|
||
},
|
||
"model_type": "text-embedding",
|
||
"features": null,
|
||
"fetch_from": "predefined-model",
|
||
"model_properties": {
|
||
"context_size": 8191
|
||
},
|
||
"status": "active"
|
||
}
|
||
]
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/datasets/pipeline/file-upload": {
|
||
"post": {
|
||
"tags": [
|
||
"ナレッジパイプライン"
|
||
],
|
||
"summary": "パイプラインファイルをアップロード",
|
||
"description": "ナレッジパイプラインで使用するファイルをアップロードします。`multipart/form-data` で単一ファイルを受け付けます。",
|
||
"operationId": "uploadPipelineFileJa",
|
||
"requestBody": {
|
||
"required": true,
|
||
"content": {
|
||
"multipart/form-data": {
|
||
"schema": {
|
||
"type": "object",
|
||
"required": [
|
||
"file"
|
||
],
|
||
"properties": {
|
||
"file": {
|
||
"type": "string",
|
||
"format": "binary",
|
||
"description": "アップロードするファイルです。"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"201": {
|
||
"description": "ファイルが正常にアップロードされました。",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"id": {
|
||
"type": "string",
|
||
"description": "アップロードされたファイルの一意識別子です。"
|
||
},
|
||
"name": {
|
||
"type": "string",
|
||
"description": "元のファイル名です。"
|
||
},
|
||
"size": {
|
||
"type": "integer",
|
||
"description": "ファイルサイズ(バイト)。"
|
||
},
|
||
"extension": {
|
||
"type": "string",
|
||
"description": "ファイル拡張子。"
|
||
},
|
||
"mime_type": {
|
||
"type": "string",
|
||
"description": "ファイルの MIME タイプ。"
|
||
},
|
||
"created_by": {
|
||
"type": "string",
|
||
"description": "ファイルをアップロードしたユーザーの ID。"
|
||
},
|
||
"created_at": {
|
||
"type": "string",
|
||
"description": "アップロードタイムスタンプ(ISO 8601 形式)です。"
|
||
}
|
||
}
|
||
},
|
||
"examples": {
|
||
"success": {
|
||
"summary": "レスポンス例",
|
||
"value": {
|
||
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
|
||
"name": "report.pdf",
|
||
"size": 524288,
|
||
"extension": "pdf",
|
||
"mime_type": "application/pdf",
|
||
"created_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4",
|
||
"created_at": "2025-03-06T12:00:00"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "- `no_file_uploaded` : ファイルをアップロードしてください。\n- `filename_not_exists_error` : 指定されたファイル名が存在しません。\n- `too_many_files` : ファイルは 1 つのみ許可されています。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"no_file_uploaded": {
|
||
"summary": "no_file_uploaded",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "no_file_uploaded",
|
||
"message": "Please upload your file."
|
||
}
|
||
},
|
||
"filename_not_exists_error": {
|
||
"summary": "filename_not_exists_error",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "filename_not_exists_error",
|
||
"message": "The specified filename does not exist."
|
||
}
|
||
},
|
||
"too_many_files": {
|
||
"summary": "too_many_files",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "too_many_files",
|
||
"message": "Only one file is allowed."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"413": {
|
||
"description": "`file_too_large` : ファイルサイズの上限を超えています。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"file_too_large": {
|
||
"summary": "file_too_large",
|
||
"value": {
|
||
"status": 413,
|
||
"code": "file_too_large",
|
||
"message": "File size exceeded."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"415": {
|
||
"description": "`unsupported_file_type` : 許可されていないファイルタイプです。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"unsupported_file_type": {
|
||
"summary": "unsupported_file_type",
|
||
"value": {
|
||
"status": 415,
|
||
"code": "unsupported_file_type",
|
||
"message": "File type not allowed."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/datasets/{dataset_id}/pipeline/datasource-plugins": {
|
||
"get": {
|
||
"tags": [
|
||
"ナレッジパイプライン"
|
||
],
|
||
"summary": "データソースプラグインリストを取得",
|
||
"description": "ナレッジパイプラインで利用可能なすべてのデータソースプラグインを一覧表示します。`is_published` クエリパラメータに応じて公開済みまたはドラフトのプラグインを返します。",
|
||
"operationId": "listDatasourcePluginsJa",
|
||
"parameters": [
|
||
{
|
||
"name": "dataset_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "ナレッジベース ID です。"
|
||
},
|
||
{
|
||
"name": "is_published",
|
||
"in": "query",
|
||
"schema": {
|
||
"type": "boolean",
|
||
"default": true
|
||
},
|
||
"description": "公開済みまたはドラフトのデータソースプラグインのどちらを取得するかを指定します。`true` は公開済みプラグイン、`false` はドラフトプラグインを返します。"
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "データソースプラグインのリストです。",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "object",
|
||
"properties": {
|
||
"id": {
|
||
"type": "string",
|
||
"description": "データソースプラグインの一意の識別子です。"
|
||
},
|
||
"name": {
|
||
"type": "string",
|
||
"description": "データソースプラグインの表示名です。"
|
||
},
|
||
"type": {
|
||
"type": "string",
|
||
"description": "データソースプラグインの種類です。"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"examples": {
|
||
"success": {
|
||
"summary": "レスポンス例",
|
||
"value": [
|
||
{
|
||
"id": "b1c2d3e4-f5a6-7890-abcd-ef1234567890",
|
||
"name": "Web Scraper",
|
||
"type": "online_document"
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"404": {
|
||
"description": "`not_found` : ナレッジベースが見つかりません。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"not_found": {
|
||
"summary": "not_found",
|
||
"value": {
|
||
"status": 404,
|
||
"code": "not_found",
|
||
"message": "Dataset not found."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/datasets/{dataset_id}/pipeline/datasource/nodes/{node_id}/run": {
|
||
"post": {
|
||
"tags": [
|
||
"ナレッジパイプライン"
|
||
],
|
||
"summary": "データソースノードを実行",
|
||
"description": "ナレッジパイプライン内の単一のデータソースノードを実行します。ノードの実行結果を含むストリーミングレスポンスを返します。",
|
||
"operationId": "runDatasourceNodeJa",
|
||
"parameters": [
|
||
{
|
||
"name": "dataset_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "ナレッジベース ID です。"
|
||
},
|
||
{
|
||
"name": "node_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string"
|
||
},
|
||
"description": "実行するデータソースノードの ID です。"
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"required": [
|
||
"inputs",
|
||
"datasource_type",
|
||
"is_published"
|
||
],
|
||
"properties": {
|
||
"inputs": {
|
||
"type": "object",
|
||
"additionalProperties": true,
|
||
"description": "データソースノードの入力変数です。"
|
||
},
|
||
"datasource_type": {
|
||
"type": "string",
|
||
"enum": [
|
||
"online_document",
|
||
"local_file",
|
||
"website_crawl",
|
||
"online_drive"
|
||
],
|
||
"description": "データソースの種類です。"
|
||
},
|
||
"credential_id": {
|
||
"type": "string",
|
||
"nullable": true,
|
||
"description": "データソースとの認証に使用する認証情報の ID です。"
|
||
},
|
||
"is_published": {
|
||
"type": "boolean",
|
||
"description": "ノードの公開バージョンとドラフトバージョンのどちらを実行するかを指定します。`true` は公開バージョン、`false` はドラフトを実行します。"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "ノード実行イベントを含むストリーミングレスポンスです。",
|
||
"content": {
|
||
"text/event-stream": {
|
||
"schema": {
|
||
"type": "string",
|
||
"description": "ノード実行の進捗と結果を含む Server-Sent Events ストリームです。"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"404": {
|
||
"description": "`not_found` : ナレッジベースが見つかりません。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"not_found": {
|
||
"summary": "not_found",
|
||
"value": {
|
||
"status": 404,
|
||
"code": "not_found",
|
||
"message": "Dataset not found."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/datasets/{dataset_id}/pipeline/run": {
|
||
"post": {
|
||
"tags": [
|
||
"ナレッジパイプライン"
|
||
],
|
||
"summary": "パイプラインを実行",
|
||
"description": "ナレッジベースの完全なナレッジパイプラインを実行します。ストリーミングとブロッキングの両方のレスポンスモードをサポートしています。",
|
||
"operationId": "runPipelineJa",
|
||
"parameters": [
|
||
{
|
||
"name": "dataset_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "ナレッジベース ID です。"
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"required": [
|
||
"inputs",
|
||
"datasource_type",
|
||
"datasource_info_list",
|
||
"start_node_id",
|
||
"is_published",
|
||
"response_mode"
|
||
],
|
||
"properties": {
|
||
"inputs": {
|
||
"type": "object",
|
||
"additionalProperties": true,
|
||
"description": "パイプラインの入力変数です。"
|
||
},
|
||
"datasource_type": {
|
||
"type": "string",
|
||
"enum": [
|
||
"online_document",
|
||
"local_file",
|
||
"website_crawl",
|
||
"online_drive"
|
||
],
|
||
"description": "データソースの種類です。"
|
||
},
|
||
"datasource_info_list": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "object",
|
||
"additionalProperties": true
|
||
},
|
||
"description": "パイプラインが処理するデータソース情報オブジェクトのリストです。"
|
||
},
|
||
"start_node_id": {
|
||
"type": "string",
|
||
"description": "パイプライン実行を開始するノードの ID です。"
|
||
},
|
||
"is_published": {
|
||
"type": "boolean",
|
||
"description": "パイプラインの公開バージョンとドラフトバージョンのどちらを実行するかを指定します。`true` は公開バージョン、`false` はドラフトを実行します。"
|
||
},
|
||
"response_mode": {
|
||
"type": "string",
|
||
"enum": [
|
||
"streaming",
|
||
"blocking"
|
||
],
|
||
"description": "パイプライン実行のレスポンスモードです。`streaming` はサーバー送信イベントストリームを返し、`blocking` は完了を待って完全な結果を返します。"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "パイプライン実行結果。フォーマットは `response_mode` に依存します:ストリーミングは `text/event-stream` を返し、ブロッキングは完全な JSON 結果を返します。",
|
||
"content": {
|
||
"text/event-stream": {
|
||
"schema": {
|
||
"type": "string",
|
||
"description": "パイプライン実行の進捗と結果を含むサーバー送信イベントストリームです。`response_mode` が `streaming` の場合に返されます。"
|
||
}
|
||
},
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"description": "パイプライン実行の完全な結果です。`response_mode` が `blocking` の場合に返されます。",
|
||
"additionalProperties": true
|
||
},
|
||
"examples": {
|
||
"success": {
|
||
"summary": "Blocking Response Example",
|
||
"value": {
|
||
"task_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
|
||
"workflow_run_id": "f1e2d3c4-b5a6-7890-abcd-ef0987654321",
|
||
"data": {
|
||
"id": "f1e2d3c4-b5a6-7890-abcd-ef0987654321",
|
||
"status": "succeeded",
|
||
"outputs": {},
|
||
"created_at": 1741267200,
|
||
"finished_at": 1741267210
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"403": {
|
||
"description": "`forbidden` : アクセスが禁止されています。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"forbidden": {
|
||
"summary": "forbidden",
|
||
"value": {
|
||
"status": 403,
|
||
"code": "forbidden",
|
||
"message": "Forbidden."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"404": {
|
||
"description": "`not_found` : ナレッジベースが見つかりません。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"not_found": {
|
||
"summary": "not_found",
|
||
"value": {
|
||
"status": 404,
|
||
"code": "not_found",
|
||
"message": "Dataset not found."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "`pipeline_run_error` : パイプライン実行に失敗しました。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"pipeline_run_error": {
|
||
"summary": "pipeline_run_error",
|
||
"value": {
|
||
"status": 500,
|
||
"code": "pipeline_run_error",
|
||
"message": "Pipeline execution failed: connection timeout"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"components": {
|
||
"schemas": {
|
||
"Dataset": {
|
||
"type": "object",
|
||
"properties": {
|
||
"id": {
|
||
"type": "string",
|
||
"description": "ナレッジベースの一意識別子です。"
|
||
},
|
||
"name": {
|
||
"type": "string",
|
||
"description": "ナレッジベースの表示名です。ワークスペース内で一意です。"
|
||
},
|
||
"description": {
|
||
"type": "string",
|
||
"description": "ナレッジベースの目的または内容を説明するオプションのテキストです。"
|
||
},
|
||
"provider": {
|
||
"type": "string",
|
||
"description": "プロバイダータイプです。内部管理の場合は `vendor`、外部ナレッジベース接続の場合は `external` です。"
|
||
},
|
||
"permission": {
|
||
"type": "string",
|
||
"description": "このナレッジベースにアクセスできるユーザーを制御します。指定可能な値:`only_me`、`all_team_members`、`partial_members`。"
|
||
},
|
||
"data_source_type": {
|
||
"type": "string",
|
||
"description": "ドキュメントのデータソースタイプです。まだ設定されていない場合は `null` です。"
|
||
},
|
||
"indexing_technique": {
|
||
"type": "string",
|
||
"description": "`high_quality` は埋め込みモデルを使用した精密検索、`economy` はキーワードベースのインデキシングです。"
|
||
},
|
||
"app_count": {
|
||
"type": "integer",
|
||
"description": "現在このナレッジベースを使用しているアプリケーションの数です。"
|
||
},
|
||
"document_count": {
|
||
"type": "integer",
|
||
"description": "ナレッジベース内のドキュメント総数です。"
|
||
},
|
||
"word_count": {
|
||
"type": "integer",
|
||
"description": "全ドキュメントの合計単語数です。"
|
||
},
|
||
"created_by": {
|
||
"type": "string",
|
||
"description": "ナレッジベースを作成したユーザーの ID です。"
|
||
},
|
||
"author_name": {
|
||
"type": "string",
|
||
"description": "作成者の表示名です。"
|
||
},
|
||
"created_at": {
|
||
"type": "number",
|
||
"description": "作成タイムスタンプ(Unix エポック、秒単位)です。"
|
||
},
|
||
"updated_by": {
|
||
"type": "string",
|
||
"description": "ナレッジベースを最後に更新したユーザーの ID です。"
|
||
},
|
||
"updated_at": {
|
||
"type": "number",
|
||
"description": "最終更新タイムスタンプ(Unix エポック、秒単位)です。"
|
||
},
|
||
"embedding_model": {
|
||
"type": "string",
|
||
"description": "インデックス作成に使用される埋め込みモデルの名前です。"
|
||
},
|
||
"embedding_model_provider": {
|
||
"type": "string",
|
||
"description": "埋め込みモデルプロバイダーです。[利用可能なモデルを取得](/api-reference/モデル/利用可能なモデルを取得) で `model_type=text-embedding` を指定した際の `provider` フィールドの値を使用します。"
|
||
},
|
||
"embedding_available": {
|
||
"type": "boolean",
|
||
"description": "設定された埋め込みモデルが現在利用可能かどうかです。"
|
||
},
|
||
"retrieval_model_dict": {
|
||
"type": "object",
|
||
"description": "ナレッジベースの検索設定です。",
|
||
"properties": {
|
||
"search_method": {
|
||
"type": "string",
|
||
"description": "検索に使用する検索方法です。`keyword_search` はキーワードマッチング、`semantic_search` は埋め込みベースの類似度検索、`full_text_search` は全文インデックス検索、`hybrid_search` はセマンティックとキーワードの組み合わせ検索を示します。"
|
||
},
|
||
"reranking_enable": {
|
||
"type": "boolean",
|
||
"description": "リランキングが有効かどうかです。"
|
||
},
|
||
"reranking_mode": {
|
||
"type": "string",
|
||
"nullable": true,
|
||
"description": "リランキングモードです。`reranking_model` はモデルベースのリランキング、`weighted_score` はスコアベースの重み付けを示します。リランキングが無効の場合は `null` です。"
|
||
},
|
||
"reranking_model": {
|
||
"type": "object",
|
||
"description": "リランキングモデルの設定です。",
|
||
"properties": {
|
||
"reranking_provider_name": {
|
||
"type": "string",
|
||
"description": "リランキングモデルのプロバイダー名です。"
|
||
},
|
||
"reranking_model_name": {
|
||
"type": "string",
|
||
"description": "リランキングモデル名です。"
|
||
}
|
||
}
|
||
},
|
||
"weights": {
|
||
"type": "object",
|
||
"nullable": true,
|
||
"description": "ハイブリッド検索の重み設定です。",
|
||
"properties": {
|
||
"weight_type": {
|
||
"type": "string",
|
||
"description": "セマンティック検索とキーワード検索の重みを調整するための戦略です。"
|
||
},
|
||
"vector_setting": {
|
||
"type": "object",
|
||
"description": "セマンティック検索の重み設定です。",
|
||
"properties": {
|
||
"vector_weight": {
|
||
"type": "number",
|
||
"description": "セマンティック(ベクトル)検索結果に割り当てられた重みです。"
|
||
},
|
||
"embedding_provider_name": {
|
||
"type": "string",
|
||
"description": "ベクトル検索に使用される埋め込みモデルのプロバイダーです。"
|
||
},
|
||
"embedding_model_name": {
|
||
"type": "string",
|
||
"description": "ベクトル検索に使用される埋め込みモデルの名前です。"
|
||
}
|
||
}
|
||
},
|
||
"keyword_setting": {
|
||
"type": "object",
|
||
"description": "キーワード検索の重み設定です。",
|
||
"properties": {
|
||
"keyword_weight": {
|
||
"type": "number",
|
||
"description": "キーワード検索結果に割り当てられた重みです。"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"top_k": {
|
||
"type": "integer",
|
||
"description": "返す結果の最大数です。"
|
||
},
|
||
"score_threshold_enabled": {
|
||
"type": "boolean",
|
||
"description": "スコア閾値フィルタリングが有効かどうかです。"
|
||
},
|
||
"score_threshold": {
|
||
"type": "number",
|
||
"description": "結果の最小関連性スコアです。`score_threshold_enabled` が `true` の場合にのみ有効です。"
|
||
}
|
||
}
|
||
},
|
||
"summary_index_setting": {
|
||
"type": "object",
|
||
"nullable": true,
|
||
"description": "サマリーインデックスの設定です。",
|
||
"properties": {
|
||
"enable": {
|
||
"type": "boolean",
|
||
"description": "サマリーインデックスが有効かどうかです。"
|
||
},
|
||
"model_name": {
|
||
"type": "string",
|
||
"description": "要約生成に使用されるモデルの名前です。"
|
||
},
|
||
"model_provider_name": {
|
||
"type": "string",
|
||
"description": "要約生成モデルのプロバイダーです。"
|
||
},
|
||
"summary_prompt": {
|
||
"type": "string",
|
||
"description": "要約生成に使用されるプロンプトテンプレートです。"
|
||
}
|
||
}
|
||
},
|
||
"tags": {
|
||
"type": "array",
|
||
"description": "このナレッジベースに関連付けられたタグです。",
|
||
"items": {
|
||
"type": "object",
|
||
"properties": {
|
||
"id": {
|
||
"type": "string",
|
||
"description": "タグ識別子です。"
|
||
},
|
||
"name": {
|
||
"type": "string",
|
||
"description": "Tag name."
|
||
},
|
||
"type": {
|
||
"type": "string",
|
||
"description": "タグタイプです。ナレッジベースタグの場合は常に `knowledge` です。"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"doc_form": {
|
||
"type": "string",
|
||
"description": "ドキュメントのチャンキングモードです。`text_model` は標準テキストチャンキング、`hierarchical_model` は親子構造、`qa_model` は QA ペア抽出を示します。"
|
||
},
|
||
"external_knowledge_info": {
|
||
"type": "object",
|
||
"nullable": true,
|
||
"description": "外部ナレッジベースの接続詳細です。`provider` が `external` の場合に存在します。",
|
||
"properties": {
|
||
"external_knowledge_id": {
|
||
"type": "string",
|
||
"description": "外部ナレッジベースの ID です。"
|
||
},
|
||
"external_knowledge_api_id": {
|
||
"type": "string",
|
||
"description": "外部ナレッジ API 接続の ID です。"
|
||
},
|
||
"external_knowledge_api_name": {
|
||
"type": "string",
|
||
"description": "外部ナレッジ API の表示名です。"
|
||
},
|
||
"external_knowledge_api_endpoint": {
|
||
"type": "string",
|
||
"description": "外部ナレッジ API のエンドポイント URL です。"
|
||
}
|
||
}
|
||
},
|
||
"external_retrieval_model": {
|
||
"type": "object",
|
||
"nullable": true,
|
||
"description": "外部ナレッジベースの検索設定です。内部ナレッジベースの場合は `null` です。",
|
||
"properties": {
|
||
"top_k": {
|
||
"type": "integer",
|
||
"description": "外部ナレッジベースから返す結果の最大数です。"
|
||
},
|
||
"score_threshold": {
|
||
"type": "number",
|
||
"description": "最小関連性スコアのしきい値です。"
|
||
},
|
||
"score_threshold_enabled": {
|
||
"type": "boolean",
|
||
"description": "スコア閾値フィルタリングが有効かどうかです。"
|
||
}
|
||
}
|
||
},
|
||
"doc_metadata": {
|
||
"type": "array",
|
||
"description": "ナレッジベースのメタデータフィールド定義です。",
|
||
"items": {
|
||
"type": "object",
|
||
"properties": {
|
||
"id": {
|
||
"type": "string",
|
||
"description": "メタデータフィールドの識別子です。"
|
||
},
|
||
"name": {
|
||
"type": "string",
|
||
"description": "メタデータフィールド名です。"
|
||
},
|
||
"type": {
|
||
"type": "string",
|
||
"description": "メタデータフィールドの値の種類です。"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"built_in_field_enabled": {
|
||
"type": "boolean",
|
||
"description": "組み込みメタデータフィールド(例:`document_name`、`uploader`)が有効かどうかです。"
|
||
},
|
||
"pipeline_id": {
|
||
"type": "string",
|
||
"nullable": true,
|
||
"description": "カスタム処理パイプラインが設定されている場合のパイプライン ID です。"
|
||
},
|
||
"runtime_mode": {
|
||
"type": "string",
|
||
"nullable": true,
|
||
"description": "ランタイム処理モードです。"
|
||
},
|
||
"chunk_structure": {
|
||
"type": "string",
|
||
"nullable": true,
|
||
"description": "チャンク構造の設定です。"
|
||
},
|
||
"icon_info": {
|
||
"type": "object",
|
||
"nullable": true,
|
||
"description": "ナレッジベースのアイコン表示設定です。",
|
||
"properties": {
|
||
"icon_type": {
|
||
"type": "string",
|
||
"description": "アイコンの種類です。"
|
||
},
|
||
"icon": {
|
||
"type": "string",
|
||
"description": "アイコン識別子または絵文字です。"
|
||
},
|
||
"icon_background": {
|
||
"type": "string",
|
||
"description": "アイコンの背景色です。"
|
||
},
|
||
"icon_url": {
|
||
"type": "string",
|
||
"description": "カスタムアイコン画像の URL です。"
|
||
}
|
||
}
|
||
},
|
||
"is_published": {
|
||
"type": "boolean",
|
||
"description": "ナレッジベースが公開済みかどうかです。"
|
||
},
|
||
"total_documents": {
|
||
"type": "integer",
|
||
"description": "ドキュメントの合計数です。"
|
||
},
|
||
"total_available_documents": {
|
||
"type": "integer",
|
||
"description": "有効で利用可能なドキュメントの数です。"
|
||
},
|
||
"enable_api": {
|
||
"type": "boolean",
|
||
"description": "このナレッジベースで API アクセスが有効かどうかです。"
|
||
},
|
||
"is_multimodal": {
|
||
"type": "boolean",
|
||
"description": "マルチモーダルコンテンツ処理が有効かどうかです。"
|
||
}
|
||
}
|
||
},
|
||
"Document": {
|
||
"type": "object",
|
||
"properties": {
|
||
"id": {
|
||
"type": "string",
|
||
"description": "ドキュメントの一意識別子です。"
|
||
},
|
||
"position": {
|
||
"type": "integer",
|
||
"description": "リスト内のドキュメントの表示位置です。"
|
||
},
|
||
"data_source_type": {
|
||
"type": "string",
|
||
"description": "ドキュメントの作成方法です。ファイルアップロードの場合は `upload_file`、Notion インポートの場合は `notion_import` です。"
|
||
},
|
||
"data_source_info": {
|
||
"type": "object",
|
||
"description": "生のデータソース情報です。`data_source_type` によって異なります。"
|
||
},
|
||
"data_source_detail_dict": {
|
||
"type": "object",
|
||
"description": "ファイル詳細を含む詳細なデータソース情報です。"
|
||
},
|
||
"dataset_process_rule_id": {
|
||
"type": "string",
|
||
"description": "このドキュメントに適用された処理ルールの ID です。"
|
||
},
|
||
"name": {
|
||
"type": "string",
|
||
"description": "ドキュメント名です。"
|
||
},
|
||
"created_from": {
|
||
"type": "string",
|
||
"description": "ドキュメントの作成元です。API で作成した場合は `api`、UI で作成した場合は `web` です。"
|
||
},
|
||
"created_by": {
|
||
"type": "string",
|
||
"description": "ドキュメントを作成したユーザーの ID です。"
|
||
},
|
||
"created_at": {
|
||
"type": "number",
|
||
"description": "作成タイムスタンプ(Unix エポック、秒単位)です。"
|
||
},
|
||
"tokens": {
|
||
"type": "integer",
|
||
"description": "ドキュメント内の合計トークン数です。"
|
||
},
|
||
"indexing_status": {
|
||
"type": "string",
|
||
"description": "現在のインデックスステータスです。`waiting` はキュー待ち、`parsing` はコンテンツ抽出中、`cleaning` はノイズ除去中、`splitting` はチャンキング中、`indexing` はベクトル構築中、`completed` は準備完了、`error` は失敗、`paused` は手動一時停止を示します。"
|
||
},
|
||
"error": {
|
||
"type": "string",
|
||
"nullable": true,
|
||
"description": "インデックス作成が失敗した場合のエラーメッセージです。エラーなしの場合は `null` です。"
|
||
},
|
||
"enabled": {
|
||
"type": "boolean",
|
||
"description": "このドキュメントが検索に対して有効かどうかです。"
|
||
},
|
||
"disabled_at": {
|
||
"type": "number",
|
||
"nullable": true,
|
||
"description": "ドキュメントが無効化されたタイムスタンプです。有効な場合は `null` です。"
|
||
},
|
||
"disabled_by": {
|
||
"type": "string",
|
||
"nullable": true,
|
||
"description": "ドキュメントを無効化したユーザーの ID です。有効な場合は `null` です。"
|
||
},
|
||
"archived": {
|
||
"type": "boolean",
|
||
"description": "ドキュメントがアーカイブ済みかどうかです。"
|
||
},
|
||
"display_status": {
|
||
"type": "string",
|
||
"description": "`indexing_status` と `enabled` 状態から導出されたユーザー向け表示ステータスです。"
|
||
},
|
||
"word_count": {
|
||
"type": "integer",
|
||
"description": "ドキュメントの合計単語数です。"
|
||
},
|
||
"hit_count": {
|
||
"type": "integer",
|
||
"description": "ドキュメントが検索クエリでマッチした回数です。"
|
||
},
|
||
"doc_form": {
|
||
"type": "string",
|
||
"description": "ドキュメントのチャンキングモードです。`text_model` は標準テキストチャンキング、`hierarchical_model` は親子構造、`qa_model` は QA ペア抽出を示します。"
|
||
},
|
||
"doc_metadata": {
|
||
"type": "array",
|
||
"description": "このドキュメントに割り当てられたメタデータ値です。",
|
||
"items": {
|
||
"type": "object",
|
||
"properties": {
|
||
"id": {
|
||
"type": "string",
|
||
"description": "メタデータフィールドの識別子です。"
|
||
},
|
||
"name": {
|
||
"type": "string",
|
||
"description": "メタデータフィールド名です。"
|
||
},
|
||
"type": {
|
||
"type": "string",
|
||
"description": "メタデータフィールドの値の種類です。"
|
||
},
|
||
"value": {
|
||
"type": "string",
|
||
"description": "このドキュメントのメタデータ値。"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"summary_index_status": {
|
||
"type": "string",
|
||
"nullable": true,
|
||
"description": "このドキュメントの要約インデックスのステータスです。要約インデックスが設定されていない場合は `null` です。"
|
||
},
|
||
"need_summary": {
|
||
"type": "boolean",
|
||
"description": "このドキュメントに要約を生成する必要があるかどうかです。"
|
||
}
|
||
}
|
||
},
|
||
"Segment": {
|
||
"type": "object",
|
||
"properties": {
|
||
"id": {
|
||
"type": "string",
|
||
"description": "チャンクの一意識別子です。"
|
||
},
|
||
"position": {
|
||
"type": "integer",
|
||
"description": "ドキュメント内のチャンクの位置。"
|
||
},
|
||
"document_id": {
|
||
"type": "string",
|
||
"description": "このチャンクが属するドキュメントの ID です。"
|
||
},
|
||
"content": {
|
||
"type": "string",
|
||
"description": "チャンクのテキスト内容です。"
|
||
},
|
||
"sign_content": {
|
||
"type": "string",
|
||
"description": "整合性検証用の署名付きコンテンツハッシュです。"
|
||
},
|
||
"answer": {
|
||
"type": "string",
|
||
"description": "回答コンテンツです。Q&A モードのドキュメントで使用されます。"
|
||
},
|
||
"word_count": {
|
||
"type": "integer",
|
||
"description": "チャンク内容の単語数です。"
|
||
},
|
||
"tokens": {
|
||
"type": "integer",
|
||
"description": "チャンク内容のトークン数です。"
|
||
},
|
||
"keywords": {
|
||
"type": "array",
|
||
"description": "キーワードベースの検索のためにこのチャンクに関連付けられたキーワードです。",
|
||
"items": {
|
||
"type": "string"
|
||
}
|
||
},
|
||
"index_node_id": {
|
||
"type": "string",
|
||
"description": "ベクトルストア内のインデックスノードの ID です。"
|
||
},
|
||
"index_node_hash": {
|
||
"type": "string",
|
||
"description": "インデックスされたコンテンツのハッシュです。変更の検出に使用されます。"
|
||
},
|
||
"hit_count": {
|
||
"type": "integer",
|
||
"description": "このチャンクが検索クエリでマッチした回数です。"
|
||
},
|
||
"enabled": {
|
||
"type": "boolean",
|
||
"description": "このチャンクが検索に対して有効かどうかです。"
|
||
},
|
||
"disabled_at": {
|
||
"type": "number",
|
||
"nullable": true,
|
||
"description": "チャンクが無効化されたタイムスタンプです。有効な場合は `null` です。"
|
||
},
|
||
"disabled_by": {
|
||
"type": "string",
|
||
"nullable": true,
|
||
"description": "チャンクを無効化したユーザーの ID です。有効な場合は `null` です。"
|
||
},
|
||
"status": {
|
||
"type": "string",
|
||
"description": "チャンクの現在のインデックスステータスです(例:`completed`、`indexing`、`error`)。"
|
||
},
|
||
"created_by": {
|
||
"type": "string",
|
||
"description": "チャンクを作成したユーザーの ID です。"
|
||
},
|
||
"created_at": {
|
||
"type": "number",
|
||
"description": "作成タイムスタンプ(Unix エポック、秒単位)です。"
|
||
},
|
||
"updated_at": {
|
||
"type": "number",
|
||
"description": "最終更新タイムスタンプ(Unix エポック、秒単位)です。"
|
||
},
|
||
"updated_by": {
|
||
"type": "string",
|
||
"description": "このチャンクを最後に更新したユーザーの ID です。"
|
||
},
|
||
"indexing_at": {
|
||
"type": "number",
|
||
"nullable": true,
|
||
"description": "インデックス作成が開始されたタイムスタンプです。まだ開始されていない場合は `null` です。"
|
||
},
|
||
"completed_at": {
|
||
"type": "number",
|
||
"nullable": true,
|
||
"description": "インデックス作成が完了したタイムスタンプです。まだ完了していない場合は `null` です。"
|
||
},
|
||
"error": {
|
||
"type": "string",
|
||
"nullable": true,
|
||
"description": "インデックス作成が失敗した場合のエラーメッセージです。エラーなしの場合は `null` です。"
|
||
},
|
||
"stopped_at": {
|
||
"type": "number",
|
||
"nullable": true,
|
||
"description": "インデックス作成が停止されたタイムスタンプです。停止されていない場合は `null` です。"
|
||
},
|
||
"child_chunks": {
|
||
"type": "array",
|
||
"description": "このチャンクに属する子チャンクです。階層モードのドキュメントにのみ存在します。",
|
||
"items": {
|
||
"$ref": "#/components/schemas/ChildChunk"
|
||
}
|
||
},
|
||
"attachments": {
|
||
"type": "array",
|
||
"description": "このチャンクに添付されたファイルです。",
|
||
"items": {
|
||
"type": "object",
|
||
"properties": {
|
||
"id": {
|
||
"type": "string",
|
||
"description": "添付ファイルの識別子です。"
|
||
},
|
||
"name": {
|
||
"type": "string",
|
||
"description": "元のファイル名です。"
|
||
},
|
||
"size": {
|
||
"type": "integer",
|
||
"description": "ファイルサイズ(バイト)。"
|
||
},
|
||
"extension": {
|
||
"type": "string",
|
||
"description": "ファイル拡張子。"
|
||
},
|
||
"mime_type": {
|
||
"type": "string",
|
||
"description": "ファイルの MIME タイプ。"
|
||
},
|
||
"source_url": {
|
||
"type": "string",
|
||
"description": "添付ファイルにアクセスする URL です。"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"summary": {
|
||
"type": "string",
|
||
"nullable": true,
|
||
"description": "AI が生成したチャンクコンテンツの要約です。要約インデックスが有効でない場合は `null` です。"
|
||
}
|
||
}
|
||
},
|
||
"ChildChunk": {
|
||
"type": "object",
|
||
"properties": {
|
||
"id": {
|
||
"type": "string",
|
||
"description": "子チャンクの一意識別子です。"
|
||
},
|
||
"segment_id": {
|
||
"type": "string",
|
||
"description": "この子チャンクが属する親チャンクの ID です。"
|
||
},
|
||
"content": {
|
||
"type": "string",
|
||
"description": "子チャンクのテキスト内容です。"
|
||
},
|
||
"position": {
|
||
"type": "integer",
|
||
"description": "親チャンク内の子チャンクの位置です。"
|
||
},
|
||
"word_count": {
|
||
"type": "integer",
|
||
"description": "子チャンク内容の単語数です。"
|
||
},
|
||
"type": {
|
||
"type": "string",
|
||
"description": "子チャンクの作成方法です。システム生成の場合は `automatic`、手動作成の場合は `custom` です。"
|
||
},
|
||
"created_at": {
|
||
"type": "number",
|
||
"description": "作成タイムスタンプ(Unix エポック、秒単位)です。"
|
||
},
|
||
"updated_at": {
|
||
"type": "number",
|
||
"description": "最終更新タイムスタンプ(Unix エポック、秒単位)です。"
|
||
}
|
||
}
|
||
},
|
||
"RetrievalModel": {
|
||
"type": "object",
|
||
"required": [
|
||
"search_method",
|
||
"reranking_enable",
|
||
"top_k",
|
||
"score_threshold_enabled"
|
||
],
|
||
"properties": {
|
||
"search_method": {
|
||
"type": "string",
|
||
"description": "検索に使用される検索メソッドです。",
|
||
"enum": [
|
||
"keyword_search",
|
||
"semantic_search",
|
||
"full_text_search",
|
||
"hybrid_search"
|
||
]
|
||
},
|
||
"reranking_enable": {
|
||
"type": "boolean",
|
||
"description": "リランキングが有効かどうかです。"
|
||
},
|
||
"reranking_model": {
|
||
"type": "object",
|
||
"description": "リランキングモデルの設定です。",
|
||
"properties": {
|
||
"reranking_provider_name": {
|
||
"type": "string",
|
||
"description": "リランキングモデルのプロバイダー名です。"
|
||
},
|
||
"reranking_model_name": {
|
||
"type": "string",
|
||
"description": "リランキングモデル名です。"
|
||
}
|
||
}
|
||
},
|
||
"reranking_mode": {
|
||
"type": "string",
|
||
"enum": [
|
||
"reranking_model",
|
||
"weighted_score"
|
||
],
|
||
"nullable": true,
|
||
"description": "リランキングモードです。`reranking_enable` が `true` の場合は必須です。"
|
||
},
|
||
"top_k": {
|
||
"type": "integer",
|
||
"description": "返す結果の最大数です。"
|
||
},
|
||
"score_threshold_enabled": {
|
||
"type": "boolean",
|
||
"description": "スコア閾値フィルタリングが有効かどうかです。"
|
||
},
|
||
"score_threshold": {
|
||
"type": "number",
|
||
"nullable": true,
|
||
"description": "結果の最小関連性スコアです。`score_threshold_enabled` が `true` の場合にのみ有効です。"
|
||
},
|
||
"weights": {
|
||
"type": "object",
|
||
"nullable": true,
|
||
"description": "ハイブリッド検索の重み設定です。",
|
||
"properties": {
|
||
"weight_type": {
|
||
"type": "string",
|
||
"description": "セマンティック検索とキーワード検索の重みを調整するための戦略です。",
|
||
"enum": [
|
||
"semantic_first",
|
||
"keyword_first",
|
||
"customized"
|
||
]
|
||
},
|
||
"vector_setting": {
|
||
"type": "object",
|
||
"description": "セマンティック検索の重み設定です。",
|
||
"properties": {
|
||
"vector_weight": {
|
||
"type": "number",
|
||
"description": "セマンティック(ベクトル)検索結果に割り当てられた重みです。"
|
||
},
|
||
"embedding_provider_name": {
|
||
"type": "string",
|
||
"description": "ベクトル検索に使用される埋め込みモデルのプロバイダーです。"
|
||
},
|
||
"embedding_model_name": {
|
||
"type": "string",
|
||
"description": "ベクトル検索に使用される埋め込みモデルの名前です。"
|
||
}
|
||
}
|
||
},
|
||
"keyword_setting": {
|
||
"type": "object",
|
||
"description": "キーワード検索の重み設定です。",
|
||
"properties": {
|
||
"keyword_weight": {
|
||
"type": "number",
|
||
"description": "キーワード検索結果に割り当てられた重みです。"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"securitySchemes": {
|
||
"ApiKeyAuth": {
|
||
"type": "http",
|
||
"scheme": "bearer",
|
||
"bearerFormat": "API_KEY",
|
||
"description": "API Key 認証です。すべての API リクエストにおいて、`Authorization` HTTP ヘッダーに `Bearer ` プレフィックスを付けた API Key を含めてください。例:`Authorization: Bearer {API_KEY}`。**API Key はサーバーサイドに保存し、クライアントサイドで共有・保存しないことを強く推奨します。API Key の漏洩は深刻な結果につながる可能性があります。**"
|
||
}
|
||
}
|
||
}
|
||
}
|