Searching

Semantic searching of documents

Last updated: 28 October 2022

Searching vs Querying

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)

Request

GET https://api.viko.ai/v1-beta/{tenancy}/search/

Request headers

Content-Type: application/json (required)
X-Api-Key (required)

Request body

{
  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.

Response

Status: 200

Response body

{
  "results": [
    {
      context: string (optional) // snippet
      title: string (optional)
      link: string (optional)
      confidence: float (required) // 0 to 1
    }
  ]
}

Example

$ 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
        }
    ]
}

Try Viko

Want to see Viko in action? Try our interactive demos