Currently if you have multiple Spring AI spring boot starters on the classpath, like Vertex AI PaLM2 and OpenAI it is not easy to control which part are loaded.
For example you might want to use the OpenAI embedding client with Vertex AI PaLM2 Chat Client.
The only why to disable the undesired auto-configurations (e.g. Vertex AI Embedding and OpenAI Chat clients) is to use the the configuration annotation exclude
parameter or the spring.autoconfigure.exclude
.
But this is not covering all cases as some auto-cnfiguraitons share the same java file. For example the VertexAiAutoConfiguration defines both the VertexAiChatClient and the VertexAiEmbeddingClient clients.
A better tailored solution would be to introduce an explicit property for each auto-configured component (e.g. clients, vector stores ...) that allow disabling the activation of this component. Those properties will be enabled by default (except for Bedrock - see below) and will allow selective disabling.
NOTE: All Bedrock chat/embedding clients already have an *.enabled
property that is set to false by default. The reason is that all Bedrock auto-configurations are sharing the same jar.