Json response looks different in Gpt-4

I am using below code,

response = openai.ChatCompletion.create(
            engine= "gpt-4",
            messages=[{"role": "system", "content": prompt},{"role": "user", "content": input_text}],
            response_format={"type": "json_object"})

We have different workspaces in Power BI.

We are seeing the responses are different even though we are using same model and version.

‘’'json is getting appended in recent days, what is the reason behind?

That is the AI model writing a markdown code block fence, for display in a user interface like ChatGPT does.

You have to make clear in a system message that the AI is automated, has no user to interact with, has no display and no renderer of markdown, output is being sent directly to an API, and using any markdown and starting a response with any other character than “{” is prohibited.

GPT-4 doesn’t have any special JSON mode, it is older than the announcement of the feature with gpt-4-turbo.

Reduce the top_p setting significantly below the default of 1.0, so the AI can produce reliably.