Is it possible to enable JSON Mode in the playground?

Is it yet possible to enable JSON Mode in the playground? I don’t see an option for it. I wonder if my UI just hasn’t updated yet, if I’m overlooking a setting, or if they just haven’t enabled that feature in the playground yet.

I see where someone posted a link to a site called Promtotype, saying it supports it. I’m trying to stick to OpenAI’s stuff if possible.

2 Likes

I don’t see any valid reason that playground should support this feature

You can pass it through the API, like this

    const response = await client.chat.completions.create({
        model: "gpt-3.5-turbo-1106",
        messages: messages,
        response_format: { "type": "json_object" }
    });

Also you should instruct the model to output in json

    const messages = [
        {
            role: "system",
            content:
                "please output every response in json",
        }
...

I see how to pass the response_format to the API, thank you.

As far as the need for Playground to support this feature, my understanding is that Playground is a way to test API calls to ensure you are getting the required responses, and to revise your system messages and parameters without having to modify code on your end for testing.

If my understanding is correct, then it seems like all parameters that can be passed in the request would be useful parameters to be able to set in Playground for testing, including response_format. Am I misunderstanding something?

2 Likes

+1, this would be really useful!

1 Like