Skip to content

Commit 82afb11

Browse files
committed
add Connect widget
1 parent 066fc6b commit 82afb11

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

integrations/cohere/semantic_search_trec.ipynb

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@
149149
}
150150
],
151151
"source": [
152-
"!pip install cohere pinecone-client datasets"
152+
"!pip install cohere pinecone-client datasets pinecone-notebooks"
153153
]
154154
},
155155
{
@@ -586,6 +586,23 @@
586586
"Now that we have our embeddings we can move on to indexing them in the Pinecone vector database. Again, this is very simple, we just initialize our connection to Pinecone and then create a new index for storing the embeddings, making sure to specify that we would like to use the cosine similarity metric to align with Cohere's embeddings."
587587
]
588588
},
589+
{
590+
"cell_type": "code",
591+
"execution_count": null,
592+
"metadata": {},
593+
"outputs": [],
594+
"source": [
595+
"from pinecone_notebooks.colab import Authenticate\n",
596+
"Authenticate()"
597+
]
598+
},
599+
{
600+
"cell_type": "markdown",
601+
"metadata": {},
602+
"source": [
603+
"The generated API key is stored in the `PINECONE_API_KEY` environment variable for us to use."
604+
]
605+
},
589606
{
590607
"cell_type": "code",
591608
"execution_count": null,
@@ -595,9 +612,20 @@
595612
"outputs": [],
596613
"source": [
597614
"from pinecone import Pinecone, ServerlessSpec\n",
615+
"import os\n",
598616
"\n",
599-
"pc = Pinecone(api_key=PINECONE_KEY)\n",
617+
"api_key = os.environ.get('PINECONE_API_KEY')\n",
600618
"\n",
619+
"# Use the API key to initialize the Pinecone client\n",
620+
"pc = Pinecone(api_key=PINECONE_KEY)"
621+
]
622+
},
623+
{
624+
"cell_type": "code",
625+
"execution_count": null,
626+
"metadata": {},
627+
"outputs": [],
628+
"source": [
601629
"index_name = 'cohere-pinecone-trec'\n",
602630
"\n",
603631
"# if the index does not exist, we create it\n",

0 commit comments

Comments
 (0)