mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-05-08 06:59:12 +08:00
10 lines
217 B
Python
10 lines
217 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.model_dump()
|