跳轉到主要內容
GET
/
v1
/
projects
/
{projectId}
/
knowledgebases
/
{knowledgebaseId}
/
query
查詢區塊
curl --request GET \
  --url https://api.pathors.com/v1/projects/{projectId}/knowledgebases/{knowledgebaseId}/query \
  --header 'Authorization: <authorization>'
{
  "id": "<string>",
  "content": "<string>",
  "contentLength": 123,
  "isEnabled": true
}

請求

GET https://api.pathors.com/v1/projects/{projectId}/knowledgebases/{knowledgebaseId}/query

路徑參數

projectId
string
必填
專案 ID
knowledgebaseId
string
必填
要查詢的知識庫 ID

標頭

Authorization
string
必填
使用您的 Developer Key 進行 Bearer 令牌認證

查詢參數

q
string
必填
搜尋查詢字串
topK
number
回傳結果的最大數量。預設為 5
scoreThreshold
number
區塊納入結果所需的最低相關性分數(0–1)。預設為 0.3

回應

回傳依相關性排序的區塊陣列。
id
string
區塊的唯一識別符
content
string
區塊的文字內容
contentLength
number
區塊內容的字元長度
isEnabled
boolean
該區塊是否參與搜尋

範例

curl "https://api.pathors.com/v1/projects/{projectId}/knowledgebases/kb_abc123/query?q=search_term&topK=5&scoreThreshold=0.3" \
  -H "Authorization: Bearer dk_your_key"
[
  {
    "id": "chunk_abc123",
    "content": "The product features include real-time analytics...",
    "contentLength": 82,
    "isEnabled": true
  }
]