4949import org .springframework .ai .chat .prompt .Prompt ;
5050import org .springframework .ai .chat .prompt .SystemPromptTemplate ;
5151import org .springframework .ai .embedding .EmbeddingResponse ;
52+ import org .springframework .ai .model .tool .autoconfigure .ToolCallingAutoConfiguration ;
5253import org .springframework .boot .autoconfigure .AutoConfigurations ;
5354import org .springframework .boot .test .context .runner .ApplicationContextRunner ;
5455import org .springframework .core .io .ClassPathResource ;
@@ -98,7 +99,9 @@ class AzureOpenAiAutoConfigurationEntraIT {
9899
99100 @ Test
100101 void chatCompletion () {
101- this .contextRunner .withConfiguration (AutoConfigurations .of (AzureOpenAiChatAutoConfiguration .class ))
102+ this .contextRunner
103+ .withConfiguration (
104+ AutoConfigurations .of (ToolCallingAutoConfiguration .class , AzureOpenAiChatAutoConfiguration .class ))
102105 .run (context -> {
103106 AzureOpenAiChatModel chatModel = context .getBean (AzureOpenAiChatModel .class );
104107 ChatResponse response = chatModel .call (new Prompt (List .of (this .userMessage , this .systemMessage )));
@@ -108,7 +111,9 @@ void chatCompletion() {
108111
109112 @ Test
110113 void httpRequestContainsUserAgentAndCustomHeaders () {
111- this .contextRunner .withConfiguration (AutoConfigurations .of (AzureOpenAiChatAutoConfiguration .class ))
114+ this .contextRunner
115+ .withConfiguration (
116+ AutoConfigurations .of (ToolCallingAutoConfiguration .class , AzureOpenAiChatAutoConfiguration .class ))
112117 .withPropertyValues ("spring.ai.azure.openai.custom-headers.foo=bar" ,
113118 "spring.ai.azure.openai.custom-headers.fizz=buzz" )
114119 .run (context -> {
@@ -135,7 +140,9 @@ void httpRequestContainsUserAgentAndCustomHeaders() {
135140
136141 @ Test
137142 void chatCompletionStreaming () {
138- this .contextRunner .withConfiguration (AutoConfigurations .of (AzureOpenAiChatAutoConfiguration .class ))
143+ this .contextRunner
144+ .withConfiguration (
145+ AutoConfigurations .of (ToolCallingAutoConfiguration .class , AzureOpenAiChatAutoConfiguration .class ))
139146 .run (context -> {
140147
141148 AzureOpenAiChatModel chatModel = context .getBean (AzureOpenAiChatModel .class );
@@ -159,7 +166,9 @@ void chatCompletionStreaming() {
159166
160167 @ Test
161168 void embedding () {
162- this .contextRunner .withConfiguration (AutoConfigurations .of (AzureOpenAiEmbeddingAutoConfiguration .class ))
169+ this .contextRunner
170+ .withConfiguration (AutoConfigurations .of (ToolCallingAutoConfiguration .class ,
171+ AzureOpenAiEmbeddingAutoConfiguration .class ))
163172 .run (context -> {
164173 AzureOpenAiEmbeddingModel embeddingModel = context .getBean (AzureOpenAiEmbeddingModel .class );
165174
@@ -180,7 +189,8 @@ void embedding() {
180189 @ EnabledIfEnvironmentVariable (named = "AZURE_OPENAI_TRANSCRIPTION_DEPLOYMENT_NAME" , matches = ".+" )
181190 void transcribe () {
182191 this .contextRunner
183- .withConfiguration (AutoConfigurations .of (AzureOpenAiAudioTranscriptionAutoConfiguration .class ))
192+ .withConfiguration (AutoConfigurations .of (ToolCallingAutoConfiguration .class ,
193+ AzureOpenAiAudioTranscriptionAutoConfiguration .class ))
184194 .run (context -> {
185195 AzureOpenAiAudioTranscriptionModel transcriptionModel = context
186196 .getBean (AzureOpenAiAudioTranscriptionModel .class );
@@ -195,22 +205,28 @@ void transcribe() {
195205 void chatActivation () {
196206
197207 // Disable the chat auto-configuration.
198- this .contextRunner .withConfiguration (AutoConfigurations .of (AzureOpenAiChatAutoConfiguration .class ))
208+ this .contextRunner
209+ .withConfiguration (
210+ AutoConfigurations .of (ToolCallingAutoConfiguration .class , AzureOpenAiChatAutoConfiguration .class ))
199211 .withPropertyValues ("spring.ai.model.chat=none" )
200212 .run (context -> {
201213 assertThat (context .getBeansOfType (AzureOpenAiChatProperties .class )).isEmpty ();
202214 assertThat (context .getBeansOfType (AzureOpenAiChatModel .class )).isEmpty ();
203215 });
204216
205217 // The chat auto-configuration is enabled by default.
206- this .contextRunner .withConfiguration (AutoConfigurations .of (AzureOpenAiChatAutoConfiguration .class ))
218+ this .contextRunner
219+ .withConfiguration (
220+ AutoConfigurations .of (ToolCallingAutoConfiguration .class , AzureOpenAiChatAutoConfiguration .class ))
207221 .run (context -> {
208222 assertThat (context .getBeansOfType (AzureOpenAiChatModel .class )).isNotEmpty ();
209223 assertThat (context .getBeansOfType (AzureOpenAiChatProperties .class )).isNotEmpty ();
210224 });
211225
212226 // Explicitly enable the chat auto-configuration.
213- this .contextRunner .withConfiguration (AutoConfigurations .of (AzureOpenAiChatAutoConfiguration .class ))
227+ this .contextRunner
228+ .withConfiguration (
229+ AutoConfigurations .of (ToolCallingAutoConfiguration .class , AzureOpenAiChatAutoConfiguration .class ))
214230 .withPropertyValues ("spring.ai.model.chat=azure-openai" )
215231 .run (context -> {
216232 assertThat (context .getBeansOfType (AzureOpenAiChatModel .class )).isNotEmpty ();
@@ -222,22 +238,28 @@ void chatActivation() {
222238 void embeddingActivation () {
223239
224240 // Disable the embedding auto-configuration.
225- this .contextRunner .withConfiguration (AutoConfigurations .of (AzureOpenAiEmbeddingAutoConfiguration .class ))
241+ this .contextRunner
242+ .withConfiguration (AutoConfigurations .of (ToolCallingAutoConfiguration .class ,
243+ AzureOpenAiEmbeddingAutoConfiguration .class ))
226244 .withPropertyValues ("spring.ai.model.embedding=none" )
227245 .run (context -> {
228246 assertThat (context .getBeansOfType (AzureOpenAiEmbeddingModel .class )).isEmpty ();
229247 assertThat (context .getBeansOfType (AzureOpenAiEmbeddingProperties .class )).isEmpty ();
230248 });
231249
232250 // The embedding auto-configuration is enabled by default.
233- this .contextRunner .withConfiguration (AutoConfigurations .of (AzureOpenAiEmbeddingAutoConfiguration .class ))
251+ this .contextRunner
252+ .withConfiguration (AutoConfigurations .of (ToolCallingAutoConfiguration .class ,
253+ AzureOpenAiEmbeddingAutoConfiguration .class ))
234254 .run (context -> {
235255 assertThat (context .getBeansOfType (AzureOpenAiEmbeddingModel .class )).isNotEmpty ();
236256 assertThat (context .getBeansOfType (AzureOpenAiEmbeddingProperties .class )).isNotEmpty ();
237257 });
238258
239259 // Explicitly enable the embedding auto-configuration.
240- this .contextRunner .withConfiguration (AutoConfigurations .of (AzureOpenAiEmbeddingAutoConfiguration .class ))
260+ this .contextRunner
261+ .withConfiguration (AutoConfigurations .of (ToolCallingAutoConfiguration .class ,
262+ AzureOpenAiEmbeddingAutoConfiguration .class ))
241263 .withPropertyValues ("spring.ai.model.embedding=azure-openai" )
242264 .run (context -> {
243265 assertThat (context .getBeansOfType (AzureOpenAiEmbeddingModel .class )).isNotEmpty ();
@@ -250,7 +272,8 @@ void audioTranscriptionActivation() {
250272
251273 // Disable the transcription auto-configuration.
252274 this .contextRunner
253- .withConfiguration (AutoConfigurations .of (AzureOpenAiAudioTranscriptionAutoConfiguration .class ))
275+ .withConfiguration (AutoConfigurations .of (ToolCallingAutoConfiguration .class ,
276+ AzureOpenAiAudioTranscriptionAutoConfiguration .class ))
254277 .withPropertyValues ("spring.ai.model.audio.transcription=none" )
255278 .run (context -> {
256279 assertThat (context .getBeansOfType (AzureOpenAiAudioTranscriptionModel .class )).isEmpty ();
@@ -259,12 +282,14 @@ void audioTranscriptionActivation() {
259282
260283 // The transcription auto-configuration is enabled by default.
261284 this .contextRunner
262- .withConfiguration (AutoConfigurations .of (AzureOpenAiAudioTranscriptionAutoConfiguration .class ))
285+ .withConfiguration (AutoConfigurations .of (ToolCallingAutoConfiguration .class ,
286+ AzureOpenAiAudioTranscriptionAutoConfiguration .class ))
263287 .run (context -> assertThat (context .getBeansOfType (AzureOpenAiAudioTranscriptionModel .class )).isNotEmpty ());
264288
265289 // Explicitly enable the transcription auto-configuration.
266290 this .contextRunner
267- .withConfiguration (AutoConfigurations .of (AzureOpenAiAudioTranscriptionAutoConfiguration .class ))
291+ .withConfiguration (AutoConfigurations .of (ToolCallingAutoConfiguration .class ,
292+ AzureOpenAiAudioTranscriptionAutoConfiguration .class ))
268293 .withPropertyValues ("spring.ai.model.audio.transcription=azure-openai" )
269294 .run (context -> assertThat (context .getBeansOfType (AzureOpenAiAudioTranscriptionModel .class )).isNotEmpty ());
270295 }
@@ -273,7 +298,9 @@ void audioTranscriptionActivation() {
273298 void openAIClientBuilderCustomizer () {
274299 AtomicBoolean firstCustomizationApplied = new AtomicBoolean (false );
275300 AtomicBoolean secondCustomizationApplied = new AtomicBoolean (false );
276- this .contextRunner .withConfiguration (AutoConfigurations .of (AzureOpenAiChatAutoConfiguration .class ))
301+ this .contextRunner
302+ .withConfiguration (
303+ AutoConfigurations .of (ToolCallingAutoConfiguration .class , AzureOpenAiChatAutoConfiguration .class ))
277304 .withBean ("first" , AzureOpenAIClientBuilderCustomizer .class ,
278305 () -> clientBuilder -> firstCustomizationApplied .set (true ))
279306 .withBean ("second" , AzureOpenAIClientBuilderCustomizer .class ,
0 commit comments