[FEATURE] dotAI: LangChain4J integration — Phase 1 (OpenAI)
Problem Statement
dotCMS currently supports only standalone OpenAI for AI capabilities (text generation, embeddings, image generation). The implementation is tightly coupled to OpenAI's API contract: hardcoded HTTP calls, OpenAI-specific parameters, and model validation via /v1/models. This makes it impossible to support alternative providers without rewriting the core request/response flow.
Enterprise customers in regulated industries cannot adopt dotAI because their compliance frameworks require AI providers that operate within approved cloud infrastructure (Azure, AWS, GCP) and provide contractual data privacy guarantees.
Solution
Integrate LangChain4J as an abstraction layer between dotCMS and AI providers, replacing the direct OpenAI HTTP client. Phase 1 establishes the architecture using OpenAI as the first provider, setting the foundation for Azure OpenAI, AWS Bedrock, and Google Vertex AI in subsequent phases.
The providerConfig JSON secret replaces all individual AI secrets with a single structured configuration object, supporting per-section (chat/embeddings/image) provider and model settings.
Acceptance Criteria
- [ ] Existing OpenAI customers can configure dotAI using the new
providerConfigJSON format. - [ ] Chat completions, embeddings, and image generation all route through the LangChain4J abstraction layer.
- [ ]
LangChain4jModelFactoryis the single place with provider-specific builder logic — adding a new provider requires changes only there. - [ ]
ProviderConfigsupports configuration fields for future providers (Azure OpenAI, AWS Bedrock, Google Vertex AI). - [ ] No breaking changes to existing
CompletionsAPI,EmbeddingsAPI, orImageAPIinterfaces.
dotCMS Version
main
Links
- PR: https://github.com/dotCMS/core/pull/35150
- Epic: https://github.com/dotCMS/core/issues/33970
QA Passed
It works as it was before using OpenAI
https://github.com/user-attachments/assets/3538ca9f-e746-44e9-8db4-182858abdbb7
PRs linked to this issue
- feat(dotAI): custom properties via providerConfig settings section by @ihoffmann-dot