From c6de93c8d39a3264cc9987891e7d6e2555e85cda Mon Sep 17 00:00:00 2001 From: AI Christianson Date: Wed, 11 Dec 2024 16:20:01 -0500 Subject: [PATCH] allow one shot research --- ra_aid/prompts.py | 10 +++++++--- ra_aid/tools/memory.py | 7 ++++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ra_aid/prompts.py b/ra_aid/prompts.py index 6ebedfe..bfba699 100644 --- a/ra_aid/prompts.py +++ b/ra_aid/prompts.py @@ -66,16 +66,20 @@ Single-Shot Task Detection Autonomously determine if a task can be completed immediately without further planning: - Simple informational queries that can be answered directly from research - - Requests that don't require complex analysis or implementation + - Basic implementation tasks that don't require complex changes - Cases where further planning would not add value - Situations where immediate response meets all user requirements + One-shot completion will be blocked if: + - Research subtasks have been requested (must wait for research summary) + - Complex implementation has been explicitly requested + If you determine a task can be completed in a single shot: - 1. Complete the necessary research to fully answer the query + 1. Complete the necessary research or basic implementation work 2. Document your findings using emit_research_notes 3. Call one_shot_completed() to immediately conclude the task - Only use single-shot completion when you are confident no implementation or further planning is needed. + Only use single-shot completion for truly straightforward tasks that don't require additional planning or extensive changes. Thoroughness and Completeness diff --git a/ra_aid/tools/memory.py b/ra_aid/tools/memory.py index 0ab41aa..cc1d7e1 100644 --- a/ra_aid/tools/memory.py +++ b/ra_aid/tools/memory.py @@ -247,11 +247,16 @@ def one_shot_completed(message: str) -> str: message: Completion message to display Raises: - TaskCompletedException: Always raised to stop execution + ValueError: If there are pending research subtasks or implementation requests + TaskCompletedException: When task is truly complete with no pending items Returns: Never returns, always raises exception """ + if len(_global_memory['research_subtasks']) > 0: + raise ValueError("Cannot complete in one shot - research subtasks pending") + if len(_global_memory['implementation_requested']) > 0: + raise ValueError("Cannot complete in one shot - implementation was requested") raise TaskCompletedException(message) def get_memory_value(key: str) -> str: