Query Knowledge Base
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>"
}Knowledge Bases
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.
POST
/
kb
/
v1
/
knowledge-bases
/
{id}
/
query
Query Knowledge Base
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.
Body
application/json