curl --request POST \
--url https://api.example.com/threads/stream_query \
--header 'Content-Type: application/json' \
--data '
{
"project_id": "my_entity/my_project",
"filter": {
"after_datetime": "2024-01-01T00:00:00Z",
"before_datetime": "2024-12-31T23:59:59Z",
"thread_ids": [
"thread_1",
"thread_2",
"my_thread_id"
]
},
"limit": 123,
"offset": 123,
"sort_by": [
{
"direction": "desc",
"field": "last_updated"
}
]
}
'import requests
url = "https://api.example.com/threads/stream_query"
payload = {
"project_id": "my_entity/my_project",
"filter": {
"after_datetime": "2024-01-01T00:00:00Z",
"before_datetime": "2024-12-31T23:59:59Z",
"thread_ids": ["thread_1", "thread_2", "my_thread_id"]
},
"limit": 123,
"offset": 123,
"sort_by": [
{
"direction": "desc",
"field": "last_updated"
}
]
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
project_id: 'my_entity/my_project',
filter: {
after_datetime: '2024-01-01T00:00:00Z',
before_datetime: '2024-12-31T23:59:59Z',
thread_ids: ['thread_1', 'thread_2', 'my_thread_id']
},
limit: 123,
offset: 123,
sort_by: [{direction: 'desc', field: 'last_updated'}]
})
};
fetch('https://api.example.com/threads/stream_query', 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/threads/stream_query",
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([
'project_id' => 'my_entity/my_project',
'filter' => [
'after_datetime' => '2024-01-01T00:00:00Z',
'before_datetime' => '2024-12-31T23:59:59Z',
'thread_ids' => [
'thread_1',
'thread_2',
'my_thread_id'
]
],
'limit' => 123,
'offset' => 123,
'sort_by' => [
[
'direction' => 'desc',
'field' => 'last_updated'
]
]
]),
CURLOPT_HTTPHEADER => [
"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/threads/stream_query"
payload := strings.NewReader("{\n \"project_id\": \"my_entity/my_project\",\n \"filter\": {\n \"after_datetime\": \"2024-01-01T00:00:00Z\",\n \"before_datetime\": \"2024-12-31T23:59:59Z\",\n \"thread_ids\": [\n \"thread_1\",\n \"thread_2\",\n \"my_thread_id\"\n ]\n },\n \"limit\": 123,\n \"offset\": 123,\n \"sort_by\": [\n {\n \"direction\": \"desc\",\n \"field\": \"last_updated\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
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/threads/stream_query")
.header("Content-Type", "application/json")
.body("{\n \"project_id\": \"my_entity/my_project\",\n \"filter\": {\n \"after_datetime\": \"2024-01-01T00:00:00Z\",\n \"before_datetime\": \"2024-12-31T23:59:59Z\",\n \"thread_ids\": [\n \"thread_1\",\n \"thread_2\",\n \"my_thread_id\"\n ]\n },\n \"limit\": 123,\n \"offset\": 123,\n \"sort_by\": [\n {\n \"direction\": \"desc\",\n \"field\": \"last_updated\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/threads/stream_query")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"project_id\": \"my_entity/my_project\",\n \"filter\": {\n \"after_datetime\": \"2024-01-01T00:00:00Z\",\n \"before_datetime\": \"2024-12-31T23:59:59Z\",\n \"thread_ids\": [\n \"thread_1\",\n \"thread_2\",\n \"my_thread_id\"\n ]\n },\n \"limit\": 123,\n \"offset\": 123,\n \"sort_by\": [\n {\n \"direction\": \"desc\",\n \"field\": \"last_updated\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"first_turn_id": "<string>",
"last_turn_id": "<string>",
"last_updated": "2023-11-07T05:31:56Z",
"p50_turn_duration_ms": 123,
"p99_turn_duration_ms": 123,
"start_time": "2023-11-07T05:31:56Z",
"thread_id": "<string>",
"turn_count": 123
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"ctx": {},
"input": "<unknown>"
}
]
}Flux de requête Threads
curl --request POST \
--url https://api.example.com/threads/stream_query \
--header 'Content-Type: application/json' \
--data '
{
"project_id": "my_entity/my_project",
"filter": {
"after_datetime": "2024-01-01T00:00:00Z",
"before_datetime": "2024-12-31T23:59:59Z",
"thread_ids": [
"thread_1",
"thread_2",
"my_thread_id"
]
},
"limit": 123,
"offset": 123,
"sort_by": [
{
"direction": "desc",
"field": "last_updated"
}
]
}
'import requests
url = "https://api.example.com/threads/stream_query"
payload = {
"project_id": "my_entity/my_project",
"filter": {
"after_datetime": "2024-01-01T00:00:00Z",
"before_datetime": "2024-12-31T23:59:59Z",
"thread_ids": ["thread_1", "thread_2", "my_thread_id"]
},
"limit": 123,
"offset": 123,
"sort_by": [
{
"direction": "desc",
"field": "last_updated"
}
]
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
project_id: 'my_entity/my_project',
filter: {
after_datetime: '2024-01-01T00:00:00Z',
before_datetime: '2024-12-31T23:59:59Z',
thread_ids: ['thread_1', 'thread_2', 'my_thread_id']
},
limit: 123,
offset: 123,
sort_by: [{direction: 'desc', field: 'last_updated'}]
})
};
fetch('https://api.example.com/threads/stream_query', 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/threads/stream_query",
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([
'project_id' => 'my_entity/my_project',
'filter' => [
'after_datetime' => '2024-01-01T00:00:00Z',
'before_datetime' => '2024-12-31T23:59:59Z',
'thread_ids' => [
'thread_1',
'thread_2',
'my_thread_id'
]
],
'limit' => 123,
'offset' => 123,
'sort_by' => [
[
'direction' => 'desc',
'field' => 'last_updated'
]
]
]),
CURLOPT_HTTPHEADER => [
"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/threads/stream_query"
payload := strings.NewReader("{\n \"project_id\": \"my_entity/my_project\",\n \"filter\": {\n \"after_datetime\": \"2024-01-01T00:00:00Z\",\n \"before_datetime\": \"2024-12-31T23:59:59Z\",\n \"thread_ids\": [\n \"thread_1\",\n \"thread_2\",\n \"my_thread_id\"\n ]\n },\n \"limit\": 123,\n \"offset\": 123,\n \"sort_by\": [\n {\n \"direction\": \"desc\",\n \"field\": \"last_updated\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
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/threads/stream_query")
.header("Content-Type", "application/json")
.body("{\n \"project_id\": \"my_entity/my_project\",\n \"filter\": {\n \"after_datetime\": \"2024-01-01T00:00:00Z\",\n \"before_datetime\": \"2024-12-31T23:59:59Z\",\n \"thread_ids\": [\n \"thread_1\",\n \"thread_2\",\n \"my_thread_id\"\n ]\n },\n \"limit\": 123,\n \"offset\": 123,\n \"sort_by\": [\n {\n \"direction\": \"desc\",\n \"field\": \"last_updated\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/threads/stream_query")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"project_id\": \"my_entity/my_project\",\n \"filter\": {\n \"after_datetime\": \"2024-01-01T00:00:00Z\",\n \"before_datetime\": \"2024-12-31T23:59:59Z\",\n \"thread_ids\": [\n \"thread_1\",\n \"thread_2\",\n \"my_thread_id\"\n ]\n },\n \"limit\": 123,\n \"offset\": 123,\n \"sort_by\": [\n {\n \"direction\": \"desc\",\n \"field\": \"last_updated\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"first_turn_id": "<string>",
"last_turn_id": "<string>",
"last_updated": "2023-11-07T05:31:56Z",
"p50_turn_duration_ms": 123,
"p99_turn_duration_ms": 123,
"start_time": "2023-11-07T05:31:56Z",
"thread_id": "<string>",
"turn_count": 123
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"ctx": {},
"input": "<unknown>"
}
]
}Corps
Interroger les threads avec des statistiques agrégées fondées uniquement sur les appels de tour.
Les appels de tour sont les enfants immédiats des contextes de thread (où call.id == turn_id). Cela fournit des statistiques pertinentes au niveau de la conversation, plutôt que d’inclure tous les détails d’implémentation imbriqués.
L’ID du projet
"my_entity/my_project"
Critères de filtrage pour la requête sur les threads
Show child attributes
Show child attributes
Nombre maximal de threads à renvoyer
Nombre de threads à ignorer
Critères de tri pour les threads. Champs pris en charge : 'thread_id', 'turn_count', 'start_time', 'last_updated', 'p50_turn_duration_ms', 'p99_turn_duration_ms'.
Show child attributes
Show child attributes
[
{
"direction": "desc",
"field": "last_updated"
}
]
Réponse
Flux de données au format JSONL
ID du premier tour de conversation dans ce thread (valeur start_time la plus ancienne)
ID du dernier tour de conversation dans ce thread (valeur end_time la plus récente)
Heure de fin la plus récente des appels de tours de conversation dans ce thread
50e percentile (médiane) des durées des tours de conversation en millisecondes dans ce thread
99e percentile des durées des tours de conversation en millisecondes dans ce thread
Heure de début la plus ancienne des appels de tours de conversation dans ce thread
Nombre d’appels de tours de conversation dans ce thread
Cette page vous a-t-elle été utile ?