ChatGLM3 icon indicating copy to clipboard operation
ChatGLM3 copied to clipboard

type object 'UsageInfo' has no attribute 'model_validate'

Open lengyanju8 opened this issue 2 years ago • 4 comments

System Info / 系統信息

python 3.10

Who can help? / 谁可以帮助到您?

File "D:\chatglm3\openai_api_demo\openai_api.py", line 233, in create_chat_completion task_usage = UsageInfo.model_validate(response["usage"]) AttributeError: type object 'UsageInfo' has no attribute 'model_validate'

Information / 问题信息

  • [X] The official example scripts / 官方的示例脚本
  • [ ] My own modified scripts / 我自己修改的脚本和任务

Reproduction / 复现过程

python

Expected behavior / 期待表现

不知道问题在哪里

lengyanju8 avatar Dec 15 '23 20:12 lengyanju8

pydantic>=2.5.1

zRzRzRzRzRzRzR avatar Dec 16 '23 04:12 zRzRzRzRzRzRzR

when i install pydantic>=2.5.1, it will have this error:

image

SHITIANYU-hue avatar Jan 30 '24 15:01 SHITIANYU-hue

my pydantic version is :

pydantic 2.6.0 pydantic_core 2.16.1

SHITIANYU-hue avatar Jan 30 '24 15:01 SHITIANYU-hue

请问这个问题解决了吗?我也遇到了同样的问题。

yhanarkham avatar Mar 05 '24 01:03 yhanarkham