Skip to content

Commit 4e4ebd1

Browse files
committed
Add missing import of os module
1 parent f3b1e71 commit 4e4ebd1

File tree

1 file changed

+24
-22
lines changed

1 file changed

+24
-22
lines changed

learn/search/semantic-search/semantic-search.ipynb

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@
155155
},
156156
"outputs": [],
157157
"source": [
158+
"import os\n",
158159
"from pinecone import Pinecone\n",
159160
"\n",
160161
"api_key = os.environ.get('PINECONE_API_KEY') or 'PINECONE_API_KEY'\n",
@@ -194,6 +195,11 @@
194195
},
195196
{
196197
"cell_type": "code",
198+
"execution_count": null,
199+
"metadata": {
200+
"id": "Z355VLWFqumq"
201+
},
202+
"outputs": [],
197203
"source": [
198204
"query = 'which city is the most populated in the world?'\n",
199205
"\n",
@@ -209,12 +215,7 @@
209215
"\n",
210216
"# Print the first 5 vectors as a sanity check\n",
211217
"xq[:5]"
212-
],
213-
"metadata": {
214-
"id": "Z355VLWFqumq"
215-
},
216-
"execution_count": null,
217-
"outputs": []
218+
]
218219
},
219220
{
220221
"cell_type": "markdown",
@@ -318,10 +319,10 @@
318319
"cell_type": "code",
319320
"execution_count": null,
320321
"metadata": {
322+
"id": "nzhBBX2PjoaF",
321323
"tags": [
322324
"parameters"
323-
],
324-
"id": "nzhBBX2PjoaF"
325+
]
325326
},
326327
"outputs": [],
327328
"source": [
@@ -370,6 +371,11 @@
370371
},
371372
{
372373
"cell_type": "code",
374+
"execution_count": null,
375+
"metadata": {
376+
"id": "7o6rdgU8olqd"
377+
},
378+
"outputs": [],
373379
"source": [
374380
"from tqdm.auto import tqdm\n",
375381
"\n",
@@ -399,12 +405,7 @@
399405
" records = zip(ids, embeddings, metadatas)\n",
400406
" # upsert to Pinecone\n",
401407
" index.upsert(vectors=records)"
402-
],
403-
"metadata": {
404-
"id": "7o6rdgU8olqd"
405-
},
406-
"execution_count": null,
407-
"outputs": []
408+
]
408409
},
409410
{
410411
"cell_type": "markdown",
@@ -426,6 +427,11 @@
426427
},
427428
{
428429
"cell_type": "code",
430+
"execution_count": null,
431+
"metadata": {
432+
"id": "SNa4WHoJ0COt"
433+
},
434+
"outputs": [],
429435
"source": [
430436
"query = \"which city has the largest population in the world?\"\n",
431437
"\n",
@@ -442,12 +448,7 @@
442448
"# now query\n",
443449
"xc = index.query(vector=xq, top_k=5, include_metadata=True)\n",
444450
"xc"
445-
],
446-
"metadata": {
447-
"id": "SNa4WHoJ0COt"
448-
},
449-
"execution_count": null,
450-
"outputs": []
451+
]
451452
},
452453
{
453454
"cell_type": "markdown",
@@ -551,9 +552,10 @@
551552
"name": "python3"
552553
},
553554
"language_info": {
554-
"name": "python"
555+
"name": "python",
556+
"version": "3.8.10"
555557
}
556558
},
557559
"nbformat": 4,
558560
"nbformat_minor": 0
559-
}
561+
}

0 commit comments

Comments
 (0)