Renaming method to _get_earliest_function_call_not_resolved_in_range
This commit is contained in:
@@ -382,7 +382,7 @@ class LLMContextSummarizationUtil:
|
|||||||
return total
|
return total
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _get_function_calls_in_progress_index(
|
def _get_earliest_function_call_not_resolved_in_range(
|
||||||
messages: List[dict], start_idx: int, summary_end: int
|
messages: List[dict], start_idx: int, summary_end: int
|
||||||
) -> int:
|
) -> int:
|
||||||
"""Find the earliest message index with incomplete function calls.
|
"""Find the earliest message index with incomplete function calls.
|
||||||
@@ -491,8 +491,10 @@ class LLMContextSummarizationUtil:
|
|||||||
return LLMMessagesToSummarize(messages=[], last_summarized_index=-1)
|
return LLMMessagesToSummarize(messages=[], last_summarized_index=-1)
|
||||||
|
|
||||||
# Check for function calls in progress in the range we want to summarize
|
# Check for function calls in progress in the range we want to summarize
|
||||||
function_call_start = LLMContextSummarizationUtil._get_function_calls_in_progress_index(
|
function_call_start = (
|
||||||
messages, summary_start, summary_end
|
LLMContextSummarizationUtil._get_earliest_function_call_not_resolved_in_range(
|
||||||
|
messages, summary_start, summary_end
|
||||||
|
)
|
||||||
)
|
)
|
||||||
if function_call_start >= 0 and function_call_start < summary_end:
|
if function_call_start >= 0 and function_call_start < summary_end:
|
||||||
# Stop summarization before the function call
|
# Stop summarization before the function call
|
||||||
|
|||||||
@@ -1168,7 +1168,7 @@ class TestLLMSpecificMessageHandling(unittest.TestCase):
|
|||||||
{"role": "tool", "tool_call_id": "call_123", "content": '{"time": "10:30 AM"}'},
|
{"role": "tool", "tool_call_id": "call_123", "content": '{"time": "10:30 AM"}'},
|
||||||
]
|
]
|
||||||
|
|
||||||
result = LLMContextSummarizationUtil._get_function_calls_in_progress_index(
|
result = LLMContextSummarizationUtil._get_earliest_function_call_not_resolved_in_range(
|
||||||
messages, 0, len(messages)
|
messages, 0, len(messages)
|
||||||
)
|
)
|
||||||
self.assertEqual(result, -1)
|
self.assertEqual(result, -1)
|
||||||
|
|||||||
Reference in New Issue
Block a user