mirror of https://github.com/microsoft/autogen.git
Compare commits
3 Commits
564e5c1dbc
...
7a0ef576b7
Author | SHA1 | Date |
---|---|---|
![]() |
7a0ef576b7 | |
![]() |
3425d7dc2c | |
![]() |
2766b47142 |
|
@ -1,6 +1,3 @@
|
||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Termination.cs
|
|
||||||
|
|
||||||
namespace Microsoft.AutoGen.AgentChat.Abstractions;
|
namespace Microsoft.AutoGen.AgentChat.Abstractions;
|
||||||
|
|
||||||
public static class TerminationConditionExtensions
|
public static class TerminationConditionExtensions
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// ExternalTermination.cs
|
|
||||||
|
|
||||||
using Microsoft.AutoGen.AgentChat.Abstractions;
|
using Microsoft.AutoGen.AgentChat.Abstractions;
|
||||||
|
|
||||||
namespace Microsoft.AutoGen.AgentChat.Terminations;
|
namespace Microsoft.AutoGen.AgentChat.Terminations;
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// FunctionCallTermination.cs
|
|
||||||
|
|
||||||
using Microsoft.AutoGen.AgentChat.Abstractions;
|
using Microsoft.AutoGen.AgentChat.Abstractions;
|
||||||
|
|
||||||
namespace Microsoft.AutoGen.AgentChat.Terminations;
|
namespace Microsoft.AutoGen.AgentChat.Terminations;
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// HandoffTermination.cs
|
|
||||||
|
|
||||||
using Microsoft.AutoGen.AgentChat.Abstractions;
|
using Microsoft.AutoGen.AgentChat.Abstractions;
|
||||||
|
|
||||||
namespace Microsoft.AutoGen.AgentChat.Terminations;
|
namespace Microsoft.AutoGen.AgentChat.Terminations;
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// SourceMatchTermination.cs
|
|
||||||
|
|
||||||
using Microsoft.AutoGen.AgentChat.Abstractions;
|
using Microsoft.AutoGen.AgentChat.Abstractions;
|
||||||
|
|
||||||
namespace Microsoft.AutoGen.AgentChat.Terminations;
|
namespace Microsoft.AutoGen.AgentChat.Terminations;
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// StopMessageTermination.cs
|
|
||||||
|
|
||||||
using Microsoft.AutoGen.AgentChat.Abstractions;
|
using Microsoft.AutoGen.AgentChat.Abstractions;
|
||||||
|
|
||||||
namespace Microsoft.AutoGen.AgentChat.Terminations;
|
namespace Microsoft.AutoGen.AgentChat.Terminations;
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// TextMentionTermination.cs
|
|
||||||
|
|
||||||
using Microsoft.AutoGen.AgentChat.Abstractions;
|
using Microsoft.AutoGen.AgentChat.Abstractions;
|
||||||
using Microsoft.Extensions.AI;
|
using Microsoft.Extensions.AI;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// TokenUsageTermination.cs
|
|
||||||
|
|
||||||
using Microsoft.AutoGen.AgentChat.Abstractions;
|
using Microsoft.AutoGen.AgentChat.Abstractions;
|
||||||
|
|
||||||
namespace Microsoft.AutoGen.AgentChat.Terminations;
|
namespace Microsoft.AutoGen.AgentChat.Terminations;
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// TerminationConditionTests.cs
|
|
||||||
|
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using Microsoft.AutoGen.AgentChat.Abstractions;
|
using Microsoft.AutoGen.AgentChat.Abstractions;
|
||||||
using Microsoft.AutoGen.AgentChat.Terminations;
|
using Microsoft.AutoGen.AgentChat.Terminations;
|
||||||
|
@ -473,4 +470,25 @@ public class TerminationConditionTests
|
||||||
termination.Reset();
|
termination.Reset();
|
||||||
termination.IsTerminated.Should().BeFalse();
|
termination.IsTerminated.Should().BeFalse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task Test_SourceMatchTermination()
|
||||||
|
{
|
||||||
|
SourceMatchTermination termination = new("user", "agent");
|
||||||
|
termination.IsTerminated.Should().BeFalse();
|
||||||
|
|
||||||
|
TextMessage userMessage = new() { Content = "Hello", Source = "user" };
|
||||||
|
TextMessage agentMessage = new() { Content = "World", Source = "agent" };
|
||||||
|
TextMessage otherMessage = new() { Content = "Hi", Source = "other" };
|
||||||
|
|
||||||
|
await termination.InvokeExpectingNullAsync([]);
|
||||||
|
await termination.InvokeExpectingStopAsync([userMessage]);
|
||||||
|
await termination.InvokeExpectingStopAsync([agentMessage]);
|
||||||
|
await termination.InvokeExpectingNullAsync([otherMessage]);
|
||||||
|
|
||||||
|
await termination.InvokeExpectingFailureAsync([], reset: false);
|
||||||
|
|
||||||
|
termination.Reset();
|
||||||
|
termination.IsTerminated.Should().BeFalse();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -291,7 +291,7 @@
|
||||||
"A --- B\n",
|
"A --- B\n",
|
||||||
"| |\n",
|
"| |\n",
|
||||||
"| |\n",
|
"| |\n",
|
||||||
"C --- D\n",
|
"D --- C\n",
|
||||||
"```\n",
|
"```\n",
|
||||||
"\n",
|
"\n",
|
||||||
"Each solver agent is connected to two other solver agents. \n",
|
"Each solver agent is connected to two other solver agents. \n",
|
||||||
|
|
Loading…
Reference in New Issue