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,30 @@
namespace AIStudio.Assistants.ModelComparison;
/// <summary>
/// Shortens a question to what a summary or a stored result keeps of it, so that the user recognizes it again.
/// </summary>
public static class ModelComparisonQuestionPreview
{
/// <summary>
/// How many characters of a question the Model Comparison assistant keeps at most.
/// </summary>
public const int MAX_CHARACTERS = 300;
/// <summary>
/// Shortens a question, and marks the cut.
/// </summary>
/// <param name="question">The question.</param>
/// <param name="maxCharacters">The number of characters of the question to keep, at most.</param>
/// <returns>The question, or its beginning followed by an ellipsis.</returns>
public static string Of(string question, int maxCharacters = MAX_CHARACTERS)
{
ArgumentOutOfRangeException.ThrowIfNegativeOrZero(maxCharacters);
if (question.Length <= maxCharacters)
return question;
// Cutting between the two halves of a character outside the basic plane, an emoji for example, would leave half of it:
var length = char.IsHighSurrogate(question[maxCharacters - 1]) ? maxCharacters - 1 : maxCharacters;
return question[..length].TrimEnd() + "…";
}
}