const streamWithSchema = await assistant.stream({
prompt: "Fournis un profil de test au format structuré.",
structuredOutput: personSpec,
});
let lastPartial;
for await (const partial of streamWithSchema.experimental_partialOutputStream) {
lastPartial = partial;
console.log("partial", partial);
}
const parsedOutput = await personSpec.parseOutput(
{ text: await streamWithSchema.text },
{
response: await streamWithSchema.response,
usage: await streamWithSchema.usage,
finishReason: await streamWithSchema.finishReason,
},
);
console.log({ lastPartial, parsedOutput });