Skip to content

Send a phone call from AI agent, in an API call. Or, directly call the bot from the configured phone number!

Python

fix: Content Safety not found throw error

Clémence Lesné6ac0810d86d0
diff --git a/helpers/llm_worker.py b/helpers/llm_worker.py
index 148acc9..93d0626 100644
--- a/helpers/llm_worker.py
+++ b/helpers/llm_worker.py
@@ -234,7 +234,7 @@ def _contentsafety_category_test(
if score == 0:
return True # No need to check severity
- detection = next(item for item in res if item.category == category)
+ detection = next((item for item in res if item.category == category), None)
if detection and detection.severity and detection.severity > score:
_logger.debug(f"Matched {category} with severity {detection.severity}")