Skip to content

[TASK] dotAI: LangChain4J - Google Vertex AI provider #35486

@fmontes

Description

@fmontes

Description

Add Google Vertex AI (Gemini) as a supported chat provider in the dotAI LangChain4J integration layer. Authentication is handled via Application Default Credentials — no API key required.

This builds on the LangChain4J abstraction established in #35183 (Phase 1 — OpenAI).

Implementation outline:

  • Add langchain4j-vertex-ai-gemini dependency (with enforcer exclusions for org.checkerframework:checker-qual and com.google.android:annotations)
  • Add vertex_ai case to LangChain4jModelFactory switch
  • Implement buildVertexAiChatModel using VertexAiGeminiChatModel
  • buildVertexAiEmbeddingModel and buildVertexAiImageModel throw UnsupportedOperationException

Acceptance Criteria

  • vertex_ai is selectable as a chat provider in providerConfig
  • Authentication uses ADC automatically; no API key is accepted
  • projectId and location are required configuration fields
  • Embeddings and image generation throw UnsupportedOperationException with a clear message
  • Unit tests cover Vertex chat builder and unsupported-operation paths in LangChain4jModelFactoryTest
  • Maven enforcer exclusions are scoped only to the Vertex dependency

Additional Context

Sample configuration:

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

The host running dotCMS must have a valid GCP identity (gcloud auth application-default login or an attached service account).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions