From 534f47f1532ffc183a0d9d8c15cc5db830a0ac5b Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Fri, 2 Jun 2023 14:14:47 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A8=20refactor(types.py):=20import=20f?= =?UTF-8?q?latten=5Flist=20function=20from=20graph.utils=20module=20This?= =?UTF-8?q?=20commit=20simply=20imports=20the=20flatten=5Flist=20function?= =?UTF-8?q?=20from=20the=20graph.utils=20module=20to=20be=20used=20in=20th?= =?UTF-8?q?e=20AgentVertex=20class.=20This=20improves=20the=20readability?= =?UTF-8?q?=20of=20the=20code=20and=20reduces=20the=20number=20of=20lines?= =?UTF-8?q?=20of=20code.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/graph/vertex/types.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/backend/langflow/graph/vertex/types.py b/src/backend/langflow/graph/vertex/types.py index 5b4e01ede..0b0d0923f 100644 --- a/src/backend/langflow/graph/vertex/types.py +++ b/src/backend/langflow/graph/vertex/types.py @@ -1,15 +1,15 @@ from typing import Any, Dict, List, Optional, Union from langflow.graph.vertex.base import Vertex -from langflow.graph.utils import extract_input_variables_from_prompt +from langflow.graph.utils import extract_input_variables_from_prompt, flatten_list class AgentVertex(Vertex): def __init__(self, data: Dict): super().__init__(data, base_type="agents") - self.tools: List[Union[ToolNode, ToolkitNode]] = [] - self.chains: List[ChainNode] = [] + self.tools: List[Union[ToolVertex, ToolkitVertex]] = [] + self.chains: List[ChainVertex] = [] def _set_tools_and_chains(self) -> None: for edge in self.edges: @@ -94,10 +94,10 @@ class ChainVertex(Vertex): tools: Optional[Union[List[Vertex], List[ToolVertex]]] = None, ) -> Any: if not self._built or force: - # Check if the chain requires a PromptNode + # Check if the chain requires a PromptVertex for key, value in self.params.items(): if isinstance(value, PromptVertex): - # Build the PromptNode, passing the tools if available + # Build the PromptVertex, passing the tools if available self.params[key] = value.build(tools=tools, force=force) self._build()