Skip to content

Commit 04776e2

Browse files
committed
Pass the metadata through to the discovert URL
Change-Id: If8f938a1026d46aafc617d1c0e95360c463f0ba0
1 parent 5eec660 commit 04776e2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

google/generativeai/client.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def __init__(self, *args, **kwargs):
5151
self._discovery_api = None
5252
super().__init__(*args, **kwargs)
5353

54-
def _setup_discovery_api(self):
54+
def _setup_discovery_api(self, metadata:dict|Sequence[tuple[str, str]]=()):
5555
api_key = self._client_options.api_key
5656
if api_key is None:
5757
raise ValueError(
@@ -62,6 +62,7 @@ def _setup_discovery_api(self):
6262
http=httplib2.Http(),
6363
postproc=lambda resp, content: (resp, content),
6464
uri=f"{GENAI_API_DISCOVERY_URL}?version=v1beta&key={api_key}",
65+
headers=dict(metadata)
6566
)
6667
response, content = request.execute()
6768
request.http.close()
@@ -82,7 +83,7 @@ def create_file(
8283
metadata:Sequence[tuple[str, str]] = ()
8384
) -> protos.File:
8485
if self._discovery_api is None:
85-
self._setup_discovery_api()
86+
self._setup_discovery_api(metadata)
8687

8788
file = {}
8889
if name is not None:

0 commit comments

Comments
 (0)