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-03 15:18:05 +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:
if hasattr(pydantic, 'model_dump'):
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: 564ms Template: 9ms
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