1818import json
1919
2020from pydantic import BaseModel , ConfigDict , StrictInt , StrictStr
21- from typing import Any , ClassVar , Dict , List
21+ from typing import Any , ClassVar , Dict , List , Optional
2222from typing import Optional , Set
2323from typing_extensions import Self
2424
@@ -34,7 +34,9 @@ class HardwareInstanceResponse(BaseModel):
3434 memory : StrictInt
3535 cost_per_hr : StrictInt
3636 cluster_id : StrictInt
37- __properties : ClassVar [List [str ]] = ["id" , "name" , "gpu_type" , "num_gpu" , "cpu" , "memory" , "cost_per_hr" , "cluster_id" ]
37+ provider : Optional [StrictStr ]
38+ num_accelerators : Optional [StrictInt ]
39+ __properties : ClassVar [List [str ]] = ["id" , "name" , "gpu_type" , "num_gpu" , "cpu" , "memory" , "cost_per_hr" , "cluster_id" , "provider" , "num_accelerators" ]
3840
3941 model_config = ConfigDict (
4042 populate_by_name = True ,
@@ -75,6 +77,16 @@ def to_dict(self) -> Dict[str, Any]:
7577 exclude = excluded_fields ,
7678 exclude_none = True ,
7779 )
80+ # set to None if provider (nullable) is None
81+ # and model_fields_set contains the field
82+ if self .provider is None and "provider" in self .model_fields_set :
83+ _dict ['provider' ] = None
84+
85+ # set to None if num_accelerators (nullable) is None
86+ # and model_fields_set contains the field
87+ if self .num_accelerators is None and "num_accelerators" in self .model_fields_set :
88+ _dict ['num_accelerators' ] = None
89+
7890 return _dict
7991
8092 @classmethod
@@ -94,7 +106,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
94106 "cpu" : obj .get ("cpu" ),
95107 "memory" : obj .get ("memory" ),
96108 "cost_per_hr" : obj .get ("cost_per_hr" ),
97- "cluster_id" : obj .get ("cluster_id" )
109+ "cluster_id" : obj .get ("cluster_id" ),
110+ "provider" : obj .get ("provider" ),
111+ "num_accelerators" : obj .get ("num_accelerators" )
98112 })
99113 return _obj
100114
0 commit comments