File tree Expand file tree Collapse file tree 1 file changed +11
-10
lines changed Expand file tree Collapse file tree 1 file changed +11
-10
lines changed Original file line number Diff line number Diff line change 595
595
},
596
596
"outputs" : [],
597
597
"source" : [
598
- " from pinecone import Pinecone\n " ,
598
+ " from pinecone import Pinecone, ServerlessSpec \n " ,
599
599
" \n " ,
600
- " pinecone.init(\n " ,
601
- " PINECONE_KEY,\n " ,
602
- " environment=\" YOUR_ENV\" # find next to API key in console\n " ,
603
- " )\n " ,
600
+ " pc = Pinecone(api_key=PINECONE_KEY)\n " ,
604
601
" \n " ,
605
602
" index_name = 'cohere-pinecone-trec'\n " ,
606
603
" \n " ,
607
604
" # if the index does not exist, we create it\n " ,
608
- " if index_name not in pinecone .list_indexes().names():\n " ,
609
- " pinecone .create_index(\n " ,
610
- " index_name,\n " ,
605
+ " if index_name not in pc .list_indexes().names():\n " ,
606
+ " pc .create_index(\n " ,
607
+ " name= index_name,\n " ,
611
608
" dimension=shape[1],\n " ,
612
- " metric='cosine'\n " ,
609
+ " metric=\" cosine\" ,\n " ,
610
+ " spec=ServerlessSpec(\n " ,
611
+ " cloud='aws', \n " ,
612
+ " region='us-east-1'\n " ,
613
+ " ) \n " ,
613
614
" )\n " ,
614
615
" \n " ,
615
616
" # connect to index\n " ,
616
- " index = pinecone .Index(index_name)"
617
+ " index = pc .Index(index_name)"
617
618
]
618
619
},
619
620
{
You can’t perform that action at this time.
0 commit comments