@@ -479,7 +479,7 @@ def _track_tool_call_streak(self, tool_name: str) -> int:
479479 self ._same_tool_streak = 1
480480 return self ._same_tool_streak
481481
482- def _build_same_tool_guidance (self , tool_name : str , streak : int ) -> str :
482+ def _build_repeated_tool_call_guidance (self , tool_name : str , streak : int ) -> str :
483483 if streak < self .REPEATED_TOOL_NOTICE_L1_THRESHOLD :
484484 return ""
485485
@@ -936,7 +936,7 @@ def _append_tool_call_result(tool_call_id: str, content: str) -> None:
936936 _append_tool_call_result (
937937 func_tool_id ,
938938 "\n \n " .join (result_parts )
939- + self ._build_same_tool_guidance (
939+ + self ._build_repeated_tool_call_guidance (
940940 func_tool_name , tool_call_streak
941941 ),
942942 )
@@ -953,7 +953,7 @@ def _append_tool_call_result(tool_call_id: str, content: str) -> None:
953953 _append_tool_call_result (
954954 func_tool_id ,
955955 "The tool has no return value, or has sent the result directly to the user."
956- + self ._build_same_tool_guidance (
956+ + self ._build_repeated_tool_call_guidance (
957957 func_tool_name , tool_call_streak
958958 ),
959959 )
@@ -965,7 +965,7 @@ def _append_tool_call_result(tool_call_id: str, content: str) -> None:
965965 _append_tool_call_result (
966966 func_tool_id ,
967967 "*The tool has returned an unsupported type. Please tell the user to check the definition and implementation of this tool.*"
968- + self ._build_same_tool_guidance (
968+ + self ._build_repeated_tool_call_guidance (
969969 func_tool_name , tool_call_streak
970970 ),
971971 )
@@ -986,7 +986,9 @@ def _append_tool_call_result(tool_call_id: str, content: str) -> None:
986986 _append_tool_call_result (
987987 func_tool_id ,
988988 f"error: { e !s} "
989- + self ._build_same_tool_guidance (func_tool_name , tool_call_streak ),
989+ + self ._build_repeated_tool_call_guidance (
990+ func_tool_name , tool_call_streak
991+ ),
990992 )
991993
992994 # yield the last tool call result
0 commit comments