mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-07-05 16:02:14 +02:00
Merge branch 'dev' into dev_make_tools
This commit is contained in:
commit
d72b457c83
7 changed files with 316 additions and 62 deletions
|
|
@ -46,9 +46,12 @@ class ExecuteCode(ABC):
|
|||
class ExecutePyCode(ExecuteCode, Action):
|
||||
"""execute code, return result to llm, and display it."""
|
||||
|
||||
def __init__(self, name: str = "python_executor", context=None, llm=None):
|
||||
def __init__(self, name: str = "python_executor", context=None, llm=None, nb=None):
|
||||
super().__init__(name, context, llm)
|
||||
self.nb = nbformat.v4.new_notebook()
|
||||
if nb is None:
|
||||
self.nb = nbformat.v4.new_notebook()
|
||||
else:
|
||||
self.nb = nb
|
||||
self.nb_client = NotebookClient(self.nb)
|
||||
self.console = Console()
|
||||
self.interaction = "ipython" if self.is_ipython() else "terminal"
|
||||
|
|
|
|||
|
|
@ -210,6 +210,8 @@ class WriteCodeWithTools(BaseWriteAnalysisCode):
|
|||
module_name=module_name,
|
||||
tool_catalog=tool_catalog,
|
||||
)
|
||||
|
||||
|
||||
else:
|
||||
prompt = GENERATE_CODE_PROMPT.format(
|
||||
user_requirement=plan.goal,
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ class WriteCodeSteps(Action):
|
|||
def process_task(task):
|
||||
task_dict = task.dict()
|
||||
# ptask = {k: task_dict[k] for k in task_dict if k in select_task_keys }
|
||||
ptask = f"task_id_{task_dict['task_id']}:{task_dict['instruction']}\n"
|
||||
ptask = f"task_id_{task_dict['task_id']}:{task_dict['instruction']}"
|
||||
return ptask
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue