From 1d22e8c97a97b18a98f2d36ef4507dea74dfba4b Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Mon, 3 Jul 2023 09:12:59 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20chore(chat.py):=20add=20missing?= =?UTF-8?q?=20build=20step=20for=20root=20node=20in=20graph=20=F0=9F=93=9D?= =?UTF-8?q?=20docs(chat.py):=20explain=20the=20need=20for=20building=20the?= =?UTF-8?q?=20root=20node=20before=20the=20rest=20of=20the=20graph=20The?= =?UTF-8?q?=20root=20node=20in=20the=20graph=20was=20not=20being=20built?= =?UTF-8?q?=20before=20the=20rest=20of=20the=20graph,=20which=20caused=20i?= =?UTF-8?q?ssues=20when=20certain=20nodes=20required=20parameters=20that?= =?UTF-8?q?=20were=20not=20connected=20to=20them.=20By=20adding=20the=20mi?= =?UTF-8?q?ssing=20build=20step=20for=20the=20root=20node,=20we=20ensure?= =?UTF-8?q?=20that=20all=20necessary=20connections=20and=20parameters=20ar?= =?UTF-8?q?e=20properly=20set=20up=20before=20building=20the=20rest=20of?= =?UTF-8?q?=20the=20graph.=20This=20improves=20the=20overall=20functionali?= =?UTF-8?q?ty=20and=20reliability=20of=20the=20chat=20module.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/api/v1/chat.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/backend/langflow/api/v1/chat.py b/src/backend/langflow/api/v1/chat.py index bf1b52058..e47c31694 100644 --- a/src/backend/langflow/api/v1/chat.py +++ b/src/backend/langflow/api/v1/chat.py @@ -113,6 +113,14 @@ async def stream_build(flow_id: str): number_of_nodes = len(graph.nodes) flow_data_store[flow_id]["status"] = BuildStatus.IN_PROGRESS + # To deal with the ZeroShotAgent case + # we need to build the root node first + # and then the rest of the graph + # This is a big problem because certain nodes require + # params that are not connected to it. + # We should consider connecting the tools to the ZeroShotPrompt + graph.build() + for i, vertex in enumerate(graph.generator_build(), 1): try: log_dict = {