Logo
Explore Help
Register Sign In
yujunjun/dify
1
0
Fork 0
You've already forked dify
mirror of https://github.com/langgenius/dify.git synced 2025-07-04 07:34:51 +00:00
Code Issues Packages Projects Releases Wiki Activity
dify/api/core/model_runtime/utils/helper.py

10 lines
217 B
Python
Raw Normal View History

Model Runtime (#1858) 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>
2024-01-02 23:42:00 +08:00
import pydantic
from pydantic import BaseModel
def dump_model(model: BaseModel) -> dict:
chore(api/core): apply ruff reformatting (#7624)
2024-09-10 17:00:20 +08:00
if hasattr(pydantic, "model_dump"):
Model Runtime (#1858) 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>
2024-01-02 23:42:00 +08:00
return pydantic.model_dump(model)
else:
improve: mordernizing validation by migrating pydantic from 1.x to 2.x (#4592)
2024-06-14 01:05:37 +08:00
return model.model_dump()
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.23.5 Page: 1378ms Template: 2ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API