# Certified Answers

**Certified Answers** are business curated, verified and trusted, question and answer pairs such as FAQs or important procedures.

Certified Answers ensure **trustworthy, consistent, and auditable** responses by returning only vetted content authored and approved by the enterprise. When a Certified Answer is retrieved, it provides a complete, source-grounded response rather than a generated one.

## How It Works

1. **Article Filtering**
  - Any article type can be configured to use with Certified Answers.
  - Articles to be used with Certified Answers should be authored in the following structured format:
    - The title represents the question (e.g., “What are loans?”).
    - The article content serves as the Certified Answer.
  - This ensures only trusted, purpose-authored FAQs are considered for Certified Answer retrieval.
2. **Semantic Search**
  - A **semantic search** is performed over the **Title** and **Related Questions** metadata fields of the filtered FAQ articles.
3. **Relevance Scoring & Threshold Evaluation**
  - All Certified Answer type articles are scored based on semantic similarity to the user query.
  - If the top result’s similarity score meets or exceeds the configured `certifiedAnswerThreshold`, the corresponding article content is returned as the **Certified Answer**.
  - Any other FAQ articles that also meet the threshold are included in the **searchResults**.
4. **Fallback to Generative**
  - If no FAQ articles meet the Certified Answer threshold, the API falls back to a **generative** and **hybrid search** approach.


## Why Certified Answers Matter

- Unlike generative AI responses, which are **probabilistic and can sometimes hallucinate**, Certified Answers guarantee that the response is grounded in actual source content.
- Ensure **traceability and compliance** for regulated industries such as finance, healthcare, and legal.


## Example Request

```curl
curl -X POST \
  'https://<API_DOMAIN>/core/aiservices/v4/PROD-1000/answers?q=mortgage%20requirements&%24lang=en-US' \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <ACCESS_TOKEN>"
```

## Example Response

When a Certified Answer is given, the `answer` object will be returned in the response and the `answerType` will be 'certified'.

```json
{
  "answer": {
    "answerValue": "To apply for a mortgage, you need proof of income, credit history, and identification documents.",
    "references": [
      {
        "id": "PROD-11223",
        "name": "Mortgage Application Guide",
        "source": "eGain Article",
        "docType": "HTML",
        "topicBreadcrumb": [
          {
            "topicSummary": [
              {
                "id": "PROD-5268",
                "name": "Mortgages"
              }
            ]
          }
        ]
      }
    ],
    "answerType": "certified",
    "relevanceScore": 0.99
  },
  "searchResults": [
    {
      "id": "PROD-11223",
      "name": "Mortgage Application Guide",
      "source": "eGain Article",
      "snippet": "To apply for a mortgage, you need proof of income, credit history, and identification documents.",
      "snippetType": "articleContent",
      "relevanceScore": 0.99,
      "topicBreadcrumb": [
        {
          "topicSummary": [
            {
              "id": "PROD-5268",
              "name": "Mortgages"
            }
          ]
        }
      ]
    }
  ],
  "sessionId": "eb24df84-50d7-4321-b699-d9b03bbe5696"
}
```