Skip to content

Azure responseFormat no converter found #3354

@JakobStadlhuber

Description

@JakobStadlhuber

Bug description
When migrating Spring AI from version 1.0.0-M8 to 1.0.0, configuring the spring.ai.azure.openai.chat.options.response-format property with values such as text, json_object, or json_schema (which were changed from the previous json value) results in an application startup failure. The application fails to bind the string property value to the org.springframework.ai.azure.openai.AzureOpenAiResponseFormat type, throwing a ConverterNotFoundException.

Environment

  • Spring AI version: 1.0.0 (migrating from 1.0.0-M8)
  • Java version: 21
  • Model Provider: Azure OpenAI

Steps to reproduce

  1. Have a Spring Boot application using spring-ai-azure-openai-starter.
  2. Previously, in version 1.0.0-M8 or earlier, have the property spring.ai.azure.openai.chat.options.responseFormat=json (or its equivalent) configured.
  3. Upgrade the Spring AI version to 1.0.0.
  4. Modify the configuration property to spring.ai.azure.openai.chat.options.response-format and set its value to one of the new supported formats, for example: spring.ai.azure.openai.chat.options.response-format=json_object.
  5. Attempt to start the Spring Boot application.
  6. Observe the APPLICATION FAILED TO START error with the ConverterNotFoundException.

Expected behavior
The application should start successfully with the spring.ai.azure.openai.chat.options.response-format property correctly bound to the AzureOpenAiResponseFormat type, allowing the Azure OpenAI chat client to use the specified response format (e.g., text, json_object, or json_schema).

Minimal Complete Reproducible example
A minimal complete reproducible example or failing test was not provided in the initial report. However, a simple Spring Boot application with the spring-ai-azure-openai-starter dependency and the following configuration in application.properties should trigger the issue:

application.properties:

spring.ai.azure.openai.api-key=<YOUR_AZURE_OPENAI_KEY>
spring.ai.azure.openai.endpoint=<YOUR_AZURE_OPENAI_ENDPOINT>
spring.ai.azure.openai.chat.options.deployment-name=<YOUR_DEPLOYMENT_NAME> # or model
spring.ai.azure.openai.chat.options.response-format=json_object # or text, or json_schema

A simple component attempting to use the ChatClient would be sufficient to trigger the context loading and property binding.

Error Log Snippet Provided:

***************************
APPLICATION FAILED TO START
***************************

Description:

Failed to bind properties under 'spring.ai.azure.openai.chat.options.response-format' to org.springframework.ai.azure.openai.AzureOpenAiResponseFormat:

    Reason: org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [java.lang.String] to type [@com.fasterxml.jackson.annotation.JsonProperty org.springframework.ai.azure.openai.AzureOpenAiResponseFormat]

Action:
Review the value of the property. If the problem persists, check the DDL definition of the an @ConfigurationProperties bean if you have one.

Metadata

Metadata

Assignees

Labels

azurebugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions