Upload add_model_explanations.py
Browse files
add_model_explanations.py
CHANGED
|
@@ -169,7 +169,9 @@ def process_json_file(filepath: str):
|
|
| 169 |
return False
|
| 170 |
|
| 171 |
# --- Check if explanation already exists ---
|
| 172 |
-
|
|
|
|
|
|
|
| 173 |
logging.info(f"[{model_id}] Explanation already exists. Skipping generation.")
|
| 174 |
return False # Indicate no update was needed
|
| 175 |
|
|
@@ -177,6 +179,7 @@ def process_json_file(filepath: str):
|
|
| 177 |
# if EXPLANATION_KEY in data: ...
|
| 178 |
|
| 179 |
# --- Generation Logic ---
|
|
|
|
| 180 |
description = data.get(DESCRIPTION_KEY)
|
| 181 |
if not description:
|
| 182 |
logging.warning(f"[{model_id}] Description field is missing or empty. Cannot generate explanation.")
|
|
|
|
| 169 |
return False
|
| 170 |
|
| 171 |
# --- Check if explanation already exists ---
|
| 172 |
+
existing_explanation = data.get(EXPLANATION_KEY)
|
| 173 |
+
logging.debug(f"[{model_id}] Checking for existing explanation. Key: '{EXPLANATION_KEY}'. Found value: '{existing_explanation}' (Type: {type(existing_explanation)})")
|
| 174 |
+
if existing_explanation: # Simplified check: Checks for non-empty string, non-None
|
| 175 |
logging.info(f"[{model_id}] Explanation already exists. Skipping generation.")
|
| 176 |
return False # Indicate no update was needed
|
| 177 |
|
|
|
|
| 179 |
# if EXPLANATION_KEY in data: ...
|
| 180 |
|
| 181 |
# --- Generation Logic ---
|
| 182 |
+
logging.info(f"[{model_id}] Existing explanation is missing or empty. Proceeding with generation.")
|
| 183 |
description = data.get(DESCRIPTION_KEY)
|
| 184 |
if not description:
|
| 185 |
logging.warning(f"[{model_id}] Description field is missing or empty. Cannot generate explanation.")
|