namespace AIStudio.Assistants.ModelComparison; /// /// What a comparison run brought back: the answers of the two models. /// public sealed record ModelComparisonRunResult { /// /// When the run ended. Both answers are shown with this one time: a time of their own would /// tell the faster model from the slower one. /// public DateTimeOffset Time { get; init; } = DateTimeOffset.Now; public required ModelComparisonAnswer First { get; init; } public required ModelComparisonAnswer Second { get; init; } /// /// What an optional judge said about the two answers, or null when no judge was asked, or when /// there was nothing for it to judge because at least one model did not answer. /// public ModelComparisonJudgeVerdict? Judge { get; init; } /// /// Whether both models answered. Only then there is anything to vote on: a vote between an /// answer and a failure would say nothing about the models. /// public bool BothCompleted => this.First.Completed && this.Second.Completed; /// /// Gets the answer of a model of the run. /// /// The first or the second model; a tie names no model. /// The answer of that model. public ModelComparisonAnswer AnswerOf(ModelComparisonModelChoice model) => model switch { ModelComparisonModelChoice.FIRST => this.First, ModelComparisonModelChoice.SECOND => this.Second, _ => throw new ArgumentOutOfRangeException(nameof(model), model, $"The choice '{model}' names no model."), }; }