gperdrizet commited on
Commit
d949669
·
verified ·
1 Parent(s): 8a31cf5

Added try/except to catch errors decoding model job summary to JSON

Browse files
Files changed (1) hide show
  1. 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
- summary = json.loads(summary)
 
 
 
 
 
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: