diff --git a/ra_aid/__main__.py b/ra_aid/__main__.py index 9d02bf8..9784d45 100644 --- a/ra_aid/__main__.py +++ b/ra_aid/__main__.py @@ -24,7 +24,6 @@ from ra_aid.prompts import ( RESEARCH_PROMPT, PLANNING_PROMPT, IMPLEMENTATION_PROMPT, - SUMMARY_PROMPT ) from ra_aid.exceptions import TaskCompletedException import time @@ -172,42 +171,6 @@ def run_implementation_stage(base_task, tasks, plan, related_files): # Run agent for this task run_agent_with_retry(task_agent, task_prompt, {"configurable": {"thread_id": "abc123"}, "recursion_limit": 100}) -def summarize_research_findings(base_task: str, config: dict) -> None: - """Summarize research findings for informational queries. - - Generates and prints a concise summary of research findings including key facts - and research notes collected during the research stage. - - Args: - base_task: The original user query - config: Configuration dictionary for the agent - """ - print_stage_header("Research Summary") - - # Create dedicated memory for research summarization - summary_memory = MemorySaver() - - # Create fresh agent for summarization with its own memory - summary_agent = create_react_agent(model, implementation_tools, checkpointer=summary_memory) - - summary_prompt = SUMMARY_PROMPT.format( - base_task=base_task, - research_notes=get_memory_value('research_notes'), - key_facts=get_memory_value('key_facts'), - key_snippets=get_memory_value('key_snippets') - ) - - while True: - try: - for chunk in summary_agent.stream( - {"messages": [HumanMessage(content=summary_prompt)]}, - config - ): - print_agent_output(chunk) - break - except ChatAnthropic.InternalServerError as e: - print(f"Encountered Anthropic Internal Server Error: {e}. Retrying...") - continue def run_research_subtasks(base_task: str, config: dict): """Run research subtasks with separate agents.""" @@ -301,11 +264,8 @@ Be very thorough in your research and emit lots of snippets, key facts. If you t # Run any research subtasks run_research_subtasks(base_task, config) - # For informational queries, summarize findings - if is_informational_query(): - summarize_research_findings(base_task, config) - else: - # Only proceed with planning and implementation if not an informational query + # Proceed with planning and implementation if not an informational query + if not is_informational_query(): print_stage_header("Planning Stage") planning_prompt = PLANNING_PROMPT.format( research_notes=get_memory_value('research_notes'), diff --git a/ra_aid/console/formatting.py b/ra_aid/console/formatting.py index 9482073..f0a66da 100644 --- a/ra_aid/console/formatting.py +++ b/ra_aid/console/formatting.py @@ -19,7 +19,6 @@ def print_stage_header(stage: str) -> None: 'task completed': 'โœ…', 'debug stage': '๐Ÿ›', 'testing stage': '๐Ÿงช', - 'research summary': '๐Ÿ“‹', 'research subtasks': '๐Ÿ“š', 'skipping implementation stage': 'โญ๏ธ' } diff --git a/ra_aid/prompts.py b/ra_aid/prompts.py index 1030e30..6258b7d 100644 --- a/ra_aid/prompts.py +++ b/ra_aid/prompts.py @@ -72,7 +72,7 @@ Single-Shot Task Detection - 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) + - Research subtasks have been requested - Complex implementation has been explicitly requested If you determine a task can be completed in a single shot: @@ -163,41 +163,6 @@ Guidelines: Do not implement anything yet. """ -# Research summary prompt - guides generation of research summaries -# Remains essentially the same, but with complexity scaling if needed. -SUMMARY_PROMPT = """ -Using only the information provided in the Research Notes and Key Facts below, write a concise and direct answer to the user's query. - -User's Query: -{base_task} - -Research Notes: -{research_notes} - -Key Facts: -{key_facts} - -Key Snippets: -{key_snippets} - -Fact Management: - Each fact is identified with [Fact ID: X]. - Facts may be deleted if they become outdated, irrelevant, or duplicates. - Use delete_key_facts([id1, id2, ...]) with a list of numeric Fact IDs to remove unnecessary facts. - -Snippet Management: - Each snippet is identified with [Snippet ID: X]. - Snippets include file path, line number, and source code. - Snippets may have optional descriptions explaining their significance. - Delete snippets with delete_key_snippets([id1, id2, ...]) to remove outdated or irrelevant ones. - Use emit_key_snippets to store important code sections needed for reference in batches. - -Instructions: -- **Stay Within Provided Information**: Do not include any information not present in the Research Notes or Key Facts. -- **Handle Contradictions Appropriately**: If contradictions exist, consider additional research or note the contradictions. -- **Maintain Focus and Brevity**: Keep the response concise, focusing on the user's query. -- **Include Technical Details If Relevant**: For technical queries, reference discovered files and snippets. -""" # Implementation stage prompt - guides specific task implementation # Added instruction to adjust complexity of implementation to match request.