Pinecone memory and memory usage tracking

This commit is contained in:
douglas
2023-04-03 20:31:01 -04:00
parent 62dfd84599
commit 475671d1e8
9 changed files with 167 additions and 71 deletions

View File

@@ -4,6 +4,7 @@ from dotenv import load_dotenv
# Load environment variables from .env file
load_dotenv()
class Singleton(type):
"""
Singleton metaclass for ensuring only one instance of a class.
@@ -39,6 +40,9 @@ class Config(metaclass=Singleton):
self.google_api_key = os.getenv("GOOGLE_API_KEY")
self.custom_search_engine_id = os.getenv("CUSTOM_SEARCH_ENGINE_ID")
self.pinecone_api_key = os.getenv("PINECONE_API_KEY")
self.pinecone_region = os.getenv("PINECONE_ENV")
# Initialize the OpenAI API client
openai.api_key = self.openai_api_key
@@ -70,4 +74,10 @@ class Config(metaclass=Singleton):
self.google_api_key = value
def set_custom_search_engine_id(self, value: str):
self.custom_search_engine_id = value
self.custom_search_engine_id = value
def set_pinecone_api_key(self, value: str):
self.pinecone_api_key = value
def set_pinecone_region(self, value: str):
self.pinecone_region = value