Skip to content

Commit

Permalink
fix: use prompt chaining in subagent task to improve reliability
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikBjare committed Oct 2, 2024
1 parent 81708e6 commit 0dd6583
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions gptme/tools/subagent.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
# noreorder
from ..logmanager import LogManager # fmt: skip


logger = logging.getLogger(__name__)

Status = Literal["running", "success", "failure"]
Expand Down Expand Up @@ -95,18 +94,15 @@ 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
{
result: 'A description of the task result/outcome',
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,
Expand Down

0 comments on commit 0dd6583

Please sign in to comment.