Generative Answers

The Generative Answers pipeline produces high-quality, conversational responses when a Certifed Answer is not found. It ensures users receive meaningful answers while maintaining relevance, traceability, and confidence safeguards.


Overview

  • The Generative Flow is triggered if the Certified Answer does not meet the configured generativeAnswerThreshold .
  • Using Hybrid Search and Re-Ranking, the pipeline selects the most relevant content chunks from the knowledge base.
  • These chunks, along with query context, are passed to the LLM for answer generation.
  • If the Generative Answer meets the confidence threshold , it is returned to the user. Otherwise, a fallback message is displayed.

How it Works

  1. Retrieve Relevant Content
    • The system searches across enterprise knowledge sources using the submitted query to identify the most relevant content chunks.
  2. Rank Results
    • Retrieved results are re-ranked to ensure the most relevant information is prioritized.
  3. Generate an Answer
    • The top results, along with the query, are sent to the LLM.
    • The LLM generates a natural language answer.
  4. Validate the Answer
    • The answer is checked against a confidence threshold.
    • If it passes, the generative answer is returned.
    • If not, a fallback message is provided.

Example Request

Copy
Copied
curl -X POST \
  'https://<API_DOMAIN>/core/aiservices/v4/PROD-1000/answers?q=mortgage%20rates' \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <ACCESS_TOKEN>"

Example Generative Response

When a generative answer is given the answer object will have the answerType as 'generative'. The references array is a list of source content that the LLM used to generate the answer shown in the answerValue.

Copy
Copied
{
  "answer": {
    "answerValue": "The current mortgage rate is 6.2% for fixed 30-year loans.",
    "references": [
      {
        "id": "PROD-98765",
        "name": "Mortgage Rate Guide",
        "source": "eGain Article",
        "docType": "HTML"
      }
    ],
    "topicBreadcrumb": [
        {
          "topicSummary": [
            {
              "id": "PROD-5268",
              "name": "Mortgages"
            }
          ]
        }
      ]
    },
    "answerType": "generative",
    "relevanceScore": 0.92,
  },
  "searchResults": [
    {
      "id": "PROD-98765",
      "name": "Mortgage Rate Guide",
      "docType": "HTML",
      "source": "eGain Article",
      "snippet": "As of today, the fixed 30-year mortgage rate is 6.2%.",
      "snippetType": "chunks",
      "relevanceScore": 0.92,
      "topicBreadcrumb": [
        {
          "topicSummary": [
            {
              "id": "PROD-5268",
              "name": "Mortgages"
            }
          ]
        }
      ]
    }
  ],
  "sessionId": "eb24df84-50d7-4321-b699-d9b03bbe5696"
}