google-gemini / generative-ai-python

The official Python library for the Google Gemini API
https://pypi.org/project/google-generativeai/
Apache License 2.0
1.19k stars 227 forks source link

Explicit Caching #355

Closed mayureshagashe2105 closed 1 month ago

mayureshagashe2105 commented 1 month ago

Change-Id: I694545243efda467d6fd599beded0dc6679b727d

===DO NOT SUBMIT===

*Inital prototype for explicit caching

*Add basic CURD support for caching

*Remove INPUT_ONLY marked fields from CachedContent dataclass

Rename files `cached_content->caching*`

*Update create method for explicit instantination of 'CachedContent'

*Add a factory method to instatinate model with CachedContent as its context

*blacken

*Add tests

*Rename get_cached_content -> get

*Stroke out functional approach for CachedContent CURD ops

*Validate name checks for CachedContent creation

*Update repr for GenerativeModel to include information about the model's context

*Update docstrings

*Improve tests

MarkDaoust commented 1 month ago

Passing with the preview build.

mayureshagashe2105 commented 1 month ago

Cool, Thnx!

MarkDaoust commented 1 month ago

This is passing unittests, and works in my end-to-end testing. Let's merge, and we can fix these comments in follow-on PRs.

mayureshagashe2105 commented 1 month ago

Thanks for the review 🙌🏻