Logo
Explore Help
Register Sign In
admin/dify
1
0
Fork 0
You've already forked dify
Code Issues Pull Requests Actions 1 Packages Projects Releases Wiki Activity
Files
f601093ccc07d1e8c1d3b91572ad9b4c70ef0b3d
dify/api/core/model_runtime/utils/helper.py

11 lines
305 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"):
feat: mypy for all type check (#10921)
2024-12-24 18:38:51 +08:00
# FIXME mypy error, try to fix it instead of using type: ignore
return pydantic.model_dump(model) # type: ignore
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
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.25.2 Page: 1172ms Template: 4ms
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