Improve work log handling.
This commit is contained in:
parent
ba82f41fa0
commit
4b24dbe960
|
|
@ -189,6 +189,7 @@ def run_research_agent(
|
||||||
human_section=human_section,
|
human_section=human_section,
|
||||||
web_research_section=web_research_section,
|
web_research_section=web_research_section,
|
||||||
key_facts=key_facts,
|
key_facts=key_facts,
|
||||||
|
work_log=get_memory_value('work_log'),
|
||||||
code_snippets=code_snippets,
|
code_snippets=code_snippets,
|
||||||
related_files=related_files
|
related_files=related_files
|
||||||
)
|
)
|
||||||
|
|
@ -382,6 +383,7 @@ def run_planning_agent(
|
||||||
related_files="\n".join(get_related_files()),
|
related_files="\n".join(get_related_files()),
|
||||||
key_facts=get_memory_value('key_facts'),
|
key_facts=get_memory_value('key_facts'),
|
||||||
key_snippets=get_memory_value('key_snippets'),
|
key_snippets=get_memory_value('key_snippets'),
|
||||||
|
work_log=get_memory_value('work_log'),
|
||||||
research_only_note='' if config.get('research_only') else ' Only request implementation if the user explicitly asked for changes to be made.'
|
research_only_note='' if config.get('research_only') else ' Only request implementation if the user explicitly asked for changes to be made.'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -118,6 +118,11 @@ Relevant Code Snippets:
|
||||||
Related Files:
|
Related Files:
|
||||||
{related_files}
|
{related_files}
|
||||||
|
|
||||||
|
Work done so far:
|
||||||
|
<work log>
|
||||||
|
{work_log}
|
||||||
|
</work log>
|
||||||
|
|
||||||
Be very thorough in your research and emit lots of snippets, key facts. If you take more than a few steps, be eager to emit research subtasks.{research_only_note}
|
Be very thorough in your research and emit lots of snippets, key facts. If you take more than a few steps, be eager to emit research subtasks.{research_only_note}
|
||||||
|
|
||||||
Objective
|
Objective
|
||||||
|
|
@ -326,6 +331,11 @@ Relevant Code Snippets:
|
||||||
Related Files:
|
Related Files:
|
||||||
{related_files}
|
{related_files}
|
||||||
|
|
||||||
|
Work done so far:
|
||||||
|
<work log>
|
||||||
|
{work_log}
|
||||||
|
</work log>
|
||||||
|
|
||||||
Be very thorough in your research and emit lots of snippets, key facts. If you take more than a few steps, be eager to emit research subtasks.
|
Be very thorough in your research and emit lots of snippets, key facts. If you take more than a few steps, be eager to emit research subtasks.
|
||||||
|
|
||||||
Objective
|
Objective
|
||||||
|
|
@ -439,6 +449,11 @@ Key Facts:
|
||||||
Key Snippets:
|
Key Snippets:
|
||||||
{key_snippets}
|
{key_snippets}
|
||||||
|
|
||||||
|
Work done so far:
|
||||||
|
<work log>
|
||||||
|
{work_log}
|
||||||
|
</work log>
|
||||||
|
|
||||||
Fact Management:
|
Fact Management:
|
||||||
Each fact is identified with [Fact ID: X].
|
Each fact is identified with [Fact ID: X].
|
||||||
Facts may be deleted if they become outdated, irrelevant, or duplicates.
|
Facts may be deleted if they become outdated, irrelevant, or duplicates.
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ ResearchResult = Dict[str, Union[str, bool, Dict[int, Any], List[Any], None]]
|
||||||
from rich.console import Console
|
from rich.console import Console
|
||||||
from ra_aid.tools.memory import _global_memory
|
from ra_aid.tools.memory import _global_memory
|
||||||
from ra_aid.console.formatting import print_error
|
from ra_aid.console.formatting import print_error
|
||||||
from .memory import get_memory_value, get_related_files, get_work_log, reset_work_log
|
from .memory import get_memory_value, get_related_files, get_work_log
|
||||||
from .human import ask_human
|
from .human import ask_human
|
||||||
from ..llm import initialize_llm
|
from ..llm import initialize_llm
|
||||||
from ..console import print_task_header
|
from ..console import print_task_header
|
||||||
|
|
@ -78,10 +78,7 @@ def request_research(query: str) -> ResearchResult:
|
||||||
# Get completion message if available
|
# Get completion message if available
|
||||||
completion_message = _global_memory.get('completion_message', 'Task was completed successfully.' if success else None)
|
completion_message = _global_memory.get('completion_message', 'Task was completed successfully.' if success else None)
|
||||||
|
|
||||||
# Get and reset work log if at root depth
|
work_log = get_work_log()
|
||||||
work_log = get_work_log() if current_depth == 1 else None
|
|
||||||
if current_depth == 1:
|
|
||||||
reset_work_log()
|
|
||||||
|
|
||||||
# Clear completion state from global memory
|
# Clear completion state from global memory
|
||||||
_global_memory['completion_message'] = ''
|
_global_memory['completion_message'] = ''
|
||||||
|
|
@ -140,11 +137,7 @@ def request_web_research(query: str) -> ResearchResult:
|
||||||
# Get completion message if available
|
# Get completion message if available
|
||||||
completion_message = _global_memory.get('completion_message', 'Task was completed successfully.' if success else None)
|
completion_message = _global_memory.get('completion_message', 'Task was completed successfully.' if success else None)
|
||||||
|
|
||||||
# Get and reset work log if at root depth
|
work_log = get_work_log()
|
||||||
current_depth = _global_memory.get('agent_depth', 0)
|
|
||||||
work_log = get_work_log() if current_depth == 1 else None
|
|
||||||
if current_depth == 1:
|
|
||||||
reset_work_log()
|
|
||||||
|
|
||||||
# Clear completion state from global memory
|
# Clear completion state from global memory
|
||||||
_global_memory['completion_message'] = ''
|
_global_memory['completion_message'] = ''
|
||||||
|
|
@ -205,11 +198,7 @@ def request_research_and_implementation(query: str) -> Dict[str, Any]:
|
||||||
# Get completion message if available
|
# Get completion message if available
|
||||||
completion_message = _global_memory.get('completion_message', 'Task was completed successfully.' if success else None)
|
completion_message = _global_memory.get('completion_message', 'Task was completed successfully.' if success else None)
|
||||||
|
|
||||||
# Get and reset work log if at root depth
|
work_log = get_work_log()
|
||||||
current_depth = _global_memory.get('agent_depth', 0)
|
|
||||||
work_log = get_work_log() if current_depth == 1 else None
|
|
||||||
if current_depth == 1:
|
|
||||||
reset_work_log()
|
|
||||||
|
|
||||||
# Clear completion state from global memory
|
# Clear completion state from global memory
|
||||||
_global_memory['completion_message'] = ''
|
_global_memory['completion_message'] = ''
|
||||||
|
|
@ -278,10 +267,7 @@ def request_task_implementation(task_spec: str) -> Dict[str, Any]:
|
||||||
completion_message = _global_memory.get('completion_message', 'Task was completed successfully.' if success else None)
|
completion_message = _global_memory.get('completion_message', 'Task was completed successfully.' if success else None)
|
||||||
|
|
||||||
# Get and reset work log if at root depth
|
# Get and reset work log if at root depth
|
||||||
current_depth = _global_memory.get('agent_depth', 0)
|
work_log = get_work_log()
|
||||||
work_log = get_work_log() if current_depth == 1 else None
|
|
||||||
if current_depth == 1:
|
|
||||||
reset_work_log()
|
|
||||||
|
|
||||||
# Clear completion state from global memory
|
# Clear completion state from global memory
|
||||||
_global_memory['completion_message'] = ''
|
_global_memory['completion_message'] = ''
|
||||||
|
|
@ -339,10 +325,7 @@ def request_implementation(task_spec: str) -> Dict[str, Any]:
|
||||||
completion_message = _global_memory.get('completion_message', 'Task was completed successfully.' if success else None)
|
completion_message = _global_memory.get('completion_message', 'Task was completed successfully.' if success else None)
|
||||||
|
|
||||||
# Get and reset work log if at root depth
|
# Get and reset work log if at root depth
|
||||||
current_depth = _global_memory.get('agent_depth', 0)
|
work_log = get_work_log()
|
||||||
work_log = get_work_log() if current_depth == 1 else None
|
|
||||||
if current_depth == 1:
|
|
||||||
reset_work_log()
|
|
||||||
|
|
||||||
# Clear completion state from global memory
|
# Clear completion state from global memory
|
||||||
_global_memory['completion_message'] = ''
|
_global_memory['completion_message'] = ''
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue