From a249e46259d3f8e055c896bc0b5615ca5d693871 Mon Sep 17 00:00:00 2001 From: better629 Date: Fri, 12 Jan 2024 18:56:42 +0800 Subject: [PATCH 1/2] update prompt of review/revise to meet gpt3.5 --- metagpt/actions/action_node.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/metagpt/actions/action_node.py b/metagpt/actions/action_node.py index b4d8c32df..b511f2662 100644 --- a/metagpt/actions/action_node.py +++ b/metagpt/actions/action_node.py @@ -61,7 +61,7 @@ Follow instructions of nodes, generate output and make sure it follows the forma REVIEW_TEMPLATE = """ ## context -Compare the keys of nodes_output and the corresponding requirements one by one. If a key that does not match the requirement is found, provide the comment content on how to modify it. No output is required for matching keys. +Compare the key's value of nodes_output and the corresponding requirements one by one. If a key's value that does not match the requirement is found, provide the comment content on how to modify it. No output is required for matching keys. ### nodes_output {nodes_output} @@ -86,7 +86,7 @@ Compare the keys of nodes_output and the corresponding requirements one by one. {constraint} ## action -generate output and make sure it follows the format example. +Follow format example's json format, generate output and make sure it follows the format example. """ REVISE_TEMPLATE = """ @@ -108,7 +108,7 @@ change the nodes_output key's value to meet its comment and no need to add extra {constraint} ## action -generate output and make sure it follows the format example. +Follow format example's json format, generate output and make sure it follows the format example. """ @@ -469,7 +469,7 @@ class ActionNode: return dict() prompt = template.format( - nodes_output=json.dumps(nodes_output, ensure_ascii=False, indent=4), tag=TAG, constraint=FORMAT_CONSTRAINT + nodes_output=json.dumps(nodes_output, ensure_ascii=False), tag=TAG, constraint=FORMAT_CONSTRAINT ) content = await self.llm.aask(prompt) @@ -563,7 +563,7 @@ class ActionNode: instruction = self.compile_instruction(schema="markdown", mode="auto", exclude=exclude_keys) prompt = template.format( - nodes_output=json.dumps(nodes_output, ensure_ascii=False, indent=4), + nodes_output=json.dumps(nodes_output, ensure_ascii=False), example=example, instruction=instruction, constraint=FORMAT_CONSTRAINT, From 4ceff0ec29051033e00a55a2c984d1616c0314f5 Mon Sep 17 00:00:00 2001 From: better629 Date: Mon, 15 Jan 2024 14:48:31 +0800 Subject: [PATCH 2/2] add prompt_schema --- metagpt/actions/action_node.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/metagpt/actions/action_node.py b/metagpt/actions/action_node.py index b511f2662..4f61af4ed 100644 --- a/metagpt/actions/action_node.py +++ b/metagpt/actions/action_node.py @@ -86,7 +86,7 @@ Compare the key's value of nodes_output and the corresponding requirements one b {constraint} ## action -Follow format example's json format, generate output and make sure it follows the format example. +Follow format example's {prompt_schema} format, generate output and make sure it follows the format example. """ REVISE_TEMPLATE = """ @@ -108,7 +108,7 @@ change the nodes_output key's value to meet its comment and no need to add extra {constraint} ## action -Follow format example's json format, generate output and make sure it follows the format example. +Follow format example's {prompt_schema} format, generate output and make sure it follows the format example. """ @@ -469,7 +469,8 @@ class ActionNode: return dict() prompt = template.format( - nodes_output=json.dumps(nodes_output, ensure_ascii=False), tag=TAG, constraint=FORMAT_CONSTRAINT + nodes_output=json.dumps(nodes_output, ensure_ascii=False), tag=TAG, constraint=FORMAT_CONSTRAINT, + prompt_schema="json" ) content = await self.llm.aask(prompt) @@ -567,6 +568,7 @@ class ActionNode: example=example, instruction=instruction, constraint=FORMAT_CONSTRAINT, + prompt_schema="json" ) # step2, use `_aask_v1` to get revise structure result