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

refacto: List editable claim fields

Clémence Lesné28d2d79e07e7
diff --git a/main.py b/main.py
index 86e6a72..9aa1b7c 100644
--- a/main.py
+++ b/main.py
@@ -695,9 +695,7 @@ async def gpt_chat(call: CallModel) -> ActionModel:
"properties": {
"field": {
"description": "The claim field to update.",
- "enum": list(
- ClaimModel.model_json_schema()["properties"].keys()
- ),
+ "enum": list(ClaimModel.editable_fields()),
"type": "string",
},
"value": {
diff --git a/models/claim.py b/models/claim.py
index 8745a6b..b22ad77 100644
--- a/models/claim.py
+++ b/models/claim.py
@@ -1,5 +1,6 @@
from pydantic import BaseModel
from typing import Optional
+from typing import Optional, Set
class ClaimModel(BaseModel):
@@ -23,3 +24,7 @@ class ClaimModel(BaseModel):
stolen_lost_items: Optional[str] = None
vehicle_info: Optional[str] = None
witnesses: Optional[str] = None
+
+ @staticmethod
+ def editable_fields() -> Set[str]:
+ return ClaimModel.model_json_schema()["properties"].keys()