mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-14 22:08: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,71 @@
|
||||
using AIStudio.Chat;
|
||||
using AIStudio.Chat.Embedded;
|
||||
|
||||
namespace AIStudio.Tests.Chat.Embedded;
|
||||
|
||||
/// <summary>
|
||||
/// Checks when an embedded chat sends the message it opens with.
|
||||
/// </summary>
|
||||
[TestFixture]
|
||||
public sealed class EmbeddedChatOpeningTests
|
||||
{
|
||||
private static readonly ContentText OPENING_MESSAGE = new() { Text = "What is new today?" };
|
||||
|
||||
[Test]
|
||||
public void AnEmptyChatSendsItsOpeningMessage()
|
||||
{
|
||||
Assert.That(EmbeddedChatOpening.SendsNow(OPENING_MESSAGE, Conversation(), wasSent: false), Is.True);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AChatWithoutOpeningMessageSendsNothing()
|
||||
{
|
||||
Assert.That(EmbeddedChatOpening.SendsNow(null, Conversation(), wasSent: false), Is.False);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AChatSendsItsOpeningMessageOnlyOnce()
|
||||
{
|
||||
// Until the request adds the message to the chat, the chat still looks empty:
|
||||
Assert.That(EmbeddedChatOpening.SendsNow(OPENING_MESSAGE, Conversation(), wasSent: true), Is.False);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AChatInWhichTheUserWroteSendsNothing()
|
||||
{
|
||||
var conversation = Conversation();
|
||||
conversation.Thread!.Blocks.Add(new ContentBlock { Role = ChatRole.USER, ContentType = ContentType.TEXT, Content = new ContentText { Text = "My own question." } });
|
||||
|
||||
Assert.That(EmbeddedChatOpening.SendsNow(OPENING_MESSAGE, conversation, wasSent: false), Is.False);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AChatWhichLoadsOrCannotBeOpenedSendsNothing()
|
||||
{
|
||||
var unavailable = Conversation();
|
||||
unavailable.Thread = null;
|
||||
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(EmbeddedChatOpening.SendsNow(OPENING_MESSAGE, null, wasSent: false), Is.False, "While the chat loads, the message waits.");
|
||||
Assert.That(EmbeddedChatOpening.SendsNow(OPENING_MESSAGE, unavailable, wasSent: false), Is.False);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AChatInWhichTheModelAnswersSendsNothing()
|
||||
{
|
||||
var conversation = Conversation();
|
||||
conversation.IsRunning = true;
|
||||
|
||||
Assert.That(EmbeddedChatOpening.SendsNow(OPENING_MESSAGE, conversation, wasSent: false), Is.False);
|
||||
}
|
||||
|
||||
private static EmbeddedConversation Conversation() => new()
|
||||
{
|
||||
ChatId = Guid.NewGuid(),
|
||||
Component = AIStudio.Tools.Components.MODEL_COMPARISON_ASSISTANT,
|
||||
Store = new InMemoryEmbeddedChatStore(),
|
||||
Thread = new ChatThread(),
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user