core icon indicating copy to clipboard operation
core copied to clipboard

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

Open ihoffmann-dot opened this issue 7 months ago • 1 comments

Problem Statement

Enterprise customers in regulated industries or with existing Azure agreements need to run dotAI against Azure-hosted OpenAI deployments rather than OpenAI directly. Azure OpenAI provides the same models under a different authentication and endpoint model (deployment names, API versions, Azure-specific SDK), along with contractual data residency and compliance guarantees.

Solution

Add `azure_openai` as a supported provider in the LangChain4J integration layer. Users configure dotAI via the `providerConfig` JSON secret — no code changes required. The implementation follows the same factory pattern established in Phase 1 (OpenAI).

Key behaviors:

  • Either `deploymentName` or `model` can be used; Azure deployments use arbitrary names that do not match the underlying model name
  • Comma-separated fallback lists are supported in `model` (e.g. `"gpt-4o,gpt-4o-mini"`)
  • o-series and gpt-5+ deployments that require `max_completion_tokens` are handled automatically — `maxTokens` is silently skipped for these to avoid a 400 error
  • Netty and Reactor versions are pinned in BOM to resolve transitive conflicts from the Azure SDK

Acceptance Criteria

  • [x] Chat completions work end-to-end with an Azure OpenAI deployment
  • [x] Streaming chat completions work end-to-end
  • [x] Embeddings work end-to-end (verified with `text-embedding-3-small`)
  • [x] `deploymentName`-only configs (no `model` field) are accepted and functional
  • [x] Configs using only `model` are accepted and functional
  • [x] o-series and gpt-5+ deployments do not receive `max_tokens` in the request
  • [x] Unit tests cover Azure-specific paths in `LangChain4jModelFactory` and `LangChain4jAIClient`
  • [ ] Image generation — blocked: Azure retired `dall-e-3` on March 4 2026; `gpt-image-1` is not yet supported by LangChain4J's `AzureOpenAiImageModel`

Example Configuration

{
  "chat": {
    "provider": "azure_openai",
    "apiKey": "...",
    "endpoint": "https://my-company.openai.azure.com/",
    "deploymentName": "my-gpt4o-deployment",
    "apiVersion": "2024-02-01",
    "maxTokens": 16384,
    "temperature": 1.0
  },
  "embeddings": {
    "provider": "azure_openai",
    "apiKey": "...",
    "endpoint": "https://my-company.openai.azure.com/",
    "deploymentName": "text-embedding-3-small",
    "apiVersion": "2024-02-01",
    "dimensions": 1536
  }
}

dotCMS Version

main

Links

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

ihoffmann-dot avatar Apr 15 '26 18:04 ihoffmann-dot

Passed QA

Tested in main ec538b7

https://github.com/user-attachments/assets/0dd66e14-a78a-4306-8eb8-4f9723029b36

KevinDavilaDotCMS avatar May 22 '26 20:05 KevinDavilaDotCMS