From 4b5c3a0c5315a876916015097a4ce31d19727599 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 22 Jun 2023 22:43:51 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A8=20refactor(process.py):=20add=20ty?= =?UTF-8?q?pe=20hinting=20to=20function=20arguments=20This=20commit=20adds?= =?UTF-8?q?=20type=20hinting=20to=20the=20function=20arguments=20of=20`get?= =?UTF-8?q?=5Fresult=5Fand=5Fthought`=20and=20`process=5Fgraph=5Fcached`?= =?UTF-8?q?=20functions=20in=20`process.py`=20file.=20This=20improves=20co?= =?UTF-8?q?de=20readability=20and=20maintainability.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/processing/process.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/langflow/processing/process.py b/src/backend/langflow/processing/process.py index c7b01883c..69f8fbfea 100644 --- a/src/backend/langflow/processing/process.py +++ b/src/backend/langflow/processing/process.py @@ -54,7 +54,7 @@ def format_actions(actions: List[Tuple[AgentAction, str]]) -> str: return "\n".join(output) -def get_result_and_thought(langchain_object, inputs: dict): +def get_result_and_thought(langchain_object: Any, inputs: dict): """Get result and thought from extracted json""" try: if hasattr(langchain_object, "verbose"): @@ -82,7 +82,7 @@ def get_input_str_if_only_one_input(inputs: dict) -> Optional[str]: return list(inputs.values())[0] if len(inputs) == 1 else None -def process_graph_cached(data_graph: Dict[str, Any], inputs: Union[dict, str]): +def process_graph_cached(data_graph: Dict[str, Any], inputs: dict): """ Process graph by extracting input variables and replacing ZeroShotPrompt with PromptTemplate,then run the graph and return the result and thought.