Thread Messages
Create Thread Message Handler
Create a new message in a thread.
POST
/
v1
/
threads
/
{thread_id}
/
messages
Create Thread Message Handler
curl --request POST \
--url http://localhost:8000/v1/threads/{thread_id}/messages \
--header 'Content-Type: application/json' \
--data '
{
"content": {
"text": "<string>",
"is_error": true,
"citations": [
{
"chunk_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"quote": "<string>",
"start_char": 1,
"length": 123
}
],
"references": [
{
"entity_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"display_name": "<string>",
"materialized_path": "<string>"
}
]
},
"message_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"details": {
"steps": [
{
"id": "<string>",
"name": "<string>",
"start_time": "2023-11-07T05:31:56Z",
"args": "<string>",
"detail": "<string>",
"end_time": "2023-11-07T05:31:56Z",
"steps": "<array>"
}
]
}
}
'import requests
url = "http://localhost:8000/v1/threads/{thread_id}/messages"
payload = {
"content": {
"text": "<string>",
"is_error": True,
"citations": [
{
"chunk_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"quote": "<string>",
"start_char": 1,
"length": 123
}
],
"references": [
{
"entity_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"display_name": "<string>",
"materialized_path": "<string>"
}
]
},
"message_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"details": { "steps": [
{
"id": "<string>",
"name": "<string>",
"start_time": "2023-11-07T05:31:56Z",
"args": "<string>",
"detail": "<string>",
"end_time": "2023-11-07T05:31:56Z",
"steps": "<array>"
}
] }
}
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({
content: {
text: '<string>',
is_error: true,
citations: [
{
chunk_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
quote: '<string>',
start_char: 1,
length: 123
}
],
references: [
{
entity_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
display_name: '<string>',
materialized_path: '<string>'
}
]
},
message_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
details: {
steps: [
{
id: '<string>',
name: '<string>',
start_time: '2023-11-07T05:31:56Z',
args: '<string>',
detail: '<string>',
end_time: '2023-11-07T05:31:56Z',
steps: '<array>'
}
]
}
})
};
fetch('http://localhost:8000/v1/threads/{thread_id}/messages', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "8000",
CURLOPT_URL => "http://localhost:8000/v1/threads/{thread_id}/messages",
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([
'content' => [
'text' => '<string>',
'is_error' => true,
'citations' => [
[
'chunk_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'quote' => '<string>',
'start_char' => 1,
'length' => 123
]
],
'references' => [
[
'entity_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'display_name' => '<string>',
'materialized_path' => '<string>'
]
]
],
'message_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'details' => [
'steps' => [
[
'id' => '<string>',
'name' => '<string>',
'start_time' => '2023-11-07T05:31:56Z',
'args' => '<string>',
'detail' => '<string>',
'end_time' => '2023-11-07T05:31:56Z',
'steps' => '<array>'
]
]
]
]),
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 := "http://localhost:8000/v1/threads/{thread_id}/messages"
payload := strings.NewReader("{\n \"content\": {\n \"text\": \"<string>\",\n \"is_error\": true,\n \"citations\": [\n {\n \"chunk_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"quote\": \"<string>\",\n \"start_char\": 1,\n \"length\": 123\n }\n ],\n \"references\": [\n {\n \"entity_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"display_name\": \"<string>\",\n \"materialized_path\": \"<string>\"\n }\n ]\n },\n \"message_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"details\": {\n \"steps\": [\n {\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"start_time\": \"2023-11-07T05:31:56Z\",\n \"args\": \"<string>\",\n \"detail\": \"<string>\",\n \"end_time\": \"2023-11-07T05:31:56Z\",\n \"steps\": \"<array>\"\n }\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("http://localhost:8000/v1/threads/{thread_id}/messages")
.header("Content-Type", "application/json")
.body("{\n \"content\": {\n \"text\": \"<string>\",\n \"is_error\": true,\n \"citations\": [\n {\n \"chunk_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"quote\": \"<string>\",\n \"start_char\": 1,\n \"length\": 123\n }\n ],\n \"references\": [\n {\n \"entity_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"display_name\": \"<string>\",\n \"materialized_path\": \"<string>\"\n }\n ]\n },\n \"message_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"details\": {\n \"steps\": [\n {\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"start_time\": \"2023-11-07T05:31:56Z\",\n \"args\": \"<string>\",\n \"detail\": \"<string>\",\n \"end_time\": \"2023-11-07T05:31:56Z\",\n \"steps\": \"<array>\"\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:8000/v1/threads/{thread_id}/messages")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"content\": {\n \"text\": \"<string>\",\n \"is_error\": true,\n \"citations\": [\n {\n \"chunk_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"quote\": \"<string>\",\n \"start_char\": 1,\n \"length\": 123\n }\n ],\n \"references\": [\n {\n \"entity_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"display_name\": \"<string>\",\n \"materialized_path\": \"<string>\"\n }\n ]\n },\n \"message_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"details\": {\n \"steps\": [\n {\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"start_time\": \"2023-11-07T05:31:56Z\",\n \"args\": \"<string>\",\n \"detail\": \"<string>\",\n \"end_time\": \"2023-11-07T05:31:56Z\",\n \"steps\": \"<array>\"\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"path_part_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"sequence": 123,
"content": {
"text": "<string>",
"is_error": true,
"citations": [
{
"chunk_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"quote": "<string>",
"start_char": 1,
"length": 123,
"document_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"document_version_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"document_name": "<string>",
"version_number": 123,
"path_part_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"materialized_path": "<string>"
}
],
"references": [
{
"ref_type": "<string>",
"entity_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"display_name": "<string>",
"materialized_path": "<string>"
}
]
},
"parent_path_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"materialized_path": "<string>",
"tenant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"details": {
"steps": [
{
"id": "<string>",
"name": "<string>",
"start_time": "2023-11-07T05:31:56Z",
"args": "<string>",
"detail": "<string>",
"end_time": "2023-11-07T05:31:56Z",
"steps": "<array>"
}
]
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Headers
Path Parameters
Cookies
Body
application/json
Request to create a new thread message.
Role of the message author (USER, ASSISTANT, SYSTEM)
Available options:
USER, ASSISTANT, SYSTEM Message content (text + citations)
Show child attributes
Show child attributes
Optional caller-supplied ThreadMessage ID for idempotent creates.
Message details (execution steps). Omit for user messages.
Show child attributes
Show child attributes
Response
Successful Response
Thread message response model.
ThreadMessage ID
PathPart ID
Sequence number (from path_part.name)
Message role
Available options:
USER, ASSISTANT, SYSTEM Message content
Show child attributes
Show child attributes
Thread's PathPart ID
Full materialized path from root
Tenant ID
Creation timestamp
Last update timestamp
Message details (None when not requested via with_details)
Show child attributes
Show child attributes
⌘I
Create Thread Message Handler
curl --request POST \
--url http://localhost:8000/v1/threads/{thread_id}/messages \
--header 'Content-Type: application/json' \
--data '
{
"content": {
"text": "<string>",
"is_error": true,
"citations": [
{
"chunk_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"quote": "<string>",
"start_char": 1,
"length": 123
}
],
"references": [
{
"entity_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"display_name": "<string>",
"materialized_path": "<string>"
}
]
},
"message_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"details": {
"steps": [
{
"id": "<string>",
"name": "<string>",
"start_time": "2023-11-07T05:31:56Z",
"args": "<string>",
"detail": "<string>",
"end_time": "2023-11-07T05:31:56Z",
"steps": "<array>"
}
]
}
}
'import requests
url = "http://localhost:8000/v1/threads/{thread_id}/messages"
payload = {
"content": {
"text": "<string>",
"is_error": True,
"citations": [
{
"chunk_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"quote": "<string>",
"start_char": 1,
"length": 123
}
],
"references": [
{
"entity_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"display_name": "<string>",
"materialized_path": "<string>"
}
]
},
"message_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"details": { "steps": [
{
"id": "<string>",
"name": "<string>",
"start_time": "2023-11-07T05:31:56Z",
"args": "<string>",
"detail": "<string>",
"end_time": "2023-11-07T05:31:56Z",
"steps": "<array>"
}
] }
}
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({
content: {
text: '<string>',
is_error: true,
citations: [
{
chunk_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
quote: '<string>',
start_char: 1,
length: 123
}
],
references: [
{
entity_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
display_name: '<string>',
materialized_path: '<string>'
}
]
},
message_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
details: {
steps: [
{
id: '<string>',
name: '<string>',
start_time: '2023-11-07T05:31:56Z',
args: '<string>',
detail: '<string>',
end_time: '2023-11-07T05:31:56Z',
steps: '<array>'
}
]
}
})
};
fetch('http://localhost:8000/v1/threads/{thread_id}/messages', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "8000",
CURLOPT_URL => "http://localhost:8000/v1/threads/{thread_id}/messages",
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([
'content' => [
'text' => '<string>',
'is_error' => true,
'citations' => [
[
'chunk_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'quote' => '<string>',
'start_char' => 1,
'length' => 123
]
],
'references' => [
[
'entity_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'display_name' => '<string>',
'materialized_path' => '<string>'
]
]
],
'message_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'details' => [
'steps' => [
[
'id' => '<string>',
'name' => '<string>',
'start_time' => '2023-11-07T05:31:56Z',
'args' => '<string>',
'detail' => '<string>',
'end_time' => '2023-11-07T05:31:56Z',
'steps' => '<array>'
]
]
]
]),
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 := "http://localhost:8000/v1/threads/{thread_id}/messages"
payload := strings.NewReader("{\n \"content\": {\n \"text\": \"<string>\",\n \"is_error\": true,\n \"citations\": [\n {\n \"chunk_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"quote\": \"<string>\",\n \"start_char\": 1,\n \"length\": 123\n }\n ],\n \"references\": [\n {\n \"entity_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"display_name\": \"<string>\",\n \"materialized_path\": \"<string>\"\n }\n ]\n },\n \"message_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"details\": {\n \"steps\": [\n {\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"start_time\": \"2023-11-07T05:31:56Z\",\n \"args\": \"<string>\",\n \"detail\": \"<string>\",\n \"end_time\": \"2023-11-07T05:31:56Z\",\n \"steps\": \"<array>\"\n }\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("http://localhost:8000/v1/threads/{thread_id}/messages")
.header("Content-Type", "application/json")
.body("{\n \"content\": {\n \"text\": \"<string>\",\n \"is_error\": true,\n \"citations\": [\n {\n \"chunk_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"quote\": \"<string>\",\n \"start_char\": 1,\n \"length\": 123\n }\n ],\n \"references\": [\n {\n \"entity_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"display_name\": \"<string>\",\n \"materialized_path\": \"<string>\"\n }\n ]\n },\n \"message_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"details\": {\n \"steps\": [\n {\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"start_time\": \"2023-11-07T05:31:56Z\",\n \"args\": \"<string>\",\n \"detail\": \"<string>\",\n \"end_time\": \"2023-11-07T05:31:56Z\",\n \"steps\": \"<array>\"\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:8000/v1/threads/{thread_id}/messages")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"content\": {\n \"text\": \"<string>\",\n \"is_error\": true,\n \"citations\": [\n {\n \"chunk_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"quote\": \"<string>\",\n \"start_char\": 1,\n \"length\": 123\n }\n ],\n \"references\": [\n {\n \"entity_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"display_name\": \"<string>\",\n \"materialized_path\": \"<string>\"\n }\n ]\n },\n \"message_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"details\": {\n \"steps\": [\n {\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"start_time\": \"2023-11-07T05:31:56Z\",\n \"args\": \"<string>\",\n \"detail\": \"<string>\",\n \"end_time\": \"2023-11-07T05:31:56Z\",\n \"steps\": \"<array>\"\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"path_part_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"sequence": 123,
"content": {
"text": "<string>",
"is_error": true,
"citations": [
{
"chunk_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"quote": "<string>",
"start_char": 1,
"length": 123,
"document_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"document_version_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"document_name": "<string>",
"version_number": 123,
"path_part_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"materialized_path": "<string>"
}
],
"references": [
{
"ref_type": "<string>",
"entity_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"display_name": "<string>",
"materialized_path": "<string>"
}
]
},
"parent_path_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"materialized_path": "<string>",
"tenant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"details": {
"steps": [
{
"id": "<string>",
"name": "<string>",
"start_time": "2023-11-07T05:31:56Z",
"args": "<string>",
"detail": "<string>",
"end_time": "2023-11-07T05:31:56Z",
"steps": "<array>"
}
]
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}