Repository navigation
feat: enable AI features with Google Vertex AI service account support - #10
Merged
Merged
Conversation
There was a problem hiding this comment.
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.credentialssupport for Vertex initialization viaGOOGLE_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 on lines
24
to
+28
| - keepcontracts | ||
| - --image=${_IMAGE} | ||
| - --region=us-west1 | ||
| - --project=$PROJECT_ID | ||
| - --service-account=keepcontracts-vertex-ai@keepcontracts.iam.gserviceaccount.com |
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 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="" |
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.
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.