Skip to content

Commit

Permalink
use the normal dataproxy if REST only
Browse files Browse the repository at this point in the history
  • Loading branch information
Philmod committed Dec 5, 2023
1 parent 2c1d3a0 commit e23d819
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions patches/sitecustomize.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ def new_configure(*args, **kwargs):
if os.getenv('KAGGLE_GOOGLE_GENERATIVE_AI_USE_REST_ONLY') != None:
client_options['api_endpoint'] += '/palmapi'
kwargs['transport'] = 'rest'
client_options['api_endpoint'] = os.environ['KAGGLE_DATA_PROXY_URL']
elif 'transport' in kwargs and kwargs['transport'] == 'rest':
client_options['api_endpoint'] += '/palmapi'
kwargs['client_options'] = client_options
Expand Down
3 changes: 2 additions & 1 deletion tests/test_google_generativeai_patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ def test_proxy_enabled(self):
proxy_token = "proxy_token"
env.set("KAGGLE_USER_SECRETS_TOKEN", secrets_token)
env.set("KAGGLE_DATA_PROXY_TOKEN", proxy_token)
env.set("KAGGLE_GRPC_DATA_PROXY_URL", self.endpoint)
env.set("KAGGLE_DATA_PROXY_URL", self.endpoint)
env.set("KAGGLE_GRPC_DATA_PROXY_URL", "http://127.0.0.1:50001")
env.set("KAGGLE_GOOGLE_GENERATIVE_AI_USE_REST_ONLY", "True")
server_address = urlparse(self.endpoint)
with env:
Expand Down

0 comments on commit e23d819

Please sign in to comment.