From e1872be72812b04875d0bf47701d1fb9e8bf5bcc Mon Sep 17 00:00:00 2001 From: Sean Javiya <70726692+sudo-update@users.noreply.github.com> Date: Wed, 28 Jun 2023 17:09:58 -0700 Subject: [PATCH] Fix: Required input llm for module LLMChain not found There is a recurring intermittent bug, where Chains fail to validate, with an error "Required module ____ for module ____ not found". This happens frequently for all LLMs that inherit from the LLM class (example Cohere's wrapper). This is caused by this chunk of code. This also explains why the bug is intermittent and not every time. "in" is matching LLM from source_types with BaseLLM from target_reqs. Also, this doesn't need to be a nested loop, it can be done with one loop. I'm a user of LangFlow, and a first time contributor. Thanks! --- src/backend/langflow/graph/edge/base.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/backend/langflow/graph/edge/base.py b/src/backend/langflow/graph/edge/base.py index 08f084a5c..b7a71ffa1 100644 --- a/src/backend/langflow/graph/edge/base.py +++ b/src/backend/langflow/graph/edge/base.py @@ -30,8 +30,7 @@ class Edge: ( output for output in self.source_types - for target_req in self.target_reqs - if output in target_req + if output in self.target_reqs ), None, )