Fix function call cli_print_tool_call with kwargs support

Updated cli_print_tool_call to accept additional parameters for backwards compatibility.

When running CAI with memory system enabled, the template code (system_master_template.md) has outdate function call. 

Warning received from CAI when running with memory:
"Warning: Failed to render system master template: cli_print_tool_call() got an unexpected keyword argument 'tool_args'"
This commit is contained in:
rzv 2026-01-06 13:27:10 +01:00 committed by GitHub
parent 559de8fcbc
commit 66c3ae171d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 11 additions and 3 deletions

View File

@ -1414,11 +1414,20 @@ def fix_message_list(messages): # pylint: disable=R0914,R0915,R0912
return processed_messages
def cli_print_tool_call(tool_name="", args="", output="", prefix=" "):
"""Print a tool call with pretty formatting"""
def cli_print_tool_call(tool_name="", args="", output="", prefix=" ", **kwargs):
"""Print a tool call with pretty formatting
Args:
tool_name: Name of the tool being called
output: Output from the tool execution
**kwargs: Accept additional parameters for backwards compatibility"""
if not tool_name:
return
if not args and 'tool_args' in kwargs:
args = kwargs['tool_args']
if not output and 'tool_output' in kwargs:
output = kwargs['tool_output']
print(f"{prefix}{color('Tool Call:', fg='cyan')}")
print(f"{prefix}{color('Name:', fg='cyan')} {tool_name}")
if args:
@ -1426,7 +1435,6 @@ def cli_print_tool_call(tool_name="", args="", output="", prefix=" "):
if output:
print(f"{prefix}{color('Output:', fg='cyan')} {output}")
def get_model_input_tokens(model):
"""
Get the number of input tokens for