Skip to content

feat(dotAI): Dot AI LangChain4J - Azure OpenAI#35243

Merged
nollymar merged 119 commits into
mainfrom
dot-ai-langchain-azure-openai
May 18, 2026
Merged

feat(dotAI): Dot AI LangChain4J - Azure OpenAI#35243
nollymar merged 119 commits into
mainfrom
dot-ai-langchain-azure-openai

Conversation

@ihoffmann-dot
Copy link
Copy Markdown
Member

@ihoffmann-dot ihoffmann-dot commented Apr 7, 2026

Summary

Adds Azure OpenAI as a supported provider in the LangChain4J integration layer.
Enterprise customers using Azure-hosted OpenAI deployments can now configure
dotAI without any code changes — only a `providerConfig` JSON update is required.

  • Add `langchain4j-azure-open-ai` dependency
  • Add `azure_openai` case to `LangChain4jModelFactory` switch for chat, streaming chat, embeddings, and image
  • Implement `buildAzureOpenAiChatModel`, `buildAzureOpenAiStreamingChatModel`, `buildAzureOpenAiEmbeddingModel`, `buildAzureOpenAiImageModel`
  • Add `deploymentName` fallback in `AppConfig` and `LangChain4jAIClient` so configs that omit `model` and use only `deploymentName` work correctly end-to-end
  • Skip `max_tokens` for o-series and gpt-5+ Azure deployments (they require `max_completion_tokens`, which is not yet exposed by the LangChain4J Azure builder — silently omitting avoids a 400 from the API)
  • Pin Netty (4.1.118.Final) and Reactor (3.4.41) in BOM to resolve transitive version conflicts introduced by Azure SDK
  • Add unit tests covering Azure-specific paths (deploymentName-only config, model/deploymentName precedence, token limit routing)

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
  }
}

Notes

  • Either `model` or `deploymentName` can be used; if both are set, `model` takes precedence for fallback list parsing while `deploymentName` is passed to the Azure builder. Using only `deploymentName` is the recommended Azure pattern.
  • `apiVersion` maps to Azure's `serviceVersion`. Recommended: `2024-02-01`. Required for some newer Azure API features.
  • For newer Azure deployments (o-series, gpt-5+), `maxTokens` is silently ignored to avoid a 400 error. These deployments require `max_completion_tokens`, which the current LangChain4J Azure builder does not expose. Token limits for these models should be controlled at the deployment level in Azure Portal.
  • Netty/Reactor version pins are required for Azure SDK compatibility and do not affect existing behavior.
  • Image generation is not functional for Azure at this time. Azure retired `dall-e-3` on March 4, 2026. The recommended replacement (`gpt-image-1`) is not supported by LangChain4J's `AzureOpenAiImageModel` — it returns base64 instead of URLs, which is incompatible with the current `ImageModel` abstraction. This will be addressed when LangChain4J adds `gpt-image-1` support.

Related Issue

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

@nollymar
Copy link
Copy Markdown
Member

@ihoffmann-dot , please link the PR to the right task

@nollymar nollymar added this pull request to the merge queue May 18, 2026
@nollymar nollymar linked an issue May 18, 2026 that may be closed by this pull request
8 tasks
Merged via the queue into main with commit 1094263 May 18, 2026
51 checks passed
@nollymar nollymar deleted the dot-ai-langchain-azure-openai branch May 18, 2026 16:43
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 (Azure OpenAI)

3 participants