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-06-27 05:30:04 +00:00
Code Issues Packages Projects Releases Wiki Activity
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.23.5 Page: 645ms Template: 26ms
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