mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-06-08 15:05:17 +02:00
tool_type renaming
This commit is contained in:
parent
638dda31cf
commit
8a14dde219
3 changed files with 8 additions and 1 deletions
|
|
@ -5,6 +5,7 @@ from pydantic import Field
|
|||
from metagpt.actions.ask_review import ReviewConst
|
||||
from metagpt.actions.execute_code import ExecutePyCode
|
||||
from metagpt.actions.write_analysis_code import WriteCodeByGenerate, WriteCodeWithTools
|
||||
from metagpt.actions.write_code_steps import WriteCodeSteps
|
||||
from metagpt.logs import logger
|
||||
from metagpt.roles import Role
|
||||
from metagpt.roles.tool_maker import ToolMaker
|
||||
|
|
@ -16,6 +17,7 @@ class CodeInterpreter(Role):
|
|||
auto_run: bool = True
|
||||
use_tools: bool = False
|
||||
make_udfs: bool = False # whether to save user-defined functions
|
||||
use_code_steps: bool = False
|
||||
execute_code: ExecutePyCode = Field(default_factory=ExecutePyCode, exclude=True)
|
||||
|
||||
def __init__(
|
||||
|
|
@ -56,6 +58,10 @@ class CodeInterpreter(Role):
|
|||
return task_result
|
||||
|
||||
async def _write_and_exec_code(self, max_retry: int = 3):
|
||||
self.planner.current_task.code_steps = (
|
||||
await WriteCodeSteps().run(self.planner.plan) if self.use_code_steps else ""
|
||||
)
|
||||
|
||||
counter = 0
|
||||
success = False
|
||||
|
||||
|
|
@ -90,6 +96,7 @@ class CodeInterpreter(Role):
|
|||
logger.info(f"ready to {todo.name}")
|
||||
|
||||
context = self.planner.get_useful_memories()
|
||||
# print(*context, sep="\n***\n")
|
||||
code = await todo.run(context=context, plan=self.planner.plan, temperature=0.0)
|
||||
# 暂时在这里转换 WriteCodeWithTools 的输出
|
||||
if isinstance(code, str):
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
from metagpt.prompts.tool_type import (
|
||||
from metagpt.prompts.tool_types import (
|
||||
DATA_PREPROCESS_PROMPT,
|
||||
FEATURE_ENGINEERING_PROMPT,
|
||||
MODEL_EVALUATE_PROMPT,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue