cleaner -> gc
This commit is contained in:
parent
14c9bdfdc7
commit
1855cc3252
|
|
@ -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)}")
|
||||
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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 = {
|
||||
|
|
@ -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.
|
||||
|
||||
<key facts>
|
||||
|
|
@ -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)}")
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue