-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into stream-token-count
- Loading branch information
Showing
15 changed files
with
598 additions
and
417 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = "0.2.32" | ||
__version__ = "0.2.33" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// GroupChatTests.cs | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using FluentAssertions; | ||
using Xunit; | ||
|
||
namespace AutoGen.Tests; | ||
|
||
public class GroupChatTests | ||
{ | ||
[Fact] | ||
public async Task ItSendMessageTestAsync() | ||
{ | ||
var alice = new DefaultReplyAgent("Alice", "I am alice"); | ||
var bob = new DefaultReplyAgent("Bob", "I am bob"); | ||
|
||
var groupChat = new GroupChat([alice, bob]); | ||
|
||
var chatHistory = new List<IMessage>(); | ||
|
||
var maxRound = 10; | ||
await foreach (var message in groupChat.SendAsync(chatHistory, maxRound)) | ||
{ | ||
chatHistory.Add(message); | ||
} | ||
|
||
chatHistory.Count().Should().Be(10); | ||
} | ||
|
||
[Fact] | ||
public async Task ItTerminateConversationWhenAgentReturnTerminateKeyWord() | ||
{ | ||
var alice = new DefaultReplyAgent("Alice", "I am alice"); | ||
var bob = new DefaultReplyAgent("Bob", "I am bob"); | ||
var cathy = new DefaultReplyAgent("Cathy", $"I am cathy, {GroupChatExtension.TERMINATE}"); | ||
|
||
var groupChat = new GroupChat([alice, bob, cathy]); | ||
|
||
var chatHistory = new List<IMessage>(); | ||
|
||
var maxRound = 10; | ||
await foreach (var message in groupChat.SendAsync(chatHistory, maxRound)) | ||
{ | ||
chatHistory.Add(message); | ||
} | ||
|
||
chatHistory.Count().Should().Be(3); | ||
chatHistory.Last().From.Should().Be("Cathy"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.