From de41b54ab4e929b01e2be4178bbe91a35e981b43 Mon Sep 17 00:00:00 2001 From: David Whittaker Date: Tue, 1 Jul 2025 16:53:01 -0700 Subject: [PATCH 1/3] fix(ai): return raw response if we can't parse the JSON --- src/dispatch/ai/service.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dispatch/ai/service.py b/src/dispatch/ai/service.py index 73940ed2cc2c..908ca9ca2ab7 100644 --- a/src/dispatch/ai/service.py +++ b/src/dispatch/ai/service.py @@ -303,9 +303,9 @@ def generate_case_signal_summary(case: Case, db_session: Session) -> dict[str, s return summary except json.JSONDecodeError as e: - message = "Unable to generate GenAI signal analysis. Error decoding response from the artificial-intelligence plugin." + message = f"Unable to decoding JSON response from the artificial-intelligence plugin, returning raw response, with error {e}." log.warning(message) - raise GenAIException(message) from e + return response def generate_incident_summary(incident: Incident, db_session: Session) -> str: From 7f5f3113c7a012eee207b50c5ef2eae37bf8b95f Mon Sep 17 00:00:00 2001 From: David Whittaker Date: Tue, 1 Jul 2025 17:07:49 -0700 Subject: [PATCH 2/3] Respond as a dictionary --- src/dispatch/ai/service.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dispatch/ai/service.py b/src/dispatch/ai/service.py index 908ca9ca2ab7..d99e77f6662c 100644 --- a/src/dispatch/ai/service.py +++ b/src/dispatch/ai/service.py @@ -305,7 +305,7 @@ def generate_case_signal_summary(case: Case, db_session: Session) -> dict[str, s except json.JSONDecodeError as e: message = f"Unable to decoding JSON response from the artificial-intelligence plugin, returning raw response, with error {e}." log.warning(message) - return response + return {"Summary": response} def generate_incident_summary(incident: Incident, db_session: Session) -> str: From 9ac4678b08315040ae95d9c79c73b1810790188a Mon Sep 17 00:00:00 2001 From: David Whittaker Date: Tue, 1 Jul 2025 17:09:22 -0700 Subject: [PATCH 3/3] fixing typo --- src/dispatch/ai/service.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dispatch/ai/service.py b/src/dispatch/ai/service.py index d99e77f6662c..ccca6539e736 100644 --- a/src/dispatch/ai/service.py +++ b/src/dispatch/ai/service.py @@ -303,7 +303,7 @@ def generate_case_signal_summary(case: Case, db_session: Session) -> dict[str, s return summary except json.JSONDecodeError as e: - message = f"Unable to decoding JSON response from the artificial-intelligence plugin, returning raw response, with error {e}." + message = f"Unable to decode JSON response from the artificial-intelligence plugin, returning raw response, with error {e}." log.warning(message) return {"Summary": response}