New implementations of AutoGen framework which was python now available in Semantic Kernel.
Implemented the Chat over the weekend 2024-08-11 to see how it works. Simple test between copywriter and reviewer
Can be used as Senior Developer to do the high level design i.e. types and data structures and logical groupings of fields into tabs, to Junior to implement the script with Senior doing the review. Then passing it to a database administrator to implement the tables and the scripts to get, update and delete stored procedures.
Another example can be were generated code can be sent to a code reviewer that can review the code sent for compliance with the standards set forth in the agent instructions.
Code
public class AgentChatSample : SemanticKerneler { private const string ReviewerName = "ArtDirector"; private const string ReviewerInstructions = @" You are an art director who has opinions about copywriting born of a love for David Ogilvy. The goal is to determine if the given copy is acceptable to print. If so, state that it is approved. If not, provide insight on how to refine suggested copy without example. "; private const string CopyWriterName = "CopyWriter"; private const string CopyWriterInstructions = @" You are a copywriter with ten years of experience and are known for brevity and a dry humor. The goal is to refine and decide on the single best copy as an expert in the field. Only provide a single proposal per response. You're laser focused on the goal at hand. Don't waste time with chit chat. Consider suggestions when refining an idea. "; public AgentChatSample(IConfiguration configuration) : base(configuration) { } public async Task UseAgentGroupChatWithTwoAgentsAsync() { // Define the agents#pragma warning disable SKEXP0110 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. ChatCompletionAgent agentReviewer = new() { Instructions = ReviewerInstructions, Name = ReviewerName, Kernel = this.CreateKernelWithChatCompletion(), }; ChatCompletionAgent agentWriter = new() { Instructions = CopyWriterInstructions, Name = CopyWriterName, Kernel = this.CreateKernelWithChatCompletion(), }; // Create a chat for agent interaction. AgentGroupChat chat = new(agentWriter, agentReviewer) { ExecutionSettings = new() { // Here a TerminationStrategy subclass is used that will terminate when // an assistant message contains the term "approve". TerminationStrategy = new ApprovalTerminationStrategy() { // Only the art-director may approve. Agents = new List<Agent>() { agentReviewer }, // Limit total number of turns MaximumIterations = 10, } } }; // Invoke chat and display messages. string input = "concept: Flowcentric - Business Process Management Software"; chat.AddChatMessage(new ChatMessageContent(AuthorRole.User, input)); Console.WriteLine($"# {AuthorRole.User}: '{input}'"); await foreach (ChatMessageContent content in chat.InvokeAsync()) {#pragma warning disable SKEXP0001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. Console.WriteLine($"# {content.Role} - {content.AuthorName ?? "*"}: '{content.Content}'");#pragma warning restore SKEXP0001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. } Console.WriteLine($"# IS COMPLETE: {chat.IsComplete}"); } private sealed class ApprovalTerminationStrategy : TerminationStrategy { // Terminate when the final message contains the term "approve" protected override Task<bool> ShouldAgentTerminateAsync(Agent agent, IReadOnlyList<ChatMessageContent> history, CancellationToken cancellationToken) => Task.FromResult(history[history.Count - 1].Content?.Contains("approve", StringComparison.OrdinalIgnoreCase) ?? false); }#pragma warning restore SKEXP0110 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. }
Output
# user: 'concept: Flowcentric - Business Process Management Software'
# assistant - CopyWriter: '"Flowcentric: Because your business shouldn't feel like herding cats."'
# assistant - ArtDirector: 'This copy is not acceptable to print. While it attempts to leverage humor, it may not resonate with all audiences who are looking for professionalism in business process management software. To refine it, focus on clearly communicating the software's benefits and capabilities without relying on informal analogies. Aim for a tone that instills confidence and highlights the efficiency and effectiveness of Flowcentric in managing business processes.'
# assistant - CopyWriter: '"Flowcentric: Streamline your processes, stop the chaos."'
# assistant - ArtDirector: 'This copy is somewhat acceptable, but it can be refined for greater impact. While it conveys a clear message about efficiency, the phrase "stop the chaos" could be perceived as negative. To improve it, consider emphasizing the positive transformation that Flowcentric brings to a business rather than focusing on what it stops. Highlight the solutions or enhancements that the software offers to foster a more inviting and aspirational tone.'
# assistant - CopyWriter: '"Flowcentric: Transform chaos into clarity."'
# assistant - ArtDirector: 'This copy is approved. It effectively captures the essence of the software by suggesting a positive transformation and appealing to potential users' desire for clarity in their business processes. The message is concise and memorable, aligning well with the purpose of Flowcentric.'
# IS COMPLETE: True