Bug description Sometimes response from LLMs uses mixed single-type and unicode quotation marks. For example:

{ "reason" : "price of flour is going to shoot up” }

Note: the last quotation mark is The UTF-8 sequence "E2 80 9D", not "34".

Which results in BeanOutputConverter failing to parse the response. "ERROR org.springframework.ai.converter.BeanOutputConverter - Could not parse the given text to the desired target type:"

What would be best ways handle such case?

Environment Spring AI version: 1.0.0-M7, Java: JDK21, Model: bedrock Nova micro

Steps to reproduce Not sure when LLM would respond with such mixed quotation marks.

Expected behavior Maybe BeanOutputConverter could be even more smarter ?

Comment From: sunyuhan1998

I think the issue you mentioned might fall under the scope of an LLM's instruction-following capability. While it is certainly possible to improve BeanOutputConverter to better accommodate the scenario you described, considering that we cannot predict all the unexpected content an LLM might return, standardizing BeanOutputConverter would be quite challenging. Perhaps you could consider implementing a custom StructuredOutputConverter and enable it via org.springframework.ai.chat.client.ChatClient.CallResponseSpec#responseEntity(org.springframework.ai.converter.StructuredOutputConverter<T>).