core icon indicating copy to clipboard operation
core copied to clipboard

[FEATURE] dotAI: LangChain4J integration — Phase 2 (Google Vertex AI)

Open ihoffmann-dot opened this issue 7 months ago • 2 comments

Problem Statement

dotCMS's LangChain4J integration (Phase 1) supports only standalone OpenAI. Enterprise customers on GCP need to route AI workloads through Vertex AI (Gemini), which provides managed model access under Google's data residency and compliance agreements. Vertex AI uses Application Default Credentials — no API key is required or accepted — making it incompatible with the existing OpenAI-centric configuration model.

Solution

Add Google Vertex AI as a supported chat provider in LangChain4jModelFactory. Authentication is handled automatically via Application Default Credentials (ADC): service account attached to the instance, gcloud auth application-default login, or Workload Identity. No API key needed. Embeddings and image generation are not available through LangChain4J for Vertex AI and throw UnsupportedOperationException.

{
  "chat": {
    "provider": "vertex_ai",
    "projectId": "my-gcp-project",
    "location": "us-central1",
    "model": "gemini-1.5-pro",
    "maxTokens": 8192,
    "temperature": 1.0
  }
}

Acceptance Criteria

  • [ ] Chat completions work end-to-end using provider: "vertex_ai" in providerConfig.
  • [ ] Authentication resolves via ADC without requiring an API key in the configuration.
  • [ ] projectId, location, and model are correctly passed to VertexAiGeminiChatModel.
  • [ ] Attempting embeddings or image generation with provider: "vertex_ai" throws a clear UnsupportedOperationException.
  • [ ] Banned transitive dependencies (org.checkerframework:checker-qual, com.google.android:annotations) are explicitly excluded from the langchain4j-vertex-ai-gemini Maven dependency.
  • [ ] Unit tests cover the Vertex AI builder paths in LangChain4jModelFactoryTest.

dotCMS Version

main

Links

  • PR: https://github.com/dotCMS/core/pull/35241
  • Epic: https://github.com/dotCMS/core/issues/33970

ihoffmann-dot avatar Apr 15 '26 18:04 ihoffmann-dot

PRs linked to this issue

github-actions[bot] avatar May 26 '26 18:05 github-actions[bot]

QA Passed

Tested in main 94fb755

https://github.com/user-attachments/assets/85e3151e-a78f-4285-b53d-4183d23d819c

KevinDavilaDotCMS avatar Jun 08 '26 12:06 KevinDavilaDotCMS