groundlens_sgi
Verify that an LLM response engaged with the provided source document using the Semantic Grounding Index score. Ideal for auditing RAG pipeline provenance.
Instructions
Check whether an LLM response engaged a source document (SGI). Provenance, not truth.
SGI (Semantic Grounding Index) measures whether the response engaged with the provided context or stayed anchored to the question. This is the method to use for RAG pipeline verification — did the model actually use the retrieved documents?
The score is a ratio: dist(response, question) / dist(response, context). A high ratio means the response moved toward the context. A low ratio means it stayed near the question (possibly ignored the context).
IMPORTANT: this measures PROVENANCE. An answer that borrows the source's
vocabulary and structure but changes one figure will pass. Surface the
handoff field and escalate fact-level verification to a second stage.
Args: params (SGIInput): The question, source context, and LLM response.
Returns: str: JSON with a plain-language CHECK, the SGI score, and the two distances.
Examples: - Verifying a RAG chatbot used the retrieved documents - Checking if a summary is faithful to the source text - Auditing whether context was ignored in a customer support bot
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| params | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |