Send a phone call from AI agent, in an API call. Or, directly call the bot from the configured phone number!
Python
fix: Not crash if LLM fails to return "customer_response" var
Clémence Lesné1d234cfd6847
diff --git a/main.py b/main.pyindex b07644f..77fff30 100644--- a/main.py+++ b/main.py@@ -732,14 +732,28 @@ async def gpt_chat(call: CallModel) -> ActionModel:elif name == IndentAction.UPDATED_CLAIM:intent = IndentAction.UPDATED_CLAIMparameters = json.loads(arguments)- content += parameters[customer_response_prop] + " "++ if not customer_response_prop in parameters:+ _logger.warn(+ f"Missing {customer_response_prop} prop in {arguments}, please fix this!"+ )+ else:+ content += parameters[customer_response_prop] + " "+setattr(call.claim, parameters["field"], parameters["value"])model.content = f"Updated claim field \"{parameters['field']}\" with value \"{parameters['value']}\"."elif name == IndentAction.NEW_CLAIM:intent = IndentAction.NEW_CLAIMparameters = json.loads(arguments)- content += parameters[customer_response_prop] + " "++ if not customer_response_prop in parameters:+ _logger.warn(+ f"Missing {customer_response_prop} prop in {arguments}, please fix this!"+ )+ else:+ content += parameters[customer_response_prop] + " "+call.claim = ClaimModel()call.reminders = []model.content = "Claim and reminders created reset."@@ -747,7 +761,13 @@ async def gpt_chat(call: CallModel) -> ActionModel:elif name == IndentAction.NEW_OR_UPDATED_REMINDER:intent = IndentAction.NEW_OR_UPDATED_REMINDERparameters = json.loads(arguments)- content += parameters[customer_response_prop] + " "++ if not customer_response_prop in parameters:+ _logger.warn(+ f"Missing {customer_response_prop} prop in {arguments}, please fix this!"+ )+ else:+ content += parameters[customer_response_prop] + " "updated = Falsefor reminder in call.reminders: