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.

5 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?

5 Likes

+1, this would be really useful!

5 Likes

+2 same for me, could be helpull to try prompts

Promptotype has an extended playground that supports json mode.
It’s a platform for developing and testing for the specific use-case of structured prompts (json or tools).
(I’m the creator- questions, requests and feedback is welcome :))