I’m reimplementing this, hopefully the success rate is high enough:
const stream = await openai.chat.completions.create({
model: "gpt-4o",
messages: fullMessages,
stream: true,
response_format: { type: "json_schema", json_schema: schema }
});