Robin Kahlow
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?Ketan (kumare3)
Robin Kahlow
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 constructordef 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("_")
],
)
)
Ketan (kumare3)
Robin Kahlow
09/15/2022, 2:02 PMKetan (kumare3)
Robin Kahlow
09/15/2022, 2:03 PMKetan (kumare3)
Robin Kahlow
09/15/2022, 2:03 PMKetan (kumare3)