-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: compatible with pydantic v1 #180
Conversation
Dobiichi-Origami
commented
Jan 8, 2024
- Description: 为 SDK 提供了 Pydantic V1 的兼容性,现在 SDK 同时支持 Pydantic V1 与 V2
- Issue: release 0.2.7 #177 ,
- Dependencies: python-dotenv = "<=0.21.1",
- Tag maintainer: @stonekim, @danielhjz, @ZingLix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
others LGTM
@@ -72,7 +73,7 @@ preview = true | |||
[tool.mypy] | |||
ignore_missing_imports = "True" | |||
disallow_untyped_defs = "True" | |||
exclude = ["qianfan/tests"] | |||
exclude = ["qianfan/tests", "qianfan/pydantic"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里是避免什么问题
""" | ||
|
||
try: | ||
from pydantic.v1 import * # noqa |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
使用v1 api
class Config: | ||
env_file_encoding = "utf-8" | ||
env_prefix = "QIANFAN_" | ||
case_sensitive = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BaseSettings内部类Config用于设置BaseSetting的一些元信息和行为选项