In the DLAIUtils.py file (access by clicking the Jupyter icon in the notebook), we have the function below. What is the purpose of adding the OpenAI key to the end of our index_name?
def create_dlai_index_name(self, index_name):
openai_key = ‘’
if self.is_colab(): # google colab
from google.colab import userdata
openai_key = userdata.get(“OPENAI_API_KEY”)
else: # jupyter notebook
openai_key = os.getenv(“OPENAI_API_KEY”)
return f’{index_name}-{openai_key[-36:].lower().replace(“_”, “-”)}’
Hello @0to1 , I believe it’s so that any indexes created on Pinecone have a unique identifier. Each time we generate a new index and upload to Pinecone, it’s listed on our Pinecone accounts by this unique identifier. I just checked my Pinecone account (I’m taking advantage of the $100 credit offered by Pinecone, so my indexes are associated with the Pinecone serverless API). I can see that for the first lesson (semantic search), the index name is based solely on the Pinecone API key. For other lessons in this course that use OpenAI functions, the index name includes a portion of the stripped and lower-cased string that makes up the OpenAI API key. I can clearly see on the Serverless Indexes page of my Pinecone account which is which.