Skip to content

Commit

Permalink
refacto: List editable claim fields
Browse files Browse the repository at this point in the history
  • Loading branch information
clemlesne committed Jan 16, 2024
1 parent 6834c50 commit 28d2d79
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 1 addition & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
5 changes: 5 additions & 0 deletions models/claim.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from pydantic import BaseModel
from typing import Optional
from typing import Optional, Set


class ClaimModel(BaseModel):
Expand All @@ -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()

0 comments on commit 28d2d79

Please sign in to comment.