4141import org .springframework .ai .azure .openai .AzureOpenAiAudioTranscriptionModel ;
4242import org .springframework .ai .azure .openai .AzureOpenAiChatModel ;
4343import org .springframework .ai .azure .openai .AzureOpenAiEmbeddingModel ;
44+ import org .springframework .ai .model .tool .autoconfigure .ToolCallingAutoConfiguration ;
4445import org .springframework .ai .chat .messages .AssistantMessage ;
4546import org .springframework .ai .chat .messages .Message ;
4647import org .springframework .ai .chat .messages .UserMessage ;
@@ -98,7 +99,8 @@ class AzureOpenAiAutoConfigurationEntraIT {
9899
99100 @ Test
100101 void chatCompletion () {
101- this .contextRunner .withConfiguration (AutoConfigurations .of (AzureOpenAiChatAutoConfiguration .class ))
102+ this .contextRunner .withConfiguration (AutoConfigurations .of (ToolCallingAutoConfiguration .class ,
103+ AzureOpenAiChatAutoConfiguration .class ))
102104 .run (context -> {
103105 AzureOpenAiChatModel chatModel = context .getBean (AzureOpenAiChatModel .class );
104106 ChatResponse response = chatModel .call (new Prompt (List .of (this .userMessage , this .systemMessage )));
@@ -108,7 +110,8 @@ void chatCompletion() {
108110
109111 @ Test
110112 void httpRequestContainsUserAgentAndCustomHeaders () {
111- this .contextRunner .withConfiguration (AutoConfigurations .of (AzureOpenAiChatAutoConfiguration .class ))
113+ this .contextRunner .withConfiguration (AutoConfigurations .of (ToolCallingAutoConfiguration .class ,
114+ AzureOpenAiChatAutoConfiguration .class ))
112115 .withPropertyValues ("spring.ai.azure.openai.custom-headers.foo=bar" ,
113116 "spring.ai.azure.openai.custom-headers.fizz=buzz" )
114117 .run (context -> {
@@ -135,7 +138,8 @@ void httpRequestContainsUserAgentAndCustomHeaders() {
135138
136139 @ Test
137140 void chatCompletionStreaming () {
138- this .contextRunner .withConfiguration (AutoConfigurations .of (AzureOpenAiChatAutoConfiguration .class ))
141+ this .contextRunner .withConfiguration (AutoConfigurations .of (ToolCallingAutoConfiguration .class ,
142+ AzureOpenAiChatAutoConfiguration .class ))
139143 .run (context -> {
140144
141145 AzureOpenAiChatModel chatModel = context .getBean (AzureOpenAiChatModel .class );
@@ -159,7 +163,8 @@ void chatCompletionStreaming() {
159163
160164 @ Test
161165 void embedding () {
162- this .contextRunner .withConfiguration (AutoConfigurations .of (AzureOpenAiEmbeddingAutoConfiguration .class ))
166+ this .contextRunner .withConfiguration (AutoConfigurations .of (ToolCallingAutoConfiguration .class ,
167+ AzureOpenAiEmbeddingAutoConfiguration .class ))
163168 .run (context -> {
164169 AzureOpenAiEmbeddingModel embeddingModel = context .getBean (AzureOpenAiEmbeddingModel .class );
165170
@@ -180,7 +185,8 @@ void embedding() {
180185 @ EnabledIfEnvironmentVariable (named = "AZURE_OPENAI_TRANSCRIPTION_DEPLOYMENT_NAME" , matches = ".+" )
181186 void transcribe () {
182187 this .contextRunner
183- .withConfiguration (AutoConfigurations .of (AzureOpenAiAudioTranscriptionAutoConfiguration .class ))
188+ .withConfiguration (AutoConfigurations .of (ToolCallingAutoConfiguration .class ,
189+ AzureOpenAiAudioTranscriptionAutoConfiguration .class ))
184190 .run (context -> {
185191 AzureOpenAiAudioTranscriptionModel transcriptionModel = context
186192 .getBean (AzureOpenAiAudioTranscriptionModel .class );
@@ -195,22 +201,25 @@ void transcribe() {
195201 void chatActivation () {
196202
197203 // Disable the chat auto-configuration.
198- this .contextRunner .withConfiguration (AutoConfigurations .of (AzureOpenAiChatAutoConfiguration .class ))
204+ this .contextRunner .withConfiguration (AutoConfigurations .of (ToolCallingAutoConfiguration .class ,
205+ AzureOpenAiChatAutoConfiguration .class ))
199206 .withPropertyValues ("spring.ai.model.chat=none" )
200207 .run (context -> {
201208 assertThat (context .getBeansOfType (AzureOpenAiChatProperties .class )).isEmpty ();
202209 assertThat (context .getBeansOfType (AzureOpenAiChatModel .class )).isEmpty ();
203210 });
204211
205212 // The chat auto-configuration is enabled by default.
206- this .contextRunner .withConfiguration (AutoConfigurations .of (AzureOpenAiChatAutoConfiguration .class ))
213+ this .contextRunner .withConfiguration (AutoConfigurations .of (ToolCallingAutoConfiguration .class ,
214+ AzureOpenAiChatAutoConfiguration .class ))
207215 .run (context -> {
208216 assertThat (context .getBeansOfType (AzureOpenAiChatModel .class )).isNotEmpty ();
209217 assertThat (context .getBeansOfType (AzureOpenAiChatProperties .class )).isNotEmpty ();
210218 });
211219
212220 // Explicitly enable the chat auto-configuration.
213- this .contextRunner .withConfiguration (AutoConfigurations .of (AzureOpenAiChatAutoConfiguration .class ))
221+ this .contextRunner .withConfiguration (AutoConfigurations .of (ToolCallingAutoConfiguration .class ,
222+ AzureOpenAiChatAutoConfiguration .class ))
214223 .withPropertyValues ("spring.ai.model.chat=azure-openai" )
215224 .run (context -> {
216225 assertThat (context .getBeansOfType (AzureOpenAiChatModel .class )).isNotEmpty ();
@@ -222,22 +231,25 @@ void chatActivation() {
222231 void embeddingActivation () {
223232
224233 // Disable the embedding auto-configuration.
225- this .contextRunner .withConfiguration (AutoConfigurations .of (AzureOpenAiEmbeddingAutoConfiguration .class ))
234+ this .contextRunner .withConfiguration (AutoConfigurations .of (ToolCallingAutoConfiguration .class ,
235+ AzureOpenAiEmbeddingAutoConfiguration .class ))
226236 .withPropertyValues ("spring.ai.model.embedding=none" )
227237 .run (context -> {
228238 assertThat (context .getBeansOfType (AzureOpenAiEmbeddingModel .class )).isEmpty ();
229239 assertThat (context .getBeansOfType (AzureOpenAiEmbeddingProperties .class )).isEmpty ();
230240 });
231241
232242 // The embedding auto-configuration is enabled by default.
233- this .contextRunner .withConfiguration (AutoConfigurations .of (AzureOpenAiEmbeddingAutoConfiguration .class ))
243+ this .contextRunner .withConfiguration (AutoConfigurations .of (ToolCallingAutoConfiguration .class ,
244+ AzureOpenAiEmbeddingAutoConfiguration .class ))
234245 .run (context -> {
235246 assertThat (context .getBeansOfType (AzureOpenAiEmbeddingModel .class )).isNotEmpty ();
236247 assertThat (context .getBeansOfType (AzureOpenAiEmbeddingProperties .class )).isNotEmpty ();
237248 });
238249
239250 // Explicitly enable the embedding auto-configuration.
240- this .contextRunner .withConfiguration (AutoConfigurations .of (AzureOpenAiEmbeddingAutoConfiguration .class ))
251+ this .contextRunner .withConfiguration (AutoConfigurations .of (ToolCallingAutoConfiguration .class ,
252+ AzureOpenAiEmbeddingAutoConfiguration .class ))
241253 .withPropertyValues ("spring.ai.model.embedding=azure-openai" )
242254 .run (context -> {
243255 assertThat (context .getBeansOfType (AzureOpenAiEmbeddingModel .class )).isNotEmpty ();
@@ -250,7 +262,8 @@ void audioTranscriptionActivation() {
250262
251263 // Disable the transcription auto-configuration.
252264 this .contextRunner
253- .withConfiguration (AutoConfigurations .of (AzureOpenAiAudioTranscriptionAutoConfiguration .class ))
265+ .withConfiguration (AutoConfigurations .of (ToolCallingAutoConfiguration .class ,
266+ AzureOpenAiAudioTranscriptionAutoConfiguration .class ))
254267 .withPropertyValues ("spring.ai.model.audio.transcription=none" )
255268 .run (context -> {
256269 assertThat (context .getBeansOfType (AzureOpenAiAudioTranscriptionModel .class )).isEmpty ();
@@ -259,12 +272,14 @@ void audioTranscriptionActivation() {
259272
260273 // The transcription auto-configuration is enabled by default.
261274 this .contextRunner
262- .withConfiguration (AutoConfigurations .of (AzureOpenAiAudioTranscriptionAutoConfiguration .class ))
275+ .withConfiguration (AutoConfigurations .of (ToolCallingAutoConfiguration .class ,
276+ AzureOpenAiAudioTranscriptionAutoConfiguration .class ))
263277 .run (context -> assertThat (context .getBeansOfType (AzureOpenAiAudioTranscriptionModel .class )).isNotEmpty ());
264278
265279 // Explicitly enable the transcription auto-configuration.
266280 this .contextRunner
267- .withConfiguration (AutoConfigurations .of (AzureOpenAiAudioTranscriptionAutoConfiguration .class ))
281+ .withConfiguration (AutoConfigurations .of (ToolCallingAutoConfiguration .class ,
282+ AzureOpenAiAudioTranscriptionAutoConfiguration .class ))
268283 .withPropertyValues ("spring.ai.model.audio.transcription=azure-openai" )
269284 .run (context -> assertThat (context .getBeansOfType (AzureOpenAiAudioTranscriptionModel .class )).isNotEmpty ());
270285 }
@@ -273,7 +288,8 @@ void audioTranscriptionActivation() {
273288 void openAIClientBuilderCustomizer () {
274289 AtomicBoolean firstCustomizationApplied = new AtomicBoolean (false );
275290 AtomicBoolean secondCustomizationApplied = new AtomicBoolean (false );
276- this .contextRunner .withConfiguration (AutoConfigurations .of (AzureOpenAiChatAutoConfiguration .class ))
291+ this .contextRunner .withConfiguration (AutoConfigurations .of (ToolCallingAutoConfiguration .class ,
292+ AzureOpenAiChatAutoConfiguration .class ))
277293 .withBean ("first" , AzureOpenAIClientBuilderCustomizer .class ,
278294 () -> clientBuilder -> firstCustomizationApplied .set (true ))
279295 .withBean ("second" , AzureOpenAIClientBuilderCustomizer .class ,
0 commit comments