檢索知識庫
調試
您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。
調試
授權資訊
請求參數
|
名稱 |
類型 |
必填 |
描述 |
樣本值 |
| KbUuid |
string |
是 |
知識庫 ID。 |
kb-*** |
| Query |
string |
是 |
查詢內容。 |
What is GraphRAG? |
| TopK |
integer |
否 |
返回 top 數量的結果。 |
10 |
| Filter |
string |
否 |
要查詢的資料的過濾條件,格式為 SQL 的 WHERE 格式。 |
title = 'test' AND name like 'test%' |
| Metrics |
string |
否 |
檢索時的相似性演算法。此值為空白時則採用建立知識庫時指定的演算法,建議如無特殊需求不需設定。 可選值:
|
cosine |
| HybridSearch |
string |
否 |
多路召回演算法,預設為空白(即直接將稠密向量和全文的分數比較並排序)。 可選值:
|
RRF |
| HybridSearchArgs |
string |
否 |
多路召回的演算法參數。目前支援 RRF 和 Weight 兩種。HybridPathsSetting 可以指定召回稠密向量(dense)、稀疏向量(sparse)和全文檢索索引(fulltext),如果值為空白,預設召回稠密向量(dense)和全文檢索索引(fulltext)。
|
{ \"Weight\": { \"alpha\": 0.5 } } |
| IncludeVector |
boolean |
否 |
是否返迴向量。預設為 false。 說明
|
false |
| IncludeMetadataFields |
string |
否 |
預設為空白,表示要返回的 metadata 欄位,多個欄位用逗號分隔。 |
title,page |
| RerankFactor |
number |
否 |
重排因子。當該值不為空白時,會對向量檢索結果再做一次重排。取值範圍:1<RerankFactor<=5。 說明
|
2 |
| RecallWindow |
string |
否 |
召回視窗。當該值不為空白時,增加返回檢索結果的上下文。格式為 2 個元素的數組:List<A, B>,其中-10<=A<=0,0<=B<=10。 說明
|
[-5,5] |
| OrderBy |
string |
否 |
預設為空白,表示排序的依據欄位。 欄位必須屬於 metadata 或表裡的預設欄位比如 id,格式支援: 單個欄位,如 chunk_id; 多個欄位,用逗號串連,如 block_id, chunk_id; 支援反序,如: block_id DESC, chunk_id DESC; |
created_at |
| Offset |
integer |
否 |
位移量,用於分頁查詢 |
0 |
返回參數
|
名稱 |
類型 |
描述 |
樣本值 |
|
object |
Schema of Response |
||
| RequestId |
string |
本次調用的唯一 ID。出現錯誤後,您可以根據該 ID 排查問題。 |
67E910F2-4B62-5B0C-ACA3-7547695C**** |
| Data |
object |
返回結構體。 |
|
| Results |
array<object> |
結果清單。 |
|
|
array<object> |
返回資料。 |
||
| Id |
string |
向量資料的唯一 Id。 |
3b35c95-57f3-442f-9220-xxxxx |
| Content |
string |
常值內容。 |
GraphRAG (Graph Retrieval-Augmented Generation) is an advanced AI framework that combines Knowledge Graphs with Large Language Models (LLMs) to improve the accuracy, context, and reasoning capabilities of information retrieval and generation. |
| FileName |
string |
文檔名稱。 |
1.txt |
| LoaderMetadata |
string |
文檔載入器載入時的元資訊。 |
{"page_pos": 1} |
| Score |
number |
此條資料的相似性分數,其分數演算法和建立索引時指定的演算法(l2/ip/cosine)相關。 |
0.81 |
| Vector |
array |
向量資料列表。 |
|
|
number |
向量資料。 |
1.2123 |
|
| Metadata |
object |
中繼資料 Map。 |
{"title":"test"} |
| RerankScore |
number |
重排分數。 |
6.2345 |
| RetrievalSource |
integer |
檢索結果的來源。1 表示向量檢索,2 表示全文檢索索引,3 表示雙路召回。 |
1 |
| Matches |
array<object> |
視窗化匹配到的列表。 |
|
|
array<object> |
返回資料。 |
||
| Content |
string |
常值內容。 |
GraphRAG (Graph Retrieval-Augmented Generation) is an advanced AI framework that combines Knowledge Graphs with Large Language Models (LLMs) to improve the accuracy, context, and reasoning capabilities of information retrieval and generation. |
| FileName |
string |
文檔名稱。 |
1.txt |
| Id |
string |
向量資料的唯一 Id。 |
3b35c95-57f3-442f-9220-xxxxx |
| LoaderMetadata |
string |
文檔載入器載入時的元資訊。 |
{"page_pos": 1} |
| Metadata |
object |
中繼資料 Map。 |
{"title":"test"} |
| ErrorCode |
string |
錯誤碼,請求異常時返回。 |
KnowledgeBaseNotFound |
| Success |
boolean |
請求是否成功,傳回值如下:
|
true |
| ErrorMessage |
string |
調用失敗時,返回的錯誤資訊。 |
Resource not found kb-*** |
樣本
正常返回樣本
JSON格式
{
"RequestId": "67E910F2-4B62-5B0C-ACA3-7547695C****",
"Data": {
"Results": [
{
"Id": "3b35c95-57f3-442f-9220-xxxxx",
"Content": "GraphRAG (Graph Retrieval-Augmented Generation) is an advanced AI framework that combines Knowledge Graphs with Large Language Models (LLMs) to improve the accuracy, context, and reasoning capabilities of information retrieval and generation.",
"FileName": "1.txt",
"LoaderMetadata": "{\"page_pos\": 1}",
"Score": 0.81,
"Vector": [
1.2123
],
"Metadata": {
"title": "test"
},
"RerankScore": 6.2345,
"RetrievalSource": 1
}
],
"Matches": [
{
"Content": "GraphRAG (Graph Retrieval-Augmented Generation) is an advanced AI framework that combines Knowledge Graphs with Large Language Models (LLMs) to improve the accuracy, context, and reasoning capabilities of information retrieval and generation.",
"FileName": "1.txt",
"Id": "3b35c95-57f3-442f-9220-xxxxx",
"LoaderMetadata": "{\"page_pos\": 1}",
"Metadata": {
"title": "test"
}
}
]
},
"ErrorCode": "KnowledgeBaseNotFound",
"Success": true,
"ErrorMessage": "Resource not found kb-***"
}
錯誤碼
訪問錯誤中心查看更多錯誤碼。
變更歷史
更多資訊,參考變更詳情。