update knowledge base api (#20426)

This commit is contained in:
Dongyu Li
2025-05-30 14:45:30 +08:00
committed by GitHub
parent 55371e5abf
commit 1ea4459d9f
6 changed files with 397 additions and 36 deletions

View File

@@ -1057,6 +1057,75 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi
<Heading
url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}'
method='GET'
title='ドキュメントセグメントの詳細を表示'
name='#view_document_segment'
/>
<Row>
<Col>
指定されたナレッジベース内の特定のドキュメントセグメントの詳細を表示します
### パス
<Properties>
<Property name='dataset_id' type='string' key='dataset_id'>
ナレッジベースID
</Property>
<Property name='document_id' type='string' key='document_id'>
ドキュメントID
</Property>
<Property name='segment_id' type='string' key='segment_id'>
セグメントID
</Property>
</Properties>
</Col>
<Col sticky>
<CodeGroup
title="リクエスト"
tag="GET"
label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}"
targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}' \\\n--header 'Authorization: Bearer {api_key}'`}
>
```bash {{ title: 'cURL' }}
curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}' \
--header 'Authorization: Bearer {api_key}'
```
</CodeGroup>
<CodeGroup title="レスポンス">
```json {{ title: 'Response' }}
{
"data": {
"id": "セグメントID",
"position": 2,
"document_id": "ドキュメントID",
"content": "セグメント内容テキスト",
"sign_content": "署名内容テキスト",
"answer": "回答内容(Q&Aモードの場合)",
"word_count": 470,
"tokens": 382,
"keywords": ["キーワード1", "キーワード2"],
"index_node_id": "インデックスードID",
"index_node_hash": "インデックスノードハッシュ",
"hit_count": 0,
"enabled": true,
"status": "completed",
"created_by": "作成者ID",
"created_at": 作成タイムスタンプ,
"updated_at": 更新タイムスタンプ,
"indexing_at": インデックス作成タイムスタンプ,
"completed_at": 完了タイムスタンプ,
"error": null,
"child_chunks": []
},
"doc_form": "text_model"
}
```
</CodeGroup>
</Col>
</Row>
<hr className='ml-0 mr-0' />
<Heading
method='DELETE'
title='ドキュメント内のチャンクを削除'
name='#delete_segment'
@@ -1100,7 +1169,6 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi
<hr className='ml-0 mr-0' />
<Heading
url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}'
method='POST'
title='ドキュメント内のチャンクを更新'
name='#update_segment'
@@ -1528,20 +1596,45 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi
クエリキーワード
</Property>
<Property name='retrieval_model' type='object' key='retrieval_model'>
検索モデル (オプション、入力されない場合はデフォルトの方法でリコールされます)
- <code>search_method</code> (text) 検索方法: 以下の 4 つのキーワードのいずれかが必要です
- <code>keyword_search</code> キーワード検索
- <code>semantic_search</code> セマンティック検索
- <code>full_text_search</code> 全文検索
- <code>hybrid_search</code> ハイブリッド検索
- <code>reranking_enable</code> (bool) 再ランキングを有効にするかどうか、検索モードが semantic_search または hybrid_search の場合に必須 (オプション)
- <code>reranking_mode</code> (object) 再ランキングモデル構成、再ランキングが有効な場合に必須
- <code>reranking_provider_name</code> (string) 再ランキングモデルプロバイダー
- <code>reranking_model_name</code> (string) 再ランキングモデル名
- <code>weights</code> (float) ハイブリッド検索モードでのセマンティック検索の重み設定
- <code>top_k</code> (integer) 返される結果の数 (オプション)
- <code>score_threshold_enabled</code> (bool) スコア閾値を有効にするかどうか
- <code>score_threshold</code> (float) スコア閾値
検索パラメータ(オプション、入力されない場合はデフォルトの方法でリコールされます
- <code>search_method</code> (text) 検索方法: 以下の4つのキーワードのいずれかが必要です
- <code>keyword_search</code> キーワード検索
- <code>semantic_search</code> セマンティック検索
- <code>full_text_search</code> 全文検索
- <code>hybrid_search</code> ハイブリッド検索
- <code>reranking_enable</code> (bool) 再ランキングを有効にするかどうか、検索モードがsemantic_searchまたはhybrid_searchの場合に必須オプション
- <code>reranking_mode</code> (object) 再ランキングモデル構成、再ランキングが有効な場合に必須
- <code>reranking_provider_name</code> (string) 再ランキングモデルプロバイダー
- <code>reranking_model_name</code> (string) 再ランキングモデル名
- <code>weights</code> (float) ハイブリッド検索モードでのセマンティック検索の重み設定
- <code>top_k</code> (integer) 返される結果の数オプション
- <code>score_threshold_enabled</code> (bool) スコア閾値を有効にするかどうか
- <code>score_threshold</code> (float) スコア閾値
- <code>metadata_filtering_conditions</code> (object) メタデータフィルタリング条件
- <code>logical_operator</code> (string) 論理演算子: <code>and</code> | <code>or</code>
- <code>conditions</code> (array[object]) 条件リスト
- <code>name</code> (string) メタデータフィールド名
- <code>comparison_operator</code> (string) 比較演算子、許可される値:
- 文字列比較:
- <code>contains</code>: 含む
- <code>not contains</code>: 含まない
- <code>start with</code>: で始まる
- <code>end with</code>: で終わる
- <code>is</code>: 等しい
- <code>is not</code>: 等しくない
- <code>empty</code>: 空
- <code>not empty</code>: 空でない
- 数値比較:
- <code>=</code>: 等しい
- <code>≠</code>: 等しくない
- <code>></code>: より大きい
- <code>< </code>: より小さい
- <code>≥</code>: 以上
- <code>≤</code>: 以下
- 時間比較:
- <code>before</code>: より前
- <code>after</code>: より後
- <code>value</code> (string|number|null) 比較値
</Property>
<Property name='external_retrieval_model' type='object' key='external_retrieval_model'>
未使用フィールド
@@ -1566,7 +1659,17 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi
"weights": null,
"top_k": 1,
"score_threshold_enabled": false,
"score_threshold": null
"score_threshold": null,
"metadata_filtering_conditions": {
"logical_operator": "and",
"conditions": [
{
"name": "document_name",
"comparison_operator": "contains",
"value": "test"
}
]
}
}
}'`}
>