ナレッジ検索 API ガイド

リクエストエンドポイント

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

利用可能なモデルリストのリクエスト

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

リクエストヘッダー

ヘッダー説明
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
  • レスポンスヘッダー: Content-Type: text/plain; charset=UTF-8 などの標準 HTTP ヘッダーを含みます。
  • レスポンスボディ: data: で始まるテキストストリーム。各 data: ブロックには、次の tag 値を持つ JSON オブジェクトが含まれます。
    • searching: 検索中であることを示し、content フィールドには進捗状況の更新が含まれます。
    • seeds: 中間検索結果。content は JSON 配列で、各要素は idtokenscontentordersource_idsource_titlenip を含む個別の知識の断片です。
    • final: 最終結果を示し、content には完全なレスポンステキストが含まれます。

streamfalse の場合

  • レスポンスステータスコード: 200 OK
  • レスポンスヘッダー: Content-Type: application/json などの標準 HTTP ヘッダーを含みます。
  • レスポンスボディ: 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> を実際の値に置き換えることを忘れないでください。

レート制限

  • リクエスト: 1 分あたり 12 リクエスト(RPM)
  • 注意: この制限を超えると、HTTP 429(Too Many Requests)エラーが返されます。

課金

  • クォータ使用量: 対応する Flowith アカウントの Credits クォータに基づいて課金されます。
  • 請求サイクル: 使用量はリアルタイムで計算され、アカウント残高から差し引かれます。