Generative Q&A

Generative Q&A

Generative Q&A is a feature that leverages the ask{} operator in GraphQL queries to extract answers from data objects. It's designed to be intuitive for developers, providing a powerful way to get precise answers from your dataset.

With the ask{} operator you can provide a question in the query and Unbody returns the answer.

Using the ask{} Operator

To effectively use the Generative Q&A feature, structure your GraphQL queries with the ask{} operator. You can provide the following parameters.

FieldData TypeRequiredExample ValueDescription
questionstringYes"What is the name of the Dutch king?"The question the module should answer.
certaintyfloatNo0.75The minimum confidence level required for the answer. Higher values narrow the search; lower values broaden it. If omitted, the search accepts any certainty level.
propertieslist of stringsNo["summary"]Specifies the text properties to search within the queried class. Defaults to all text properties if not set.
rerankboolNotrueWhen true, reorders the search results so that the answer with the highest score is presented first. Available from version 1.10.0 onwards.

While the Explore {} function can use the ask{} searcher, it will only pinpoint the object containing the answer without extracting it.


The ask{} operator cannot be combined with other 'near' operators in the same query.

  • Example Query Let us have a look at the sample query demonstrating the ask{} operator.
  Get {
      ask: {
        question: "Who directed '2001: A Space Odyssey'?"
        properties: ["summary"]
      limit: 1
    ) {
      _additional {
        answer {

Understanding the GraphQL Response

The response to the ask{} query will include an _additional field with subfields structured as follows.

  • hasAnswer (boolean): This field indicates whether an answer was found.
  • result (string, nullable): If the answer text is available, it is stored in this field.
  • property (string, nullable): It denotes the property where the answer was found.
  • startPosition (int): It is the start index of the answer in the property text.
  • endPosition (int): It is the end index of the answer in the property text. Please note that startPosition, endPosition, and property rely on a string search and may not be accurate if the formatting in the source text differs from the model's output.
  • Example Response Let us have a look at the example response to the example query.
      "data": {
        "Get": {
          "Article": [
              "_additional": {
                "answer": {
                  "hasAnswer": true,
                  "result": "Stanley Kubrick directed '2001: A Space Odyssey.'",
                  "property": "summary",
                  "startPosition": 15,
                  "endPosition": 54

Now that you have learned the Generative Q&A, you are well-equipped to find answers within your data, leveraging the full capabilities of the Generative Q&A module.

You can learn more by following the link to Question Answering.