fix: Add session_id Parameter to run_flow_from_json Function (#3989)

This pull request fixes the `run_flow_from_json` function by adding  `session_id` parameter. This update ensures that session management is properly handled during flow execution.

Changes include:
- Added `session_id` as an optional input parameter.
- Updated function documentation to reflect the inclusion of the new parameter.
- Added unit test for run_flow_from_json input parameters

This fix enhances the function's usability by allowing for better tracking of individual sessions.
This commit is contained in:
Edwin Jose 2024-10-03 11:43:31 -04:00 • committed by GitHub
commit 461238aa0e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 33 additions and 1 deletions

View file

@ -0,0 +1,26 @@
from langflow.load import run_flow_from_json
def test_run_flow_from_json_params():
# Define the expected parameters
expected_params = {
"flow",
"input_value",
"session_id",
"tweaks",
"input_type",
"output_type",
"output_component",
"log_level",
"log_file",
"env_file",
"cache",
"disable_logs",
"fallback_to_env_vars",
}
# Check if the function accepts all expected parameters
params = run_flow_from_json.__code__.co_varnames[: run_flow_from_json.__code__.co_argcount]
assert expected_params.issubset(params), "Not all expected parameters are present in run_flow_from_json"
# TODO: Add tests by loading a flow and running it need to text with fake llm and check if it returns the correct output