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: Claim model email validation

Clémence Lesné45537d77f2e1
diff --git a/models/claim.py b/models/claim.py
index 0c9e053..2f8b36d 100644
--- a/models/claim.py
+++ b/models/claim.py
@@ -47,12 +47,12 @@ class ClaimModel(BaseModel):
@field_validator("policyholder_email")
@classmethod
- def _policyholder_email_validator(cls, email: str) -> str:
- if not re.match(EMAIL_PARSER_R, email):
+ def _policyholder_email_validator(cls, policyholder_email: str) -> str:
+ if policyholder_email and not re.match(EMAIL_PARSER_R, policyholder_email):
raise ValueError(
'Invalid email address, please use a valid email (e.g. "[email protected]").'
)
- return email
+ return policyholder_email
@staticmethod
def editable_fields() -> Set[str]: