Spaces:
Sleeping
Sleeping
import os | |
import pinecone | |
from dotenv import load_dotenv | |
load_dotenv() | |
if __name__ == '__main__': | |
index_name = 'moviereviews' | |
# get api key from app.pinecone.io | |
api_key = os.environ.get('PINECONE_API_KEY') or 'YOUR_PINECONE_API_KEY' | |
# find your environment next to the api key in pinecone console | |
env = os.environ.get('PINECONE_ENVIRONMENT') or 'YOUR_PINECONE_ENVIRONMENT' | |
print(api_key, env) | |
pinecone.init( | |
api_key=api_key, | |
environment=env | |
) | |
if index_name not in pinecone.list_indexes(): | |
# we create a new index | |
pinecone.create_index( | |
name=index_name, | |
metric='cosine', | |
dimension= 1536### YOU CODE HERE - REMEMBER TO USE THE SAME DIMENSION AS THE EMBEDDING MODEL (text-embedding-ada-002) | |
) | |