From 99e10b235bcba40848b160d037898bc862ebbcd0 Mon Sep 17 00:00:00 2001 From: geekan Date: Wed, 3 Jan 2024 14:42:13 +0800 Subject: [PATCH] make tot follow format in 3.5-turbo --- metagpt/strategy/tot.py | 2 +- tests/metagpt/strategy/examples/creative_writing.py | 2 +- tests/metagpt/strategy/prompt_templates/creative_writing.py | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/metagpt/strategy/tot.py b/metagpt/strategy/tot.py index ce94d0de1..88c2ac9ff 100644 --- a/metagpt/strategy/tot.py +++ b/metagpt/strategy/tot.py @@ -17,7 +17,7 @@ from metagpt.strategy.tot_schema import MethodSelect, Strategy, ThoughtSolverCon from metagpt.utils.common import CodeParser OUTPUT_FORMAT = """ -Output a list of jsons following the format: +Each output should be strictly a list of nodes, in json format, like this: ```json [ { diff --git a/tests/metagpt/strategy/examples/creative_writing.py b/tests/metagpt/strategy/examples/creative_writing.py index 59a3c94d7..ff1d4147c 100644 --- a/tests/metagpt/strategy/examples/creative_writing.py +++ b/tests/metagpt/strategy/examples/creative_writing.py @@ -71,7 +71,7 @@ def test_creative_writing(): parser = TextGenParser() evaluator = TextGenEvaluator() - config = ThoughtSolverConfig(n_generate_sample=3, parser=parser, evaluator=evaluator) + config = ThoughtSolverConfig(max_step=2, n_generate_sample=1, n_select_sample=1, parser=parser, evaluator=evaluator) tot_base = TreeofThought(strategy=Strategy.BFS, config=config) asyncio.run(tot_base.solve(init_prompt=initial_prompt)) diff --git a/tests/metagpt/strategy/prompt_templates/creative_writing.py b/tests/metagpt/strategy/prompt_templates/creative_writing.py index eb3a584d3..560629316 100644 --- a/tests/metagpt/strategy/prompt_templates/creative_writing.py +++ b/tests/metagpt/strategy/prompt_templates/creative_writing.py @@ -5,13 +5,13 @@ Write a coherent passage of 4 short paragraphs. The end sentence of each paragra cot_prompt = """ Write a coherent passage of 4 short paragraphs. The end sentence of each paragraph must be: {input} -Make a plan then write. Your output should be of the following format: +Make a plan then write. Your output should be like: Plan: -Your plan here. + Passage: -Your passage here. + """