using AIStudio.Tools.RAG;
namespace AIStudio.AIOperations.RetrievalContextValidation;
///
/// Represents the result of a retrieval context validation.
///
///
/// 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.
///
/// The retrieval context that was validated, as it is prepared for the AI.
/// Whether the model gave a usable answer.
/// Whether the retrieval context is useful or not.
/// The reason for the decision, or why the model gave no usable answer.
/// The probability that the decision is right, between 0 and 1.
public readonly record struct RetrievalContextValidationResult(PreparedRetrievalContext RetrievalContext, bool IsAnswered, bool Decision, string Reason, float Confidence) : IConfidence
{
///
/// A validation without a usable answer, e.g., because the model gave none or its JSON was invalid.
///
/// The retrieval context that was to be validated.
/// Why there is no usable answer.
/// The result, with IsAnswered being false.
public static RetrievalContextValidationResult NotAnswered(PreparedRetrievalContext retrievalContext, string reason) => new(retrievalContext, false, false, reason, 0f);
}