From d650ea77e8f8ca486d3dd753b2849d039d55a23e Mon Sep 17 00:00:00 2001 From: David Duong Date: Wed, 15 Jan 2025 21:08:17 +0100 Subject: [PATCH] fix(io): update tuples are ignored by pregel io (#776) --- libs/langgraph/src/pregel/io.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/libs/langgraph/src/pregel/io.ts b/libs/langgraph/src/pregel/io.ts index d439b85e..b471f3da 100644 --- a/libs/langgraph/src/pregel/io.ts +++ b/libs/langgraph/src/pregel/io.ts @@ -119,8 +119,15 @@ export function* mapCommand( "Expected cmd.update to be a dict mapping channel names to update values" ); } - for (const [k, v] of Object.entries(cmd.update)) { - yield [NULL_TASK_ID, k, v]; + + if (Array.isArray(cmd.update)) { + for (const [k, v] of cmd.update) { + yield [NULL_TASK_ID, k, v]; + } + } else { + for (const [k, v] of Object.entries(cmd.update)) { + yield [NULL_TASK_ID, k, v]; + } } } }