From d6bd8a1a1b4b62a3e21b32c7759b636db1127918 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 29 Jun 2023 19:30:51 -0300 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=94=A7=20chore(utils.py):=20add=20sup?= =?UTF-8?q?port=20for=20handle=5Fkeys=20in=20build=5Finput=5Fkeys=5Frespon?= =?UTF-8?q?se=20function=20The=20build=5Finput=5Fkeys=5Fresponse=20functio?= =?UTF-8?q?n=20now=20includes=20support=20for=20handle=5Fkeys=20in=20the?= =?UTF-8?q?=20response.=20This=20allows=20the=20function=20to=20populate?= =?UTF-8?q?=20the=20handle=5Fkeys=20field=20in=20the=20response=20with=20t?= =?UTF-8?q?he=20values=20from=20the=20artifacts=20dictionary,=20if=20avail?= =?UTF-8?q?able.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/api/utils.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/backend/langflow/api/utils.py b/src/backend/langflow/api/utils.py index 2df86eb7f..aa9598814 100644 --- a/src/backend/langflow/api/utils.py +++ b/src/backend/langflow/api/utils.py @@ -30,6 +30,7 @@ def build_input_keys_response(langchain_object, artifacts): input_keys_response = { "input_keys": {key: "" for key in langchain_object.input_keys}, "memory_keys": [], + "handle_keys": artifacts.get("handle_keys", []), } # Set the input keys values from artifacts From 1743edfd1d61b5f1c9967c42d3bc8e7ed535db87 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 29 Jun 2023 19:31:01 -0300 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=90=9B=20fix(loading.py):=20handle=20?= =?UTF-8?q?case=20when=20"handle=5Fkeys"=20is=20not=20in=20params=20dictio?= =?UTF-8?q?nary=20and=20add=20input=5Fvariable=20to=20"handle=5Fkeys"=20li?= =?UTF-8?q?st=20The=20code=20now=20checks=20if=20the=20"handle=5Fkeys"=20k?= =?UTF-8?q?ey=20is=20present=20in=20the=20params=20dictionary.=20If=20it?= =?UTF-8?q?=20is=20not=20present,=20it=20creates=20an=20empty=20list=20and?= =?UTF-8?q?=20adds=20the=20input=5Fvariable=20to=20it.=20This=20ensures=20?= =?UTF-8?q?that=20the=20"handle=5Fkeys"=20list=20is=20always=20present=20a?= =?UTF-8?q?nd=20the=20input=5Fvariable=20is=20correctly=20added=20to=20it.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/interface/initialize/loading.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/backend/langflow/interface/initialize/loading.py b/src/backend/langflow/interface/initialize/loading.py index 34249239d..eed253192 100644 --- a/src/backend/langflow/interface/initialize/loading.py +++ b/src/backend/langflow/interface/initialize/loading.py @@ -142,6 +142,13 @@ def instantiate_prompt(node_type, class_object, params): for item in variable ] ) + # handle_keys will be a list but it does not exist yet + # so we need to create it + if "handle_keys" not in params: + format_kwargs["handle_keys"] = [] + + # Add the handle_keys to the list + format_kwargs["handle_keys"].append(input_variable) return prompt, format_kwargs