From 1855cc32529d577c732c31b98eba868beef7498b Mon Sep 17 00:00:00 2001 From: AI Christianson Date: Sun, 2 Mar 2025 14:44:39 -0500 Subject: [PATCH] cleaner -> gc --- ra_aid/__main__.py | 4 ++-- ra_aid/agents/__init__.py | 6 +++--- ...ey_facts_cleaner_agent.py => key_facts_gc_agent.py} | 10 +++++----- ...acts_cleaner_prompts.py => key_facts_gc_prompts.py} | 6 +++--- ra_aid/tools/memory.py | 4 ++-- 5 files changed, 15 insertions(+), 15 deletions(-) rename ra_aid/agents/{key_facts_cleaner_agent.py => key_facts_gc_agent.py} (90%) rename ra_aid/prompts/{key_facts_cleaner_prompts.py => key_facts_gc_prompts.py} (91%) diff --git a/ra_aid/__main__.py b/ra_aid/__main__.py index 5d56d05..ce34b6a 100644 --- a/ra_aid/__main__.py +++ b/ra_aid/__main__.py @@ -622,7 +622,7 @@ def run_cleanup(): """Run cleanup tasks after main execution.""" try: # Import the key facts cleaner agent - from ra_aid.agents.key_facts_cleaner_agent import run_key_facts_cleaner_agent + from ra_aid.agents.key_facts_gc_agent import run_key_facts_gc_agent # Get the count of key facts from ra_aid.database.repositories.key_fact_repository import KeyFactRepository @@ -631,7 +631,7 @@ def run_cleanup(): # Only run the cleaner if we have more than 30 facts facts = key_fact_repository.get_all() if len(facts) > 30: - run_key_facts_cleaner_agent() + run_key_facts_gc_agent() except Exception as e: logger.error(f"Failed to run cleanup tasks: {str(e)}") diff --git a/ra_aid/agents/__init__.py b/ra_aid/agents/__init__.py index 8f941bf..b37449a 100644 --- a/ra_aid/agents/__init__.py +++ b/ra_aid/agents/__init__.py @@ -1,5 +1,5 @@ """ -Key facts cleaner agent package. +Key facts gc agent package. This package contains the agent responsible for cleaning up key facts in the database when they exceed a certain threshold. @@ -7,9 +7,9 @@ in the database when they exceed a certain threshold. from typing import Optional -def run_key_facts_cleaner_agent(max_facts: int = 20) -> None: +def run_key_facts_gc_agent(max_facts: int = 20) -> None: """ - Run the key facts cleaner agent to reduce key facts to the specified maximum. + Run the key facts gc agent to reduce key facts to the specified maximum. This agent evaluates the importance of key facts and removes the least important ones when the total count exceeds the maximum threshold. diff --git a/ra_aid/agents/key_facts_cleaner_agent.py b/ra_aid/agents/key_facts_gc_agent.py similarity index 90% rename from ra_aid/agents/key_facts_cleaner_agent.py rename to ra_aid/agents/key_facts_gc_agent.py index c6bf314..0b003d8 100644 --- a/ra_aid/agents/key_facts_cleaner_agent.py +++ b/ra_aid/agents/key_facts_gc_agent.py @@ -1,5 +1,5 @@ """ -Key facts cleaner agent implementation. +Key facts gc agent implementation. This agent is responsible for maintaining the knowledge base by pruning less important facts when the total number exceeds a specified threshold. The agent evaluates all @@ -16,7 +16,7 @@ from rich.panel import Panel from ra_aid.agent_utils import create_agent, run_agent_with_retry from ra_aid.database.repositories.key_fact_repository import KeyFactRepository from ra_aid.llm import initialize_llm -from ra_aid.prompts.key_facts_cleaner_prompts import KEY_FACTS_CLEANER_PROMPT +from ra_aid.prompts.key_facts_gc_prompts import KEY_FACTS_GC_PROMPT from ra_aid.tools.memory import log_work_event @@ -52,8 +52,8 @@ def delete_key_fact(fact_id: int) -> str: return f"Fact #{fact_id} not found" -def run_key_facts_cleaner_agent() -> None: - """Run the key facts cleaner agent to maintain a reasonable number of key facts. +def run_key_facts_gc_agent() -> None: + """Run the key facts gc agent to maintain a reasonable number of key facts. The agent analyzes all key facts and determines which are the least valuable, deleting them to maintain a manageable collection size of high-value facts. @@ -81,7 +81,7 @@ def run_key_facts_cleaner_agent() -> None: agent = create_agent(model, [delete_key_fact]) # Format the prompt with the current facts - prompt = KEY_FACTS_CLEANER_PROMPT.format(key_facts=formatted_facts) + prompt = KEY_FACTS_GC_PROMPT.format(key_facts=formatted_facts) # Set up the agent configuration config = { diff --git a/ra_aid/prompts/key_facts_cleaner_prompts.py b/ra_aid/prompts/key_facts_gc_prompts.py similarity index 91% rename from ra_aid/prompts/key_facts_cleaner_prompts.py rename to ra_aid/prompts/key_facts_gc_prompts.py index 80f0554..b75aabb 100644 --- a/ra_aid/prompts/key_facts_cleaner_prompts.py +++ b/ra_aid/prompts/key_facts_gc_prompts.py @@ -1,12 +1,12 @@ """ -Key facts cleaner-specific prompts for the AI agent system. +Key facts gc-specific prompts for the AI agent system. -This module contains the prompt for the key facts cleaner agent that is +This module contains the prompt for the key facts gc agent that is responsible for evaluating and trimming down the stored key facts to keep only the most valuable ones, ensuring that the collection remains manageable. """ -KEY_FACTS_CLEANER_PROMPT = """ +KEY_FACTS_GC_PROMPT = """ You are a Key Facts Cleaner agent responsible for maintaining the knowledge base by pruning less important facts. diff --git a/ra_aid/tools/memory.py b/ra_aid/tools/memory.py index bada123..1430c54 100644 --- a/ra_aid/tools/memory.py +++ b/ra_aid/tools/memory.py @@ -136,8 +136,8 @@ def emit_key_facts(facts: List[str]) -> str: if len(all_facts) > 30: # Trigger the key facts cleaner agent try: - from ra_aid.agents.key_facts_cleaner_agent import run_key_facts_cleaner_agent - run_key_facts_cleaner_agent() + from ra_aid.agents.key_facts_gc_agent import run_key_facts_gc_agent + run_key_facts_gc_agent() except Exception as e: logger.error(f"Failed to run key facts cleaner: {str(e)}")