Answer Web
curl --request POST \
--url https://api.example.com/v1/chat/ \
--header 'Content-Type: application/json' \
--data '
{
"role": "<string>",
"content": "<string>",
"user_context": {
"id": 123,
"email": "<string>",
"updated_at": "<string>",
"is_active": true,
"team_id": 123,
"created_at": "2023-11-07T05:31:56Z",
"connectors": [
{
"name": "<string>",
"id": [
123
]
}
],
"vector_store": {
"id": 123,
"index_name": "<string>",
"environment": "<string>",
"namespaces": [
"<string>"
],
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"provider": "<string>"
}
},
"timestamp": "<string>",
"chat_id": "<string>"
}
'import requests
url = "https://api.example.com/v1/chat/"
payload = {
"role": "<string>",
"content": "<string>",
"user_context": {
"id": 123,
"email": "<string>",
"updated_at": "<string>",
"is_active": True,
"team_id": 123,
"created_at": "2023-11-07T05:31:56Z",
"connectors": [
{
"name": "<string>",
"id": [123]
}
],
"vector_store": {
"id": 123,
"index_name": "<string>",
"environment": "<string>",
"namespaces": ["<string>"],
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"provider": "<string>"
}
},
"timestamp": "<string>",
"chat_id": "<string>"
}
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({
role: '<string>',
content: '<string>',
user_context: {
id: 123,
email: '<string>',
updated_at: '<string>',
is_active: true,
team_id: 123,
created_at: '2023-11-07T05:31:56Z',
connectors: [{name: '<string>', id: [123]}],
vector_store: {
id: 123,
index_name: '<string>',
environment: '<string>',
namespaces: ['<string>'],
created_at: '2023-11-07T05:31:56Z',
updated_at: '2023-11-07T05:31:56Z',
provider: '<string>'
}
},
timestamp: '<string>',
chat_id: '<string>'
})
};
fetch('https://api.example.com/v1/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/v1/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([
'role' => '<string>',
'content' => '<string>',
'user_context' => [
'id' => 123,
'email' => '<string>',
'updated_at' => '<string>',
'is_active' => true,
'team_id' => 123,
'created_at' => '2023-11-07T05:31:56Z',
'connectors' => [
[
'name' => '<string>',
'id' => [
123
]
]
],
'vector_store' => [
'id' => 123,
'index_name' => '<string>',
'environment' => '<string>',
'namespaces' => [
'<string>'
],
'created_at' => '2023-11-07T05:31:56Z',
'updated_at' => '2023-11-07T05:31:56Z',
'provider' => '<string>'
]
],
'timestamp' => '<string>',
'chat_id' => '<string>'
]),
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/v1/chat/"
payload := strings.NewReader("{\n \"role\": \"<string>\",\n \"content\": \"<string>\",\n \"user_context\": {\n \"id\": 123,\n \"email\": \"<string>\",\n \"updated_at\": \"<string>\",\n \"is_active\": true,\n \"team_id\": 123,\n \"created_at\": \"2023-11-07T05:31:56Z\",\n \"connectors\": [\n {\n \"name\": \"<string>\",\n \"id\": [\n 123\n ]\n }\n ],\n \"vector_store\": {\n \"id\": 123,\n \"index_name\": \"<string>\",\n \"environment\": \"<string>\",\n \"namespaces\": [\n \"<string>\"\n ],\n \"created_at\": \"2023-11-07T05:31:56Z\",\n \"updated_at\": \"2023-11-07T05:31:56Z\",\n \"provider\": \"<string>\"\n }\n },\n \"timestamp\": \"<string>\",\n \"chat_id\": \"<string>\"\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/v1/chat/")
.header("Content-Type", "application/json")
.body("{\n \"role\": \"<string>\",\n \"content\": \"<string>\",\n \"user_context\": {\n \"id\": 123,\n \"email\": \"<string>\",\n \"updated_at\": \"<string>\",\n \"is_active\": true,\n \"team_id\": 123,\n \"created_at\": \"2023-11-07T05:31:56Z\",\n \"connectors\": [\n {\n \"name\": \"<string>\",\n \"id\": [\n 123\n ]\n }\n ],\n \"vector_store\": {\n \"id\": 123,\n \"index_name\": \"<string>\",\n \"environment\": \"<string>\",\n \"namespaces\": [\n \"<string>\"\n ],\n \"created_at\": \"2023-11-07T05:31:56Z\",\n \"updated_at\": \"2023-11-07T05:31:56Z\",\n \"provider\": \"<string>\"\n }\n },\n \"timestamp\": \"<string>\",\n \"chat_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/chat/")
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 \"role\": \"<string>\",\n \"content\": \"<string>\",\n \"user_context\": {\n \"id\": 123,\n \"email\": \"<string>\",\n \"updated_at\": \"<string>\",\n \"is_active\": true,\n \"team_id\": 123,\n \"created_at\": \"2023-11-07T05:31:56Z\",\n \"connectors\": [\n {\n \"name\": \"<string>\",\n \"id\": [\n 123\n ]\n }\n ],\n \"vector_store\": {\n \"id\": 123,\n \"index_name\": \"<string>\",\n \"environment\": \"<string>\",\n \"namespaces\": [\n \"<string>\"\n ],\n \"created_at\": \"2023-11-07T05:31:56Z\",\n \"updated_at\": \"2023-11-07T05:31:56Z\",\n \"provider\": \"<string>\"\n }\n },\n \"timestamp\": \"<string>\",\n \"chat_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}question_and_answering
Answer Web
Answer a user question or prompt and stream the response
POST
/
v1
/
chat
/
Answer Web
curl --request POST \
--url https://api.example.com/v1/chat/ \
--header 'Content-Type: application/json' \
--data '
{
"role": "<string>",
"content": "<string>",
"user_context": {
"id": 123,
"email": "<string>",
"updated_at": "<string>",
"is_active": true,
"team_id": 123,
"created_at": "2023-11-07T05:31:56Z",
"connectors": [
{
"name": "<string>",
"id": [
123
]
}
],
"vector_store": {
"id": 123,
"index_name": "<string>",
"environment": "<string>",
"namespaces": [
"<string>"
],
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"provider": "<string>"
}
},
"timestamp": "<string>",
"chat_id": "<string>"
}
'import requests
url = "https://api.example.com/v1/chat/"
payload = {
"role": "<string>",
"content": "<string>",
"user_context": {
"id": 123,
"email": "<string>",
"updated_at": "<string>",
"is_active": True,
"team_id": 123,
"created_at": "2023-11-07T05:31:56Z",
"connectors": [
{
"name": "<string>",
"id": [123]
}
],
"vector_store": {
"id": 123,
"index_name": "<string>",
"environment": "<string>",
"namespaces": ["<string>"],
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"provider": "<string>"
}
},
"timestamp": "<string>",
"chat_id": "<string>"
}
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({
role: '<string>',
content: '<string>',
user_context: {
id: 123,
email: '<string>',
updated_at: '<string>',
is_active: true,
team_id: 123,
created_at: '2023-11-07T05:31:56Z',
connectors: [{name: '<string>', id: [123]}],
vector_store: {
id: 123,
index_name: '<string>',
environment: '<string>',
namespaces: ['<string>'],
created_at: '2023-11-07T05:31:56Z',
updated_at: '2023-11-07T05:31:56Z',
provider: '<string>'
}
},
timestamp: '<string>',
chat_id: '<string>'
})
};
fetch('https://api.example.com/v1/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/v1/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([
'role' => '<string>',
'content' => '<string>',
'user_context' => [
'id' => 123,
'email' => '<string>',
'updated_at' => '<string>',
'is_active' => true,
'team_id' => 123,
'created_at' => '2023-11-07T05:31:56Z',
'connectors' => [
[
'name' => '<string>',
'id' => [
123
]
]
],
'vector_store' => [
'id' => 123,
'index_name' => '<string>',
'environment' => '<string>',
'namespaces' => [
'<string>'
],
'created_at' => '2023-11-07T05:31:56Z',
'updated_at' => '2023-11-07T05:31:56Z',
'provider' => '<string>'
]
],
'timestamp' => '<string>',
'chat_id' => '<string>'
]),
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/v1/chat/"
payload := strings.NewReader("{\n \"role\": \"<string>\",\n \"content\": \"<string>\",\n \"user_context\": {\n \"id\": 123,\n \"email\": \"<string>\",\n \"updated_at\": \"<string>\",\n \"is_active\": true,\n \"team_id\": 123,\n \"created_at\": \"2023-11-07T05:31:56Z\",\n \"connectors\": [\n {\n \"name\": \"<string>\",\n \"id\": [\n 123\n ]\n }\n ],\n \"vector_store\": {\n \"id\": 123,\n \"index_name\": \"<string>\",\n \"environment\": \"<string>\",\n \"namespaces\": [\n \"<string>\"\n ],\n \"created_at\": \"2023-11-07T05:31:56Z\",\n \"updated_at\": \"2023-11-07T05:31:56Z\",\n \"provider\": \"<string>\"\n }\n },\n \"timestamp\": \"<string>\",\n \"chat_id\": \"<string>\"\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/v1/chat/")
.header("Content-Type", "application/json")
.body("{\n \"role\": \"<string>\",\n \"content\": \"<string>\",\n \"user_context\": {\n \"id\": 123,\n \"email\": \"<string>\",\n \"updated_at\": \"<string>\",\n \"is_active\": true,\n \"team_id\": 123,\n \"created_at\": \"2023-11-07T05:31:56Z\",\n \"connectors\": [\n {\n \"name\": \"<string>\",\n \"id\": [\n 123\n ]\n }\n ],\n \"vector_store\": {\n \"id\": 123,\n \"index_name\": \"<string>\",\n \"environment\": \"<string>\",\n \"namespaces\": [\n \"<string>\"\n ],\n \"created_at\": \"2023-11-07T05:31:56Z\",\n \"updated_at\": \"2023-11-07T05:31:56Z\",\n \"provider\": \"<string>\"\n }\n },\n \"timestamp\": \"<string>\",\n \"chat_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/chat/")
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 \"role\": \"<string>\",\n \"content\": \"<string>\",\n \"user_context\": {\n \"id\": 123,\n \"email\": \"<string>\",\n \"updated_at\": \"<string>\",\n \"is_active\": true,\n \"team_id\": 123,\n \"created_at\": \"2023-11-07T05:31:56Z\",\n \"connectors\": [\n {\n \"name\": \"<string>\",\n \"id\": [\n 123\n ]\n }\n ],\n \"vector_store\": {\n \"id\": 123,\n \"index_name\": \"<string>\",\n \"environment\": \"<string>\",\n \"namespaces\": [\n \"<string>\"\n ],\n \"created_at\": \"2023-11-07T05:31:56Z\",\n \"updated_at\": \"2023-11-07T05:31:56Z\",\n \"provider\": \"<string>\"\n }\n },\n \"timestamp\": \"<string>\",\n \"chat_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}⌘I

