visual-chatgpt
visual-chatgpt copied to clipboard
ValidationError: 1 validation error for OpenAI - please help :)
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /Users/user/PycharmProjects/pythonProject2/visual_chatgpt.py:941 in OPENAI_API_KEY
which contains it, or pass openai_api_key
as a named
parameter. (type=value_error)
# prepare your private openAI private key
export OPENAI_API_KEY={Your_Private_Openai_Key}
1 validation error for OpenAI root Did not find openai_api_key, please add an environment variable
OPENAI_API_KEY
which contains it, or passopenai_api_key
as a named parameter. (type=value_error)
Have you soloved this problem?Can you share your idea with me?
# prepare your private openAI private key export OPENAI_API_KEY={Your_Private_Openai_Key}
it makes no sense,i have tried this idea but this problem still exists, Do you have another idea?
it makes no sense,i have tried this idea but this problem still exists, Do you have another idea?
If you are on linux, it should work as long as you don't close the command line after export the api key. However, if you are on windows, you may want to mannually set the api key as your enviroment variable.
how to use it on windows???
I also encountered this issue on Windows 11,I even manually set "OPENAI_API_KEY" in the system environment variable Who can tell me where the problem is? Thank you.
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ D:\PROJECT\Python_Project\VisualChatGPT\visual-chatgpt\visual_chatgpt.py:1051 in <module> │
│ │
│ 1048 │ parser.add_argument('--load', type=str, default="ImageCaptioning_cuda:0,Text2Image_c │
│ 1049 │ args = parser.parse_args() │
│ 1050 │ load_dict = {e.split('_')[0].strip(): e.split('_')[1].strip() for e in args.load.spl │
│ ❱ 1051 │ bot = ConversationBot(load_dict=load_dict) │
│ 1052 │ with gr.Blocks(css="#chatbot .overflow-y-auto{height:500px}") as demo: │
│ 1053 │ │ chatbot = gr.Chatbot(elem_id="chatbot", label="Visual ChatGPT") │
│ 1054 │ │ state = gr.State([]) │
│ │
│ D:\PROJECT\Python_Project\VisualChatGPT\visual-chatgpt\visual_chatgpt.py:981 in __init__ │
│ │
│ 978 │ │ if 'ImageCaptioning' not in load_dict: │
│ 979 │ │ │ raise ValueError("You have to load ImageCaptioning as a basic function for V │
│ 980 │ │ │
│ ❱ 981 │ │ self.llm = OpenAI(temperature=0) │
│ 982 │ │ self.memory = ConversationBufferMemory(memory_key="chat_history", output_key='ou │
│ 983 │ │ │
│ 984 │ │ self.models = {} │
│ │
│ in pydantic.main.BaseModel.__init__:341 │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
ValidationError: 1 validation error for OpenAI
__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)```
If you have manually set the system environment variable then just restart your device once, it'll run.