Send a phone call from AI agent, in an API call. Or, directly call the bot from the configured phone number!
Python
fix: Fine-tune prompts
Clémence Lesné1e4f6ed5ab0d
diff --git a/helpers/config_models/prompts.py b/helpers/config_models/prompts.pyindex b3c2e66..75ae115 100644--- a/helpers/config_models/prompts.py+++ b/helpers/config_models/prompts.py@@ -67,10 +67,11 @@ class LlmModel(BaseModel):- Keep the sentences short and simple- Messages from the customer are generated with a speech-to-text tool, so they may contain errors, do your best to understand them- Rephrase the customer's questions as statements and answer them+ - Update the claim as soon as possible with the information gathered- Use styles as often as possible, to add emotions to the conversation- Use trusted data to answer the customer's questions- Welcome the customer when they call- - When the customer says a word and then spells out letters, this means that the word is written in the way the customer spelled it (e.g., "I live in Paris PARIS", "My name is John JOHN", "My email is Clemence CLEMENCE at gmail GMAIL dot com COM")+ - When the customer says a word and then spells out letters, this means that the word is written in the way the customer spelled it (e.g., "I live in Paris PARIS" -> "Paris", "My name is John JOHN" -> "John", "My email is Clemence CLEMENCE at gmail GMAIL dot com COM" -> "[email protected]")- Will answer the customer's questions if they are related to their contract, claim, or insurance- Work for {bot_company}, not someone else@@ -83,12 +84,14 @@ class LlmModel(BaseModel):- Phone number or email address# General process to follow- 1. Gather information to know the customer identity (e.g., name, policy number), if not already known- 2. Gather general information about the incident to understand the situation (e.g., what, when, where), if not already known- 3. Make sure the customer is safe (if not, refer to emergency services or the police)- 4. Gather detailed information about the incident (e.g., identity of other people involved, witnesses, damages, how it happened)- 5. Advise the customer on what to do next based on the trusted data- 6. Be proactive and create reminders for the customer (e.g., follup up on the claim, send documents), if not already created+ 1. Quickly introduce yourself, if the customer is not already familiar with you, and recall the last conversation, if any+ 2. Make sure all the informations from the customer introduction are stored in the claim+ 3. Gather information to know the customer identity (e.g., name, policy number), if not already known+ 4. Gather general information about the incident to understand the situation (e.g., what, when, where), if not already known+ 5. Make sure the customer is safe (if not, refer to emergency services or the police)+ 6. Gather detailed information about the incident (e.g., identity of other people involved, witnesses, damages, how it happened)+ 7. Advise the customer on what to do next based on the trusted data+ 8. Be proactive and create reminders for the customer (e.g., follup up on the claim, send documents), if not already created# Allowed styles{styles}@@ -139,7 +142,6 @@ class LlmModel(BaseModel):- Include salutations (e.g., "Have a nice day", "Best regards", "Best wishes for recovery")- Is polite, helpful, and professional- Refer to the customer by their name, if known- - Update the claim as soon as possible with the information gathered- Use simple and short sentences- Won't make any assumptionsdiff --git a/helpers/llm_tools.py b/helpers/llm_tools.pyindex 7217225..def9fbd 100644--- a/helpers/llm_tools.py+++ b/helpers/llm_tools.py@@ -57,7 +57,7 @@ class LlmPlugins:self,customer_response: Annotated[str,- "Sentence to be said to the customer to confirm the update. Only speak about this action. Use an imperative sentence. Example: 'I am updating the involved parties to Marie-Jeanne and Jean-Pierre', 'I am updating the contact contact info to 123 rue de la paix 75000 Paris, +33735119775, only call after 6pm'.",+ "Sentence for the customer to confirm the creation of a new claim. Describe what you're doing in one sentence. Example: 'I am updating the involved parties to Marie-Jeanne and Jean-Pierre', 'I am updating the contact contact info to 123 rue de la paix 75000 Paris, +33735119775, only call after 6pm'.",],) -> str:"""@@ -77,11 +77,11 @@ class LlmPlugins:self,customer_response: Annotated[str,- "Contextual description of the reminder. Should be detailed enough to be understood by anyone. Example: 'Watch model is Rolex Submariner 116610LN', 'Customer said the witnesses car was red but the police report says it was blue. Double check with the involved parties'.",+ "Sentence for the customer to confirm the update. Describe what you're doing in one sentence. Example: 'I am creating a reminder for next week to call you back', 'I am creating a todo for next week to send the report'.",],description: Annotated[str,- "Sentence to be said to the customer to confirm the reminder. Only speak about this action. Use an imperative sentence. Example: 'I am creating a reminder for next week to call back the customer', 'I am creating a reminder for next week to send the report'.",+ "Sentence for the customer to confirm the reminder. Describe what you're doing in one sentence. Example: 'I am creating a reminder for next week to call back the customer', 'I am creating a reminder for next week to send the report'.",],due_date_time: Annotated[str,@@ -97,7 +97,7 @@ class LlmPlugins:],) -> str:"""- Use this if you think there is something important to do in the future, and you want to be reminded about it. If it already exists, it will be updated with the new values. Example: 'Remind Assitant thuesday at 10am to call back the customer', 'Remind Assitant next week to send the report', 'Remind the customer next week to send the documents by the end of the month'.+ Use this if you think there is something important to do in the future, and you want to be reminded about it. If it already exists, it will be updated with the new values."""await self.user_callback(customer_response, self.style)@@ -127,7 +127,7 @@ class LlmPlugins:self,customer_response: Annotated[str,- "Sentence to be said to the customer to confirm the update. Only speak about this action. Use an imperative sentence. Example: 'I am updating the involved parties to Marie-Jeanne and Jean-Pierre', 'I am updating the contact contact info to 123 rue de la paix 75000 Paris, +33735119775, only call after 6pm'.",+ "Sentence for the customer to confirm the update. Describe what you're doing in one sentence. Example: 'I am updating the involved parties to Marie-Jeanne and Jean-Pierre', 'I am updating the contact contact info your home address, 123 rue De La Paix, and your phone ending with 75'.",],field: Annotated[str, f"The claim field to update: {list(ClaimModel.editable_fields())}"@@ -138,7 +138,7 @@ class LlmPlugins:],) -> str:"""- Use this if the customer wants to update a claim field with a new value. Example: 'Update claim explanation to: I was driving on the highway when a car hit me from behind', 'Update contact contact info to: 123 rue de la paix 75000 Paris, +33735119775, only call after 6pm'.+ Use this if the customer wants to update a claim field with a new value. It is OK to approximate dates if the customer is not precise (e.g., "last night" -> today 04h, "I'm stuck on the highway" -> now)."""await self.user_callback(customer_response, self.style)@@ -171,7 +171,7 @@ class LlmPlugins:self,customer_response: Annotated[str,- "Sentence to be said to the customer to confirm the update. Only speak about this action. Use an imperative sentence. Example: 'I am searching for the document about the car accident', 'I am searching for the document about the stolen watch'.",+ "Sentence for the customer to confirm the search. Describe what you're doing in one sentence. Example: 'I am searching for the document about the car accident', 'I am looking for the contract details'.",],queries: Annotated[list[str],@@ -179,7 +179,7 @@ class LlmPlugins:],) -> str:"""- Use this if the customer wants to search for a public specific information you don't have. Example: contract, law, regulation, article, etc.+ Use this if the customer wants to search for a public specific information you don't have. Examples: contract, law, regulation, article."""await self.user_callback(customer_response, self.style)@@ -201,7 +201,7 @@ class LlmPlugins:self,customer_response: Annotated[str,- "Sentence to be said to the customer to confirm the update. Only speak about this action. Use an imperative sentence. Example: 'I am notifying the emergency services', 'I am notifying the police'.",+ "Text for the customer to confirm the action. Describe what you're doing in one sentence. Example: 'I am notifying the emergency services', 'I am notifying the police'.",],reason: Annotated[str,@@ -220,6 +220,9 @@ class LlmPlugins:"The emergency service to notify.",],) -> str:+ """+ Use this if the customer wants to notify the emergency services for a specific reason. This will notify the emergency services. Use it only if the situation is critical and requires immediate intervention. Examples: 'My neighbor is having a heart attack', 'A child is lying on the ground and is not moving', 'I am stuck in a car in fire'.+ """await self.user_callback(customer_response, self.style)# TODO: Implement notification to emergency services for production usage_logger.info(