Spaces:
Runtime error
Runtime error
logs
Browse files- auditqa/utils.py +9 -3
auditqa/utils.py
CHANGED
@@ -9,7 +9,12 @@ import requests
|
|
9 |
from datetime import datetime
|
10 |
from uuid import uuid4
|
11 |
|
12 |
-
|
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
|
15 |
# def save_logs(scheduler, JSON_DATASET_PATH, logs, feedback=None) -> None:
|
@@ -40,11 +45,12 @@ def save_logs(JSON_DATASET_PATH: str, logs: dict, feedback: str = None) -> None:
|
|
40 |
with open(JSON_DATASET_PATH, 'a') as f:
|
41 |
json.dump(logs, f)
|
42 |
f.write("\n")
|
43 |
-
|
44 |
except Exception as e:
|
45 |
-
|
46 |
raise
|
47 |
|
|
|
48 |
def get_message_template(type, SYSTEM_PROMPT, USER_PROMPT):
|
49 |
if type == 'NVIDIA':
|
50 |
messages = [{"role": "system", "content": SYSTEM_PROMPT},
|
|
|
9 |
from datetime import datetime
|
10 |
from uuid import uuid4
|
11 |
|
12 |
+
# TESTING DEBUG LOG
|
13 |
+
from auditqa.logging_config import setup_logging
|
14 |
+
setup_logging()
|
15 |
+
import logging
|
16 |
+
logger = logging.getLogger(__name__)
|
17 |
+
logger.setLevel(logging.DEBUG) # Ensure debug logging is enabled
|
18 |
|
19 |
|
20 |
# def save_logs(scheduler, JSON_DATASET_PATH, logs, feedback=None) -> None:
|
|
|
45 |
with open(JSON_DATASET_PATH, 'a') as f:
|
46 |
json.dump(logs, f)
|
47 |
f.write("\n")
|
48 |
+
logger.info(f"Successfully saved logs to {JSON_DATASET_PATH}")
|
49 |
except Exception as e:
|
50 |
+
logger.error(f"Failed to save logs to {JSON_DATASET_PATH}: {str(e)}")
|
51 |
raise
|
52 |
|
53 |
+
|
54 |
def get_message_template(type, SYSTEM_PROMPT, USER_PROMPT):
|
55 |
if type == 'NVIDIA':
|
56 |
messages = [{"role": "system", "content": SYSTEM_PROMPT},
|