def create_flexible_model(model: Type[BaseModel]) -> Type[FlexibleModel]:
    """Create a flexible version of the model that allows any fields."""
    return create_model(
        f"Flexible{model.__name__}",
        __base__=FlexibleModel,
        **dict.fromkeys(model.model_fields, (Optional[Any], None)),
    )  # type: ignore
Create a flexible version of the model that allows any fields.
llama-index-core/llama_index/core/program/utils.py