mirror of
https://github.com/encounter/adk-python.git
synced 2026-07-09 18:19:28 -07:00
fix: Rename SlidingWindowCompactor to LlmEventSummarizer and refine its docstring
The class is now named `LlmEventSummarizer` to better reflect that its primary function is to use an LLM to summarize events. The docstring has been updated to clarify that this class is responsible *only* for the LLM-based summarization of a given set of events, while the logic for determining *when* and *which* events form the sliding window is handled by an external component, such as an ADK Runner. PiperOrigin-RevId: 815976264
This commit is contained in:
committed by
Copybara-Service
parent
68402bda49
commit
f1abdb1938
@@ -20,7 +20,7 @@ from google.adk.agents.base_agent import BaseAgent
|
||||
from google.adk.apps.app import App
|
||||
from google.adk.apps.app import EventsCompactionConfig
|
||||
from google.adk.apps.compaction import _run_compaction_for_sliding_window
|
||||
from google.adk.apps.sliding_window_compactor import SlidingWindowCompactor
|
||||
from google.adk.apps.llm_event_summarizer import LlmEventSummarizer
|
||||
from google.adk.events.event import Event
|
||||
from google.adk.events.event_actions import EventActions
|
||||
from google.adk.events.event_actions import EventCompaction
|
||||
@@ -38,7 +38,7 @@ class TestCompaction(unittest.IsolatedAsyncioTestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.mock_session_service = AsyncMock(spec=BaseSessionService)
|
||||
self.mock_compactor = AsyncMock(spec=SlidingWindowCompactor)
|
||||
self.mock_compactor = AsyncMock(spec=LlmEventSummarizer)
|
||||
|
||||
def _create_event(
|
||||
self, timestamp: float, invocation_id: str, text: str
|
||||
|
||||
+3
-3
@@ -16,7 +16,7 @@ import unittest
|
||||
from unittest.mock import AsyncMock
|
||||
from unittest.mock import Mock
|
||||
|
||||
from google.adk.apps.sliding_window_compactor import SlidingWindowCompactor
|
||||
from google.adk.apps.llm_event_summarizer import LlmEventSummarizer
|
||||
from google.adk.events.event import Event
|
||||
from google.adk.events.event_actions import EventActions
|
||||
from google.adk.events.event_actions import EventCompaction
|
||||
@@ -32,12 +32,12 @@ import pytest
|
||||
@pytest.mark.parametrize(
|
||||
'env_variables', ['GOOGLE_AI', 'VERTEX'], indirect=True
|
||||
)
|
||||
class TestSlidingWindowCompactor(unittest.IsolatedAsyncioTestCase):
|
||||
class TestLlmEventSummarizer(unittest.IsolatedAsyncioTestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.mock_llm = AsyncMock(spec=BaseLlm)
|
||||
self.mock_llm.model = 'test-model'
|
||||
self.compactor = SlidingWindowCompactor(llm=self.mock_llm)
|
||||
self.compactor = LlmEventSummarizer(llm=self.mock_llm)
|
||||
|
||||
def _create_event(
|
||||
self, timestamp: float, text: str, author: str = 'user'
|
||||
Reference in New Issue
Block a user