From e59cf2956438f5c927fbe27fddce2ff6c6e834fb Mon Sep 17 00:00:00 2001 From: Dominik Kundel Date: Thu, 15 Feb 2024 21:01:33 -0800 Subject: [PATCH 1/4] Fix streaming example The example to use replicate.stream was wrongly checking the event type and was not producing any output. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 90ed101..fd24089 100644 --- a/README.md +++ b/README.md @@ -224,7 +224,7 @@ const output = []; for await (const event of replicate.stream(model, options)) { console.debug({ event }); - if (event && event === "output") { + if (event && event.event === "output") { output.push(event.data); } } From 308e2ffdd73c470d4029f99b1d3a644a143eaa63 Mon Sep 17 00:00:00 2001 From: Dominik Kundel Date: Fri, 16 Feb 2024 13:59:21 -0800 Subject: [PATCH 2/4] Update README.md Co-authored-by: Mattt --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fd24089..c7f1360 100644 --- a/README.md +++ b/README.md @@ -222,7 +222,7 @@ const options = { }; const output = []; -for await (const event of replicate.stream(model, options)) { +for await (const { event, data } of replicate.stream(model, options)) { console.debug({ event }); if (event && event.event === "output") { output.push(event.data); From 9fa8ff29914226a393f2cd0a3e4ba159a9bd3a26 Mon Sep 17 00:00:00 2001 From: Dominik Kundel Date: Fri, 16 Feb 2024 13:59:27 -0800 Subject: [PATCH 3/4] Update README.md Co-authored-by: Mattt --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c7f1360..756d99c 100644 --- a/README.md +++ b/README.md @@ -224,8 +224,8 @@ const output = []; for await (const { event, data } of replicate.stream(model, options)) { console.debug({ event }); - if (event && event.event === "output") { - output.push(event.data); + if (event === "output") { + output.push(data); } } From 5e2aab731cc3a4d34d421cbbc2ac7fbe24b3b2c8 Mon Sep 17 00:00:00 2001 From: Dominik Kundel Date: Fri, 16 Feb 2024 14:00:27 -0800 Subject: [PATCH 4/4] Update README.md Removing the console.dir since it's no longer relevant --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 756d99c..6893da2 100644 --- a/README.md +++ b/README.md @@ -223,7 +223,6 @@ const options = { const output = []; for await (const { event, data } of replicate.stream(model, options)) { - console.debug({ event }); if (event === "output") { output.push(data); }