mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-14 22:28: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
@@ -0,0 +1,50 @@
|
||||
using AIStudio.Components;
|
||||
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace AIStudio.Assistants.ModelComparison;
|
||||
|
||||
/// <summary>
|
||||
/// How fast the models answered: the median times as a chart, and as a table which also lists the models without a
|
||||
/// complete answer.
|
||||
/// </summary>
|
||||
public partial class ModelComparisonSpeeds : MSGComponentBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the speeds of all models.
|
||||
/// </summary>
|
||||
[Parameter, EditorRequired]
|
||||
public IReadOnlyList<ModelComparisonModelSpeed> Speeds { get; set; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// The models with complete answers, whose median times the chart can show.
|
||||
/// </summary>
|
||||
private IReadOnlyList<ModelComparisonModelSpeed> timedSpeeds = [];
|
||||
|
||||
#region Overrides of ComponentBase
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
this.timedSpeeds = [.. this.Speeds.Where(speed => speed is { MedianFirstTokenTime: not null, MedianTotalTime: not null })];
|
||||
base.OnParametersSet();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// The median times of each model in seconds, as the two series of a bar chart.
|
||||
/// </summary>
|
||||
private List<ChartSeries<double>> SpeedSeries =>
|
||||
[
|
||||
new() { Name = T("Until the first token"), Data = new([.. this.timedSpeeds.Select(speed => speed.MedianFirstTokenTime!.Value.TotalSeconds)]) },
|
||||
new() { Name = T("Until the complete answer"), Data = new([.. this.timedSpeeds.Select(speed => speed.MedianTotalTime!.Value.TotalSeconds)]) },
|
||||
];
|
||||
|
||||
private BarChartOptions ChartOptions => new()
|
||||
{
|
||||
ChartPalette = ModelComparisonCharts.SPEED_PALETTE,
|
||||
YAxisTicks = ModelComparisonCharts.AxisStep(this.timedSpeeds.Select(speed => speed.MedianTotalTime!.Value.TotalSeconds)),
|
||||
YAxisToStringFunc = ModelComparisonFormat.Seconds,
|
||||
XAxisLabelRotation = ModelComparisonCharts.LabelRotation(this.timedSpeeds.Count),
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user