From c41fac82b736adaf6145a35c85d4797bc70b4a32 Mon Sep 17 00:00:00 2001 From: user Date: Sat, 21 Dec 2024 20:20:00 -0500 Subject: [PATCH] Include known context in research prompt. --- ra_aid/agent_utils.py | 10 +++++++++- ra_aid/prompts.py | 10 ++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/ra_aid/agent_utils.py b/ra_aid/agent_utils.py index f50917e..eb0a3d5 100644 --- a/ra_aid/agent_utils.py +++ b/ra_aid/agent_utils.py @@ -105,12 +105,20 @@ def run_research_agent( expert_section = EXPERT_PROMPT_SECTION_RESEARCH if expert_enabled else "" human_section = HUMAN_PROMPT_SECTION_RESEARCH if hil else "" + # Get research context from memory + key_facts = _global_memory.get("key_facts", "") + code_snippets = _global_memory.get("code_snippets", "") + related_files = _global_memory.get("related_files", "") + # Build prompt prompt = RESEARCH_PROMPT.format( base_task=base_task_or_query, research_only_note='' if research_only else ' Only request implementation if the user explicitly asked for changes to be made.', expert_section=expert_section, - human_section=human_section + human_section=human_section, + key_facts=key_facts, + code_snippets=code_snippets, + related_files=related_files ) # Set up configuration diff --git a/ra_aid/prompts.py b/ra_aid/prompts.py index d3389f4..bf72a03 100644 --- a/ra_aid/prompts.py +++ b/ra_aid/prompts.py @@ -70,6 +70,16 @@ Human Interaction: # Research stage prompt - guides initial codebase analysis RESEARCH_PROMPT = """User query: {base_task} --keep it simple +Context from Previous Research (if available): +Key Facts: +{key_facts} + +Relevant Code Snippets: +{code_snippets} + +Related Files: +{related_files} + 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