新增robot;调整engineer

This commit is contained in:
2025-01-13 18:17:27 +08:00
parent 5f9111948b
commit 6fcac50416
7 changed files with 186 additions and 32 deletions

View File

@@ -7,9 +7,10 @@ from autogen_agentchat.teams import SelectorGroupChat, RoundRobinGroupChat
from autogen_agentchat.ui import Console
from autogen_agentchat.base import Handoff
from autogen_ext.models.openai import OpenAIChatCompletionClient
from constant import MODEL, OPENAI_API_KEY, OPENAI_BASE_URL
from constant import MODEL, OPENAI_API_KEY, OPENAI_BASE_URL, code_executor
from scientist_team import create_scientist_team
from engineer_team import create_engineer_team
from robot_platform import create_robot_team
model_client = OpenAIChatCompletionClient(
model=MODEL,
@@ -23,10 +24,11 @@ model_client = OpenAIChatCompletionClient(
},
)
async def main(task: str = "") -> dict:
scientist_team = create_scientist_team()
engineer_team = create_engineer_team()
# await code_executor.start()
robot_platform = create_robot_team()
result = {}
user = UserProxyAgent("user", input_func=input)
@@ -43,24 +45,34 @@ async def main(task: str = "") -> dict:
1. User: A human agent to whom you transfer information whenever you need to confirm your execution steps to a human.
2. Engineer team: A team of professional engineers who are responsible for writing code, visualizing experimental schemes, converting experimental schemes to JSON, and more.
- The engineer team has the following members:
2.1 Software engineer: Good at writing code to turn structured schemes in JSON format into Python code that can be executed by robots.
2.2 Structural engineer: Focus on converting natural language synthesis schemes to formatted synthesis schemes in JSON or XML format.
2.1 Structural engineer: Focus on converting natural language synthesis schemes to formatted synthesis schemes in JSON or XML format.
2.2 Data_Engineer: A professional data engineer will use Python to implement various machine learning algorithms to analyze and visualize data.
3. Scientist team: A professional team of material scientists who are mainly responsible for consulting on material synthesis, structure, application and properties.
- The scientist team has the following members:
3.1 Synthesis Scientist: who is good at giving perfect and correct synthesis solutions.
3.2 Structure Scientist: focusing on agents of structural topics in materials science.
3.3 Property Scientist: focuses on physical and chemistry property topics in materials science.
3.4 Application Scientist: Focus on practical applications of materials, such as devices, chips, etc.
4. Robot Platform: A robotic platform is responsible for performing automated synthesis experiments, automated characterization experiments, and collecting experimental logs.
- The Robot Platform has the following members:
4.1 RobotIO_Agent: The agent responsible for the input and output of the robot platform. Pass a structured JSON schema to the robot; Get the experiment log of the robot.
You only plan and delegate tasks - you do not execute them yourself.
第一次回答时你需要初始化任务分配并按顺序执行在后续的回答中重申你的任务分配使用如下格式并利用Mermaid绘制流程图
| Team_name | Member_name | sub-task |
| ----------- | ------------- | ---------------------------- |
| <team_name> | <member_name> | <brief sub-task description> |
回答时你需要初始化/更新如下任务分配表和Mermaid流程图并按顺序执行使用如下格式并利用
| Team_name | Member_name | sub-task |
| ----------- | ------------- | ------------------------------------ |
| <team_name> | <member_name> | <status: brief sub-task description> |
```mermaid
graph
graph TD
User[User]
subgraph <team_name>
A1[<member_name>]
end
style xxx # 推荐多样的风格
...
User --> A1
...
```
@@ -70,7 +82,7 @@ async def main(task: str = "") -> dict:
**Next sub-task:**
n. <team> : <subtask>
You can end with "USER" if you need to, which means you need human approval or other advice or instructions;
You can end with "HUMAN" if you need to, which means you need human approval or other advice or instructions;
After plan and delegate tasks are complete, end with "START";
Determine if all sub-teams have completed their tasks, and if so, summarize the findings and end with "TERMINATE".
""",
@@ -87,12 +99,12 @@ async def main(task: str = "") -> dict:
def selector_func(messages: Sequence[AgentEvent | ChatMessage]) -> str | None:
if messages[-1].source != planning_agent.name:
return planning_agent.name # Always return to the planning agent after the other agents have spoken.
elif "USER" in messages[-1].content:
elif "HUMAN" in messages[-1].content:
return user.name
return None
team = SelectorGroupChat(
[planning_agent, user, scientist_team, engineer_team],
[planning_agent, user, scientist_team, engineer_team, robot_platform],
model_client=model_client, # Use a smaller model for the selector.
termination_condition=termination,
selector_func=selector_func,