メインコンテンツへスキップ
POST
/
chat-messages
Error
A valid request URL is required to generate request examples
{
  "event": "message",
  "task_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "message_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "conversation_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "mode": "chat",
  "answer": "<string>",
  "metadata": {
    "usage": {
      "prompt_tokens": 123,
      "prompt_unit_price": "<string>",
      "prompt_price_unit": "<string>",
      "prompt_price": "<string>",
      "completion_tokens": 123,
      "completion_unit_price": "<string>",
      "completion_price_unit": "<string>",
      "completion_price": "<string>",
      "total_tokens": 123,
      "total_price": "<string>",
      "currency": "<string>",
      "latency": 123
    },
    "retriever_resources": [
      {
        "position": 123,
        "dataset_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "dataset_name": "<string>",
        "document_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "document_name": "<string>",
        "segment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "score": 123,
        "content": "<string>"
      }
    ]
  },
  "created_at": 123
}

承認

Authorization
string
header
必須

API キー認証。

ボディ

application/json

高度なチャットメッセージを送信するためのリクエストボディ。

query
string
必須

ユーザー入力/質問内容。

user
string
必須

ユーザー識別子。注意: Service API は WebApp で作成された会話を共有しません。API を通じて作成された会話は、WebApp インターフェースで作成された会話とは分離されています。

inputs
object

アプリ変数のキー/値ペア。ファイルタイプの変数の場合、値は InputFileObject である必要があります。

response_mode
enum<string>
デフォルト:streaming

レスポンスモード。Cloudflare のタイムアウトはブロッキングで100秒です。

利用可能なオプション:
streaming,
blocking
conversation_id
string

続行する会話 ID。

files
object[]

Vision 対応モデルまたは一般的なファイル入力用のファイルリスト。

:
{
"type": "image",
"transfer_method": "remote_url",
"url": "https://example.com/image.png"
}
auto_generate_name
boolean
デフォルト:true

会話タイトルを自動生成。

レスポンス

成功レスポンス。コンテンツタイプと構造は response_mode によって異なります。

  • blocking: ChatCompletionResponse を含む application/json
  • streaming: ChunkAdvancedChatEvent ストリームを含む text/event-stream

ブロッキングモードチャットのレスポンス。

event
string
:

"message"

task_id
string<uuid>
id
string<uuid>

このレスポンスイベントの一意の ID。

message_id
string<uuid>
conversation_id
string<uuid>
mode
string
:

"chat"

answer
string
metadata
object
created_at
integer<int64>