Skip to content

Commit 31551c3

Browse files
committed
added delete index at end
1 parent 0619ea2 commit 31551c3

File tree

13 files changed

+252
-57
lines changed

13 files changed

+252
-57
lines changed

analytics-and-ml/model-training/classifier-train-vector-search/01-fine-tune-vector-search.ipynb

+21-1
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,13 @@
2525
"source": [
2626
"import pinecone\n",
2727
"\n",
28+
"index_name = \"fine-tune-vector-search\"\n",
29+
"\n",
2830
"pinecone.init(\n",
2931
" api_key=\"YOUR_API_KEY\",\n",
3032
" environment=\"YOUR_ENV\" # find next to API key in console\n",
3133
")\n",
32-
"index = pinecone.Index(\"imagenet-query-trainer-clip\")"
34+
"index = pinecone.Index(index_name)"
3335
]
3436
},
3537
{
@@ -1363,6 +1365,24 @@
13631365
]
13641366
},
13651367
{
1368+
"attachments": {},
1369+
"cell_type": "markdown",
1370+
"metadata": {},
1371+
"source": [
1372+
"Once we've finished training the classifier we can delete our Pinecone index to save resources."
1373+
]
1374+
},
1375+
{
1376+
"cell_type": "code",
1377+
"execution_count": null,
1378+
"metadata": {},
1379+
"outputs": [],
1380+
"source": [
1381+
"pinecone.delete_index(index_name)"
1382+
]
1383+
},
1384+
{
1385+
"attachments": {},
13661386
"cell_type": "markdown",
13671387
"metadata": {},
13681388
"source": [

analytics-and-ml/model-training/gpl/02-negative-mining.ipynb

+9-8
Original file line numberDiff line numberDiff line change
@@ -57,29 +57,30 @@
5757
"source": [
5858
"import pinecone # pip install pinecone-client\n",
5959
"\n",
60-
"API_KEY = \"YOUR_API_KEY\" # get api key app.pinecone.io\n",
60+
"index_name = \"negative-mining\"\n",
6161
"\n",
6262
"pinecone.init(\n",
63-
" api_key=API_KEY,\n",
63+
" api_key=\"YOUR_API_KEY\", # app.pinecone.io\n",
6464
" environment=\"YOUR_ENV\" # find next to API key in console\n",
6565
")\n",
6666
"# create a new negative mining index if does not already exist\n",
67-
"if 'negative-mine' not in pinecone.list_indexes():\n",
67+
"if index_name not in pinecone.list_indexes():\n",
6868
" pinecone.create_index(\n",
69-
" 'negative-mine',\n",
69+
" index_name,\n",
7070
" dimension=model.get_sentence_embedding_dimension(),\n",
7171
" metric='dotproduct',\n",
7272
" pods=1\n",
7373
" )\n",
7474
"# connect\n",
75-
"index = pinecone.Index('negative-mine')"
75+
"index = pinecone.Index(index_name)"
7676
]
7777
},
7878
{
79+
"attachments": {},
7980
"cell_type": "markdown",
8081
"metadata": {},
8182
"source": [
82-
"Now we encode the passages and store in the `negative-mine` index."
83+
"Now we encode the passages and store in the `negative-mining` index."
8384
]
8485
},
8586
{
@@ -227,7 +228,7 @@
227228
"metadata": {},
228229
"outputs": [],
229230
"source": [
230-
"pinecone.delete_index('negative-mine') # delete the index when done to avoid higher charges (if using multiple pods)"
231+
"pinecone.delete_index(index_name) # delete the index when done to avoid higher charges (if using multiple pods)"
231232
]
232233
},
233234
{
@@ -260,7 +261,7 @@
260261
"name": "python",
261262
"nbconvert_exporter": "python",
262263
"pygments_lexer": "ipython3",
263-
"version": "3.10.7 (main, Sep 14 2022, 22:38:23) [Clang 14.0.0 (clang-1400.0.29.102)]"
264+
"version": "3.10.9"
264265
},
265266
"vscode": {
266267
"interpreter": {

analytics-and-ml/model-training/training-with-wandb/02-encode.ipynb

+3-3
Original file line numberDiff line numberDiff line change
@@ -431,8 +431,8 @@
431431
"import pinecone\n",
432432
"\n",
433433
"pinecone.init(\n",
434-
" api_key='<<YOUR_API_KEY>>', # app.pinecone.io\n",
435-
" environment='us-west1-gcp'\n",
434+
" api_key='YOUR_API_KEY', # app.pinecone.io\n",
435+
" environment='YOUR_ENV' # find next to API key in console\n",
436436
")"
437437
]
438438
},
@@ -543,7 +543,7 @@
543543
"name": "python",
544544
"nbconvert_exporter": "python",
545545
"pygments_lexer": "ipython3",
546-
"version": "3.10.7 (main, Sep 14 2022, 22:38:23) [Clang 14.0.0 (clang-1400.0.29.102)]"
546+
"version": "3.10.9"
547547
},
548548
"vscode": {
549549
"interpreter": {

analytics-and-ml/model-training/training-with-wandb/03-query.ipynb

+31-3
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@
4242
"import pinecone\n",
4343
"\n",
4444
"pinecone.init(\n",
45-
" api_key='<<YOUR_API_KEY>>', # app.pinecone.io\n",
46-
" environment='us-west1-gcp'\n",
45+
" api_key='YOUR_API_KEY', # app.pinecone.io\n",
46+
" environment='YOUR_ENV' # find next to api key in console\n",
4747
")\n",
4848
"\n",
4949
"index_id = 'arxiv-search'\n",
@@ -833,6 +833,34 @@
833833
"source": [
834834
"In this case it seems the best result is in position *5* (still not bad out of 2M+ abstracts) and the top result seems relevant but might not quite answer our query."
835835
]
836+
},
837+
{
838+
"attachments": {},
839+
"cell_type": "markdown",
840+
"id": "67dfc5ea",
841+
"metadata": {},
842+
"source": [
843+
"Once we're finished, we delete the index to save resources."
844+
]
845+
},
846+
{
847+
"cell_type": "code",
848+
"execution_count": null,
849+
"id": "144fd999",
850+
"metadata": {},
851+
"outputs": [],
852+
"source": [
853+
"pinecone.delete_index(index_id)"
854+
]
855+
},
856+
{
857+
"attachments": {},
858+
"cell_type": "markdown",
859+
"id": "14fa79c2",
860+
"metadata": {},
861+
"source": [
862+
"---"
863+
]
836864
}
837865
],
838866
"metadata": {
@@ -857,7 +885,7 @@
857885
"name": "python",
858886
"nbconvert_exporter": "python",
859887
"pygments_lexer": "ipython3",
860-
"version": "3.10.7 (main, Sep 14 2022, 22:38:23) [Clang 14.0.0 (clang-1400.0.29.102)]"
888+
"version": "3.10.9"
861889
},
862890
"vscode": {
863891
"interpreter": {

generation/generative-qa/openai-ml-qa/01-making-queries.ipynb

+25
Original file line numberDiff line numberDiff line change
@@ -1028,6 +1028,31 @@
10281028
"source": [
10291029
"The advantage of Tensorflow.js could have been framed better and the fact that PyTorch has no equivalent explicitly stated. However, the answer is good and gives a nice summary and answer to our question — using information pulled from multiple sources."
10301030
]
1031+
},
1032+
{
1033+
"attachments": {},
1034+
"cell_type": "markdown",
1035+
"metadata": {},
1036+
"source": [
1037+
"Once you're finished with the index we delete it to save resources:"
1038+
]
1039+
},
1040+
{
1041+
"cell_type": "code",
1042+
"execution_count": null,
1043+
"metadata": {},
1044+
"outputs": [],
1045+
"source": [
1046+
"pinecone.delete_index(index_name)"
1047+
]
1048+
},
1049+
{
1050+
"attachments": {},
1051+
"cell_type": "markdown",
1052+
"metadata": {},
1053+
"source": [
1054+
"---"
1055+
]
10311056
}
10321057
],
10331058
"metadata": {

generation/generative-qa/openai/gen-qa-openai/gen-qa-openai.ipynb

+26-1
Original file line numberDiff line numberDiff line change
@@ -988,6 +988,31 @@
988988
"source": [
989989
"And we get a pretty great answer straight away, specifying to use _multiple-rankings loss_ (also called _multiple negatives ranking loss_)."
990990
]
991+
},
992+
{
993+
"attachments": {},
994+
"cell_type": "markdown",
995+
"metadata": {},
996+
"source": [
997+
"Once we're done with the index we delete it to save resources:"
998+
]
999+
},
1000+
{
1001+
"cell_type": "code",
1002+
"execution_count": null,
1003+
"metadata": {},
1004+
"outputs": [],
1005+
"source": [
1006+
"pinecone.delete_index(index_name)"
1007+
]
1008+
},
1009+
{
1010+
"attachments": {},
1011+
"cell_type": "markdown",
1012+
"metadata": {},
1013+
"source": [
1014+
"---"
1015+
]
9911016
}
9921017
],
9931018
"metadata": {
@@ -1009,7 +1034,7 @@
10091034
"name": "python",
10101035
"nbconvert_exporter": "python",
10111036
"pygments_lexer": "ipython3",
1012-
"version": "3.9.12 (main, Apr 5 2022, 01:52:34) \n[Clang 12.0.0 ]"
1037+
"version": "3.9.12"
10131038
},
10141039
"vscode": {
10151040
"interpreter": {

integrations/cohere/semantic_search_trec.ipynb

+20-2
Original file line numberDiff line numberDiff line change
@@ -946,13 +946,31 @@
946946
]
947947
},
948948
{
949+
"attachments": {},
950+
"cell_type": "markdown",
951+
"metadata": {},
952+
"source": [
953+
"Looks great, our semantic search pipeline is clearly able to identify the meaning between each of our queries and return the most semantically similar questions from the already indexed questions.\n",
954+
"\n",
955+
"Once we're done with the index we delete it to save resources:"
956+
]
957+
},
958+
{
959+
"cell_type": "code",
960+
"execution_count": null,
961+
"metadata": {},
962+
"outputs": [],
963+
"source": [
964+
"piencone.delete_index(index_name)"
965+
]
966+
},
967+
{
968+
"attachments": {},
949969
"cell_type": "markdown",
950970
"metadata": {
951971
"id": "gR-oj6C9NA1W"
952972
},
953973
"source": [
954-
"Looks great, our semantic search pipeline is clearly able to identify the meaning between each of our queries and return the most semantically similar questions from the already indexed questions.\n",
955-
"\n",
956974
"---"
957975
]
958976
}

integrations/cohere/webinar_classification_and_search/01_semantic_search.ipynb

+26-1
Original file line numberDiff line numberDiff line change
@@ -1020,6 +1020,31 @@
10201020
"for match in res['results'][0]['matches']:\n",
10211021
" print(f\"{match['score']:.2f}: {match['metadata']['title']} ({match['metadata']['link_flair_text']})\")"
10221022
]
1023+
},
1024+
{
1025+
"attachments": {},
1026+
"cell_type": "markdown",
1027+
"metadata": {},
1028+
"source": [
1029+
"Once we're finished with the index we delete it to save resources."
1030+
]
1031+
},
1032+
{
1033+
"cell_type": "code",
1034+
"execution_count": null,
1035+
"metadata": {},
1036+
"outputs": [],
1037+
"source": [
1038+
"pinecone.delete_index(index_name)"
1039+
]
1040+
},
1041+
{
1042+
"attachments": {},
1043+
"cell_type": "markdown",
1044+
"metadata": {},
1045+
"source": [
1046+
"---"
1047+
]
10231048
}
10241049
],
10251050
"metadata": {
@@ -1044,7 +1069,7 @@
10441069
"name": "python",
10451070
"nbconvert_exporter": "python",
10461071
"pygments_lexer": "ipython3",
1047-
"version": "3.10.7 (main, Sep 14 2022, 22:38:23) [Clang 14.0.0 (clang-1400.0.29.102)]"
1072+
"version": "3.10.9"
10481073
},
10491074
"orig_nbformat": 4,
10501075
"vscode": {

integrations/openai/beyond_search_webinar/01_index-init.ipynb

+3-3
Original file line numberDiff line numberDiff line change
@@ -404,11 +404,11 @@
404404
"import pinecone\n",
405405
"\n",
406406
"pinecone.init(\n",
407-
" api_key='<<PINECONE_API_KEY>>', # app.pinecone.io\n",
407+
" api_key='PINECONE_API_KEY', # app.pinecone.io\n",
408408
" environment=\"YOUR_ENV\" # find next to API key in console\n",
409409
")\n",
410410
"\n",
411-
"index_name = 'apr-demo'\n",
411+
"index_name = 'beyond-search-openai'\n",
412412
"\n",
413413
"if not index_name in pinecone.list_indexes():\n",
414414
" pinecone.create_index(\n",
@@ -515,7 +515,7 @@
515515
"name": "python",
516516
"nbconvert_exporter": "python",
517517
"pygments_lexer": "ipython3",
518-
"version": "3.10.7 (main, Sep 14 2022, 22:38:23) [Clang 14.0.0 (clang-1400.0.29.102)]"
518+
"version": "3.10.9"
519519
},
520520
"orig_nbformat": 4,
521521
"vscode": {

integrations/openai/beyond_search_webinar/02_pinecone-code-demo.ipynb

+20-3
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"import openai\n",
3030
"from openai.embeddings_utils import get_embedding\n",
3131
"\n",
32-
"openai.api_key = '<<OPENAI_API_KEY>>' # beta.openai.com/login/"
32+
"openai.api_key = 'OPENAI_API_KEY' # platform.openai.com/login/"
3333
]
3434
},
3535
{
@@ -63,11 +63,11 @@
6363
"\n",
6464
"def load_index():\n",
6565
" pinecone.init(\n",
66-
" api_key='<<PINECONE_API_KEY>>', # app.pinecone.io\n",
66+
" api_key='PINECONE_API_KEY', # app.pinecone.io\n",
6767
" environment=\"YOUR_ENV\" # find next to API key in console\n",
6868
" )\n",
6969
"\n",
70-
" index_name = 'apr-demo'\n",
70+
" index_name = 'beyond-search-openai'\n",
7171
"\n",
7272
" if not index_name in pinecone.list_indexes():\n",
7373
" raise KeyError(f\"Index '{index_name}' does not exist.\")\n",
@@ -456,6 +456,23 @@
456456
"print(answer_question(index, question=\"How can I use embeddings to visualize my data?\"))"
457457
]
458458
},
459+
{
460+
"attachments": {},
461+
"cell_type": "markdown",
462+
"metadata": {},
463+
"source": [
464+
"Once you're finished with the index, delete it to save resources:"
465+
]
466+
},
467+
{
468+
"cell_type": "code",
469+
"execution_count": null,
470+
"metadata": {},
471+
"outputs": [],
472+
"source": [
473+
"pinecone.delete_index(index_name)"
474+
]
475+
},
459476
{
460477
"cell_type": "markdown",
461478
"metadata": {},

0 commit comments

Comments
 (0)