Merge branch 'master' into llm-fn-call

This commit is contained in:
AI Christianson 2024-12-28 12:22:34 -05:00
commit 377a670ac8
4 changed files with 12 additions and 21 deletions

View File

@ -5,12 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased] ## [0.10.3] - 1024-12-27
- Fix logging on interrupt. - Fix logging on interrupt.
- Fix web research prompt. - Fix web research prompt.
- Simplify planning stage by executing tasks directly. - Simplify planning stage by executing tasks directly.
- Make research notes available to more agents/tools. - Make research notes available to more agents/tools.
- Make read_file always output status panel.
## [0.10.2] - 2024-12-26 ## [0.10.2] - 2024-12-26

View File

@ -1,3 +1,3 @@
"""Version information.""" """Version information."""
__version__ = "0.10.1" __version__ = "0.10.3"

View File

@ -15,22 +15,13 @@ CHUNK_SIZE = 8192
@tool @tool
def read_file_tool( def read_file_tool(
filepath: str, filepath: str,
verbose: bool = True,
encoding: str = 'utf-8' encoding: str = 'utf-8'
) -> Dict[str, str]: ) -> Dict[str, str]:
"""Read and return the contents of a text file. """Read and return the contents of a text file.
Args: Args:
filepath: Path to the file to read filepath: Path to the file to read
verbose: Whether to display a Rich panel with read statistics (default: True)
encoding: File encoding to use (default: utf-8) encoding: File encoding to use (default: utf-8)
Returns:
Dict containing:
- content: The file contents as a string (truncated if needed)
Raises:
RuntimeError: If file cannot be read or does not exist
""" """
start_time = time.time() start_time = time.time()
try: try:
@ -60,7 +51,6 @@ def read_file_tool(
logging.debug(f"File read complete: {total_bytes} bytes in {elapsed:.2f}s") logging.debug(f"File read complete: {total_bytes} bytes in {elapsed:.2f}s")
logging.debug(f"Pre-truncation stats: {total_bytes} bytes, {line_count} lines") logging.debug(f"Pre-truncation stats: {total_bytes} bytes, {line_count} lines")
if verbose:
console.print(Panel( console.print(Panel(
f"Read {line_count} lines ({total_bytes} bytes) from {filepath} in {elapsed:.2f}s", f"Read {line_count} lines ({total_bytes} bytes) from {filepath} in {elapsed:.2f}s",
title="📄 File Read", title="📄 File Read",

View File

@ -54,19 +54,19 @@ def test_get_implementation_tools():
def test_get_web_research_tools(): def test_get_web_research_tools():
# Test with expert enabled # Test with expert enabled
tools = get_web_research_tools(expert_enabled=True) tools = get_web_research_tools(expert_enabled=True)
assert len(tools) == 4 assert len(tools) == 5
assert all(callable(tool) for tool in tools) assert all(callable(tool) for tool in tools)
# Get tool names and verify exact matches # Get tool names and verify exact matches
tool_names = [tool.name for tool in tools] tool_names = [tool.name for tool in tools]
expected_names = ['emit_expert_context', 'ask_expert', 'web_search_tavily', 'emit_research_notes'] expected_names = ['emit_expert_context', 'ask_expert', 'web_search_tavily', 'emit_research_notes', 'task_completed']
assert sorted(tool_names) == sorted(expected_names) assert sorted(tool_names) == sorted(expected_names)
# Test without expert enabled # Test without expert enabled
tools_no_expert = get_web_research_tools(expert_enabled=False) tools_no_expert = get_web_research_tools(expert_enabled=False)
assert len(tools_no_expert) == 2 assert len(tools_no_expert) == 3
assert all(callable(tool) for tool in tools_no_expert) assert all(callable(tool) for tool in tools_no_expert)
# Verify exact tool names when expert is disabled # Verify exact tool names when expert is disabled
tool_names_no_expert = [tool.name for tool in tools_no_expert] tool_names_no_expert = [tool.name for tool in tools_no_expert]
assert sorted(tool_names_no_expert) == sorted(['web_search_tavily', 'emit_research_notes']) assert sorted(tool_names_no_expert) == sorted(['web_search_tavily', 'emit_research_notes', 'task_completed'])