From 36ef6e91150ab5debfb39151f52a53a305a4fd77 Mon Sep 17 00:00:00 2001 From: Kaveen Kumarasinghe Date: Wed, 25 Jan 2023 14:23:18 -0500 Subject: [PATCH] lock the second pinecone index behind GCP key (disable this) --- gpt3discord.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/gpt3discord.py b/gpt3discord.py index 02dc3fd..6344ec9 100644 --- a/gpt3discord.py +++ b/gpt3discord.py @@ -62,14 +62,15 @@ if PINECONE_TOKEN: pod_type="s1", ) PINECONE_INDEX_SEARCH = "search-embeddings" - if PINECONE_INDEX_SEARCH not in pinecone.list_indexes(): - print("Creating pinecone index for seraches. Please wait...") - pinecone.create_index( - PINECONE_INDEX_SEARCH, - dimension=1536, - metric="dotproduct", - pod_type="s1", - ) + if EnvService.get_google_search_api_key() and EnvService.get_google_search_engine_id(): + if PINECONE_INDEX_SEARCH not in pinecone.list_indexes(): + print("Creating pinecone index for seraches. Please wait...") + pinecone.create_index( + PINECONE_INDEX_SEARCH, + dimension=1536, + metric="dotproduct", + pod_type="s1", + ) pinecone_service = PineconeService(pinecone.Index(PINECONE_INDEX)) pinecone_search_service = PineconeService(pinecone.Index(PINECONE_INDEX_SEARCH))