daodao97/chatdoc

后端运行报错,没找到openai_api_key

Closed this issue · 1 comments

您好!我想要修改chatdoc后端的一些功能,然后在debug后端的时候,会报错,报错内容如下:
Traceback (most recent call last):
File "/Users/nancygetup/PycharmProjects/chatdoc-final/server/main.py", line 6, in
from doc_util import Doc
File "/Users/nancygetup/PycharmProjects/chatdoc-final/server/doc_util.py", line 17, in
llm_predictor = LLMPredictor(llm=ChatOpenAI(
File "pydantic/main.py", line 341, in pydantic.main.BaseModel.init
pydantic.error_wrappers.ValidationError: 1 validation error for ChatOpenAI
root
Did not find openai_api_key, please add an environment variable OPENAI_API_KEY which contains it, or pass openai_api_key as a named parameter. (type=value_error)

我已经在yml文件中输入自己的api key 了,不知道这里是有什么问题,可以请教一下吗谢谢了

可以在 start 脚步中deubg下, 看看 OPENAI_API_KEY 的链路传递是否正常