Skip to content

Question about LLM query caching #253

Closed as duplicate
Closed as duplicate

Description

@NikolayTV

Hi! I want to add LLM caching, so that I do not call api twice on the same payload. I have tried to implement it using callback context, but it looks kind of ugly and has a lot of pitfalls. Then I saw this feature already implemented in LiteLLM lib: https://docs.litellm.ai/docs/caching/all_caches. But LiteLLM class from from google.adk.models.lite_llm does not seem to support it. Is there are good way now or in the future to add query caching? At least my reddis connection does not work with google-adk, but somehow disk is working. But disk is not enough. I also tried to add custom caching, using

cache.add_cache = add_cache
cache.get_cache = get_cache

but it has no effect

Activity

  1. hangfei commented on Apr 29, 2025

    @hangfei
    Collaborator

    What API and where you want to cache?

  2. self-assigned this
    on Apr 29, 2025
  3. added
    services
    on Apr 29, 2025
  4. NikolayTV commented on May 3, 2025

    @NikolayTV
    Author

    I mean this llm query caching https://docs.litellm.ai/docs/caching/local_caching

    You could keep compatibility with all LiteLLM features by just reusing their class. What was the reason why you chose to build your own LightLLM class?

  5. ptone commented on May 17, 2025

    @ptone

    This feels like a duplicated of #211

  6. added
    models
    and removed
    services
    on May 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

models

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions