Hi, since yesterday, with no changes on my API code, streamObject started returning no chunks in partialObjectStream.
Current behaviour:
Since last night, streamObject returns no chunks in partialObjectStream 9 out of 10 times (more or less)
- If I retry this call 10 times, it will usually work 1 out of 10 times (when was working 10/10 until last night) so I wonder if there are any recent known issues with streamObject?
- I have tried changing the model (tried groq and mistral) and this happens with both, which makes me think it’s something with streamObject.
- streamText works fine.
Can reproduce in production, local and preview environments.
Expected Behaviour:
To be able to iterate through the chunks in partialObjectStream as it was working until yesterday. Nothing was changed in my code.
Code:
const { result: metadataResponse, responseTime: metadataTime } = await retryApiCall(() => streamObject({
model: metadataModel,
system: <System Prompt>,
prompt: <Prompt>,
temperature: 0.7,
top_k: 50,
top_p: 0.9,
maxTokens: 1500,
schema: z.object({<ZOD SCHEMA>}).required()
}), "metadata");
const { partialObjectStream: metadataResponseStream, usage: metadataUsage } = metadataResponse;
let chunkCount = 0;
metadataContent = {};
for await (const chunk of metadataResponseStream) {
++chunkCount;
controller.enqueue(new TextEncoder().encode(JSON.stringify({ type: "metadata", content: chunk }) + "\n"));
metadataContent = { ...metadataContent, ...chunk };
}
if (chunkCount === 0 || Object.keys(metadataContent).length === 0) {
throw new Error("No metadata was generated");
}
Environment (local, preview, production): can reproduce in all 3
Frameworks: Node 20, Nextjs 14.2.13