curl --location --request POST 'https://app.gpt-trainer.com/api/v1/session/{uuid}/message/stream' \
--header 'Content-Type: application/json' \
--data-raw '{"query": "Your query goes here"}'
import requests
uuid = '<session-uuid>'
url = f"https://app.gpt-trainer.com/api/v1/session/{uuid}/message/stream"
headers = {
"Content-Type": "application/json"
}
data = {
"query": "Your query goes here"
}
response = requests.post(url, headers=headers, json=data, stream=True)
if response.status_code == 200:
for line in response.iter_lines(decode_unicode=True):
# Process streaming response here
print(line + '\n')
else:
print("Error:", response.status_code)
const xhr = new XMLHttpRequest();
const uuid = "<session-uuid>";
xhr.open(
"POST",
`https://app.gpt-trainer.com/api/v1/session/${uuid}/message/stream`,
true
);
xhr.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
const data = JSON.stringify({ query: "Your query goes here" });
xhr.send(data);
xhr.onprogress = () => {
const streamingResponse = xhr.responseText;
console.log(streamingResponse);
};
xhr.onreadystatechange = () => {
if (xhr.readyState === 4) {
if (xhr.status === 200) {
console.log("Streaming completed successfully");
} else {
console.error("Error:", xhr.status);
}
}
};
"Chat streaming response"
Session Messages
Create Message
Create a session message for a chatbot session specified by session uuid
POST
/
api
/
v1
/
session
/
{uuid}
/
message
/
stream
curl --location --request POST 'https://app.gpt-trainer.com/api/v1/session/{uuid}/message/stream' \
--header 'Content-Type: application/json' \
--data-raw '{"query": "Your query goes here"}'
import requests
uuid = '<session-uuid>'
url = f"https://app.gpt-trainer.com/api/v1/session/{uuid}/message/stream"
headers = {
"Content-Type": "application/json"
}
data = {
"query": "Your query goes here"
}
response = requests.post(url, headers=headers, json=data, stream=True)
if response.status_code == 200:
for line in response.iter_lines(decode_unicode=True):
# Process streaming response here
print(line + '\n')
else:
print("Error:", response.status_code)
const xhr = new XMLHttpRequest();
const uuid = "<session-uuid>";
xhr.open(
"POST",
`https://app.gpt-trainer.com/api/v1/session/${uuid}/message/stream`,
true
);
xhr.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
const data = JSON.stringify({ query: "Your query goes here" });
xhr.send(data);
xhr.onprogress = () => {
const streamingResponse = xhr.responseText;
console.log(streamingResponse);
};
xhr.onreadystatechange = () => {
if (xhr.readyState === 4) {
if (xhr.status === 200) {
console.log("Streaming completed successfully");
} else {
console.error("Error:", xhr.status);
}
}
};
"Chat streaming response"
This API utilizes streaming technique to transmit data, and as a result, it
returns the data in the form of a string continuously over the connection.
Once the connection is over, you can refetch the list of messages to view the
actual data.
Path
Session uuid
Body
Response
curl --location --request POST 'https://app.gpt-trainer.com/api/v1/session/{uuid}/message/stream' \
--header 'Content-Type: application/json' \
--data-raw '{"query": "Your query goes here"}'
import requests
uuid = '<session-uuid>'
url = f"https://app.gpt-trainer.com/api/v1/session/{uuid}/message/stream"
headers = {
"Content-Type": "application/json"
}
data = {
"query": "Your query goes here"
}
response = requests.post(url, headers=headers, json=data, stream=True)
if response.status_code == 200:
for line in response.iter_lines(decode_unicode=True):
# Process streaming response here
print(line + '\n')
else:
print("Error:", response.status_code)
const xhr = new XMLHttpRequest();
const uuid = "<session-uuid>";
xhr.open(
"POST",
`https://app.gpt-trainer.com/api/v1/session/${uuid}/message/stream`,
true
);
xhr.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
const data = JSON.stringify({ query: "Your query goes here" });
xhr.send(data);
xhr.onprogress = () => {
const streamingResponse = xhr.responseText;
console.log(streamingResponse);
};
xhr.onreadystatechange = () => {
if (xhr.readyState === 4) {
if (xhr.status === 200) {
console.log("Streaming completed successfully");
} else {
console.error("Error:", xhr.status);
}
}
};
"Chat streaming response"
⌘I