.NET: Update GroupChat workflow builder to support name and description#4334
.NET: Update GroupChat workflow builder to support name and description#4334
Conversation
There was a problem hiding this comment.
Pull request overview
This PR enhances the GroupChatWorkflowBuilder by adding support for setting a name and description on workflows, improving the developer experience when using DevUI.
Changes:
- Added
WithName()andWithDescription()methods to GroupChatWorkflowBuilder - Updated the Build() method to apply name and description to the workflow when provided
- Added comprehensive unit tests covering various scenarios for name and description settings
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| GroupChatWorkflowBuilder.cs | Added private fields for name/description and new builder methods to set them; updated Build() to conditionally apply these values |
| AgentWorkflowBuilderTests.cs | Added three new unit tests to verify name/description behavior in different scenarios |
| Program.cs | Demonstrated usage by adding name and description to the round-robin translation workflow example |
| private string _name = string.Empty; | ||
| private string _description = string.Empty; |
There was a problem hiding this comment.
Initializing _name and _description to string.Empty will prevent them from being null when not set, but the tests expect null values. Consider initializing these fields to null (private string? _name; private string? _description;) to match the expected behavior shown in the test BuildGroupChat_WithoutNameOrDescription_DefaultsToNull.
| private string _name = string.Empty; | |
| private string _description = string.Empty; | |
| private string? _name; | |
| private string? _description; |
| /// </summary> | ||
| /// <param name="name">The name of the workflow.</param> | ||
| /// <returns>This instance of the <see cref="GroupChatWorkflowBuilder"/>.</returns> | ||
| public GroupChatWorkflowBuilder WithName(string name) |
There was a problem hiding this comment.
The WithName method does not validate if the name parameter is null. Consider adding null validation or documenting the expected behavior when null is passed, especially since the field is initialized to string.Empty.
| /// <param name="description">The description of what the workflow does.</param> | ||
| /// <returns>This instance of the <see cref="GroupChatWorkflowBuilder"/>.</returns> | ||
| public GroupChatWorkflowBuilder WithDescription(string description) | ||
| { |
There was a problem hiding this comment.
The WithDescription method does not validate if the description parameter is null. Consider adding null validation or documenting the expected behavior when null is passed, especially since the field is initialized to string.Empty.
| { | |
| { | |
| Throw.IfNull(description); |
Description
This PR updates the GroupChatWorkflowBuilder to support name and description on the workflow for better user experience using DevUI.
Fixes #1885
Contribution Checklist