For the last 2 hours I am trying to create an index using the following code:
# Check if the knowledge base index exists
try:
# Attempt to retrieve information about the index
pinecone.describe_index("demand-writer")
except pinecone.ApiException as e:
# If the index does not exist, create it
if "Index not found" in str(e):
pinecone.create_index(
"demand-writer",
dimension=len(embeddings[0]), # Assuming all embeddings have the same dimension
metric='cosine',
)
However, it seems to be throwing an error.
This is another variation of the code also generating the same error:
# Check if the knowledge base index exists and create an index if it does not exist
if "demand-writer" not in pinecone.list_indexes():
pinecone.create_index(
"demand-writer",
dimension=1536,
metric='cosine',
)
Now I have used this code last week and there were no errors. Could someone provide some guidance
6 posts - 3 participants