Co-authored-by: StyleZhang <[email protected]> Co-authored-by: Garfield Dai <[email protected]> Co-authored-by: chenhe <[email protected]> Co-authored-by: jyong <[email protected]> Co-authored-by: Joel <[email protected]> Co-authored-by: Yeuoly <[email protected]>
10 lines
211 B
Python
10 lines
211 B
Python
import pydantic
|
|
from pydantic import BaseModel
|
|
|
|
|
|
def dump_model(model: BaseModel) -> dict:
|
|
if hasattr(pydantic, 'model_dump'):
|
|
return pydantic.model_dump(model)
|
|
else:
|
|
return model.dict()
|