Fixed the retrieval context validation keeping unhelpful passages (#1217)

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2026-11-21 20:50:25 +01:00
1 parent 808b95b15d
commit 78f5066bfd
10 files changed
+454 -36

No files matched your search

@@ -0,0 +1,18 @@
namespace AIStudio.Tools.RAG;
/// <summary>
/// The passages which the check of which passages fit the user prompt left, and why it left out the others.
/// </summary>
/// <param name="Contexts">The passages left, in the order of the results of the check.</param>
/// <param name="NumJudged">How many passages the check judged, i.e., got a usable answer for.</param>
/// <param name="NumUnchecked">How many passages stayed without a judgment, because their check failed.</param>
/// <param name="NumRejected">How many passages were left out, because the check judged them not to fit.</param>
/// <param name="NumBelowThreshold">How many passages judged to fit were left out, because their confidence fell below the threshold.</param>
/// <param name="Threshold">The confidence a passage judged to fit needed to stay.</param>
public sealed record ValidatedPassages(IReadOnlyList<PreparedRetrievalContext> Contexts, int NumJudged, int NumUnchecked, int NumRejected, int NumBelowThreshold, float Threshold)
{
/// <summary>
/// Whether the check failed for every passage, so that it judged none of them.
/// </summary>
public bool IsUnchecked => this.NumUnchecked > 0 && this.NumJudged is 0;
}