feat(genai): migrate Vertex AI env var to Enterprise 02#14229
feat(genai): migrate Vertex AI env var to Enterprise 02#14229msampathkumar wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the environment variable GOOGLE_GENAI_USE_VERTEXAI to GOOGLE_GENAI_USE_ENTERPRISE across several test files. Feedback suggests avoiding module-level environment variable settings to prevent global state mutation and potential initialization issues, recommending the use of pytest fixtures with monkeypatch instead. Additionally, it was noted that the Enterprise setting typically requires a regional location rather than 'global' for compatibility.
| import ctrlgen_with_resp_schema | ||
|
|
||
| os.environ["GOOGLE_GENAI_USE_VERTEXAI"] = "True" | ||
| os.environ["GOOGLE_GENAI_USE_ENTERPRISE"] = "True" |
There was a problem hiding this comment.
Setting environment variables at the module level, especially after imports, can lead to issues if any imported modules initialize clients at the module level. It also causes global state mutation that can affect other tests in the suite. Consider using a pytest fixture with monkeypatch for better isolation. Additionally, note that Vertex AI (Enterprise) typically requires a regional location (e.g., us-central1) rather than global; you may need to update GOOGLE_CLOUD_LOCATION to ensure compatibility.
| import counttoken_with_txt_vid | ||
|
|
||
| os.environ["GOOGLE_GENAI_USE_VERTEXAI"] = "True" | ||
| os.environ["GOOGLE_GENAI_USE_ENTERPRISE"] = "True" |
There was a problem hiding this comment.
Setting environment variables at the module level, especially after imports, can lead to issues if any imported modules initialize clients at the module level. It also causes global state mutation that can affect other tests in the suite. Consider using a pytest fixture with monkeypatch for better isolation. Additionally, note that Vertex AI (Enterprise) typically requires a regional location (e.g., us-central1) rather than global; you may need to update GOOGLE_CLOUD_LOCATION to ensure compatibility.
|
|
||
|
|
||
| os.environ["GOOGLE_GENAI_USE_VERTEXAI"] = "True" | ||
| os.environ["GOOGLE_GENAI_USE_ENTERPRISE"] = "True" |
There was a problem hiding this comment.
Setting environment variables at the module level, especially after imports, can lead to issues if any imported modules initialize clients at the module level. It also causes global state mutation that can affect other tests in the suite. Consider using a pytest fixture with monkeypatch for better isolation. Additionally, note that Vertex AI (Enterprise) typically requires a regional location (e.g., us-central1) rather than global; you may need to update GOOGLE_CLOUD_LOCATION to ensure compatibility.
| import thinking_textgen_with_txt | ||
|
|
||
| os.environ["GOOGLE_GENAI_USE_VERTEXAI"] = "True" | ||
| os.environ["GOOGLE_GENAI_USE_ENTERPRISE"] = "True" |
There was a problem hiding this comment.
Setting environment variables at the module level, especially after imports, can lead to issues if any imported modules initialize clients at the module level. It also causes global state mutation that can affect other tests in the suite. Consider using a pytest fixture with monkeypatch for better isolation. Additionally, note that Vertex AI (Enterprise) typically requires a regional location (e.g., us-central1) rather than global; you may need to update GOOGLE_CLOUD_LOCATION to ensure compatibility.
| import thinking_with_txt | ||
|
|
||
| os.environ["GOOGLE_GENAI_USE_VERTEXAI"] = "True" | ||
| os.environ["GOOGLE_GENAI_USE_ENTERPRISE"] = "True" |
There was a problem hiding this comment.
Setting environment variables at the module level, especially after imports, can lead to issues if any imported modules initialize clients at the module level. It also causes global state mutation that can affect other tests in the suite. Consider using a pytest fixture with monkeypatch for better isolation. Additionally, note that Vertex AI (Enterprise) typically requires a regional location (e.g., us-central1) rather than global; you may need to update GOOGLE_CLOUD_LOCATION to ensure compatibility.
Description
Updating Vertex AI environmental variable for GenAI SDK.
Checklist