mirror of
https://github.com/langgenius/dify.git
synced 2025-06-27 05:30:04 +00:00
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()
|