mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-23 08:33:49 +00:00
Fixed the retrieval context validation keeping unhelpful passages (#1217)
This commit is contained in:
1 parent
808b95b15d
commit
78f5066bfd
10 files changed
+454
-36
No files matched your search
+18
-4
@@ -5,8 +5,22 @@ namespace AIStudio.AIOperations.RetrievalContextValidation;
|
||||
/// <summary>
|
||||
/// Represents the result of a retrieval context validation.
|
||||
/// </summary>
|
||||
/// <param name="Decision">Whether the retrieval context is useful or not.</param>
|
||||
/// <param name="Reason">The reason for the decision.</param>
|
||||
/// <param name="Confidence">The confidence of the decision.</param>
|
||||
/// <remarks>
|
||||
/// Decision and Confidence mean nothing unless IsAnswered is true: a validation which failed says nothing about
|
||||
/// its retrieval context, neither that it helps nor that it does not.
|
||||
/// </remarks>
|
||||
/// <param name="RetrievalContext">The retrieval context that was validated, as it is prepared for the AI.</param>
|
||||
public readonly record struct RetrievalContextValidationResult(bool Decision, string Reason, float Confidence, PreparedRetrievalContext? RetrievalContext) : IConfidence;
|
||||
/// <param name="IsAnswered">Whether the model gave a usable answer.</param>
|
||||
/// <param name="Decision">Whether the retrieval context is useful or not.</param>
|
||||
/// <param name="Reason">The reason for the decision, or why the model gave no usable answer.</param>
|
||||
/// <param name="Confidence">The probability that the decision is right, between 0 and 1.</param>
|
||||
public readonly record struct RetrievalContextValidationResult(PreparedRetrievalContext RetrievalContext, bool IsAnswered, bool Decision, string Reason, float Confidence) : IConfidence
|
||||
{
|
||||
/// <summary>
|
||||
/// A validation without a usable answer, e.g., because the model gave none or its JSON was invalid.
|
||||
/// </summary>
|
||||
/// <param name="retrievalContext">The retrieval context that was to be validated.</param>
|
||||
/// <param name="reason">Why there is no usable answer.</param>
|
||||
/// <returns>The result, with IsAnswered being false.</returns>
|
||||
public static RetrievalContextValidationResult NotAnswered(PreparedRetrievalContext retrievalContext, string reason) => new(retrievalContext, false, false, reason, 0f);
|
||||
}
|
||||
Reference in new issue
Block a user