disable related if aider disabled
This commit is contained in:
parent
65b8619517
commit
6b7d2374ee
|
|
@ -197,7 +197,6 @@ Reporting Findings
|
|||
Document discovered documentation files and their contents at a high level (e.g., "There is a README.md in the root directory that explains the folder structure").
|
||||
Document code files by type or apparent purpose (e.g., "There is a main.py file containing code to launch an application").
|
||||
Document configuration files, dependencies (like package.json, requirements.txt), testing files, and anything else present.
|
||||
Use emit_related_files to note all files that are relevant to the base task.
|
||||
|
||||
No Planning or Problem-Solving
|
||||
|
||||
|
|
@ -501,8 +500,6 @@ Testing:
|
|||
|
||||
Test before and after making changes, if relevant.
|
||||
|
||||
Once the task is complete, ensure all updated files are registered with emit_related_files.
|
||||
|
||||
{expert_section}
|
||||
{human_section}
|
||||
{web_research_section}
|
||||
|
|
|
|||
|
|
@ -46,20 +46,22 @@ def set_modification_tools(use_aider=False):
|
|||
|
||||
# Read-only tools that don't modify system state
|
||||
def get_read_only_tools(
|
||||
human_interaction: bool = False, web_research_enabled: bool = False
|
||||
human_interaction: bool = False, web_research_enabled: bool = False, use_aider: bool = False
|
||||
):
|
||||
"""Get the list of read-only tools, optionally including human interaction tools.
|
||||
|
||||
Args:
|
||||
human_interaction: Whether to include human interaction tools
|
||||
web_research_enabled: Whether to include web research tools
|
||||
use_aider: Whether aider is being used for code modifications
|
||||
|
||||
Returns:
|
||||
List of tool functions
|
||||
"""
|
||||
tools = [
|
||||
emit_key_snippet,
|
||||
emit_related_files,
|
||||
# Only include emit_related_files if use_aider is True
|
||||
*([emit_related_files] if use_aider else []),
|
||||
emit_key_facts,
|
||||
# *TEMPORARILY* disabled to improve tool calling perf.
|
||||
# delete_key_facts,
|
||||
|
|
@ -94,11 +96,19 @@ def get_all_tools() -> list[BaseTool]:
|
|||
|
||||
|
||||
# Define constant tool groups
|
||||
READ_ONLY_TOOLS = get_read_only_tools()
|
||||
# Get config from global memory for use_aider value
|
||||
_config = {}
|
||||
try:
|
||||
from ra_aid.tools.memory import _global_memory
|
||||
_config = _global_memory.get("config", {})
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
READ_ONLY_TOOLS = get_read_only_tools(use_aider=_config.get("use_aider", False))
|
||||
|
||||
# MODIFICATION_TOOLS will be set dynamically based on config, default defined here
|
||||
MODIFICATION_TOOLS = [file_str_replace, put_complete_file_contents]
|
||||
COMMON_TOOLS = get_read_only_tools()
|
||||
COMMON_TOOLS = get_read_only_tools(use_aider=_config.get("use_aider", False))
|
||||
EXPERT_TOOLS = [emit_expert_context, ask_expert]
|
||||
RESEARCH_TOOLS = [
|
||||
emit_research_notes,
|
||||
|
|
@ -123,8 +133,20 @@ def get_research_tools(
|
|||
human_interaction: Whether to include human interaction tools
|
||||
web_research_enabled: Whether to include web research tools
|
||||
"""
|
||||
# Get config for use_aider value
|
||||
use_aider = False
|
||||
try:
|
||||
from ra_aid.tools.memory import _global_memory
|
||||
use_aider = _global_memory.get("config", {}).get("use_aider", False)
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
# Start with read-only tools
|
||||
tools = get_read_only_tools(human_interaction, web_research_enabled).copy()
|
||||
tools = get_read_only_tools(
|
||||
human_interaction,
|
||||
web_research_enabled,
|
||||
use_aider=use_aider
|
||||
).copy()
|
||||
|
||||
tools.extend(RESEARCH_TOOLS)
|
||||
|
||||
|
|
@ -152,8 +174,19 @@ def get_planning_tools(
|
|||
expert_enabled: Whether to include expert tools
|
||||
web_research_enabled: Whether to include web research tools
|
||||
"""
|
||||
# Get config for use_aider value
|
||||
use_aider = False
|
||||
try:
|
||||
from ra_aid.tools.memory import _global_memory
|
||||
use_aider = _global_memory.get("config", {}).get("use_aider", False)
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
# Start with read-only tools
|
||||
tools = get_read_only_tools(web_research_enabled=web_research_enabled).copy()
|
||||
tools = get_read_only_tools(
|
||||
web_research_enabled=web_research_enabled,
|
||||
use_aider=use_aider
|
||||
).copy()
|
||||
|
||||
# Add planning-specific tools
|
||||
planning_tools = [
|
||||
|
|
@ -180,8 +213,19 @@ def get_implementation_tools(
|
|||
expert_enabled: Whether to include expert tools
|
||||
web_research_enabled: Whether to include web research tools
|
||||
"""
|
||||
# Get config for use_aider value
|
||||
use_aider = False
|
||||
try:
|
||||
from ra_aid.tools.memory import _global_memory
|
||||
use_aider = _global_memory.get("config", {}).get("use_aider", False)
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
# Start with read-only tools
|
||||
tools = get_read_only_tools(web_research_enabled=web_research_enabled).copy()
|
||||
tools = get_read_only_tools(
|
||||
web_research_enabled=web_research_enabled,
|
||||
use_aider=use_aider
|
||||
).copy()
|
||||
|
||||
# Add modification tools since it's not research-only
|
||||
tools.extend(MODIFICATION_TOOLS)
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
/.ra-aid
|
||||
|
|
@ -10,13 +10,22 @@ from ra_aid.tool_configs import (
|
|||
|
||||
|
||||
def test_get_read_only_tools():
|
||||
# Test without human interaction
|
||||
tools = get_read_only_tools(human_interaction=False)
|
||||
# Test without human interaction, without aider
|
||||
tools = get_read_only_tools(human_interaction=False, use_aider=False)
|
||||
assert len(tools) > 0
|
||||
assert all(callable(tool) for tool in tools)
|
||||
|
||||
# Check emit_related_files is not included when use_aider is False
|
||||
tool_names = [tool.name for tool in tools]
|
||||
assert "emit_related_files" not in tool_names
|
||||
|
||||
# Test with use_aider=True
|
||||
tools_with_aider = get_read_only_tools(human_interaction=False, use_aider=True)
|
||||
tool_names_with_aider = [tool.name for tool in tools_with_aider]
|
||||
assert "emit_related_files" in tool_names_with_aider
|
||||
|
||||
# Test with human interaction
|
||||
tools_with_human = get_read_only_tools(human_interaction=True)
|
||||
tools_with_human = get_read_only_tools(human_interaction=True, use_aider=False)
|
||||
assert len(tools_with_human) == len(tools) + 1
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue