Skip to content

Python: Fix GoogleAI validation: skip API key check when using Vertex AI#13518

Open
veeceey wants to merge 1 commit intomicrosoft:mainfrom
veeceey:fix/issue-13483-googleai-vertex-validation
Open

Python: Fix GoogleAI validation: skip API key check when using Vertex AI#13518
veeceey wants to merge 1 commit intomicrosoft:mainfrom
veeceey:fix/issue-13483-googleai-vertex-validation

Conversation

@veeceey
Copy link

@veeceey veeceey commented Feb 7, 2026

Summary

Fixes #13483 - GoogleAIChatCompletion now correctly skips API key validation when use_vertexai=True.

Changes

  • Updated API key validation in GoogleAIChatCompletion constructor to only require api_key when use_vertexai is False
  • Added unit test to verify initialization succeeds with Vertex AI mode without an API key

Test Plan

  • Added test_google_ai_chat_completion_init_with_vertexai_without_api_key to verify the fix
  • Existing tests ensure API key is still required when use_vertexai=False
  • Existing tests ensure project ID is required when use_vertexai=True

The validation logic now correctly differentiates between:

  • Vertex AI mode (use_vertexai=True): Requires project_id, API key is optional (uses ADC)
  • Standard mode (use_vertexai=False): Requires api_key

@veeceey veeceey requested a review from a team as a code owner February 7, 2026 23:25
@moonbox3 moonbox3 added the python Pull requests for the Python Semantic Kernel label Feb 7, 2026
@github-actions github-actions bot changed the title Fix GoogleAI validation: skip API key check when using Vertex AI Python: Fix GoogleAI validation: skip API key check when using Vertex AI Feb 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Pull requests for the Python Semantic Kernel

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python: Bug: GoogleAIChatCompletion wrongly requires api_key even when use_vertexai is set to True

2 participants