Skip to content

A programming framework for agentic AI

#2708 add Add a judgment to the graph constructor (#2709)

Jeffrey Su08726421fc2d
diff --git a/dotnet/AutoGen.sln b/dotnet/AutoGen.sln
index 5ecfe1938..cd1d68340 100644
--- a/dotnet/AutoGen.sln
+++ b/dotnet/AutoGen.sln
@@ -1,4 +1,4 @@
-
+
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.8.34322.80
@@ -206,4 +206,4 @@ Global
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {93384647-528D-46C8-922C-8DB36A382F0B}
EndGlobalSection
-EndGlobal
+EndGlobal
\ No newline at end of file
diff --git a/dotnet/src/AutoGen.Core/GroupChat/Graph.cs b/dotnet/src/AutoGen.Core/GroupChat/Graph.cs
index 02f4da50b..d6b71e2a3 100644
--- a/dotnet/src/AutoGen.Core/GroupChat/Graph.cs
+++ b/dotnet/src/AutoGen.Core/GroupChat/Graph.cs
@@ -12,9 +12,16 @@ public class Graph
{
private readonly List<Transition> transitions = new List<Transition>();
- public Graph(IEnumerable<Transition> transitions)
+ public Graph()
{
- this.transitions.AddRange(transitions);
+ }
+
+ public Graph(IEnumerable<Transition>? transitions)
+ {
+ if (transitions != null)
+ {
+ this.transitions.AddRange(transitions);
+ }
}
public void AddTransition(Transition transition)
diff --git a/dotnet/test/AutoGen.Tests/GroupChat/GraphTests.cs b/dotnet/test/AutoGen.Tests/GroupChat/GraphTests.cs
new file mode 100644
index 000000000..77e2c99dc
--- /dev/null
+++ b/dotnet/test/AutoGen.Tests/GroupChat/GraphTests.cs
@@ -0,0 +1,18 @@
+
+using Xunit;
+
+namespace AutoGen.Tests
+{
+ public class GraphTests
+ {
+ [Fact]
+ public void GraphTest()
+ {
+ var graph1 = new Graph();
+ Assert.NotNull(graph1);
+
+ var graph2 = new Graph(null);
+ Assert.NotNull(graph2);
+ }
+ }
+}