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:
Dominic NeuburgandThorsten Sommer authored and GitHub committed 2026-11-14 14:11:34 +01:00
1 parent 12f26445ba
commit b7255694cd
221 files changed
+19989 -90

No files matched your search

@@ -0,0 +1,35 @@
using AIStudio.Provider;
namespace AIStudio.Assistants.ModelComparison;
/// <summary>
/// What tells one model apart from another across stored comparisons, see ModelComparisonModelIdentity.
/// </summary>
/// <param name="LLMProvider">The kind of provider which ran the model.</param>
/// <param name="Hostname">The address of the server of a self-hosted model in lowercase, without a trailing slash; empty for every other provider.</param>
/// <param name="ModelId">The ID of the model at its provider.</param>
public readonly record struct ModelComparisonModelKey(LLMProviders LLMProvider, string Hostname, string ModelId) : IComparable<ModelComparisonModelKey>
{
/// <summary>
/// Gets the key of a model, with its host written the same way however the user typed it.
/// </summary>
/// <param name="llmProvider">The kind of provider which ran the model.</param>
/// <param name="hostname">The address of the server of a self-hosted model, or empty.</param>
/// <param name="modelId">The ID of the model at its provider.</param>
/// <returns>The key.</returns>
public static ModelComparisonModelKey Of(LLMProviders llmProvider, string hostname, string modelId) => new(llmProvider, hostname.Trim().TrimEnd('/').ToLowerInvariant(), modelId);
/// <summary>
/// Orders keys the same way on every computer, so that a pair of models is always written in the same order.
/// </summary>
/// <param name="other">The other key.</param>
public int CompareTo(ModelComparisonModelKey other)
{
var byProvider = this.LLMProvider.CompareTo(other.LLMProvider);
if (byProvider != 0)
return byProvider;
var byHost = string.CompareOrdinal(this.Hostname, other.Hostname);
return byHost != 0 ? byHost : string.CompareOrdinal(this.ModelId, other.ModelId);
}
}