From 0dd6583cf0268aa47233499a3f3a57fc7a4775b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Bj=C3=A4reholt?= Date: Wed, 2 Oct 2024 10:54:22 +0200 Subject: [PATCH] fix: use prompt chaining in subagent task to improve reliability --- gptme/tools/subagent.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/gptme/tools/subagent.py b/gptme/tools/subagent.py index 4399d7cc..6fbf1f58 100644 --- a/gptme/tools/subagent.py +++ b/gptme/tools/subagent.py @@ -19,7 +19,6 @@ # noreorder from ..logmanager import LogManager # fmt: skip - logger = logging.getLogger(__name__) Status = Literal["running", "success", "failure"] @@ -95,7 +94,7 @@ def run_subagent(): initial_msgs = [get_prompt(interactive=False)] # add the return prompt - return_prompt = """When done with the task, please end with a JSON response on the format: + return_prompt = """Thank you for doing the task, please respond with a JSON response on the format: ```json { @@ -103,10 +102,7 @@ def run_subagent(): status: 'success' | 'failure', } ```""" - init_msg = initial_msgs[0] - initial_msgs[0] = init_msg.replace( - content=init_msg.content + "\n\n" + return_prompt - ) + prompt_msgs.append(Message("user", return_prompt)) chat( prompt_msgs,