Skip to content

Improve tool usage error reporting #309

@johbo

Description

@johbo

While in agent mode I noticed the llm calling a tool with wrong parameters. The behavior is good, error is caught and made visible to the user (probably also to the model) and then it tries to achieve its goal in a different way.

I think the reporting to the user could be improved though. When I saw it I was not sure if that's an issue in the tool or on the model side.

Current example

Now I can see the issue! The `log_llm_history` method is defined in the `InputOutput` class but it's never called anywhere in the code. The LLM communication happens in the `models.py` file in 
the `send_completion` method, but there's no integration with the `log_llm_history` method.

Let me examine the `send_completion` method more closely:

Tokens: 33k sent, 81 received.

---
Tool Call: local_tools • View
Arguments: {"file_path": "aider/models.py", "line_number": 988, "context_lines": 50}

Error in View: Tool.execute() got an unexpected keyword argument 'line_number'
Traceback (most recent call last):
  File "/Users/johannes/wo/aider-ce/aider/tools/utils/base_tool.py", line 58, in process_response
    return cls.execute(coder, **params)
           ~~~~~~~~~~~^^^^^^^^^^^^^^^^^
TypeError: Tool.execute() got an unexpected keyword argument 'line_number'

---
Tool Call: local_tools • ShowNumberedContext
Arguments: {"file_path": "aider/models.py", "pattern": "async def send_completion", "context_lines": 50}

Successfully retrieved context for aider/models.py
⚠️ 'aider/io.py' is very large (12773 tokens). Use /context-management to toggle truncation off if needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions