Skip to content

Commit

Permalink
blacken
Browse files Browse the repository at this point in the history
  • Loading branch information
mayureshagashe2105 committed May 23, 2024
1 parent cfc936e commit e65d16e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
10 changes: 4 additions & 6 deletions google/generativeai/caching.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def _apply_update(self, path, value):
value = self.expire_time + datetime.timedelta(seconds=value["seconds"])
parts[-1] = "expire_time"
setattr(self, parts[-1], value)

@classmethod
def _decode_cached_content(cls, cached_content: glm.CachedContent) -> CachedContent:
# not supposed to get INPUT_ONLY repeated fields, but local gapic lib build
Expand Down Expand Up @@ -186,17 +186,15 @@ def get(cls, name: str, client: glm.CacheServiceClient | None = None) -> CachedC
request = glm.GetCachedContentRequest(name=name)
response = client.get_cached_content(request)
return cls._decode_cached_content(response)

@classmethod
def list(
cls,
page_size: Optional[int] = 1,
client: glm.CacheServiceClient | None = None
cls, page_size: Optional[int] = 1, client: glm.CacheServiceClient | None = None
) -> Iterable[CachedContent]:
"""Lists `CachedContent` objects associated with the project.
Args:
page_size: The maximum number of permissions to return (per page).
page_size: The maximum number of permissions to return (per page).
The service may return fewer `CachedContent` objects.
Returns:
Expand Down
1 change: 1 addition & 0 deletions google/generativeai/generative_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from google.generativeai.types import helper_types
from google.generativeai.types import safety_types


class GenerativeModel:
"""
The `genai.GenerativeModel` class wraps default parameters for calls to
Expand Down
1 change: 1 addition & 0 deletions google/generativeai/types/caching_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class TTL(TypedDict):

ExpirationTypes = Union[TTL, int, datetime.timedelta]


def to_ttl(expiration: Optional[ExpirationTypes]) -> TTL:
if isinstance(expiration, datetime.timedelta):
return {"seconds": int(expiration.total_seconds())}
Expand Down

0 comments on commit e65d16e

Please sign in to comment.