Bug description The error affects the JSON schema mode response format for Azure OpenAI. When using Azure OpenAI chat models, the strict property is not mapped from the Spring AI response format to the Azure SDK response format. As a result, the property is missing in the api call.

Environment Spring AI version: 1.0.0 Java version: Java 21 Azure AI OpenAi: 1.0.0-Beta.16

Steps to reproduce Create a chat client and set the response format to json_schema in AzureOpenAiChatOptions. Provide a JSON schema and set the strict property to true. Execute a prompt. When checking the payload for the Azure API endpoint, you will see that the property always remains false. To display the payload, you can set the env variable AZURE_HTTP_LOG_DETAIL_LEVEL to BODY_AND_HEADERS, for example.

Expected behavior The strict property should be mapped correctly to the Azure SDK depending on the input.

Minimal Complete Reproducible example chatClient.prompt() .options( AzureOpenAiChatOptions.builder().responseFormat( AzureOpenAiResponseFormat.builder() .type(AzureOpenAiResponseFormat.Type.JSON_SCHEMA) .jsonSchema( AzureOpenAiResponseFormat.JsonSchema.builder() .schema( $$""" { "$schema" : "https://json-schema.org/draft/2020-12/schema", "type" : "object", "properties" : { "exampleName" : { "type" : "string" } }, "required" : [ "exampleName" ], "additionalProperties" : false }""" ) .strict(true) .name("ExampleSchema") .build() ) .build() ).build() ) .messages(UserMessage("I need an example")) .call() .content()

leads to:

{ "messages": [ { "role": "user", "content": [ { "text": "I need an example", "type": "text" } ] } ], "stream": false, "model": "o4-mini", "logprobs": false, "response_format": { "json_schema": { "name": "ExampleSchema", "schema": { "$schema": "https://json-schema.org/draft/2020-12/schema", "additionalProperties": false, "type": "object", "properties": { "exampleName": { "type": "string" } }, "required": [ "exampleName" ] } }, "type": "json_schema" } }

Comment From: FlorainB

PR #3931