mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-06-11 15:15:18 +02:00
add code_prompt for make tools.
This commit is contained in:
parent
7ddca9e995
commit
fdf16f5535
1 changed files with 4 additions and 2 deletions
|
|
@ -180,10 +180,12 @@ class MLEngineer(Role):
|
|||
debug_context = [self.get_useful_memories(task_exclude_field={'result', 'code_steps'})[0]]
|
||||
cause_by = WriteCodeByGenerate
|
||||
|
||||
if self.make_udfs:
|
||||
if self.make_udfs and len(code.split('\n')) > 2:
|
||||
# make and save user-defined function tools.
|
||||
make_tools = MakeTools()
|
||||
tool_code = await make_tools.run(code)
|
||||
code_prompt = f"The following code is about {self.plan.current_task.instruction},\
|
||||
convert it to be a General Function, {code}"
|
||||
tool_code = await make_tools.run(code_prompt)
|
||||
make_tools.save(tool_code)
|
||||
else:
|
||||
logger.info("Write code with tools")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue