Switch Vertex AI provider to native genai SDK#242
Merged
Conversation
Replace the OpenAI-compatible endpoint approach with the native google-genai SDK for Vertex AI. This eliminates the custom token refresher, TokenInjectingTransport, and async lifecycle complexity while also removing the 8192 output token cap that the OpenAI endpoint enforced. Changes: - vertexai provider now uses genai.Client(vertexai=True) instead of AsyncOpenAI with token-injecting transport - Routes through existing _call_gemini/_call_with_tools_gemini paths - Strips google/ prefix from model names (native SDK uses bare names) - Preserves service account key auth via credentials parameter - Delete vertexai_token_refresher.py (no longer needed) - Strip markdown code fences in consolidator JSON parsing - Rewrite vertexai tests for native SDK integration
nicoloboschi
approved these changes
Jan 30, 2026
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
google-genaiSDK (genai.Client(vertexai=True)) for thevertexaiLLM providervertexai_token_refresher.py— the SDK handles credential refresh internallyMotivation
The
vertexaiprovider originally used the Vertex AI OpenAI-compatible endpoint to reuse theAsyncOpenAIclient code path. This required a customTokenInjectingTransport, a background token refresher with async lifecycle management, and hit an undocumented 8192 max output token cap on the endpoint. The nativegenaiSDK (already a dependency for thegeminiprovider) handles auth automatically and doesn't have the output token cap.Changes
llm_wrapper.py:vertexainow createsgenai.Client(vertexai=True, project=..., location=...)and routes through_call_gemini/_call_with_tools_gemini. Service account key auth preserved viacredentialsparameter. Model names withgoogle/prefix are auto-stripped.vertexai_token_refresher.py: Deleted (no longer needed)consolidator.py: Strip ``` code fences before JSON parsingtest_vertexai_provider.py: Rewritten for native SDK (mockgenai.Clientinstead of token refresher)Test plan
pytest tests/test_vertexai_provider.py— all 6 pass, 1 skipped (integration)vertexaiprovider