Chunk

Generate suggested queries

Changed on

This endpoint will generate 3 suggested queries based off a hybrid search using RAG with the query provided in the request body and return them as a JSON object.

post/api/chunk/suggestions

Request

  • Base URL
    https://api.trieve.ai
  • URL
    https://api.trieve.ai/api/chunk/suggestions
  • Auth
    API key in header Authorization

Headers

TR-Datasetstring uuid required

The dataset id or tracking_id to use for the request. We assume you intend to use an id if the value is a valid uuid.

Request body

contextstring nullable

Context is the context of the query. This can be any string under 15 words and 200 characters. The context will be used to generate the suggested queries. Defaults to None.

is_ecommerceboolean nullable

Whether of not the suggested queries are being generated for ecommerce.

is_followupboolean nullable

Whether or not the suggested queries are being generated for a followup question. If true, the suggested queries will be generated for a followup question. If false, the suggested queries will be generated for a new question.

querystring nullable

The query to base the generated suggested queries off of using RAG. A hybrid search for 10 chunks from your dataset using this query will be performed and the context of the chunks will be used to generate the suggested queries.

search_type'fulltext' | 'semantic' | 'hybrid' | 'bm25'
suggestion_type'question' | 'keyword' | 'semantic'
suggestions_to_createinteger nullable

The number of suggested queries to create, defaults to 10

Example request

{
  "filters": {
    "must": [
      {
        "field": "tag_set",
        "match_all": [
          "A",
          "B"
        ]
      },
      {
        "field": "num_value",
        "range": {
          "gte": 10,
          "lte": 25
        }
      }
    ]
  }
}

Response

A JSON object containing a list of alternative suggested queries

queriesstring[] required

Changes

    • info

      added the new optional request property

    • breaking

      the / response's property type changed from object to string for status

    • warning

      removed the optional property // from the response with the status

    • warning

      removed the optional property // from the response with the status