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

Add metadata wrapper #636

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion google/generativeai/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,13 @@ def make_client(self, name):
)
raise e

return _add_metadata_wrapper(client)


def _add_metadata_wrapper(self, client):
if not self.default_metadata:
return client

def keep(name, f):
if name.startswith("_"):
return False
Expand Down Expand Up @@ -269,6 +273,7 @@ def get_default_operations_client(self) -> operations_v1.OperationsClient:
if client is None:
model_client = self.get_default_client("Model")
client = model_client._transport.operations_client
client = self._add_metadata_wrapper(client)
self.clients["operations"] = client
return client

Expand Down
Loading