From 931a2452eb730a440d3059c52b4982d93d295581 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 20 Dec 2023 14:41:55 -0300 Subject: [PATCH] Refactor result handling in generate_result function --- src/backend/langflow/processing/process.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/backend/langflow/processing/process.py b/src/backend/langflow/processing/process.py index 03587cd29..766027bdf 100644 --- a/src/backend/langflow/processing/process.py +++ b/src/backend/langflow/processing/process.py @@ -136,7 +136,12 @@ async def generate_result(langchain_object: Union[Chain, VectorStore], inputs: d elif isinstance(inputs, dict): call_func = langchain_object.ainvoke result = await call_func(inputs) - result = result.content if hasattr(result, "content") else result + if isinstance(result, list): + result = [r.content if hasattr(r, "content") else r for r in result] + elif hasattr(result, "content"): + result = result.content + else: + result = result elif hasattr(langchain_object, "run") and isinstance(langchain_object, CustomComponent): result = langchain_object.run(inputs)