File size: 803 Bytes
72a5f6e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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)
        )