Download api/core/model_runtime/utils/helper.py from ZHZ1024/dify: direct link, hf CLI and curl.
- Browser
- Download file 217 Bytes
-
https://huggingface.co/spaces/ZHZ1024/dify/resolve/main/api/core/model_runtime/utils/helper.py
- Command line
-
hf download hf://spaces/ZHZ1024/dify/api/core/model_runtime/utils/helper.py
-
curl -L -o helper.py https://huggingface.co/spaces/ZHZ1024/dify/resolve/main/api/core/model_runtime/utils/helper.py
217 Bytes
| 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() | |