Skip to content

Commit bd67fdc

Browse files
committed
fix: improve message for tool that violates allowed token size
1 parent 3bff6de commit bd67fdc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

holmes/core/tools_utils/tool_context_window_limiter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def prevent_overly_big_tool_response(tool_call_result: ToolCallResult, llm: LLM)
2121
relative_pct = (
2222
(messages_token - max_tokens_allowed) / messages_token
2323
) * 100
24-
error_message = f"The tool call result is too large to return: {messages_token} tokens.\nThe maximum allowed tokens is {max_tokens_allowed} which is {format(relative_pct, '.1f')} smaller.\nInstructions for the LLM: try to repeat the query but proactively narrow down the result so that the tool answer fits within the allowed number of tokens."
24+
error_message = f"The tool call result is too large to return: {messages_token} tokens.\nThe maximum allowed tokens is {max_tokens_allowed} which is {format(relative_pct, '.1f')}% smaller.\nInstructions for the LLM: try to repeat the query but proactively narrow down the result so that the tool answer fits within the allowed number of tokens."
2525
tool_call_result.result.status = StructuredToolResultStatus.ERROR
2626
tool_call_result.result.data = None
2727
tool_call_result.result.error = error_message

0 commit comments

Comments
 (0)