Skip to content

Commit

Permalink
Resolve comments
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkDaoust committed Oct 5, 2023
1 parent 6bfb3ed commit 64f2480
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions google/generativeai/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
import os
import dataclasses
import types
from typing import Any, cast, Sequence
from typing import Any, cast
from collections.abc import Sequence

import google.ai.generativelanguage as glm

Expand Down Expand Up @@ -56,7 +57,7 @@ def configure(
client_options: client_options_lib.ClientOptions | dict | None = None,
client_info: gapic_v1.client_info.ClientInfo | None = None,
default_metadata: Sequence[tuple[str, str]] = (),
):
) -> None:
"""Captures default client configuration.
If no API key has been provided (either directly, or on `client_options`) and the
Expand All @@ -70,6 +71,7 @@ def configure(
If omitted, and the `GOOGLE_API_KEY` environment variable is set, it will be
used.
default_metadata: Default (key, value) metadata pairs to send with every request.
when using `transport="rest"` these are sent as HTTP headers.
"""
if isinstance(client_options, dict):
client_options = client_options_lib.from_dict(client_options)
Expand Down Expand Up @@ -128,14 +130,14 @@ def make_client(self, cls):
def keep(name, f):
if name.startswith("_"):
return False
if not isinstance(f, types.FunctionType):
elif not isinstance(f, types.FunctionType):
return False
if isinstance(f, classmethod):
elif isinstance(f, classmethod):
return False
if isinstance(f, staticmethod):
False

return True
elif isinstance(f, staticmethod):
return False
else:
return True

def add_default_metadata_wrapper(f):
def call(*args, metadata=(), **kwargs):
Expand Down Expand Up @@ -211,7 +213,8 @@ def configure(
a separate client). This is a shortcut for `client_options={"api_key": api_key}`.
If omitted, and the `GOOGLE_API_KEY` environment variable is set, it will be
used.
default_metadata: Default `(key, value)` metadata pairs to send with every request.
default_metadata: Default (key, value) metadata pairs to send with every request.
when using `transport="rest"` these are sent as HTTP headers.
"""
return _client_manager.configure(
api_key=api_key,
Expand Down

0 comments on commit 64f2480

Please sign in to comment.