Python: fix(google-ai): skip api_key check when use_vertexai is True#13607
Python: fix(google-ai): skip api_key check when use_vertexai is True#13607giulio-leone wants to merge 2 commits intomicrosoft:mainfrom
Conversation
|
@microsoft-github-policy-service agree |
27f8e4d to
ce250e0
Compare
|
Friendly ping — CI is green and this is ready for review. Happy to address any feedback. Thanks! |
ce250e0 to
3814db8
Compare
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
|
Hi! Gentle ping — this PR is rebased, CI passes, and ready for review. Happy to address any feedback. Thanks! |
94d8643 to
d8cb434
Compare
d8cb434 to
56c3e4c
Compare
|
Friendly ping — CI is green, tests pass, ready for review whenever convenient. Happy to address any feedback. Thanks! 🙏 |
56c3e4c to
2bf8b08
Compare
|
Hi — all 4 threads resolved. cloud_region validation added to all 3 service classes. Fixes #13483. Ready for review! |
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