Structured Outputs. Does order of properties matter? Hopefully yes - e.g. I can make “reason” and then “answer”. But it seems in playground environment there is a bug that sometimes (randomly?) reverse or reorder the keys in JSON object - e.g. I get “answer” then “reason”.
I understand that JSON is, by design, an unordered format and order of keys in JSON technically shouldn’t matter - but seems to me in this context it is desirable to have a specific order, especially in cases like structured output from models where “reason” should logically precede “answer.”
Just like a regular response, the structured output is created one token at a time so the first variables are made before the others.
In your prompt it helps to instruct the model to “Produce a JSON in the following format:” and then list the format you want. If it’s still out of order maybe put some more emphasis on the ordering of the variables.
It works as expected and model does follow schema ordering but I still think there is a bug in Playground - it sometimes reorders schema when you save it or make small edits which makes testing difficult. This seems to be not a problem with model or system prompt but only with Playground environment.