mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-06-05 14:55:18 +02:00
role pydantic init
This commit is contained in:
parent
1a1610a67e
commit
35438e7b03
2 changed files with 5 additions and 9 deletions
|
|
@ -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 (
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue