Table of Contents

Class KnowledgeGrounding

Namespace
LMKit.Agents.Knowledge
Assembly
LM-Kit.NET.dll

The grounding verdict of one answer: the passages the model was given for it, the passages it cited, and whether those citations hold.

public sealed class KnowledgeGrounding
Inheritance
KnowledgeGrounding
Inherited Members

Examples

var result = await chat.SubmitAsync("What is the refund window?");
if (result.Grounding?.Status == KnowledgeGroundingStatus.Grounded)
{
    foreach (var source in result.Grounding.Citations)
    {
        Console.WriteLine($"[{source.CitationId}] {source.Title}, page {source.PageNumber}");
    }
}

Remarks

Read it from Grounding or Grounding. Citations are verified against the passages the conversation really presented: a number the model invents is reported in UnresolvedCitationIds, never resolved.

Properties

Citations

Gets the passages the answer cites, resolved, in the order they are first cited.

Evidence

Gets the passages presented to the model for this answer, each with its CitationId.

IsGrounded

Gets whether the answer cites only passages it was given, and at least one.

Query

Gets the query the knowledge sources were searched with for this answer (the rewritten, self-contained form of a follow-up), or an empty string when no search ran.

Status

Gets the verdict.

StatusName

Gets the verdict's stable name, as hosts and reports write it: grounded, uncited, invalid_citation, no_evidence, not_retrieved or retrieval_failed.

UnresolvedCitationIds

Gets the passage numbers the answer cites that the conversation never presented.

Methods

NameOf(KnowledgeGroundingStatus)

The stable name of a verdict (see StatusName).

Share