Python: fix(google-ai): skip api_key check when use_vertexai is True#13607
Open
giulio-leone wants to merge 2 commits intomicrosoft:mainfrom
Open
Python: fix(google-ai): skip api_key check when use_vertexai is True#13607giulio-leone wants to merge 2 commits intomicrosoft:mainfrom
giulio-leone wants to merge 2 commits intomicrosoft:mainfrom
Conversation
Author
|
@microsoft-github-policy-service agree |
27f8e4d to
ce250e0
Compare
Author
|
Friendly ping — CI is green and this is ready for review. Happy to address any feedback. Thanks! |
ce250e0 to
3814db8
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes Google AI connector initialization for Vertex AI usage by skipping the api_key requirement when use_vertexai=True, aligning the validation logic with the intended ADC authentication path.
Changes:
- Guard
api_keyvalidation withnot use_vertexaiinGoogleAIChatCompletion. - Guard
api_keyvalidation withnot use_vertexaiinGoogleAITextCompletion. - Guard
api_keyvalidation withnot use_vertexaiinGoogleAITextEmbedding.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| python/semantic_kernel/connectors/ai/google/google_ai/services/google_ai_chat_completion.py | Skip API key validation when using Vertex AI during initialization. |
| python/semantic_kernel/connectors/ai/google/google_ai/services/google_ai_text_completion.py | Skip API key validation when using Vertex AI during initialization. |
| python/semantic_kernel/connectors/ai/google/google_ai/services/google_ai_text_embedding.py | Skip API key validation when using Vertex AI during initialization. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
python/semantic_kernel/connectors/ai/google/google_ai/services/google_ai_chat_completion.py
Show resolved
Hide resolved
python/semantic_kernel/connectors/ai/google/google_ai/services/google_ai_chat_completion.py
Show resolved
Hide resolved
python/semantic_kernel/connectors/ai/google/google_ai/services/google_ai_text_completion.py
Show resolved
Hide resolved
python/semantic_kernel/connectors/ai/google/google_ai/services/google_ai_text_embedding.py
Show resolved
Hide resolved
Author
|
Hi! Gentle ping — this PR is rebased, CI passes, and ready for review. Happy to address any feedback. Thanks! |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
94d8643 to
d8cb434
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #13483
Motivation and Context
When
use_vertexai=True, users authenticate via Application Default Credentials (ADC) and don't need an API key. However, the initialization check forapi_keyruns unconditionally, blocking Vertex AI users with:Description
Guard the
api_keyvalidation withnot google_ai_settings.use_vertexaiin all three Google AI service classes:GoogleAIChatCompletionGoogleAITextCompletionGoogleAITextEmbeddingThe error message already reads "when use_vertexai is False", so the condition now matches the intent.
Before / After
Contribution Checklist