#12624: feat: add google-vertex embedding provider for Vertex AI ADC auth
agents
stale
Cluster:
Google and Amazon AI Providers
## Summary
- Adds `google-vertex` as a new embedding provider, enabling Vertex AI users to use embeddings with their existing service account (ADC) authentication — no separate Google AI Studio API key needed
- Implements OAuth2 token exchange (SA JSON → JWT → access token) using Node.js built-in `crypto` — zero new npm dependencies
- Supports `embedQuery` (single text, `RETRIEVAL_QUERY`) and `embedBatch` (multiple texts, `RETRIEVAL_DOCUMENT`) with the Vertex AI `predict` endpoint
## Changes
| File | Change |
|------|--------|
| `src/memory/embeddings-vertex.ts` | **New** — Core provider: token exchange, predict API, caching |
| `src/memory/embeddings-vertex.test.ts` | **New** — 11 unit tests (URL, auth, request/response, batch, edge cases) |
| `src/memory/embeddings.ts` | Wire `google-vertex` into provider factory + auto-selection |
| `src/memory/manager.ts` | Add `google-vertex` to type unions and fallback logic |
| `src/config/types.tools.ts` | Add `google-vertex` to provider/fallback type unions |
| `src/config/zod-schema.agent-runtime.ts` | Add `google-vertex` to Zod validation schema |
| `src/agents/memory-search.ts` | Add `google-vertex` config defaults and model resolution |
## Configuration
```yaml
# openclaw.json — memory search config
memorySearch:
provider: google-vertex
model: text-embedding-005 # default, can be omitted
```
Required environment variables:
- `GOOGLE_CLOUD_PROJECT` — GCP project ID (required)
- `GOOGLE_CLOUD_LOCATION` — Region (optional, defaults to `us-central1`)
- `GOOGLE_APPLICATION_CREDENTIALS` — Path to SA JSON key (optional, falls back to `gcloud auth`)
## Test plan
- [x] All 11 new unit tests pass (`pnpm test src/memory/embeddings-vertex.test.ts`)
- [x] Existing embedding tests unaffected (`pnpm test src/memory/embeddings.test.ts`)
- [x] Full test suite passes (89 tests, 0 failures)
- [x] TypeScript type check passes (`pnpm typecheck`)
- [x] E2E verified: real Vertex AI API calls return 768-dim embeddings from Docker container
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR adds a new `google-vertex` embedding provider and wires it through memory-search config, types, and runtime Zod validation. The provider implements Vertex AI embeddings via the `predict` endpoint using ADC-style auth (service account JSON → JWT → OAuth2 token, with a `gcloud` fallback) and adds unit tests covering URL formation, headers, request shapes, batch embeddings, and model/location normalization.
<h3>Confidence Score: 3/5</h3>
- This PR is mergeable after fixing the auto-provider selection hard-fail and the provider-key cache collision for google-vertex.
- The core provider wiring and tests look solid, but two behavior issues likely impact real users: `provider:auto` can throw immediately in non-GCP environments due to google-vertex init errors not being treated as 'missing creds', and the embedding cache key does not include Vertex project/location, which can cause cross-project cache collisions.
- src/memory/embeddings.ts, src/memory/manager.ts
<!-- greptile_other_comments_section -->
<sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#17546: feat(memory): add native google-vertex embedding provider
by mike-hyperverse · 2026-02-15
88.4%
#19246: feat(media): add Google Vertex AI media provider
by ronaldslc · 2026-02-17
83.2%
#17462: fix(cache): enable cache retention for Google Vertex AI (#15525)
by rrenamed · 2026-02-15
78.4%
#16786: fix: support google-antigravity OAuth for Gemini embeddings
by outsourc-e · 2026-02-15
77.6%
#20191: feat(memory): add Amazon Bedrock embedding provider (Nova 2)
by gabrielkoo · 2026-02-18
76.4%
#10550: feat(memory-lancedb): local embeddings via node-llama-cpp
by namick · 2026-02-06
76.0%
#15991: feat: add Novita AI provider support with dynamic model discovery
by Alex-wuhu · 2026-02-14
74.0%
#20771: feat(memory-lancedb): support custom OpenAI-compatible embedding pr...
by marcodelpin · 2026-02-19
73.3%
#11258: feat(memory): Add Qdrant Vector Database Provider
by hleliofficiel · 2026-02-07
72.8%
#18204: feat(memory): add native Telnyx embedding provider
by aisling404 · 2026-02-16
72.7%