Document Filtered Search
curl --request POST \
--url https://app.baseplate.ai/api/datasets/{id}/document-filtered-search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "<string>",
"top_k_documents": 123,
"top_k_rows": 123
}
'import requests
url = "https://app.baseplate.ai/api/datasets/{id}/document-filtered-search"
payload = {
"query": "<string>",
"top_k_documents": 123,
"top_k_rows": 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({query: '<string>', top_k_documents: 123, top_k_rows: 123})
};
fetch('https://app.baseplate.ai/api/datasets/{id}/document-filtered-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://app.baseplate.ai/api/datasets/{id}/document-filtered-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([
'query' => '<string>',
'top_k_documents' => 123,
'top_k_rows' => 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://app.baseplate.ai/api/datasets/{id}/document-filtered-search"
payload := strings.NewReader("{\n \"query\": \"<string>\",\n \"top_k_documents\": 123,\n \"top_k_rows\": 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://app.baseplate.ai/api/datasets/{id}/document-filtered-search")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"<string>\",\n \"top_k_documents\": 123,\n \"top_k_rows\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.baseplate.ai/api/datasets/{id}/document-filtered-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 \"query\": \"<string>\",\n \"top_k_documents\": 123,\n \"top_k_rows\": 123\n}"
response = http.request(request)
puts response.read_bodyAPI
Document Filtered Search
Performs a full text search on documents in a dataset, then uses those documents to perform an embedding search on the dataset. This is the same as calling /search-documents followed by /search, and using the documents from the first call as a metadata filter.
POST
/
api
/
datasets
/
{id}
/
document-filtered-search
Document Filtered Search
curl --request POST \
--url https://app.baseplate.ai/api/datasets/{id}/document-filtered-search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "<string>",
"top_k_documents": 123,
"top_k_rows": 123
}
'import requests
url = "https://app.baseplate.ai/api/datasets/{id}/document-filtered-search"
payload = {
"query": "<string>",
"top_k_documents": 123,
"top_k_rows": 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({query: '<string>', top_k_documents: 123, top_k_rows: 123})
};
fetch('https://app.baseplate.ai/api/datasets/{id}/document-filtered-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://app.baseplate.ai/api/datasets/{id}/document-filtered-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([
'query' => '<string>',
'top_k_documents' => 123,
'top_k_rows' => 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://app.baseplate.ai/api/datasets/{id}/document-filtered-search"
payload := strings.NewReader("{\n \"query\": \"<string>\",\n \"top_k_documents\": 123,\n \"top_k_rows\": 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://app.baseplate.ai/api/datasets/{id}/document-filtered-search")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"<string>\",\n \"top_k_documents\": 123,\n \"top_k_rows\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.baseplate.ai/api/datasets/{id}/document-filtered-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 \"query\": \"<string>\",\n \"top_k_documents\": 123,\n \"top_k_rows\": 123\n}"
response = http.request(request)
puts response.read_bodyPath Parameters
string
required
Dataset ID
Header
string
Baseplate API key. Must be in the format βBearer $BASEPLATE_API_KEYβ
Body Parameters
string
required
Query string
number
default:"3"
Number of documents to use in embedding search filter.
number
default:"3"
Number of documents to use in embedding search filter.
Responses
π’ 200: OK
{
"document_results": [
{
"document_id": "fc74e81e-05ac-4df6-936f-ce51cc69a868",
"dataset_id": "e2fa7f7b-d580-4ecf-8232-a1131938a3fc",
"content": "",
"filename": "doc1.pdf",
"url": "/5274962e-04c3-4a23-b3d5-1d7e1ea6a230/doc1.pdf",
"similarity": 0.0919062
},
{
"document_id": "e6afaf5b-e8f0-4af3-ba50-bbb2d0d1f1af",
"dataset_id": "e2fa7f7b-d580-4ecf-8232-a1131938a3fc",
"content": "",
"filename": "doc2.pdf",
"url": "/5274962e-04c3-4a23-b3d5-1d7e1ea6a230/doc2.pdf",
"similarity": 0.0919062
}
],
"results": [
{
"embedding": "Example text",
"data": {
"text": "Example text"
},
"confidence": 10.3084955,
"query": "text",
"metadata": {
"documentId": "fc74e81e-05ac-4df6-936f-ce51cc69a868",
"rowId": 567228,
"url": "/5274962e-04c3-4a23-b3d5-1d7e1ea6a230/doc1.pdf"
}
},
{
"embedding": "Example text 2",
"data": {
"text": "Example text 2"
},
"confidence": 10.3084955,
"query": "text",
"metadata": {
"documentId": "e6afaf5b-e8f0-4af3-ba50-bbb2d0d1f1af",
"rowId": 569813,
"url": "/5274962e-04c3-4a23-b3d5-1d7e1ea6a230/doc2.pdf"
}
}
]
}
βI