curl --request POST \
--url https://api-prod.interactly.ai/kb/v1/knowledge-bases/{id}/query \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "gpt-4o",
"prompt": "<string>",
"messages": [
{
"role": "user",
"content": "What are the services offered?"
}
],
"temperature": 0.1,
"seed": 42,
"stream": false
}
'import requests
url = "https://api-prod.interactly.ai/kb/v1/knowledge-bases/{id}/query"
payload = {
"model": "gpt-4o",
"prompt": "<string>",
"messages": [
{
"role": "user",
"content": "What are the services offered?"
}
],
"temperature": 0.1,
"seed": 42,
"stream": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'gpt-4o',
prompt: '<string>',
messages: [{role: 'user', content: 'What are the services offered?'}],
temperature: 0.1,
seed: 42,
stream: false
})
};
fetch('https://api-prod.interactly.ai/kb/v1/knowledge-bases/{id}/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-prod.interactly.ai/kb/v1/knowledge-bases/{id}/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([
'model' => 'gpt-4o',
'prompt' => '<string>',
'messages' => [
[
'role' => 'user',
'content' => 'What are the services offered?'
]
],
'temperature' => 0.1,
'seed' => 42,
'stream' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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-prod.interactly.ai/kb/v1/knowledge-bases/{id}/query"
payload := strings.NewReader("{\n \"model\": \"gpt-4o\",\n \"prompt\": \"<string>\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"What are the services offered?\"\n }\n ],\n \"temperature\": 0.1,\n \"seed\": 42,\n \"stream\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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-prod.interactly.ai/kb/v1/knowledge-bases/{id}/query")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"gpt-4o\",\n \"prompt\": \"<string>\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"What are the services offered?\"\n }\n ],\n \"temperature\": 0.1,\n \"seed\": 42,\n \"stream\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-prod.interactly.ai/kb/v1/knowledge-bases/{id}/query")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"gpt-4o\",\n \"prompt\": \"<string>\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"What are the services offered?\"\n }\n ],\n \"temperature\": 0.1,\n \"seed\": 42,\n \"stream\": false\n}"
response = http.request(request)
puts response.read_body{
"response": "string"
}{
"details": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>"
}Query Knowledge Base
Send a question to the specified knowledge base and receive a response. Optionally pass a conversation history for the assistant to take into consideration while generating responses.
curl --request POST \
--url https://api-prod.interactly.ai/kb/v1/knowledge-bases/{id}/query \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "gpt-4o",
"prompt": "<string>",
"messages": [
{
"role": "user",
"content": "What are the services offered?"
}
],
"temperature": 0.1,
"seed": 42,
"stream": false
}
'import requests
url = "https://api-prod.interactly.ai/kb/v1/knowledge-bases/{id}/query"
payload = {
"model": "gpt-4o",
"prompt": "<string>",
"messages": [
{
"role": "user",
"content": "What are the services offered?"
}
],
"temperature": 0.1,
"seed": 42,
"stream": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'gpt-4o',
prompt: '<string>',
messages: [{role: 'user', content: 'What are the services offered?'}],
temperature: 0.1,
seed: 42,
stream: false
})
};
fetch('https://api-prod.interactly.ai/kb/v1/knowledge-bases/{id}/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-prod.interactly.ai/kb/v1/knowledge-bases/{id}/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([
'model' => 'gpt-4o',
'prompt' => '<string>',
'messages' => [
[
'role' => 'user',
'content' => 'What are the services offered?'
]
],
'temperature' => 0.1,
'seed' => 42,
'stream' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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-prod.interactly.ai/kb/v1/knowledge-bases/{id}/query"
payload := strings.NewReader("{\n \"model\": \"gpt-4o\",\n \"prompt\": \"<string>\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"What are the services offered?\"\n }\n ],\n \"temperature\": 0.1,\n \"seed\": 42,\n \"stream\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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-prod.interactly.ai/kb/v1/knowledge-bases/{id}/query")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"gpt-4o\",\n \"prompt\": \"<string>\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"What are the services offered?\"\n }\n ],\n \"temperature\": 0.1,\n \"seed\": 42,\n \"stream\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-prod.interactly.ai/kb/v1/knowledge-bases/{id}/query")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"gpt-4o\",\n \"prompt\": \"<string>\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"What are the services offered?\"\n }\n ],\n \"temperature\": 0.1,\n \"seed\": 42,\n \"stream\": false\n}"
response = http.request(request)
puts response.read_body{
"response": "string"
}{
"details": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>"
}Authorizations
Retrieve your API Key from Dashboard API Keys Section.
Path Parameters
The ID of the knowledge base to train.
Body
Optional parameter - The GPT model to use for generating responses
gpt-4o, gpt-4o-mini [DEPRECATED. USE "messages" instead] The query prompt to send to the knowledge base.
A list of messages to query with. Note that "messages" and "prompt" cannot be used together. If both are found in the request, "messages" takes precedence and "prompt" is ignored.
Show child attributes
Show child attributes
Temperature controls the randomness in the output of the underlying language model; while lower values produce predictable and factual replies, higher values allow the model to be creative and reword the responses.
0 <= x <= 20.1
Seed initializes the random number generator in the underlying language model, ensuring reproducible outputs for the same prompt and settings.
42
Determines whether to stream the generated response back instead of returning it all at once. When stream = true, the response is a list of JSON objects of the form {"response": string} separated by newline characters
Response
Successful response
The response from the knowledge base.
"string"