Knowledge Bases
Test a search
See the passages an assistant’s search would hand over for a question, with their scores, and the ones it would leave out, with why.
POST
/
knowledge-base
/
search
Test a search
curl --request POST \
--url https://api.verbeo.ai/v1/knowledge-base/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"store_ids": [
"<string>"
],
"query": "<string>",
"top_k": 123,
"min_similarity": 123
}
'import requests
url = "https://api.verbeo.ai/v1/knowledge-base/search"
payload = {
"store_ids": ["<string>"],
"query": "<string>",
"top_k": 123,
"min_similarity": 123
}
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({store_ids: ['<string>'], query: '<string>', top_k: 123, min_similarity: 123})
};
fetch('https://api.verbeo.ai/v1/knowledge-base/search', 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.verbeo.ai/v1/knowledge-base/search",
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([
'store_ids' => [
'<string>'
],
'query' => '<string>',
'top_k' => 123,
'min_similarity' => 123
]),
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.verbeo.ai/v1/knowledge-base/search"
payload := strings.NewReader("{\n \"store_ids\": [\n \"<string>\"\n ],\n \"query\": \"<string>\",\n \"top_k\": 123,\n \"min_similarity\": 123\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.verbeo.ai/v1/knowledge-base/search")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"store_ids\": [\n \"<string>\"\n ],\n \"query\": \"<string>\",\n \"top_k\": 123,\n \"min_similarity\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.verbeo.ai/v1/knowledge-base/search")
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 \"store_ids\": [\n \"<string>\"\n ],\n \"query\": \"<string>\",\n \"top_k\": 123,\n \"min_similarity\": 123\n}"
response = http.request(request)
puts response.read_body{
"passages[].score": 123,
"passages[].verdict": "<string>"
}Searches knowledge bases the way an assistant does during a call, and answers the five closest passages with what the search does with each: hand it over (
sent), or leave it out and why. Use it to check that a question your callers ask finds the right passage, and to choose an assistant’s kbTopK and kbMinSimilarity. It searches ready files only, and places no call.
Body
The knowledge bases to search: 1 to 25 UUIDs, each once. An assistant’s are its
kbStoreIds.Match strictness, as an assistant’s
kbMinSimilarity: 0.40 to 0.80 in steps of 0.05.Request
curl -X POST "https://api.verbeo.ai/v1/knowledge-base/search" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "store_ids": ["5df09066-0842-4c92-8ef0-6cf2ff6d7455"], "query": "Are you open on Sundays?", "top_k": 3 }'
Response
200 OK. The passages come best first.
{
"success": true,
"data": {
"query": "Are you open on Sundays?",
"top_k": 3,
"min_similarity": 0.55,
"close_to_best": 0.05,
"passages": [
{ "rank": 1, "file": "opening-hours.docx", "content": "Opening hours: 9 to 5 on weekdays. Closed on Sundays.", "score": 0.74, "verdict": "sent" },
{ "rank": 2, "file": "faq.md", "content": "Do you take walk-ins? Yes, until 4 pm.", "score": 0.58, "verdict": "far_from_best" }
]
}
}
sent: the search hands it over. Left out: past_top_k (beyond the results per search), below_cutoff (not above min_similarity) or far_from_best (more than close_to_best below the best match).Errors
| Code | Status | When |
|---|---|---|
VALIDATION_FAILED | 422 | store_ids empty, repeated or over 25 (store_ids: must name at least one knowledge base); query empty or over 1,000 characters; top_k or min_similarity off its scale. |
NOT_FOUND | 404 | A knowledge base that does not exist or is in another workspace. |
BAD_GATEWAY | 502 | The search could not be run just now. Try again in a moment. |
Was this page helpful?
⌘I
Test a search
curl --request POST \
--url https://api.verbeo.ai/v1/knowledge-base/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"store_ids": [
"<string>"
],
"query": "<string>",
"top_k": 123,
"min_similarity": 123
}
'import requests
url = "https://api.verbeo.ai/v1/knowledge-base/search"
payload = {
"store_ids": ["<string>"],
"query": "<string>",
"top_k": 123,
"min_similarity": 123
}
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({store_ids: ['<string>'], query: '<string>', top_k: 123, min_similarity: 123})
};
fetch('https://api.verbeo.ai/v1/knowledge-base/search', 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.verbeo.ai/v1/knowledge-base/search",
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([
'store_ids' => [
'<string>'
],
'query' => '<string>',
'top_k' => 123,
'min_similarity' => 123
]),
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.verbeo.ai/v1/knowledge-base/search"
payload := strings.NewReader("{\n \"store_ids\": [\n \"<string>\"\n ],\n \"query\": \"<string>\",\n \"top_k\": 123,\n \"min_similarity\": 123\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.verbeo.ai/v1/knowledge-base/search")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"store_ids\": [\n \"<string>\"\n ],\n \"query\": \"<string>\",\n \"top_k\": 123,\n \"min_similarity\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.verbeo.ai/v1/knowledge-base/search")
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 \"store_ids\": [\n \"<string>\"\n ],\n \"query\": \"<string>\",\n \"top_k\": 123,\n \"min_similarity\": 123\n}"
response = http.request(request)
puts response.read_body{
"passages[].score": 123,
"passages[].verdict": "<string>"
}