Skip to content

Commit 3814db8

Browse files
author
giulio-leone
committed
Python: fix(google-ai): skip api_key check when use_vertexai is True
1 parent b712ffc commit 3814db8

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

python/semantic_kernel/connectors/ai/google/google_ai/services/google_ai_chat_completion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def __init__(
119119
if not client:
120120
if google_ai_settings.use_vertexai and not google_ai_settings.cloud_project_id:
121121
raise ServiceInitializationError("Project ID must be provided when use_vertexai is True.")
122-
if not google_ai_settings.api_key:
122+
if not google_ai_settings.use_vertexai and not google_ai_settings.api_key:
123123
raise ServiceInitializationError("The API key is required when use_vertexai is False.")
124124

125125
super().__init__(

python/semantic_kernel/connectors/ai/google/google_ai/services/google_ai_text_completion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def __init__(
9090
if not client:
9191
if google_ai_settings.use_vertexai and not google_ai_settings.cloud_project_id:
9292
raise ServiceInitializationError("Project ID must be provided when use_vertexai is True.")
93-
if not google_ai_settings.api_key:
93+
if not google_ai_settings.use_vertexai and not google_ai_settings.api_key:
9494
raise ServiceInitializationError("The API key is required when use_vertexai is False.")
9595

9696
super().__init__(

python/semantic_kernel/connectors/ai/google/google_ai/services/google_ai_text_embedding.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def __init__(
8181
if not client:
8282
if google_ai_settings.use_vertexai and not google_ai_settings.cloud_project_id:
8383
raise ServiceInitializationError("Project ID must be provided when use_vertexai is True.")
84-
if not google_ai_settings.api_key:
84+
if not google_ai_settings.use_vertexai and not google_ai_settings.api_key:
8585
raise ServiceInitializationError("The API key is required when use_vertexai is False.")
8686

8787
super().__init__(

0 commit comments

Comments
 (0)