baidubce / bce-qianfan-sdk

Provide best practices for LMOps, as well as elegant and convenient access to the features of the Qianfan MaaS Platform. (提供大模型工具链最佳实践,以及优雅且便捷地访问千帆大模型平台)
https://cloud.baidu.com/doc/WENXINWORKSHOP/index.html
Apache License 2.0
331 stars 50 forks source link

partially initialized module 'qianfan' has no attribute 'ChatCompletion' (most likely due to a circular import) #421

Closed wolfherder closed 7 months ago

wolfherder commented 7 months ago

import os import qianfan

os.environ["QIANFAN_ACCESS_KEY"]="--" os.environ["QIANFAN_SECRET_KEY"]="--"

chat_comp = qianfan.ChatCompletion() resp = chat_comp.do(endpoint="your_custom_endpoint", messages=[{ "role": "user", "content": "你好" }])

partially initialized module 'qianfan' has no attribute 'ChatCompletion' (most likely due to a circular import)

Suggestion:

No response

AInseven commented 7 months ago
chat_comp = qianfan.ChatCompletion(model="ERNIE-Bot")
                ^^^^^^^^^^^^^^^^^^^^^^
AttributeError: partially initialized module 'qianfan' has no attribute 'ChatCompletion' (most likely due to a circular import)
pip install qianfan
pip install qianfan==0.3.5
pip install qianfan==0.3.6

None of them work properly

ZingLix commented 7 months ago

看看是不是这个代码文件的文件名是qianfan.py,或者同个文件夹里有这个文件,和 qianfan 包名冲突了所以失败了

AInseven commented 7 months ago

是的,谢谢