refactor(live): generalize AudioCacheManager into CacheManager and wire live flow - #7348
Open
copybara-service[bot] wants to merge 1 commit into
Open
copybara-service[bot] wants to merge 1 commit into
copybara-service[bot] wants to merge 1 commit into
Conversation
…re live flow - Introduce `CacheManager`, `CacheConfig`, and `RealtimeCacheEntry` in `google.adk.live._cache_manager` with `cache_blob()` MIME routing, shared `_save_artifact_and_build_event()`, and concurrent fault-isolated cache flushing (`asyncio.gather(..., return_exceptions=True)`). - Keep `google.adk.live._audio_cache_manager` and `google.adk.flows.llm_flows.audio_cache_manager` as backward-compatible re-export shims (`AudioCacheManager = CacheManager`, `AudioCacheConfig = CacheConfig`). - Add `input_media_realtime_cache` and `output_media_realtime_cache` fields to `InvocationContext`. - Add `self.cache_manager = CacheManager()` to `BaseLlmFlow` with deprecated `__getattribute__`/`__setattr__` forwarding for `self.audio_cache_manager`. - Update `_live_llm_flow.py` and `_flow_utils.py` to use `flow.cache_manager` and `cache_manager.cache_blob()`. Testing Plan: - Added unit tests in `tests/unittests/live/test_cache_manager.py` covering `CacheManager`, `CacheConfig`, `cache_blob()` routing, MIME parameter normalization, and concurrent fault-isolated flushing. - Updated `tests/unittests/live/test_audio_cache_manager.py`, `tests/unittests/live/test_flow_utils.py`, `tests/unittests/live/test_live_llm_flow.py`, and `tests/unittests/flows/llm_flows/test_audio_cache_manager.py`. PiperOrigin-RevId: 990565785
copybara-service
Bot
force-pushed
the
copybara/990565785
branch
from
September 30, 2026 02:12
9a816bf to
9b62858
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
refactor(live): generalize AudioCacheManager into CacheManager and wire live flow
CacheManager,CacheConfig, andRealtimeCacheEntryingoogle.adk.live._cache_managerwithcache_blob()MIME routing, shared_save_artifact_and_build_event(), and concurrent fault-isolated cache flushing (asyncio.gather(..., return_exceptions=True)).google.adk.live._audio_cache_managerandgoogle.adk.flows.llm_flows.audio_cache_manageras backward-compatible re-export shims (AudioCacheManager = CacheManager,AudioCacheConfig = CacheConfig).input_media_realtime_cacheandoutput_media_realtime_cachefields toInvocationContext.self.cache_manager = CacheManager()toBaseLlmFlowwith deprecated__getattribute__/__setattr__forwarding forself.audio_cache_manager._live_llm_flow.pyand_flow_utils.pyto useflow.cache_managerandcache_manager.cache_blob().Testing Plan:
tests/unittests/live/test_cache_manager.pycoveringCacheManager,CacheConfig,cache_blob()routing, MIME parameter normalization, and concurrent fault-isolated flushing.tests/unittests/live/test_audio_cache_manager.py,tests/unittests/live/test_flow_utils.py,tests/unittests/live/test_live_llm_flow.py, andtests/unittests/flows/llm_flows/test_audio_cache_manager.py.