mirror of
https://github.com/langgenius/dify.git
synced 2024-11-16 19:59:50 +08:00
d069c668f8
Co-authored-by: StyleZhang <jasonapring2015@outlook.com> Co-authored-by: Garfield Dai <dai.hai@foxmail.com> Co-authored-by: chenhe <guchenhe@gmail.com> Co-authored-by: jyong <jyong@dify.ai> Co-authored-by: Joel <iamjoel007@gmail.com> Co-authored-by: Yeuoly <admin@srmxy.cn>
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()
|