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

ux: Allow to disable Content Safety during conversation

Clémence Lesné705a0475862a
diff --git a/helpers/call_llm.py b/helpers/call_llm.py
index dc46316..a7f7772 100644
--- a/helpers/call_llm.py
+++ b/helpers/call_llm.py
@@ -133,11 +133,12 @@ async def load_llm_chat(
"""
nonlocal should_play_sound
- try:
- text = await safety_check(text)
- except SafetyCheckError as e:
- logger.warning(f"Unsafe text detected, not playing: {e}")
- return
+ if CONFIG.conversation.content_safety_for_chat:
+ try:
+ text = await safety_check(text)
+ except SafetyCheckError as e:
+ logger.warning(f"Unsafe text detected, not playing: {e}")
+ return
should_play_sound = False
await asyncio.gather(
diff --git a/helpers/config_models/conversation.py b/helpers/config_models/conversation.py
index 573b321..c258683 100644
--- a/helpers/config_models/conversation.py
+++ b/helpers/config_models/conversation.py
@@ -182,6 +182,7 @@ class ConversationModel(BaseModel):
default=2, # 2 retries
serialization_alias="max_voice_recognition_retry", # Compatibility with v7
)
+ content_safety_for_chat: bool = True
def _fields_to_pydantic(name: str, fields: list[ClaimFieldModel]) -> type[BaseModel]: