Find answers from the community

Updated last year

Hi there When i try to run the following

Hi there. When i try to run the following example: https://gpt-index.readthedocs.io/en/latest/getting_started/starter_example.html#build-and-query-index I get the error that I doen't have the OPENAI_API_KEY configurated. I really need this key for this simple example??
L
e
9 comments
Yea it's needed because it's generating embeddings (which defaults to text-embedding-ada-002 from OpenAI)

If you upgrade to v0.8.0, there are some easy options for local stuff, but you need to install some extra dependencies (llama.cpp, sentence-transformers)
https://gpt-index.readthedocs.io/en/latest/getting_started/installation.html#local-environment-setup
I imported a open ai key and i get:
tenacity.RetryError: RetryError[<Future at 0x7fdac8ab62b0 state=finished raised RateLimitError>]
how did you set the openai key? My go-to method is this, especially for notebooks

Plain Text
import os
import openai

os.environ["OPENAI_API_KEY"] = "sk-..."
openai.api_key = os.environ["OPENAI_API_KEY"]
import os import openai from llama_index import SimpleDirectoryReader, VectorStoreIndex os.environ["OPENAI_API_KEY"] = "sk-" openai.api_key = "sk-" documents = SimpleDirectoryReader('data').load_data() index = VectorStoreIndex.from_documents(documents) query_engine = index.as_query_engine() response = query_engine.query("What did the author do growing up?") print(response)
πŸ€·β€β™‚οΈ Should be working
Although you did get a rate limit error I just noticed
Which happens if you have the free credits usually
Ahh okayy, thankss
Add a reply
Sign up and join the conversation on Discord