mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-14 21:48:27 +00:00
Added the Model Comparison assistant for blind comparisons of two models (#1009)
Co-authored-by: Thorsten Sommer <SommerEngineering@users.noreply.github.com>
This commit is contained in:
1 parent
12f26445ba
commit
b7255694cd
221 files changed
+19989
-90
No files matched your search
+48
@@ -0,0 +1,48 @@
|
||||
namespace AIStudio.Assistants.ModelComparison;
|
||||
|
||||
public static class ModelComparisonPresentationOrderExtensions
|
||||
{
|
||||
/// <param name="order">Which model is shown in column A.</param>
|
||||
extension(ModelComparisonPresentationOrder order)
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the answer which is shown in column A.
|
||||
/// </summary>
|
||||
/// <param name="run">The answers of both models.</param>
|
||||
/// <returns>The answer for column A.</returns>
|
||||
public ModelComparisonAnswer InColumnA(ModelComparisonRunResult run) => order switch
|
||||
{
|
||||
ModelComparisonPresentationOrder.FIRST_MODEL_FIRST => run.First,
|
||||
ModelComparisonPresentationOrder.SECOND_MODEL_FIRST => run.Second,
|
||||
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(order), order, $"The presentation order '{order}' is not known."),
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Gets the answer which is shown in column B.
|
||||
/// </summary>
|
||||
/// <param name="run">The answers of both models.</param>
|
||||
/// <returns>The answer for column B.</returns>
|
||||
public ModelComparisonAnswer InColumnB(ModelComparisonRunResult run) => order switch
|
||||
{
|
||||
ModelComparisonPresentationOrder.FIRST_MODEL_FIRST => run.Second,
|
||||
ModelComparisonPresentationOrder.SECOND_MODEL_FIRST => run.First,
|
||||
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(order), order, $"The presentation order '{order}' is not known."),
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Turns a column-based choice back into the model it means. The reverse of InColumnA and InColumnB:
|
||||
/// those turn a known model into its column, this turns a known column back into its model.
|
||||
/// </summary>
|
||||
/// <param name="vote">The column-based choice, from the user's own vote or from a judge verdict.</param>
|
||||
public ModelComparisonModelChoice ToModelChoice(ModelComparisonVote vote) => vote switch
|
||||
{
|
||||
ModelComparisonVote.TIE => ModelComparisonModelChoice.TIE,
|
||||
ModelComparisonVote.COLUMN_A => order is ModelComparisonPresentationOrder.FIRST_MODEL_FIRST ? ModelComparisonModelChoice.FIRST : ModelComparisonModelChoice.SECOND,
|
||||
ModelComparisonVote.COLUMN_B => order is ModelComparisonPresentationOrder.FIRST_MODEL_FIRST ? ModelComparisonModelChoice.SECOND : ModelComparisonModelChoice.FIRST,
|
||||
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(vote), vote, $"The vote '{vote}' is not known."),
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user