From ce0140f266e8374403fac1800c8d05c8e86bf544 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucca=20Baumg=C3=A4rtner?= Date: Mon, 5 Feb 2024 16:44:29 +0100 Subject: [PATCH] Adjust gpt caching error logging MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Lucca Baumgärtner --- src/database/leads/local_repository.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/database/leads/local_repository.py b/src/database/leads/local_repository.py index ae02a5c..3b50c75 100644 --- a/src/database/leads/local_repository.py +++ b/src/database/leads/local_repository.py @@ -19,7 +19,7 @@ class LocalRepository(Repository): BASE_PATH = os.path.dirname(__file__) DF_INPUT = os.path.abspath( - os.path.join(BASE_PATH, "../../data/sumup_leads_email.csv") + os.path.join(BASE_PATH, "../../data/demo_leads_email.csv") ) DF_OUTPUT = os.path.abspath( os.path.join(BASE_PATH, "../../data/leads_enriched.csv") @@ -196,6 +196,11 @@ def fetch_gpt_result(self, file_id, operation_name): try: with open(json_file_path, "r", encoding="utf-8") as json_file: data = json.load(json_file) + if operation_name not in data: + log.info( + f"Data for operation {operation_name} was not found in {json_file_path}" + ) + return "" return data[operation_name] except: log.warning(f"Error loading GPT results from path {json_file_path}.")