Skip to content

feat: enable AI features with Google Vertex AI service account support - #10

Merged
austinw8 merged 1 commit into
mainfrom
enable-ai-features
Aug 12, 2026
Merged

austinw8 merged 1 commit into
mainfrom
enable-ai-features

Conversation

@austinw8

Copy link
Copy Markdown
Collaborator

Enables AI contact and field detection for uploaded documents. We've attached a dedicated, minimally scoped service account directly to our Cloud Run service, so Google automatically hands the app short-lived credentials with no static secret ever stored anywhere.

Copilot AI lite review requested due to automatic review settings August 12, 2026 19:35
@austinw8
austinw8 merged commit 76b0b2f into main Aug 12, 2026
5 of 7 checks passed
@austinw8
austinw8 deleted the enable-ai-features branch August 12, 2026 19:38

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Enables Google Vertex AI-backed document AI features (contact and field detection) by supporting alternative authentication paths beyond an API key, including service account JSON credentials and Application Default Credentials (ADC), and configures Cloud Run to run under a dedicated service account.

Changes:

  • Add optional googleAuthOptions.credentials support for Vertex initialization via GOOGLE_VERTEX_SERVICE_ACCOUNT_JSON.
  • Expand AI “configured” gating to allow API key, service account JSON, or explicit ADC opt-in.
  • Update Cloud Build Cloud Run deploy step to use a dedicated runtime service account; document new env vars in .env.example.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
packages/lib/server-only/ai/google.ts Adds service-account JSON credential support when creating the Vertex client.
packages/lib/constants/app.ts Broadens AI configuration detection to support API key, service account JSON, or ADC flag.
cloudbuild.yaml Sets the Cloud Run runtime service account during deployment.
.env.example Documents new Vertex AI authentication env vars (service account JSON + ADC flag).

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines 13 to 16
location: env('GOOGLE_VERTEX_LOCATION') || 'global',
apiKey: env('GOOGLE_VERTEX_API_KEY'),
googleAuthOptions: serviceAccountJson ? { credentials: JSON.parse(serviceAccountJson) } : undefined,
});
Comment thread cloudbuild.yaml
Comment on lines 24 to +28
- keepcontracts
- --image=${_IMAGE}
- --region=us-west1
- --project=$PROJECT_ID
- --service-account=keepcontracts-vertex-ai@keepcontracts.iam.gserviceaccount.com
Comment thread .env.example
Comment on lines +214 to +218
# OPTIONAL: Service account credentials for Google Vertex AI,
# as a JSON string (the contents of a downloaded service account key file).
# Used instead of GOOGLE_VERTEX_API_KEY.
GOOGLE_VERTEX_SERVICE_ACCOUNT_JSON=""
# OPTIONAL: Set to "true" to rely on Application Default Credentials instead of an
Comment thread .env.example
Comment on lines +218 to +220
# OPTIONAL: Set to "true" to rely on Application Default Credentials instead of an
# API key or service account JSON
GOOGLE_VERTEX_USE_ADC=""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants