Semantic searching of documents
Last updated: 28 October 2022
Viko supports two types of query - question answering and searching. This document relates to searching. Read more about question answering vs searching
The examples in this document use the stubbed endpoint. Remember to switch over to the real endpoint !
Search for a relevant document and snippet.
Filters can be applied to restrict the document sources (context)
GET https://api.viko.ai/v1-beta/{tenancy}/search/
Content-Type: application/json (required)
X-Api-Key (required)
{
text: string (required)
filter: {
folders: Array<string> (optional)
}
}
Note: The context used to answer a question is a union of all those documents matching a filter. Put another way - we apply an implicit OR clause to filters i.e. documents within any of the specified folders.
Status: 200
{
"results": [
{
context: string (optional) // snippet
title: string (optional)
link: string (optional)
confidence: float (required) // 0 to 1
}
]
}
$ curl \
--header 'X-Api-Key: replaceme' \
--header 'Content-Type: application/json' \
--request GET 'https://stub.viko.ai/v1-beta/acme/search/' \
--data-raw '{
"text": "shipping prices",
"filter": {
"folders": [
"shipping"
]
}
}'
{
"results": [
{
"context": "Lorem ipsum next day shipping is available for $4.95 Lorem ipsum",
"title": "Shipping prices",
"link": "https://acme.com/shipping.html",
"confidence": 0.85
}
]
}