We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f7c11c8 commit dcec87bCopy full SHA for dcec87b
packages/workers-ai-provider/src/streaming.ts
@@ -30,16 +30,16 @@ export function getMappedStream(response: Response) {
30
partialToolCalls.push(...chunk.tool_calls);
31
}
32
33
- // Handle top-level response text
34
- if (chunk.response?.length) {
+ // Handle top-level response text + Handling number responses for models like Llama4
+ if (chunk.response?.length || typeof chunk.response === "number") {
35
if (!textId) {
36
textId = generateId();
37
controller.enqueue({ type: "text-start", id: textId });
38
39
controller.enqueue({
40
type: "text-delta",
41
id: textId,
42
- delta: chunk.response,
+ delta: typeof chunk.response === "number" ? String(chunk.response) : chunk.response,
43
});
44
45
0 commit comments