知識檢索 API 指南

請求端點

POST /external/use/seek-knowledge/seek HTTP/1.1

取得可用模型清單

GET /external/use/seek-knowledge/models HTTP/1.1

請求標頭

HeaderValue說明
AuthorizationBearer <your_token>用於驗證使用者身分的認證權杖。請將 <your_token> 替換為你的實際權杖。
Content-Typeapplication/json表示請求主體為 JSON 格式。
Hostedge.flowith.netAPI 伺服器位址。
User-AgentHTTPie(選填)用戶端標識。

請求主體(JSON)

參數類型說明
messagesArray對話訊息清單。每條訊息物件包含 rolecontent 欄位。
modelString模型名稱。範例:"gpt-4o-mini"
streamBoolean是否啟用串流回應?true 為啟用,false 為停用。
kb_listString Array知識庫 ID 清單。指定知識檢索的範圍。

messages 欄位說明

  • role:訊息角色,可選值為 "assistant""user"
  • content:訊息內容,例如複雜的查詢或指令。

回應

streamtrue 時(串流回應)

  • 回應狀態碼:200 OK
  • 回應標頭:包含標準 HTTP 標頭資訊,如 Content-Type: text/plain; charset=UTF-8 等。
  • 回應主體:以 data: 開頭的文字串流。每個 data: 區塊包含一個 JSON 物件,其中 tag 欄位有以下可能的值:
    • searching:表示搜尋進行中,content 欄位包含進度更新資訊。
    • seeds:中間搜尋結果,content 為 JSON 陣列,每個元素代表一條獨立的知識片段,包含 idtokenscontentordersource_idsource_titlenip 欄位。
    • final:表示最終結果,content 包含完整的回應文字。

streamfalse

  • 回應狀態碼:200 OK
  • 回應標頭:包含標準 HTTP 標頭資訊,如 Content-Type: application/json 等。
  • 回應主體:一個包含 tagcontent 欄位的 JSON 物件。
    • tag:固定為 "final"
    • content:完整的回應文字。

curl 範例

串流回應(stream = true)

curl -X POST "https://edge.flowith.net/external/use/knowledge-base/seek" \
  -H "Authorization: Bearer <your_token>" \
  -H "Content-Type: application/json" \
  -H "Host: edge.flowith.net" \
  -d '{
    "messages": [
      {"role": "assistant", "content": "I'd like to explore effective social dynamics and interpersonal relationships"},
      {"role": "user", "content": "Share your best strategies for authentic connection and building rapport in professional settings"}
    ],
    "model": "gpt-4.1-mini",
    "stream": true,
    "kb_list": ["<knowledge_base_id>"]
  }'

非串流回應(stream = false)

curl -X POST "https://edge.flowith.net/external/use/knowledge-base/seek" \
  -H "Authorization: Bearer <your_token>" \
  -H "Content-Type: application/json" \
  -H "Host: edge.flowith.net" \
  -d '{
    "messages": [
      {"role": "assistant", "content": "I'd like to explore effective social dynamics and interpersonal relationships"},
      {"role": "user", "content": "Share your best strategies for authentic connection and building rapport in professional settings"}
    ],
    "model": "gpt-4.1-mini",
    "stream": false,
    "kb_list": ["<knowledge_base_id>"]
  }'

請將 <your_token><knowledge_base_id> 替換為你的實際值。

速率限制

  • 請求頻率:每分鐘 12 次請求(RPM)
  • 注意:超過此限制將傳回 HTTP 429(Too Many Requests)錯誤

計費說明

  • 額度消耗:費用根據對應 Flowith 帳戶的 Credits 額度進行計算
  • 計費週期:用量將即時計算並從帳戶餘額中扣除