From 11fcc3dda648889162622654c9134e793199345b Mon Sep 17 00:00:00 2001
From: Kevin BEAUGRAND <9513635+kbeaugrand@users.noreply.github.com>
Date: Wed, 31 Jan 2024 23:21:37 +0100
Subject: [PATCH] Rename RoomThread to GroupThread (#15)
---
SemanticKernel.Assistants.sln | 9 +++++++++
src/Assistants.Tests/HarnessTests.cs | 2 +-
src/Assistants/Assistant.cs | 9 +++------
.../RoomThread.cs => GroupThread/GroupThread.cs} | 14 +++++++-------
.../GroupThreadInstructions.handlebars} | 0
.../IGroupThread.cs} | 4 ++--
src/Assistants/RoomThread/SpectatorAgent.yaml | 10 ----------
src/Assistants/SemanticKernel.Assistants.csproj | 16 ++++++++--------
8 files changed, 30 insertions(+), 34 deletions(-)
rename src/Assistants/{RoomThread/RoomThread.cs => GroupThread/GroupThread.cs} (88%)
rename src/Assistants/{RoomThread/RoomMeetingInstructions.handlebars => GroupThread/GroupThreadInstructions.handlebars} (100%)
rename src/Assistants/{RoomThread/IRoomThread.cs => GroupThread/IGroupThread.cs} (88%)
delete mode 100644 src/Assistants/RoomThread/SpectatorAgent.yaml
diff --git a/SemanticKernel.Assistants.sln b/SemanticKernel.Assistants.sln
index 741a14f..aadc43d 100644
--- a/SemanticKernel.Assistants.sln
+++ b/SemanticKernel.Assistants.sln
@@ -37,23 +37,32 @@ EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
+ Publish|Any CPU = Publish|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{6D530B82-6217-4A67-B22D-E5ACFAE4A511}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6D530B82-6217-4A67-B22D-E5ACFAE4A511}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {6D530B82-6217-4A67-B22D-E5ACFAE4A511}.Publish|Any CPU.ActiveCfg = Publish|Any CPU
+ {6D530B82-6217-4A67-B22D-E5ACFAE4A511}.Publish|Any CPU.Build.0 = Publish|Any CPU
{6D530B82-6217-4A67-B22D-E5ACFAE4A511}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6D530B82-6217-4A67-B22D-E5ACFAE4A511}.Release|Any CPU.Build.0 = Release|Any CPU
{03C21161-E835-4857-A81A-C1727140E920}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{03C21161-E835-4857-A81A-C1727140E920}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {03C21161-E835-4857-A81A-C1727140E920}.Publish|Any CPU.ActiveCfg = Release|Any CPU
+ {03C21161-E835-4857-A81A-C1727140E920}.Publish|Any CPU.Build.0 = Release|Any CPU
{03C21161-E835-4857-A81A-C1727140E920}.Release|Any CPU.ActiveCfg = Release|Any CPU
{03C21161-E835-4857-A81A-C1727140E920}.Release|Any CPU.Build.0 = Release|Any CPU
{BBC6C36F-DC43-4FD3-9706-ECA4738F8F57}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BBC6C36F-DC43-4FD3-9706-ECA4738F8F57}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {BBC6C36F-DC43-4FD3-9706-ECA4738F8F57}.Publish|Any CPU.ActiveCfg = Release|Any CPU
+ {BBC6C36F-DC43-4FD3-9706-ECA4738F8F57}.Publish|Any CPU.Build.0 = Release|Any CPU
{BBC6C36F-DC43-4FD3-9706-ECA4738F8F57}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BBC6C36F-DC43-4FD3-9706-ECA4738F8F57}.Release|Any CPU.Build.0 = Release|Any CPU
{CEAC598F-3763-467A-904D-C0C098DF7B9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CEAC598F-3763-467A-904D-C0C098DF7B9E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {CEAC598F-3763-467A-904D-C0C098DF7B9E}.Publish|Any CPU.ActiveCfg = Publish|Any CPU
+ {CEAC598F-3763-467A-904D-C0C098DF7B9E}.Publish|Any CPU.Build.0 = Publish|Any CPU
{CEAC598F-3763-467A-904D-C0C098DF7B9E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CEAC598F-3763-467A-904D-C0C098DF7B9E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
diff --git a/src/Assistants.Tests/HarnessTests.cs b/src/Assistants.Tests/HarnessTests.cs
index 16d458f..44663a5 100644
--- a/src/Assistants.Tests/HarnessTests.cs
+++ b/src/Assistants.Tests/HarnessTests.cs
@@ -215,7 +215,7 @@ public async Task RoomMeetingSampleTestAsync(string prompt)
var logger = this._loggerFactory.CreateLogger("Tests");
- var thread = Assistant.CreateRoomThread(butler, mathematician);
+ var thread = Assistant.CreateGroupThread(butler, mathematician);
thread.OnMessageReceived += (object? sender, ChatMessageContent message) =>
{
diff --git a/src/Assistants/Assistant.cs b/src/Assistants/Assistant.cs
index 594b79f..46217b5 100644
--- a/src/Assistants/Assistant.cs
+++ b/src/Assistants/Assistant.cs
@@ -1,14 +1,11 @@
// Copyright (c) Kevin BEAUGRAND. All rights reserved.
using Microsoft.Extensions.DependencyInjection;
-using Microsoft.Extensions.Logging;
using Microsoft.SemanticKernel;
using Microsoft.SemanticKernel.ChatCompletion;
+using SemanticKernel.Assistants.GroupThread;
using SemanticKernel.Assistants.Models;
-using SemanticKernel.Assistants.RoomThread;
using System.Collections.Generic;
-using System.IO;
-using YamlDotNet.Serialization;
namespace SemanticKernel.Assistants;
@@ -89,9 +86,9 @@ internal Assistant(AssistantModel model,
///
/// The collaborative agents.
///
- public static IRoomThread CreateRoomThread(params IAssistant[] agents)
+ public static IGroupThread CreateGroupThread(params IAssistant[] agents)
{
- return new RoomThread.RoomThread(agents);
+ return new GroupThread.GroupThread(agents);
}
///
diff --git a/src/Assistants/RoomThread/RoomThread.cs b/src/Assistants/GroupThread/GroupThread.cs
similarity index 88%
rename from src/Assistants/RoomThread/RoomThread.cs
rename to src/Assistants/GroupThread/GroupThread.cs
index 337bae8..2fbbe63 100644
--- a/src/Assistants/RoomThread/RoomThread.cs
+++ b/src/Assistants/GroupThread/GroupThread.cs
@@ -10,9 +10,9 @@
using System.Reflection;
using System.Threading.Tasks;
-namespace SemanticKernel.Assistants.RoomThread;
+namespace SemanticKernel.Assistants.GroupThread;
-internal class RoomThread : IRoomThread
+internal class GroupThread : IGroupThread
{
public IReadOnlyList ChatMessages => throw new NotImplementedException();
@@ -20,12 +20,12 @@ internal class RoomThread : IRoomThread
public event EventHandler? OnMessageReceived;
- internal RoomThread(IEnumerable agents)
+ internal GroupThread(IEnumerable agents)
{
this._assistantThreads = agents.ToDictionary(agent => agent, agent =>
{
var thread = agent.CreateThread();
- thread.AddSystemMessage(this.GetRoomInstructions()(new
+ thread.AddSystemMessage(this.GetInstructions()(new
{
agent,
participants = agents
@@ -71,9 +71,9 @@ await Task.WhenAll(this._assistantThreads
})).ConfigureAwait(false);
}
- private HandlebarsTemplate