feat: flow_runner better init and remove the depend on old load func (#7933)

* fixes

* fix: Update SQLAlchemy import to SQLModel in flow_runner.py

* [autofix.ci] apply automated fixes

* Update flow_runner tests to match new LangflowRunnerExperimental API (#1)

* Initial plan

* Update test_flow_runner.py to match new LangflowRunnerExperimental API

Co-authored-by: barnuri <13019522+barnuri@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: barnuri <13019522+barnuri@users.noreply.github.com>

* [autofix.ci] apply automated fixes

* patch-1 - fix lint

* patch-1 - tweaks_values

* patch-1 - tweaks_values

* lint

---------

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Edwin Jose <edwin.jose@datastax.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: barnuri <13019522+barnuri@users.noreply.github.com>
This commit is contained in:
Bar Nuri 2025-06-26 18:14:35 +03:00 committed by GitHub
commit fe7b7dfd27
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 157 additions and 73 deletions

View file

@ -7,10 +7,12 @@ from langflow.services.flow.flow_runner import LangflowRunnerExperimental
@pytest.fixture
def sample_flow_dict():
return {
"id": str(uuid4()), # Add required ID field
"name": "test_flow", # Add name field
"data": {
"nodes": [],
"edges": [],
}
},
}
@ -48,9 +50,9 @@ async def test_run_with_dict_input(flow_runner, sample_flow_dict):
input_value = "test input"
result = await flow_runner.run(
session_id=session_id,
flow=sample_flow_dict,
input_value=input_value,
session_id=session_id,
)
assert result is not None
@ -62,16 +64,16 @@ async def test_run_with_different_input_types(flow_runner, sample_flow_dict):
test_cases = [
("text input", "text", "text"),
("chat input", "chat", "chat"),
("test input", "chat", "text"),
("test input", "chat", "all"), # Updated to use "all" as default output_type
]
for input_value, input_type, output_type in test_cases:
result = await flow_runner.run(
session_id=session_id,
flow=sample_flow_dict,
input_value=input_value,
input_type=input_type,
output_type=output_type,
session_id=session_id,
)
assert result is not None