groundlens_sgi
Evaluate if an LLM response is grounded in source context by computing the ratio of distances to question and context. Use for RAG pipeline verification.
Instructions
Check whether an LLM response is grounded in a source document (SGI).
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 (grounded). A low ratio means it stayed near the question (possibly ignored the context).
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 |