Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicit Caching #355

Merged
merged 23 commits into from
Jun 5, 2024
Merged

Explicit Caching #355

merged 23 commits into from
Jun 5, 2024

Conversation

mayureshagashe2105
Copy link
Contributor

@mayureshagashe2105 mayureshagashe2105 commented May 21, 2024

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

*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

Change-Id: I694545243efda467d6fd599beded0dc6679b727d
@mayureshagashe2105 mayureshagashe2105 marked this pull request as ready for review May 21, 2024 18:23
@github-actions github-actions bot added status:awaiting review PR awaiting review from a maintainer component:python sdk Issue/PR related to Python SDK labels May 21, 2024
mayureshagashe2105 and others added 21 commits May 22, 2024 10:50
Change-Id: I39f61012f850a82e09a7afb80b527a0f99ad0ec7
Change-Id: I39f61012f850a82e09a7afb80b527a0f99ad0ec7
Change-Id: Ie41602621d99ddff6404c6708c7278e0da790652
Change-Id: I249188fa585bd9b7193efa48b1cfca20b8a79821
If not provided, the name will be randomly generated

Change-Id: Ib95fbafd3dfe098b43164d7ee4d6c2a84b0aae2e
Change-Id: I6c69c036e54d56d18ea60368fa0a1dcda2d315fd
Change-Id: I06676fad23895e3e1a6393baa938fc1f2df57d80
Change-Id: I4e073d821d29eea30801bdb7e2a8dc01bb7d6b9a
Change-Id: Ia4bf6b936fab4c1992798c65cff91c15e51a92c0
Change-Id: I6020df4e862a4f1d58462a4cd70876a8448293cf
Change-Id: Id3e7316562f4029e5b7409ae725bb66e2207f075
Change-Id: Id3e7316562f4029e5b7409ae725bb66e2207f075
…ve-ai-python into caching

Change-Id: Id2b259fe4b2c91653bf5e4d5e883f556366d8676
Change-Id: I2f02d2421d7303f0309ec86f05d33c07332c03c1
Change-Id: Ic1cd4fc28f591794dc5fbff0647a00a77ea7f601
Change-Id: I2bade6b0099f12dd37a24fe26cfda1981c58fbc0
@MarkDaoust
Copy link
Collaborator

MarkDaoust commented Jun 4, 2024

Passing with the preview build.

@mayureshagashe2105
Copy link
Contributor Author

Cool, Thnx!

google/generativeai/types/caching_types.py Outdated Show resolved Hide resolved
google/generativeai/caching.py Show resolved Hide resolved
google/generativeai/client.py Show resolved Hide resolved
google/generativeai/generative_models.py Show resolved Hide resolved
google/generativeai/caching.py Show resolved Hide resolved
return protos.CreateCachedContentRequest(cached_content=cached_content)

@classmethod
def create(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Async?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't implement it, due to the following reason:

  1. Does it make sense to have async for cacheservice?
  2. Anyway, I'll submit it in a separate PR, just copy paste and async/await :)

@MarkDaoust
Copy link
Collaborator

MarkDaoust commented Jun 5, 2024

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.

@MarkDaoust MarkDaoust merged commit 5412d24 into google-gemini:main Jun 5, 2024
7 checks passed
@github-actions github-actions bot removed the status:awaiting review PR awaiting review from a maintainer label Jun 5, 2024
@mayureshagashe2105
Copy link
Contributor Author

Thanks for the review 🙌🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:python sdk Issue/PR related to Python SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants