spring-projects / spring-projects/spring-ai

Make defining AzureOpenAiClientBuilderConfiguration endpoint property optional

Open
#5,140 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: waiting-for-triage
Dominant language
Java
Stars
9.5k
Forks
2.9k
Avg merge
1d 7h
Merged PRs (30d)
6

Description

Expected Behavior
Including the spring-ai-starter-model-azure-openai starter causes
AzureOpenAiClientBuilderConfiguration to eagerly create an
OpenAIClientBuilder even when no Azure OpenAI properties are defined and Azure OpenAI is not used as a model provider.
This leads to startup failures when applications include the starter
but - depending on the Spring profile used - use a different AI model provider or none at all. I would expect the startup to not fail as long as no Azure OpenAI model is required.

I'm not sure in what situations the OpenAIClientBuilder is used. The guard in AzureOpenAiEmbeddingAutoConfiguration works by checking the Spring property spring.ai.model.embedding for the value azure-openai. See here. Maybe the same guard could be used to decide whether a OpenAIClientBuilder needs to be created.

Current Behavior

For the application start to work, we need to set a dummy value for spring.ai.azure.openai.endpoint. Without this workaround, the start fails because of this assertion.
It would be nice if no such workaround is required in order for the application start to succeed.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading AzureOpenAiClientBuilderConfiguration.java, especially the assertion referenced at line 76, and compare its conditions with the guard in AzureOpenAiEmbeddingAutoConfiguration.java. Verify that an application using the starter without Azure OpenAI properties can start when Azure OpenAI is not selected, without requiring a dummy endpoint.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, java, spring-boot
Domain
ai, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.