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 GetRoomInstructions() + private HandlebarsTemplate GetInstructions() { - var roomInstructionTemplate = this.ReadManifestResource("RoomMeetingInstructions.handlebars"); + var roomInstructionTemplate = this.ReadManifestResource("GroupThreadInstructions.handlebars"); IHandlebars handlebarsInstance = Handlebars.Create( new HandlebarsConfiguration @@ -88,7 +88,7 @@ private HandlebarsTemplate GetRoomInstructions() private string ReadManifestResource(string resourceName) { - var promptStream = Assembly.GetExecutingAssembly().GetManifestResourceStream($"{typeof(RoomThread).Namespace}.{resourceName}")!; + var promptStream = Assembly.GetExecutingAssembly().GetManifestResourceStream($"{typeof(GroupThread).Namespace}.{resourceName}")!; using var reader = new StreamReader(promptStream); diff --git a/src/Assistants/RoomThread/RoomMeetingInstructions.handlebars b/src/Assistants/GroupThread/GroupThreadInstructions.handlebars similarity index 100% rename from src/Assistants/RoomThread/RoomMeetingInstructions.handlebars rename to src/Assistants/GroupThread/GroupThreadInstructions.handlebars diff --git a/src/Assistants/RoomThread/IRoomThread.cs b/src/Assistants/GroupThread/IGroupThread.cs similarity index 88% rename from src/Assistants/RoomThread/IRoomThread.cs rename to src/Assistants/GroupThread/IGroupThread.cs index 2e7b6f4..5178bd3 100644 --- a/src/Assistants/RoomThread/IRoomThread.cs +++ b/src/Assistants/GroupThread/IGroupThread.cs @@ -4,12 +4,12 @@ using System; using System.Threading.Tasks; -namespace SemanticKernel.Assistants.RoomThread; +namespace SemanticKernel.Assistants.GroupThread; /// /// Interface representing a room thread. /// -public interface IRoomThread +public interface IGroupThread { /// /// Adds the user message to the discussion. diff --git a/src/Assistants/RoomThread/SpectatorAgent.yaml b/src/Assistants/RoomThread/SpectatorAgent.yaml deleted file mode 100644 index 0b72b98..0000000 --- a/src/Assistants/RoomThread/SpectatorAgent.yaml +++ /dev/null @@ -1,10 +0,0 @@ -name: Auditor -description: A spectator of this meeting. -instructions: | - You are a spectator of a conversation between agents. - You have the access to all the conversation. - Regarding this conversation, you have to decide if this conversation is ended or not. - If the conversation is supposed to end, return only "True", otherwise simply return "False". -execution_settings: - model: gpt-4 - deployment_name: gpt-4-1106-preview diff --git a/src/Assistants/SemanticKernel.Assistants.csproj b/src/Assistants/SemanticKernel.Assistants.csproj index e345fbe..a077833 100644 --- a/src/Assistants/SemanticKernel.Assistants.csproj +++ b/src/Assistants/SemanticKernel.Assistants.csproj @@ -25,21 +25,21 @@ - + - - - - - + + + + + - + - +