Skip to content

Added VertexAI support, including GCP ADC Resolution#12

Open
logans-a11y wants to merge 2 commits into
NVIDIA:mainfrom
logans-a11y:vertexai-provider
Open

Added VertexAI support, including GCP ADC Resolution#12
logans-a11y wants to merge 2 commits into
NVIDIA:mainfrom
logans-a11y:vertexai-provider

Conversation

@logans-a11y

Copy link
Copy Markdown

Enables VertexAI Integration for the series of Gemini models. Automatically resolves API Key via google-auth package.

Follows same pattern as every other provider, only difference is resolving from ADC json file, rather than an API key.

@rng1995 rng1995 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Request changes — the provider is cleanly structured and conforms to the ModelMetadataProvider / CredentialsProvider protocols (it mirrors OpenAIProvider and reuses registry.lookup_* correctly), and the ADC-based credential flow is sensible (fail-closed when env is unset, no secret logging, no eval/exec/subprocess). However, there's a functional blocker that means Gemini calls won't actually succeed as written, plus a merge conflict and a couple of smaller items.

Blocking

  1. Model identifier is missing the required google/ prefix. The Vertex AI OpenAI-compatibility endpoint (.../endpoints/openapi/chat/completions) requires the model field to be prefixed with google/ for Gemini models, per Google's OpenAI-compatibility docs (e.g. model="google/gemini-2.5-flash"). Here resolve_model() returns the bare label (gemini-2.5-flash), which flows unchanged into MODEL_CONFIGget_chat_model(model=...)ChatOpenAI(model=...), so requests go out as model: "gemini-2.5-flash" and the endpoint will reject them. The README example (SKILLSPECTOR_MODEL=gemini-2.5-pro) has the same gap.

    • Heads-up on the fix: the resolved model string is also used for token-budget lookups (get_max_output_tokens(model)registry.lookup_*), so simply prepending google/ inside resolve_model would break the registry key match (keys are bare) and silently drop token budgeting. Please decide where the prefix belongs — e.g. apply it only at the ChatOpenAI boundary for this provider, or key the registry on the prefixed names and update the README/.env.example to match — and ideally add a test asserting the outgoing model value.
  2. Merge conflict with main. GitHub reports this branch as conflicting (mergeable_state: dirty) — the shared registry YAMLs / pyproject.toml appear to have diverged. Please rebase and resolve before merge.

Should fix

  1. Lint failures. pyproject.toml selects the W ruleset (only E501 is ignored). provider.py has trailing whitespace on blank lines (W293) and no newline at end of file (W292), so ruff check will fail.
  2. No tests for the new provider. The credential/URL logic is non-trivial (ADC resolution, token refresh, base-URL construction). A unit test mocking google.auth.default() — asserting the constructed base_url, the returned token, the None fall-through when env is unset, and the model id sent to the client — would match the coverage the other providers have in tests/unit/test_providers.py.

Minor / optional

  • Dead branch: after the if not project_id or not location: return None guard, project_id is always truthy, so project = project_id or default_project and the following if not project: raise ValueError(...) are unreachable (and default_project is then unused). Either drop the dead branch, or restructure so GOOGLE_CLOUD_PROJECT can be optional and fall back to the ADC-resolved project.
  • Registry duplication: the same Gemini block is added to the root, openai, and nv_build registries in addition to the new vertexai one. The openai entry is defensible (Gemini via an OpenAI-compatible base URL), but the nv_build provider doesn't serve Gemini, so that entry reads as misleading.
  • Stray double blank line after SLOT_DEFAULTS.

Thanks — the structure is solid and protocol conformance is spot on; mainly the google/ model prefix needs sorting out for this to work end to end.

@logans-a11y

Copy link
Copy Markdown
Author

@rng1995 Thank you for the feedback. Fixes should be applied. Let me know if you want anything further.

@rng1995 rng1995 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review — the blocking issues from my prior review are resolved; approving.

  • google/ model prefix (was blocking): now applied exactly at the wire boundary — create_chat_model builds wire_model = google/<model> for ChatOpenAI while get_context_length/get_max_output_tokens/resolve_model keep using the bare label, so registry/token-budget lookups still match. test_create_chat_model_prefixes_model_with_google and ..._does_not_double_prefix lock both halves in.
  • Provider tests (was a gap): comprehensive TestVertexAIProvider (env fail-closed, ADC mocked, prefix behavior, bundled-YAML metadata, resolve_model).
  • Dead project/default_project branch: removed.
  • nv_build registry duplication: correctly avoided (Gemini added only to root + openai + the new vertexai registry).

Non-blocking: src/skillspector/providers/nv_build/model_registry.yaml picked up a stray blank line with trailing whitespace — please trim. Also confirm the branch is rebased on main before merge (it previously reported conflicts).

@logans-a11y

Copy link
Copy Markdown
Author

@rng1995 Merge conflict should be resolved now, sorry for the confusion. In terms of the trailing whitespace I just cannot find it. Would it be picked up by the linter? Please let me know, thank you.

@rng1995 rng1995 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VertexAI behavior remains unchanged from the previously approved head, including correct single application of the google/ wire prefix. The new merge commit is nevertheless stale against current main and conflicts in README.md, provider selection, and uv.lock. It also has failing Python 3.12/3.13 lint-and-test and DCO checks. Please rebase or merge current main, preserve VertexAI and every current provider option, regenerate the lockfile, remove the trailing whitespace, and restore green checks.

Comment thread src/skillspector/providers/__init__.py Outdated
raise ValueError(
f"Unknown SKILLSPECTOR_PROVIDER: {name!r}. "
"Expected one of: openai, anthropic, anthropic_proxy, bedrock, nv_build (or unset)."
"Expected one of: openai, anthropic, anthropic_proxy, vertexai bedrock, nv_build (or unset)."

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This merge result leaves the provider list malformed ('vertexai bedrock') and stale: current main's CLI provider options are absent. Rebase and resolve the provider conflict so VertexAI is retained alongside every current provider, and fix the comma and error message.

Signed-off-by: Logan Solonche <logan.s@covergenius.com>
@logans-a11y

Copy link
Copy Markdown
Author

Sorry for all of the confusion. Should now be good, signed off on the force push, so that check should pass. Ran the linter, and resolved the dangling whitespace. rebased, and should have restored green checks.

@logans-a11y logans-a11y requested a review from rng1995 July 1, 2026 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants