メインコンテンツへスキップ
POST
/
agents
/
conversations
/
chat
GenAI Conversationチャット
curl --request POST \
  --url https://api.example.com/agents/conversations/chat \
  --header 'Authorization: Basic <encoded-value>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "conversation_id": "<string>",
  "project_id": "<string>",
  "include_feedback": false,
  "limit": 50,
  "offset": 0
}
'
import requests

url = "https://api.example.com/agents/conversations/chat"

payload = {
"conversation_id": "<string>",
"project_id": "<string>",
"include_feedback": False,
"limit": 50,
"offset": 0
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
conversation_id: '<string>',
project_id: '<string>',
include_feedback: false,
limit: 50,
offset: 0
})
};

fetch('https://api.example.com/agents/conversations/chat', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/agents/conversations/chat",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'conversation_id' => '<string>',
'project_id' => '<string>',
'include_feedback' => false,
'limit' => 50,
'offset' => 0
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.example.com/agents/conversations/chat"

payload := strings.NewReader("{\n \"conversation_id\": \"<string>\",\n \"project_id\": \"<string>\",\n \"include_feedback\": false,\n \"limit\": 50,\n \"offset\": 0\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.example.com/agents/conversations/chat")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"conversation_id\": \"<string>\",\n \"project_id\": \"<string>\",\n \"include_feedback\": false,\n \"limit\": 50,\n \"offset\": 0\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.example.com/agents/conversations/chat")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"conversation_id\": \"<string>\",\n \"project_id\": \"<string>\",\n \"include_feedback\": false,\n \"limit\": 50,\n \"offset\": 0\n}"

response = http.request(request)
puts response.read_body
{
  "conversation_id": "<string>",
  "feedback": [
    {}
  ],
  "has_more": false,
  "limit": 50,
  "offset": 0,
  "total_turns": 0,
  "turns": [
    {
      "trace_id": "<string>",
      "feedback": [
        {}
      ],
      "messages": [
        {
          "agent_handoff": {},
          "agent_name": "<string>",
          "agent_start": {
            "model": "<string>",
            "system_instructions": "<string>",
            "tool_definitions": "<string>"
          },
          "assistant_message": {
            "text": "<string>",
            "content_refs": [
              "<string>"
            ],
            "duration_ms": 123,
            "input_tokens": 123,
            "model": "<string>",
            "output_tokens": 123,
            "reasoning_content": "<string>",
            "reasoning_tokens": 123
          },
          "context_compacted": {
            "compaction_items_after": 123,
            "compaction_items_before": 123,
            "compaction_summary": "<string>"
          },
          "feedback": [
            {}
          ],
          "span_id": "<string>",
          "started_at": "2023-11-07T05:31:56Z",
          "tool_call": {
            "content_refs": [
              "<string>"
            ],
            "duration_ms": 123,
            "tool_arguments": "<string>",
            "tool_name": "<string>",
            "tool_result": "<string>"
          },
          "user_message": {
            "text": "<string>",
            "content_refs": [
              "<string>"
            ]
          }
        }
      ],
      "provider": "<string>",
      "root_span_name": "<string>",
      "total_duration_ms": 123
    }
  ]
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}

承認

Authorization
string
header
必須

Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.

ボディ

application/json

会話の multi-turn チャット ビューを取得するためのリクエスト。

conversation_id
string
必須
project_id
string
必須
include_feedback
boolean
デフォルト:false
limit
integer
デフォルト:50

返す会話ターンの最大数。

必須範囲: 0 <= x <= 50
offset
integer
デフォルト:0

スキップする直近のターン数。結果は、選択したページ内で時系列順に返されます。

必須範囲: x >= 0

レスポンス

成功レスポンス

Multi-turn チャット ビュー: ターンごとのチャット応答を順序どおりに並べた一覧です。

turns 内の各エントリは 1 つの trace_id に対応し、Weave はそれを 1 つの会話ターンとして扱います。これは必ずしも 1 つの invoke_agent スパンであるとは限りません。1 つのターンには、エージェント呼び出しが 0 個、1 個、または複数含まれる場合があります。フロントエンドでは、エントリ間にターン番号の区切りを表示しつつ、各ターンの描画に AgentTraceChatRes レンダリングをそのまま再利用できます。

conversation_id
string
必須
feedback
Feedback · object[] | null
has_more
boolean
デフォルト:false
limit
integer
デフォルト:50
offset
integer
デフォルト:0
total_turns
integer
デフォルト:0
turns
AgentTraceChatRes · object[]