definitive-io / conversational-chatbot-groq

83 stars 123 forks source link

Prompt KeyError after running #11

Open 13516513760 opened 3 months ago

13516513760 commented 3 months ago

I filled in my API KEY in app. py and started it, but it prompted KEYError. Xxxxxxxxxx is my confidential API KEY

KeyError:'xxxxxxxxx'
File "C:\Users\99548\AppData\Roaming\Python\Python311\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 535, in _run_script
    exec(code, module.__dict__)
File "E:\groq\conversational-chatbot-groq-main\app.py", line 70, in <module>
    main()
File "E:\groq\conversational-chatbot-groq-main\app.py", line 18, in main
    groq_api_key = os.environ['org_01htfdrvx4et585nnqtsq1vp9p']
                   ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen os>", line 679, in __getitem__
zenitogr commented 1 month ago

you dont fill there the API key, if you want to fill it there you should do directly:

groq_api_key = '<your api key>'

you put your key normally in an environment variable GROQ_API_KEY add you get it:

groq_api_key = os.environ['GROQ_API_KEY']

the os.environ['myenvvariable'] gets the value of environmental variable myenvvariable

myenvvariable is the name of the variable and the value is returned