elegant-petabyte-32634
09/15/2022, 12:20 PMnative_interface = transform_function_to_interface(workflow_function, docstring=docstring)
I assume I could make the workflow function take kwargs, but then change this line to create the interface from the field names+types+default obtained by using inspect
on the Config constructor. Does that make sense or is there an easier way?elegant-petabyte-32634
09/15/2022, 12:22 PMfreezing-airport-6809
elegant-petabyte-32634
09/15/2022, 1:57 PMdataclasses.make_dataclass
to create a dataclass from my existing config class, using those as workflow parameters, then converting the dataclass obj to a dict and passing that as kwargs to existing config constructorelegant-petabyte-32634
09/15/2022, 1:58 PMdef pydantic_class_to_dataclass(pydantic_class):
fields = list(inspect.signature(pydantic_class).parameters.values())
return dataclass_json(
make_dataclass(
f"{pydantic_class.__name__}DataClass",
fields=[
(p.name, p.annotation, p.default)
for p in fields
if not p.name.startswith("_")
],
)
)
freezing-airport-6809
elegant-petabyte-32634
09/15/2022, 2:02 PMelegant-petabyte-32634
09/15/2022, 2:02 PMfreezing-airport-6809
freezing-airport-6809
elegant-petabyte-32634
09/15/2022, 2:03 PMfreezing-airport-6809
elegant-petabyte-32634
09/15/2022, 2:03 PMfreezing-airport-6809