[Extensibility 4/4] feat: Vertex AI provider (stacked on #259)

⛔ closed · #262 · open-legal-products/mike ← amal66/mike · opened 3mo ago by amal66 · closed 3mo ago · +796-94 across 10 files · ↗ on GitHub

From the PR description

Stacked on #259 - merge that first; until it merges, this diff shows its commit too. This PR's own change is the single Vertex commit.

Summary

Google models via Vertex AI without touching call sites: setupVertexAI() re-registers the "gemini" provider id so the same Gemini model IDs route through Vertex AI - enterprise billing, IAM-gated access, Workload Identity instead of a distributed API key. Zero behavior change unless configured: nothing calls setupVertexAI() by default.

Changes

  • providers/vertexAI.ts (new): streams/completes via @google/genai with vertexai: true (ADC, VERTEX_AI_PROJECT / VERTEX_AI_LOCATION); tool calls, thinking deltas, abort supported. No new dependencies - @google/genai is already in backend/package.json.
  • __tests__/vertexAI.test.ts: 7 tests (registration, model matching, re-registration).

Why

AI Studio API keys don't fit enterprise deployments needing project-scoped billing, VPC-SC/data-residency compliance, or keyless Workload Identity.

Testing

On this branch: backend npm test - 286 passed, 5 skipped (includes the 7 new tests). tsc clean.

Provenance

Both files byte-identical to the code running in amal66/mike (main). Details in amal66#48.

🤖 Generated with Claude Code

Our analysis

Route Gemini models through Vertex AI — read the full analysis →

Think the analysis missed something the PR description covers?

Capture this PR into my fork

Download a Markdown prompt that tells Claude how to port every commit in this PR into your working tree. Run it via claude -p < capture-pull-262.md from inside the repo you want the changes in.

⬇ Download capture-pull-262.md