core icon indicating copy to clipboard operation
core copied to clipboard

[FEATURE] dotAI: LangChain4J integration — Phase 1 (OpenAI)

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

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 providerConfig JSON format.
  • [ ] Chat completions, embeddings, and image generation all route through the LangChain4J abstraction layer.
  • [ ] LangChain4jModelFactory is the single place with provider-specific builder logic — adding a new provider requires changes only there.
  • [ ] ProviderConfig supports configuration fields for future providers (Azure OpenAI, AWS Bedrock, Google Vertex AI).
  • [ ] No breaking changes to existing CompletionsAPI, EmbeddingsAPI, or ImageAPI interfaces.

dotCMS Version

main

Links

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

ihoffmann-dot avatar Apr 02 '26 16:04 ihoffmann-dot

QA Passed

It works as it was before using OpenAI

https://github.com/user-attachments/assets/3538ca9f-e746-44e9-8db4-182858abdbb7

zJaaal avatar Apr 27 '26 16:04 zJaaal

PRs linked to this issue

github-actions[bot] avatar Apr 30 '26 21:04 github-actions[bot]