@@ -117,7 +117,7 @@ def _(data: pd.DataFrame):
117117 >>> another_prototype.schema() == prototype.schema()
118118 True
119119 """
120- dict_data = data .iloc [0 , :].to_dict ()
120+ dict_data = _to_field ( data .iloc [0 , :].to_dict () )
121121 prototype = create_prototype (** dict_data )
122122 return prototype
123123
@@ -156,7 +156,9 @@ def _item(value):
156156
157157 dict_data = dict (enumerate (data [0 ], 0 ))
158158 # pydantic requires strings as indicies
159- dict_data = {f"{ key } " : _item (value ) for key , value in dict_data .items ()}
159+ dict_data = {
160+ f"{ key } " : (type (value ), _item (value )) for key , value in dict_data .items ()
161+ }
160162 prototype = create_prototype (** dict_data )
161163 return prototype
162164
@@ -171,7 +173,7 @@ def _(data: dict):
171173 data : dict
172174 Dictionary
173175 """
174- return create_prototype (** data )
176+ return create_prototype (** _to_field ( data ) )
175177
176178
177179@vetiver_create_prototype .register
@@ -198,3 +200,10 @@ def _(data: NoneType):
198200 None
199201 """
200202 return None
203+
204+
205+ def _to_field (data ):
206+ basemodel_input = dict ()
207+ for key , value in data .items ():
208+ basemodel_input [key ] = (type (value ), value )
209+ return basemodel_input
0 commit comments