Hi everyone,
I am encountering a persistent issue where the model generates multiple, repetitive JSON objects in a single response, corrupting the expected format.
The Setup: I am using JSON Schema (Structured Outputs) to manage a pizza ordering assistant. The goal is to receive a single JSON object per turn.
The Problem: Instead of stopping after the first valid JSON object, the model continues generating the same object (or slightly varied versions) multiple times in a row within the same output block. This results in a stream of concatenated JSON objects (e.g., {...} {...} {...}) rather than a single valid JSON, causing the parser to fail.
What I have tried so far (unsuccessfully):
-
Changed Temperature: I tried adjusting the temperature (e.g., lowering it to 0.2 and testing other values), but the repetition persists.
-
Switched Models: I was originally using
gpt-4o-mini(referred to as 4.1-mini in my logs), but I also tested withgpt-5-mini, and the behavior remains exactly the same.
Has anyone faced this looping behavior with Structured Outputs recently? Is there a specific parameter or instruction in the system prompt needed to force a stop after the first object?
Thanks in advance for any help.
