Skip to content

Commit

Permalink
feat: Add optional target handle name in get_result method.
Browse files Browse the repository at this point in the history
  • Loading branch information
ogabrielluiz committed Aug 16, 2024
1 parent 00d2cff commit 9499e7e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/backend/base/langflow/graph/vertex/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ def _is_list_of_vertices(self, value):
"""
return all(self._is_vertex(vertex) for vertex in value)

async def get_result(self, requester: "Vertex") -> Any:
async def get_result(self, requester: "Vertex", target_handle_name: Optional[str] = None) -> Any:
"""
Retrieves the result of the vertex.
Expand All @@ -593,9 +593,9 @@ async def get_result(self, requester: "Vertex") -> Any:
The result of the vertex.
"""
async with self._lock:
return await self._get_result(requester)
return await self._get_result(requester, target_handle_name)

async def _get_result(self, requester: "Vertex") -> Any:
async def _get_result(self, requester: "Vertex", target_handle_name: Optional[str] = None) -> Any:
"""
Retrieves the result of the built component.
Expand All @@ -620,7 +620,7 @@ async def _build_vertex_and_update_params(self, key, vertex: "Vertex"):
Builds a given vertex and updates the params dictionary accordingly.
"""

result = await vertex.get_result(self)
result = await vertex.get_result(self, target_handle_name=key)
self._handle_func(key, result)
if isinstance(result, list):
self._extend_params_list_with_result(key, result)
Expand Down
2 changes: 1 addition & 1 deletion src/backend/base/langflow/graph/vertex/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def get_edge_with_target(self, target_id: str) -> Generator["CycleEdge", None, N
if edge.target_id == target_id:
yield edge

async def _get_result(self, requester: "Vertex") -> Any:
async def _get_result(self, requester: "Vertex", target_handle_name: str | None = None) -> Any:
"""
Retrieves the result of the built component.
Expand Down

0 comments on commit 9499e7e

Please sign in to comment.