Skip to content

feat(dotAI): Dot AI LangChain4J - Google AI Gemini#36137

Draft
ihoffmann-dot wants to merge 2 commits into
mainfrom
dot-ai-langchain-google-gemini
Draft

feat(dotAI): Dot AI LangChain4J - Google AI Gemini#36137
ihoffmann-dot wants to merge 2 commits into
mainfrom
dot-ai-langchain-google-gemini

Conversation

@ihoffmann-dot

Copy link
Copy Markdown
Member

Summary

Adds Google AI (Gemini API / AI Studio) as a supported provider under the identifier
google_ai — distinct from the existing vertex_ai, which reaches the same model
family through Google Cloud. This is the consumer-facing Gemini API: a single
AI Studio API key, no GCP project/location/service-account setup.

Full model-type coverage — the only provider besides OpenAI with all four:

  • Add langchain4j-google-ai-gemini dependency (version via langchain4j BOM)
  • Add GoogleAiGeminiModelProviderStrategy registered in LangChain4jModelFactory.STRATEGIES
  • Chat + streaming chat via GoogleAiGeminiChatModel / GoogleAiGeminiStreamingChatModel
  • Embeddings via GoogleAiEmbeddingModeldimensions maps to outputDimensionality
  • Image generation via GoogleAiGeminiImageModelsize maps to imageSize (1K/2K)
  • Add 11 unit tests in LangChain4jModelFactoryTest

Configuration

{
  "chat": {
    "provider": "google_ai",
    "model": "gemini-2.0-flash",
    "apiKey": "AIza...",
    "maxTokens": 4096,
    "temperature": 0.7
  },
  "embeddings": {
    "provider": "google_ai",
    "model": "gemini-embedding-001",
    "apiKey": "AIza...",
    "dimensions": 768
  },
  "image": {
    "provider": "google_ai",
    "model": "gemini-2.5-flash-image",
    "apiKey": "AIza...",
    "size": "1K"
  }
}

Notes

  • API key comes from Google AI Studio — no GCP project required.
  • size for image uses Gemini's format (1K, 2K), not OpenAI's 1024x1024.
  • maxRetries is not supported by the streaming chat model and is ignored with a warning (same behavior as the OpenAI provider).
  • endpoint optionally overrides the default base URL on all three model types.

Related Issue

This PR fixes #36134
EPIC: dotAI Multi-Provider Support #33970

@claude

claude Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Claude finished @ihoffmann-dot's task in 1m 15s —— View job


Rollback Safety Analysis

  • Read rollback-unsafe categories reference
  • Get full PR diff
  • Analyze diff against all categories
  • Apply label

Verdict: ✅ Safe to Roll Back

All changes in this PR are purely additive — no database schema, Elasticsearch mapping, content model, REST API contract, or VTL viewtool changes are involved.

Category Result
C-1 Structural Data Model Change ✅ No DB schema changes
C-2 Elasticsearch Mapping Change ✅ No ES mapping changes
C-3 Content JSON Model Version Bump ✅ No contentlet model changes
C-4 DROP TABLE / DROP COLUMN ✅ No destructive DDL
H-1 One-Way Data Migration ✅ No data migrations
H-2 RENAME TABLE / RENAME COLUMN ✅ No renames
H-3 PK Restructuring ✅ No PK changes
H-4 New ContentType Field Type ✅ No new field types
H-5 Storage Provider Change ✅ No storage provider changes
H-6 DROP PROCEDURE / FUNCTION ✅ No procedure drops
H-7 NOT NULL Column Without Default ✅ No column additions
H-8 VTL Viewtool Contract Change ✅ No viewtool changes
M-1 Non-Broadening Column Type Change ✅ No type changes
M-2 Push Publishing Bundle Format ✅ No bundle format changes
M-3 REST / GraphQL API Contract Change ✅ No API contract changes
M-4 OSGi Plugin API Breakage ✅ No OSGi interface changes

What changed:

  • New Maven dependency langchain4j-google-ai-gemini (version from BOM)
  • New GoogleAiGeminiModelProviderStrategy class (package-private, internal)
  • STRATEGIES list in LangChain4jModelFactory extended with the new strategy
  • Javadoc updates in ProviderConfig.java and LangChain4jModelFactory.java
  • 11 new unit tests

Rolling back to N-1 simply means the google_ai provider identifier is unrecognized — existing configurations using other providers are unaffected, and no stored data or index state is changed.

@github-actions

github-actions Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

🤖 Codex Review — openai.gpt-5.5

**[> [🟡 Medium] dotCMS/pom.xml:517 — New dependency is added directly to dotCMS/pom.xml without showing dependency management in bom/application/pom.xml. dotCMS convention requires dependency versions to be managed in the BOM; if this artifact is not already managed there, Maven builds will fail with a missing version.


Run: #27393353859 · tokens: in: 4253 · out: 597 (reasoning: 516) · total: 4850

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI: Safe To Rollback Area : Backend PR changes Java/Maven backend code

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

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

1 participant