Spaces:
Configuration error
Configuration error
Added try/except to catch errors decoding model job summary to JSON
Browse files- functions/job_call.py +6 -1
functions/job_call.py
CHANGED
|
@@ -101,7 +101,12 @@ def summarize_job_call(job_call: str) -> str:
|
|
| 101 |
|
| 102 |
if response is not None:
|
| 103 |
summary = response.choices[0].message.content
|
| 104 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
|
| 106 |
# Save the extracted job call information to data directory
|
| 107 |
try:
|
|
|
|
| 101 |
|
| 102 |
if response is not None:
|
| 103 |
summary = response.choices[0].message.content
|
| 104 |
+
|
| 105 |
+
try:
|
| 106 |
+
summary = json.loads(summary)
|
| 107 |
+
|
| 108 |
+
except json.JSONDecodeError as e:
|
| 109 |
+
logger.error("Failed to parse job call summary JSON: %s", e)
|
| 110 |
|
| 111 |
# Save the extracted job call information to data directory
|
| 112 |
try:
|