Skip to content

Commit

Permalink
feat: Add ability to apply configuration before starting graph.
Browse files Browse the repository at this point in the history
  • Loading branch information
ogabrielluiz committed Aug 14, 2024
1 parent 09a1a99 commit 8933cf8
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/backend/base/langflow/graph/graph/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,22 @@ async def async_start(self, inputs: Optional[List[dict]] = None):

raise ValueError("Max iterations reached")

def start(self, inputs: Optional[List[dict]] = None, max_iterations: Optional[int] = None) -> Generator:
def __apply_config(self, config: StartConfigDict):

Check failure on line 273 in src/backend/base/langflow/graph/graph/base.py

View workflow job for this annotation

GitHub Actions / Ruff Style Check (3.12)

Ruff (F821)

src/backend/base/langflow/graph/graph/base.py:273:38: F821 Undefined name `StartConfigDict`
for vertex in self.vertices:
if vertex._custom_component is None:
continue
for output in vertex._custom_component.outputs:
for key, value in config["output"].items():
setattr(output, key, value)

def start(
self,
inputs: Optional[List[dict]] = None,
max_iterations: Optional[int] = None,
config: Optional[StartConfigDict] = None,

Check failure on line 285 in src/backend/base/langflow/graph/graph/base.py

View workflow job for this annotation

GitHub Actions / Ruff Style Check (3.12)

Ruff (F821)

src/backend/base/langflow/graph/graph/base.py:285:26: F821 Undefined name `StartConfigDict`
) -> Generator:
if config is not None:
self.__apply_config(config)
#! Change this ASAP
nest_asyncio.apply()
loop = asyncio.get_event_loop()
Expand Down

0 comments on commit 8933cf8

Please sign in to comment.