Generative Answers

The Generative Answers pipeline produces high-quality, conversational responses when certified answers are insufficient. 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 relevance threshold .
  • 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. Process the Query
    • The user’s question is converted into a machine-readable representation.
  2. Find Relevant Content
    • The system searches across enterprise knowledge sources to identify the most relevant content.
  3. Rank Results
    • Retrieved results are re-ranked to ensure the most relevant information is prioritized.
  4. Generate an Answer
    • The top results, along with the query, are sent to the LLM.
    • The LLM generates a natural language answer.
  5. 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.

Key Characteristics

  • Fallback-Ready : Triggered automatically if certified answers are insufficient.
  • Context-Aware : Incorporates content chunks and query context for accurate answers.
  • Traceable : Returns references to source content used by the LLM.

Example Request

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

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.",
    "answerType": "generative",
    "relevanceScore": 0.92,
    "references": [
      {
        "id": "PROD-98765",
        "name": "Mortgage Rate Guide",
        "source": "eGain Article",
        "docType": "HTML"
      }
    ]
  },
  "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%.",
      "relevanceScore": 0.92
    }
  ],
  "channel": {
    "type": "portal",
    "name": "customer-web"
  },
  "sessionId": "123456",
  "eventId": "78910"
}