<@ULVA73B9P> Can I pass self defined types as a fl...
# marvin-in-the-wild
m
@Marvin Can I pass self defined types as a flow argument? If not what types are supported?
m
Yes, you can pass self-defined types as flow arguments in Prefect, but they need to be serializable. Prefect supports a variety of types, including custom types, and uses type hints with pydantic models to ensure automatic type coercion of inputs. Here's an example using a pydantic model: from prefect import flow from pydantic import BaseModel class Model(BaseModel): a: int b: float c: str @flow def model_validator(model: Model): print(model) In the example above, the
Model
class is user-defined and can be used as a flow argument. Prefect will handle the coercion automatically, ensuring that the inputs match the expected data types defined in the
Model
. For a more detailed explanation, you can refer to the Prefect documentation here: * https://docs.prefect.io/latest/concepts/flows/ If you encounter any issues or need further assistance, feel free to check for similar issues or submit new ones on the Prefect GitHub repository.