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: View reports with older data model

Clémence Lesné3938339a3445
diff --git a/models/message.py b/models/message.py
index 49e5a8c..abdadc6 100644
--- a/models/message.py
+++ b/models/message.py
@@ -134,6 +134,17 @@ class MessageModel(BaseModel):
style: StyleEnum = StyleEnum.NONE
tool_calls: list[ToolModel] = []
+ @field_validator("created_at")
+ def validate_created_at(cls, created_at: datetime) -> datetime:
+ """
+ Ensure the created_at field is timezone-aware.
+
+ Backward compatibility with models created before the timezone was added. All dates require the same timezone to be compared.
+ """
+ if not created_at.tzinfo:
+ return created_at.replace(tzinfo=UTC)
+ return created_at
+
def to_openai(
self,
) -> list[