Enable JSON mode for GPT-4 turbo

I'd like to be able to use the recently released JSON mode for GPT-4 turbo to enforce consistency in data schema that's returned by the OpenAI API call.

My use case for vectors and AI actions requires OpenAI API response to be returned in JSON format.

To enable JSON mode, the API call needs to set response_format to { "type": "json_object" }. However this isn't possible in Retool without writing my own REST API, which is a much bigger lift than I'm capable of.

https://platform.openai.com/docs/guides/text-generation/json-mode

Without this, I am having problems getting the API call to return data in a consistent format, and it's degrading the quality of my product and generated data.

3 Likes

Hi @hstan Thanks for posting this feedback!

It sounds like this request is on our team's roadmap already :blush: The current workaround is to add an OpenAI resource instead of using our ai query type.

+1 for this request. json mode is extremely useful for building AI into workflows in retool because you can control the data format the OpenAI API is giving you

This feature was released 3 months ago by OpenAI and should just be another param in the api call

The problem with the workaround is the retool api call will time out after 10 seconds, which is never long enough to get a response from the open ai api if you're sending any amount of data

1 Like

+1 !! This is super usefull

1 Like