Skip to content

Commit d16fed4

Browse files
authored
.Net Fix Agent Orchestration: Fix message type (#12715)
### Motivation and Context <!-- Thank you for your contribution to the semantic-kernel repo! Please help reviewers and future users, providing the following information: 1. Why is this change required? 2. What problem does it solve? 3. What scenario does it contribute to? 4. If it fixes an open issue, please link to the issue here. --> Replace inadvertant use of GroupChatOrchestration `Result` message with the expected `Magentic` message type. ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> MagenticOrchestration does not define a handler for GroupChatOrchestration `Result` message since it was not intended to mix message protocols. ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [X] The code builds clean without any errors or warnings - [X] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [X] All unit tests pass, and I have added new tests where possible - [X] I didn't break anyone 😄
1 parent d0fed70 commit d16fed4

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

dotnet/src/Agents/Magentic/MagenticManagerActor.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
using System.Threading.Tasks;
99
using Microsoft.Extensions.Logging;
1010
using Microsoft.SemanticKernel.Agents.Orchestration;
11-
using Microsoft.SemanticKernel.Agents.Orchestration.GroupChat;
1211
using Microsoft.SemanticKernel.Agents.Runtime;
1312
using Microsoft.SemanticKernel.Agents.Runtime.Core;
1413
using Microsoft.SemanticKernel.ChatCompletion;

dotnet/src/Agents/Magentic/MagenticMessages.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) Microsoft. All rights reserved.
22

33
using System.Collections.Generic;
4+
using Microsoft.SemanticKernel.ChatCompletion;
45

56
namespace Microsoft.SemanticKernel.Agents.Magentic;
67

@@ -76,4 +77,9 @@ public sealed class InputTask
7677
/// Extension method to convert a <see cref="ChatMessageContent"/> to a <see cref="Result"/> message.
7778
/// </summary>
7879
public static Result AsResultMessage(this ChatMessageContent message) => new() { Message = message };
80+
81+
/// <summary>
82+
/// Extension method to convert a <see cref="string"/> to a <see cref="Result"/>.
83+
/// </summary>
84+
public static Result AsResultMessage(this string text) => new() { Message = new(AuthorRole.Assistant, text) };
7985
}

dotnet/src/Agents/Orchestration/GroupChat/GroupChatMessages.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace Microsoft.SemanticKernel.Agents.Orchestration.GroupChat;
88
/// <summary>
99
/// Common messages used for agent chat patterns.
1010
/// </summary>
11-
public static class GroupChatMessages
11+
internal static class GroupChatMessages
1212
{
1313
/// <summary>
1414
/// An empty message instance as a default.
@@ -79,7 +79,7 @@ public sealed class InputTask
7979
public static InputTask AsInputTaskMessage(this IEnumerable<ChatMessageContent> messages) => new() { Messages = messages };
8080

8181
/// <summary>
82-
/// Extension method to convert a <see cref="ChatMessageContent"/> to a <see cref="Result"/>.
82+
/// Extension method to convert a <see cref="string"/> to a <see cref="Result"/>.
8383
/// </summary>
8484
public static Result AsResultMessage(this string text) => new() { Message = new(AuthorRole.Assistant, text) };
8585
}

0 commit comments

Comments
 (0)