Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add run_id parameter to run_flow function #3834

Merged
merged 4 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/backend/base/langflow/base/tools/flow_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,12 @@ async def _arun(
) -> str:
"""Use the tool asynchronously."""
tweaks = self.build_tweaks_dict(args, kwargs)
run_id = self.graph.run_id if self.graph else None
run_outputs = await run_flow(
tweaks={key: {"input_value": value} for key, value in tweaks.items()},
flow_id=self.flow_id,
user_id=self.user_id,
run_id=run_id,
)
if not run_outputs:
return "No output"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,7 @@ async def run_flow(
flow_name=flow_name,
tweaks=tweaks,
user_id=str(self._user_id),
run_id=self.graph.run_id,
)

def list_flows(self) -> list[Data]:
Expand Down
3 changes: 3 additions & 0 deletions src/backend/base/langflow/helpers/flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,13 @@ async def run_flow(
flow_name: Optional[str] = None,
output_type: Optional[str] = "chat",
user_id: Optional[str] = None,
run_id: Optional[str] = None,
) -> List[RunOutputs]:
if user_id is None:
raise ValueError("Session is invalid")
graph = await load_flow(user_id, flow_id, flow_name, tweaks)
if run_id:
graph.set_run_id(UUID(run_id))

if inputs is None:
inputs = []
Expand Down
Loading