mirror of
https://github.com/encounter/adk-python.git
synced 2026-07-09 18:19:28 -07:00
fix: Make compactor optional in EventsCompactionConfig and add a default
If `EventsCompactionConfig` is provided without a `compactor`, a `SlidingWindowCompactor` is now automatically instantiated using the `root_agent`'s LLM. This simplifies configuration by providing a sensible default. PiperOrigin-RevId: 816038579
This commit is contained in:
committed by
Copybara-Service
parent
238472d083
commit
3f4bd67b49
@@ -64,7 +64,7 @@ class TestLlmEventSummarizer(unittest.IsolatedAsyncioTestCase):
|
||||
|
||||
self.mock_llm.generate_content_async.return_value = async_gen()
|
||||
|
||||
compacted_event = await self.compactor.maybe_compact_events(events=events)
|
||||
compacted_event = await self.compactor.maybe_summarize_events(events=events)
|
||||
|
||||
self.assertIsNotNone(compacted_event)
|
||||
self.assertEqual(
|
||||
@@ -101,11 +101,11 @@ class TestLlmEventSummarizer(unittest.IsolatedAsyncioTestCase):
|
||||
|
||||
self.mock_llm.generate_content_async.return_value = async_gen()
|
||||
|
||||
compacted_event = await self.compactor.maybe_compact_events(events=events)
|
||||
compacted_event = await self.compactor.maybe_summarize_events(events=events)
|
||||
self.assertIsNone(compacted_event)
|
||||
|
||||
async def test_maybe_compact_events_empty_input(self):
|
||||
compacted_event = await self.compactor.maybe_compact_events(events=[])
|
||||
compacted_event = await self.compactor.maybe_summarize_events(events=[])
|
||||
self.assertIsNone(compacted_event)
|
||||
self.mock_llm.generate_content_async.assert_not_called()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user