akseljoonas HF Staff commited on
Commit
9689843
·
1 Parent(s): 13025d5

adding token counts

Browse files
Files changed (1) hide show
  1. agent/utils/terminal_display.py +7 -2
agent/utils/terminal_display.py CHANGED
@@ -94,13 +94,18 @@ def format_tool_call(tool_name: str, arguments: str) -> str:
94
 
95
  def format_tool_output(output: str, success: bool, truncate: bool = True) -> str:
96
  """Format tool output with color and optional truncation"""
 
97
  if truncate:
98
  output = truncate_to_lines(output, max_lines=6)
99
 
100
  if success:
101
- return f"{Colors.YELLOW}Tool output:{Colors.RESET}\n{output}"
 
 
102
  else:
103
- return f"{Colors.RED}Tool output:{Colors.RESET}\n{output}"
 
 
104
 
105
 
106
  def format_turn_complete() -> str:
 
94
 
95
  def format_tool_output(output: str, success: bool, truncate: bool = True) -> str:
96
  """Format tool output with color and optional truncation"""
97
+ original_length = len(output)
98
  if truncate:
99
  output = truncate_to_lines(output, max_lines=6)
100
 
101
  if success:
102
+ return (
103
+ f"{Colors.YELLOW}Tool output ({original_length} tkns): {Colors.RESET}\n{output}"
104
+ )
105
  else:
106
+ return (
107
+ f"{Colors.RED}Tool output ({original_length} tokens): {Colors.RESET}\n{output}"
108
+ )
109
 
110
 
111
  def format_turn_complete() -> str: