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

Use a new KAGGLE_GRPC_DATA_PROXY_URL env variable for gRPC proxying #1337

Merged
merged 5 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 2 additions & 2 deletions patches/sitecustomize.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def post_import_logic(module):
return
if (os.getenv('KAGGLE_DATA_PROXY_TOKEN') == None or
os.getenv('KAGGLE_USER_SECRETS_TOKEN') == None or
os.getenv('KAGGLE_DATA_PROXY_URL') == None):
os.getenv('KAGGLE_GRPC_DATA_PROXY_URL') == None):
return

old_configure = module.configure
Expand All @@ -101,7 +101,7 @@ def new_configure(*args, **kwargs):
client_options = kwargs['client_options']
else:
client_options = {}
client_options['api_endpoint'] = os.environ['KAGGLE_DATA_PROXY_URL']
client_options['api_endpoint'] = os.environ['KAGGLE_GRPC_DATA_PROXY_URL']
Philmod marked this conversation as resolved.
Show resolved Hide resolved
if os.getenv('KAGGLE_GOOGLE_GENERATIVE_AI_USE_REST_ONLY') != None:
client_options['api_endpoint'] += '/palmapi'
kwargs['transport'] = 'rest'
Expand Down
2 changes: 1 addition & 1 deletion tests/test_google_generativeai_patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ 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_DATA_PROXY_URL", self.endpoint)
env.set("KAGGLE_GRPC_DATA_PROXY_URL", self.endpoint)
env.set("KAGGLE_GOOGLE_GENERATIVE_AI_USE_REST_ONLY", "True")
server_address = urlparse(self.endpoint)
with env:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_google_generativeai_patch_disabled.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def test_disabled(self):
env = EnvironmentVarGuard()
env.set("KAGGLE_USER_SECRETS_TOKEN", "foobar")
env.set("KAGGLE_DATA_PROXY_TOKEN", "foobar")
env.set("KAGGLE_DATA_PROXY_URL", self.endpoint)
env.set("KAGGLE_GRPC_DATA_PROXY_URL", self.endpoint)
env.set("KAGGLE_DISABLE_GOOGLE_GENERATIVE_AI_INTEGRATION", "True")
server_address = urlparse(self.endpoint)
with env:
Expand Down