跳至主要内容
版本:PrivStation 2.6.0
Markdown 原文

資料參考搜尋

此 API 用於在指定的知識版本中,搜尋相關的參考資料。

curl -X 'POST' \
'http://127.0.0.1:8000/v1/chat/references?fileset_id={fileset_id}&query={query}' \
-H 'accept: application/json' \
-H 'Authorization: Bearer <your-api-key>'

Request Headers​

KeyValue
Request MethodPOST
acceptapplication/json
AuthorizationBearer <your-api-key>
Content-Typeapplication/json

Query Parameters​

FieldTypeNoteRequired
fileset_idstring知識版本的唯一鍵,uuidtrue
querystring搜尋的內容true

Response Body​

[
{
"id": "c7ea032b-eb16-4ccb-94a6-88af66db5d22",
"metadata": {
"file_id": "e2a26cf8-6618-4738-98b0-80520fa19b2c",
"filename": "The Pragmatic Programmer.pdf",
"filetype": "text/plain",
"start_index": 0,
"end_index": 0,
"_distance": 0.7463585138320923,
"score": 0.2536414861679077,
"relevance_score": 0.40771484375,
"rerank_logit": -3.736328125
},
"page_content": "Filename: The Pragmatic Programmer.pdf\n\n\n...",
"type": "Document"
}
]

Field Explanation

FieldDetail
[]搜尋到的資料列表
[].id資料的唯一鍵,uuid
[].metadata資料的描述內容
[].metadata.file_id檔案的唯一鍵,uuid
[].metadata.filename檔案的名稱
[].metadata.filetype檔案的種類
[].metadata.start_index相關段落的起始位置
[].metadata.end_index相關段落的結束位置
[].metadata._distance(與 OpenAI 相容而保留)
[].metadata.score(與 OpenAI 相容而保留)
[].metadata.relevance_score(與 OpenAI 相容而保留)
[].metadata.rerank_logit(與 OpenAI 相容而保留)
[].page_content相關段落的內容
[].type(與 OpenAI 相容而保留)