Python
import os
from scale_gp import SGPClient
client = SGPClient(
api_key=os.environ.get("SGP_API_KEY"), # This is the default and can be omitted
)
chat_thread_history = client.chat_threads.messages.retrieve(
thread_id="thread_id",
)
print(chat_thread_history.application_spec_id)package main
import (
"context"
"fmt"
"github.com/stainless-sdks/sgp-go"
"github.com/stainless-sdks/sgp-go/option"
)
func main() {
client := sgp.NewClient(
option.WithAPIKey("My API Key"),
)
chatThreadHistory, err := client.ChatThreads.Messages.Get(
context.TODO(),
"thread_id",
sgp.ChatThreadMessageGetParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", chatThreadHistory.ApplicationSpecID)
}curl --request GET \
--url https://api.egp.scale.com/v4/threads/{thread_id}/messagesconst options = {method: 'GET'};
fetch('https://api.egp.scale.com/v4/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_URL => "https://api.egp.scale.com/v4/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 => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.get("https://api.egp.scale.com/v4/threads/{thread_id}/messages")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.egp.scale.com/v4/threads/{thread_id}/messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"thread": {
"id": "<string>",
"title": "<string>",
"application_variant_id": "<string>",
"account_id": "<string>",
"created_by_user_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"thread_metadata": {},
"archived_at": "2023-11-07T05:31:56Z"
},
"messages": [
{
"entry": {
"id": "<string>",
"input": {},
"output": {},
"aggregated": true,
"application_spec_id": "<string>",
"application_variant_id": "<string>",
"start_timestamp": "2023-11-07T05:31:56Z",
"duration_ms": 123,
"created_at": "2023-11-07T05:31:56Z",
"operation_metadata": {},
"models": [
"<string>"
],
"chat_thread_id": "<string>"
},
"spans": [
{
"id": "<string>",
"node_id": "<string>",
"start_timestamp": "2023-11-07T05:31:56Z",
"duration_ms": 123,
"application_interaction_id": "<string>",
"application_variant_id": "<string>",
"operation_input": {},
"operation_output": {},
"operation_expected": {},
"operation_metadata": {},
"end_timestamp": "2023-11-07T05:31:56Z",
"trace_id": "<string>",
"parent_id": "<string>",
"group_id": "<string>",
"account_id": "<string>",
"created_by_user_id": "<string>"
}
],
"feedback": {
"id": "<string>",
"chat_thread_id": "<string>",
"application_interaction_id": "<string>",
"description": "<string>",
"created_at": "2023-11-07T05:31:56Z"
}
}
],
"application_spec_id": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}ChatThreads
Get Thread Messages
GET
/
v4
/
threads
/
{thread_id}
/
messages
Python
import os
from scale_gp import SGPClient
client = SGPClient(
api_key=os.environ.get("SGP_API_KEY"), # This is the default and can be omitted
)
chat_thread_history = client.chat_threads.messages.retrieve(
thread_id="thread_id",
)
print(chat_thread_history.application_spec_id)package main
import (
"context"
"fmt"
"github.com/stainless-sdks/sgp-go"
"github.com/stainless-sdks/sgp-go/option"
)
func main() {
client := sgp.NewClient(
option.WithAPIKey("My API Key"),
)
chatThreadHistory, err := client.ChatThreads.Messages.Get(
context.TODO(),
"thread_id",
sgp.ChatThreadMessageGetParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", chatThreadHistory.ApplicationSpecID)
}curl --request GET \
--url https://api.egp.scale.com/v4/threads/{thread_id}/messagesconst options = {method: 'GET'};
fetch('https://api.egp.scale.com/v4/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_URL => "https://api.egp.scale.com/v4/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 => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.get("https://api.egp.scale.com/v4/threads/{thread_id}/messages")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.egp.scale.com/v4/threads/{thread_id}/messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"thread": {
"id": "<string>",
"title": "<string>",
"application_variant_id": "<string>",
"account_id": "<string>",
"created_by_user_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"thread_metadata": {},
"archived_at": "2023-11-07T05:31:56Z"
},
"messages": [
{
"entry": {
"id": "<string>",
"input": {},
"output": {},
"aggregated": true,
"application_spec_id": "<string>",
"application_variant_id": "<string>",
"start_timestamp": "2023-11-07T05:31:56Z",
"duration_ms": 123,
"created_at": "2023-11-07T05:31:56Z",
"operation_metadata": {},
"models": [
"<string>"
],
"chat_thread_id": "<string>"
},
"spans": [
{
"id": "<string>",
"node_id": "<string>",
"start_timestamp": "2023-11-07T05:31:56Z",
"duration_ms": 123,
"application_interaction_id": "<string>",
"application_variant_id": "<string>",
"operation_input": {},
"operation_output": {},
"operation_expected": {},
"operation_metadata": {},
"end_timestamp": "2023-11-07T05:31:56Z",
"trace_id": "<string>",
"parent_id": "<string>",
"group_id": "<string>",
"account_id": "<string>",
"created_by_user_id": "<string>"
}
],
"feedback": {
"id": "<string>",
"chat_thread_id": "<string>",
"application_interaction_id": "<string>",
"description": "<string>",
"created_at": "2023-11-07T05:31:56Z"
}
}
],
"application_spec_id": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Path Parameters
Query Parameters
Fetch the thread by account instead of user
Fetch spans for each message
⌘I

