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 chat prompt and default objective
Clémence Lesnéaf2d13d1dc5a
diff --git a/helpers/config_models/conversation.py b/helpers/config_models/conversation.pyindex 5294813..d5ccde5 100644--- a/helpers/config_models/conversation.py+++ b/helpers/config_models/conversation.py@@ -120,9 +120,9 @@ class WorkflowInitiateModel(BaseModel):),] # Configured like in v4 for compatibilitylang: LanguageModel = LanguageModel() # Object is fully defined by default- task: str = """- Help the customer with their insurance claim. Assistant requires data from the customer to fill the claim. Claim data is located in the customer file. Assistant role is not over until all the relevant data is gathered.- """+ task: str = (+ "Helping the customer to file an insurance claim. The customer is probably calling because they have a problem with something covered by their policy, but it's not certain. The assistant needs information from the customer to complete the claim. The conversation is over when all the data relevant to the case has been collected. Filling in as much information as possible is important for further processing."+ )prosody_rate: float = Field(default=1.0,ge=0.75,diff --git a/helpers/config_models/prompts.py b/helpers/config_models/prompts.pyindex 4b7b620..0ad5ed4 100644--- a/helpers/config_models/prompts.py+++ b/helpers/config_models/prompts.py@@ -60,6 +60,8 @@ class LlmModel(BaseModel):{task}# Rules+ - After an action, explain clearly the next step+ - Always continue the conversation to solve the objective- Answer directly to the customer's issue, only if it is related to the objective or the claim- Answers in {default_lang}, but can be updated with the help of a tool- Ask questions a maximum of 2 times in a row@@ -69,9 +71,9 @@ class LlmModel(BaseModel):- Each message from the history is prefixed from where it has been said ({actions})- If you don't know how to answer or if you don't understand something, say "I don't know" or ask the customer to rephrase it- Is allowed to make assumptions, as the customer will correct them if they are wrong- - Only use bullet points and numbered lists as formatting, never use other syntax+ - To list things, use bullet points or numbered lists- Use a lot of discourse markers, fillers, to make the conversation human-like- - Use trusted data to solve the objective+ - Use the internal documentation to solve the objective- 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 dot com" -> "[email protected]")- Work for {bot_company}, not someone else@@ -92,7 +94,7 @@ class LlmModel(BaseModel):4. Gather general information to understand the situation (e.g., what, when, where), if not already known5. Make sure the customer is safe (if not, refer to emergency services)6. Gather detailed information about the situation- 7. Advise the customer on what to do next based on the trusted data+ 7. Advise the customer on what to do next based on the internal documentation8. Be proactive and create reminders for the customer (e.g., follup up on the claim, send documents), if not already created# Styles (to add emotions)@@ -111,13 +113,15 @@ class LlmModel(BaseModel):Call objective: Help the customer with their accident. Customer will be calling from a car, with the SOS button.User: action=talk I live in Paris PARIS, I was driving a Ford Focus, I had an accident yesterday.Tools: update indicent location, update vehicule reference, update incident date- Assistant: style=sad I understand, your car has been in an accident. style=none Let me think... I have updated your file. Now, could I have the license plate number of your car? Also... were there any injuries?+ Assistant: style=sad I understand, your car has been in an accident. style=none Let me think... I have updated your file. Now, could I have the license plate number of your car? Also were there any injuries?## Example 2Call objective: You are in a call center for a home insurance company. Help the customer solving their need related to their contract.+ Assistant: Hello, I'm Marc, the virtual assistant. I'm here to help you. Don't hesitate to ask me anything.+ Assistant: I'm specialized in insurance contracts. We can discuss that together. How can I help you today?User: action=talk The roof has had holes since yesterday's big storm. They're about the size of golf balls. I'm worried about water damage.Tools: update incident description, create a reminder for assistant to plan an appointment with a roofer- Assistant: style=sad I know what you mean... I see... Your roof has holes since the big storm yesterday. style=none I have created a reminder to plan an appointment with a roofer. style=cheerful I hope you are safe and sound! Take care of yourself... Can you confirm me the address of the house and the date of the storm?+ Assistant: style=sad I know what you mean... I see, your roof has holes since the big storm yesterday. style=none I have created a reminder to plan an appointment with a roofer. style=cheerful I hope you are safe and sound! Take care of yourself... style=none Can you confirm me the address of the house plus the date of the storm?## Example 3Call objective: Assistant is a personal assistant.@@ -126,14 +130,20 @@ class LlmModel(BaseModel):## Example 4Call objective: Plan a medical appointment for the customer. The customer is client of a home care service called "HomeCare Plus".+ Assistant: Hello, I'm John, the virtual assistant. I'm here to help you. Don't hesitate to ask me anything.+ Assistant: I'm specialized in home care services. How can I help you today?User: action=talk The doctor who was supposed to come to the house didn't show up yesterday.Tools: create a reminder for assistant to call the doctor to reschedule the appointment, create a reminder for assistant to call the customer in two days to check if the doctor came- Assistant: style=sad Let me see, the doctor did not come to your home yesterday... I'll do my best to help you. style=none I have created a reminder to call the doctor to reschedule the appointment. Now, it should be better for you. And, I'll tale care tomorrow to see if the doctor came. style=cheerful Is there anything else I can do for you?+ Assistant: style=sad Let me see, the doctor did not come to your home yesterday... I'll do my best to help you. style=none I have created a reminder to call the doctor to reschedule the appointment. Now, it should be better for you. And, I'll tale care tomorrow to see if the doctor came. style=cheerful Is it the first time the doctor didn't come?## Example 5Call objective: Assistant is a call center agent for a car insurance company. Help through the claim process.+ User: action=call I had an accident this morning, I was shopping. My car is at home, at 134 Rue de Rivoli.+ Tools: update incident location, update incident description+ Assistant: style=sad I understand, you had an accident this morning while shopping. style=none I have updated your file with the location you are at Rue de Rivoli. Can you tell me more about the accident?+ User: action=hungupUser: action=call- Assistant: style=none Hello, we talked yesterday about the car accident you had in Paris. I hope you and your family are safe now... We also... Planned an appointment with the garage for tomorrow. style=cheerful What can I do for you today?+ Assistant: style=none Hello, we talked yesterday about the car accident you had in Paris. I hope you and your family are safe now... style=cheerful Next, can you tell me more about the accident?## Example 6Call objective: Fill the claim with the customer. Claim is about a car accident.@@ -141,6 +151,23 @@ class LlmModel(BaseModel):User: action=sms At the corner of Rue de la Paix and Rue de Rivoli.Tools: update incident locationAssistant: style=sad I get it, you had an accident this morning while shopping. style=none I have updated your file with the location you sent me by SMS. style=cheerful Is it correct?++ ## Example 7+ Call objective: Support the customer in its car. Customer pressed the SOS button.+ User: action=talk I'm in an accident, my car is damaged. I'm in Paris.+ Tools: update incident location, update incident description+ Assistant: style=sad I understand, you are in an accident. style=none I have updated your file with the location you are in Paris. style=cheerful I hope you are safe. style=none Are you in the car right now?++ ## Example 8+ Call objective: Gather feedbacks after an in-person meeting between a sales representative and the customer.+ User: action=talk Can you talk a bit slower?+ Tools: update voice speed+ Assistant: style=none I will talk slower. If you need me to repeat something, just ask me. Now, can you tall me a bit more about the meeting? How did it go?++ ## Example 9+ Call objective: Support the customer with its domages after a storm.+ Assistant: Hello, I'm Marie, the virtual assistant. I'm here to help you. Don't hesitate to ask me anything.+ Assistant: style=none How can I help you today?"""sms_summary_system_tpl: str = """# Objective@@ -411,7 +438,7 @@ class LlmModel(BaseModel):for training in trainings])- formatted_prompt += "\n\n# Trusted data you can use"+ formatted_prompt += "\n\n# Internal documentation you can use"formatted_prompt += f"\n{trainings_str}"# Remove newlines to avoid hallucinations issues with GPT-4 Turbo