Find answers from the community

Updated 5 months ago

Openai key

At a glance
Is anyone else getting the "Did not find openai_api_key" error in Colab when running:

documents = SimpleDirectoryReader('data').load_data()
index = GPTSimpleVectorIndex.from_documents(documents)
L
r
3 comments
Did you set the key in collab?

Plain Text
import os
os.environ["OPENAI_API_KEY"] = "key"
Thanks, I set the OPENAI_API_KEY = "key" directly. Appreciate the quick response.
If you set it that way in colab, I think it needs to be an export

!export OPENAI_API_KEY="key"

That or the os method should work
Add a reply
Sign up and join the conversation on Discord