Skip to content

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

role pydantic init

yzlin35438e7b037d
diff --git a/metagpt/roles/code_interpreter.py b/metagpt/roles/code_interpreter.py
index 1ae4feec7..1cae17ca0 100644
--- a/metagpt/roles/code_interpreter.py
+++ b/metagpt/roles/code_interpreter.py
@@ -9,6 +9,8 @@ from metagpt.schema import Message, Task, TaskResult
class CodeInterpreter(Role):
+ name: str = "Charlie"
+ profile: str = "CodeInterpreter"
auto_run: bool = True
use_tools: bool = False
execute_code: ExecuteNbCode = Field(default_factory=ExecuteNbCode, exclude=True)
@@ -16,17 +18,12 @@ class CodeInterpreter(Role):
def __init__(
self,
- name="Charlie",
- profile="CodeInterpreter",
- goal="",
auto_run=True,
use_tools=False,
tools=[],
**kwargs,
):
- super().__init__(
- name=name, profile=profile, goal=goal, auto_run=auto_run, use_tools=use_tools, tools=tools, **kwargs
- )
+ super().__init__(auto_run=auto_run, use_tools=use_tools, tools=tools, **kwargs)
self._set_react_mode(react_mode="plan_and_act", auto_run=auto_run, use_tools=use_tools)
if use_tools and tools:
from metagpt.tools.tool_registry import (
diff --git a/metagpt/roles/ml_engineer.py b/metagpt/roles/ml_engineer.py
index 19c34f62d..633c3306c 100644
--- a/metagpt/roles/ml_engineer.py
+++ b/metagpt/roles/ml_engineer.py
@@ -8,12 +8,11 @@ from metagpt.utils.common import any_to_str
class MLEngineer(CodeInterpreter):
+ name: str = "Mark"
+ profile: str = "MLEngineer"
debug_context: list = []
latest_code: str = ""
- def __init__(self, name="Mark", profile="MLEngineer", **kwargs):
- super().__init__(name=name, profile=profile, **kwargs)
-
async def _write_code(self):
if not self.use_tools:
return await super()._write_code()