From e6e09cd99c4356cb298639648de715a38585d954 Mon Sep 17 00:00:00 2001 From: "yongen.loong" Date: Thu, 7 Nov 2024 10:28:53 +0800 Subject: [PATCH] feat: code types --- examples/software_team/agents.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/examples/software_team/agents.py b/examples/software_team/agents.py index 75e78a50..227b6b0e 100644 --- a/examples/software_team/agents.py +++ b/examples/software_team/agents.py @@ -1,19 +1,19 @@ from swarm import Agent -def write_code(task): +def write_code(task, type="frontend"): """ Provide the code written for the given task. """ - return f"Code for {task} has been written." + return f"Code for {task} ({type}) has been written." -def test_code(code): +def test_code(code, type="frontend"): """ Provide the test results. When there is a problem with the test results, you can feedback to the User and Developer. """ - return f"Code '{code}' has been tested and passed all tests." + return f"Code '{code}' for {type} has been tested and passed all tests." def manage_project(task): @@ -27,17 +27,24 @@ def get_status(task): """ When the user asks for the status of the project, you can provide the output of the code from Developer or the result of the tests from Tester. """ - return f"Project task '{task}' is in progress. The output is as follows:" + return f"Project task '{task}' is in progress." developer_agent = Agent( name="Developer Agent", - instructions="You are responsible for writing code based on the given task.", + instructions=""" + You are responsible for writing code based on the given task. + There may be different types of code written for frontend, backend, etc. + """, functions=[write_code], ) tester_agent = Agent( name="Tester Agent", - instructions="You are responsible for testing the given code.", + instructions=""" + You are responsible for testing the code written by the Developer. + There may be different types of code written for frontend, backend, etc. + There may be different types of tests such as unit tests, integration tests, etc. + """, functions=[test_code], )