Problem Statement
dotCMS's LangChain4J integration supports Gemini models only through Google Vertex AI, which requires a GCP project, location and service-account/ADC authentication. Customers who want Gemini through the consumer-facing Gemini API (Google AI Studio) — a simple API key, no GCP project setup — have no way to configure dotAI for it without code changes. Vertex AI also lacks embeddings and image support in our integration, while the Gemini API exposes both through LangChain4J.
Solution
Add Google AI (Gemini API / AI Studio) as a supported provider in LangChain4jModelFactory under the identifier google_ai, distinct from the existing vertex_ai. Authenticates with a Google AI Studio API key. Supports chat (streaming and non-streaming), embeddings and image generation — full model-type coverage. The dimensions field maps to Gemini's outputDimensionality for embeddings; the size field maps to Gemini's imageSize (1K/2K) for image.
{
"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"
}
}
Acceptance Criteria
dotCMS Version
main
Links
Problem Statement
dotCMS's LangChain4J integration supports Gemini models only through Google Vertex AI, which requires a GCP project, location and service-account/ADC authentication. Customers who want Gemini through the consumer-facing Gemini API (Google AI Studio) — a simple API key, no GCP project setup — have no way to configure dotAI for it without code changes. Vertex AI also lacks embeddings and image support in our integration, while the Gemini API exposes both through LangChain4J.
Solution
Add Google AI (Gemini API / AI Studio) as a supported provider in
LangChain4jModelFactoryunder the identifiergoogle_ai, distinct from the existingvertex_ai. Authenticates with a Google AI Studio API key. Supports chat (streaming and non-streaming), embeddings and image generation — full model-type coverage. Thedimensionsfield maps to Gemini'soutputDimensionalityfor embeddings; thesizefield maps to Gemini'simageSize(1K/2K) for image.{ "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" } }Acceptance Criteria
provider: "google_ai"inproviderConfig.dimensionscontrolling the output vector size.gemini-2.5-flash-image), with optionalsize(1K/2K).endpointoverrides the default base URL when set.LangChain4jModelFactoryTest.dotCMS Version
main
Links