Skip to content

🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming

add test

geekanc7f47e80add0
diff --git a/metagpt/actions/action.py b/metagpt/actions/action.py
index 24237c6f1..c8c901eb0 100644
--- a/metagpt/actions/action.py
+++ b/metagpt/actions/action.py
@@ -59,7 +59,7 @@ class Action(BaseModel):
action_subclass_registry[cls.__name__] = cls
def dict(self, *args, **kwargs) -> "DictStrAny":
- obj_dict = super(Action, self).dict(*args, **kwargs)
+ obj_dict = super().dict(*args, **kwargs)
if "llm" in obj_dict:
obj_dict.pop("llm")
return obj_dict
diff --git a/tests/metagpt/actions/test_action_node.py b/tests/metagpt/actions/test_action_node.py
index 24b48f2f6..5bafe2bf2 100644
--- a/tests/metagpt/actions/test_action_node.py
+++ b/tests/metagpt/actions/test_action_node.py
@@ -53,7 +53,7 @@ async def test_debate_one_role():
@pytest.mark.asyncio
-async def test_action_node():
+async def test_action_node_one_layer():
node = ActionNode(key="key-a", expected_type=str, instruction="instruction-b", example="example-c")
raw_template = node.compile(context="123", schema="raw", mode="auto")
@@ -74,3 +74,15 @@ async def test_action_node():
assert "key-a" in markdown_template
assert node_dict["key-a"] == "instruction-b"
+
+
+async def test_action_node_two_layer():
+ node_a = ActionNode(key="key-a", expected_type=str, instruction="i-a", example="e-a")
+ node_b = ActionNode(key="key-b", expected_type=str, instruction="i-b", example="e-b")
+
+ root = ActionNode.from_children(key="", nodes=[node_a, node_b])
+ assert "key-a" in root.children
+ assert node_b in root.children.values()
+ json_template = root.compile(context="123", schema="json", mode="auto")
+ assert "i-a" in json_template