Send a phone call from AI agent, in an API call. Or, directly call the bot from the configured phone number!
Python
fix: Inform the LLM when the claim update is invalid
Clémence Lesné6902b8b4dd39
diff --git a/main.py b/main.pyindex f04903b..d0f4ad8 100644--- a/main.py+++ b/main.py@@ -942,12 +942,10 @@ async def gpt_chat(content = f'Failed to update a non-editable field "{parameters['field']}".'else:try:- # Define the field- setattr(- call.claim, parameters["field"], parameters["value"]- )- # Trigger a re-validation to spot errors before saving- ClaimModel.model_validate(call.claim)+ # Define the field and force to trigger validation+ copy = call.claim.model_dump()+ copy[parameters["field"]] = parameters["value"]+ call.claim = ClaimModel.model_validate(copy)except ValidationError as e:content = f'Failed to edit field "{parameters["field"]}": {e.json()}'if not content: