From 6afca21e5ab050d31498059bfe6bf2779d65da19 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 28 Jun 2023 17:13:06 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(utils.py):=20fix=20build=5Fi?= =?UTF-8?q?nput=5Fkeys=5Fresponse=20function=20to=20correctly=20filter=20o?= =?UTF-8?q?ut=20memory=20variables=20from=20input=20keys=20The=20build=5Fi?= =?UTF-8?q?nput=5Fkeys=5Fresponse=20function=20now=20correctly=20filters?= =?UTF-8?q?=20out=20memory=20variables=20from=20the=20input=20keys=20respo?= =?UTF-8?q?nse.=20Previously,=20it=20was=20using=20a=20list=20comprehensio?= =?UTF-8?q?n=20to=20filter=20the=20keys,=20but=20it=20should=20have=20been?= =?UTF-8?q?=20using=20a=20dictionary=20comprehension=20to=20preserve=20the?= =?UTF-8?q?=20key-value=20pairs.=20This=20fix=20ensures=20that=20only=20th?= =?UTF-8?q?e=20keys=20that=20are=20not=20present=20in=20the=20langchain=5F?= =?UTF-8?q?object's=20memory=20variables=20are=20included=20in=20the=20inp?= =?UTF-8?q?ut=20keys=20response.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/api/utils.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/backend/langflow/api/utils.py b/src/backend/langflow/api/utils.py index bd566896d..bd25d74f4 100644 --- a/src/backend/langflow/api/utils.py +++ b/src/backend/langflow/api/utils.py @@ -37,11 +37,11 @@ def build_input_keys_response(langchain_object): langchain_object.memory, "memory_variables" ): # Remove memory variables from input keys - input_keys_response["input_keys"] = [ - key - for key in input_keys_response["input_keys"] + input_keys_response["input_keys"] = { + key: value + for key, value in input_keys_response["input_keys"].items() if key not in langchain_object.memory.memory_variables - ] + } # Add memory variables to memory_keys input_keys_response["memory_keys"] = langchain_object.memory.memory_variables