OpenAI br encoding issue with Spring AI
If you encountered JSON error when using Spring AI to interact with OpenAI, remove br from Accept-Encoding header.
This can be done by configuring RestClient and WebClient used by OpenAiApi, see the code below. Accept-Encoding header is set to gzip, deflate.
OpenAiApi.builder()
.apiKey("<api-key>")
.restClientBuilder(RestClient.builder().defaultHeader(HttpHeaders.ACCEPT_ENCODING, "gzip, deflate"))
.webClientBuilder(WebClient.builder().defaultHeader(HttpHeaders.ACCEPT_ENCODING, "gzip, deflate"))
.build()
Use OpenAI GPT-5
OpenAI GPT-5 is a reasoning model, so it doesn't support the parameter temperature. GPT-5 Chat is a chat model. To replace GPT 4o in an app, you should use GPT-5 Chat.
Text-to-SQL Course Update (Spring AI 1.0.0)
In this post, I'll talk about changes made to the implementation of Text-to-SQL course. The source code has been updated to Spring AI 1.0.0 release version.
Text-to-SQL Course March Update
In this post, I'll talk about changes made to the implementation of Text-to-SQL course.
Text-to-SQL Course February Update
In this post, I'll talk about three changes made to the implementation of Text-to-SQL course.
Giving up Chroma, Embracing Pgvector
For my local development of AI applications using Spring AI, I have been used Chroma for a long time. It used to be a very smooth experience. I just installed Chroma using pip and started it using chroma run. In Spring AI, I simply use the Spring Boot starter.
Spring AI Client for OpenAI with Official SDK
I'm working on a project which is still using Spring 5. When I was trying to use Spring AI in this project, it turned out that the default OpenAIChatModel couldn't be used. This is because OpenAIChatModel uses RestClient, which is only available in Spring 6.