Send a phone call from AI agent, in an API call. Or, directly call the bot from the configured phone number!
Python
feat: Add satisfaction analysis after call
Clémence Lesné0f10709a5c6e
diff --git a/models/synthesis.py b/models/synthesis.pyindex 25f7448..d5f12b2 100644--- a/models/synthesis.py+++ b/models/synthesis.py@@ -1,6 +1,15 @@+from enum import Enumfrom pydantic import BaseModel, Field+class SatisfactionEnum(str, Enum):+ TERRIBLE = "terrible" # 1+ LOW = "low" # 2+ PARTIAL = "partial" # 3+ HIGH = "high" # 4+ UNKNOW = "unknow"++class SynthesisModel(BaseModel):long: str = Field(description="""@@ -15,6 +24,9 @@ class SynthesisModel(BaseModel):- Use Markdown syntax to format the message with paragraphs, bold text, and URL""")+ satisfaction: SatisfactionEnum = Field(+ description="How satisfied is the customer with the call."+ )short: str = Field(description="""Summarize the call with the customer in a few words. The customer cannot reply to this message, but will read it in their web portal.@@ -30,3 +42,12 @@ class SynthesisModel(BaseModel):- "your broken window"""")+ improvement_suggestions: str = Field(+ description="""+ Provide suggestions to improve the customer experience during the call.++ # Rules+ - Include suggestions to improve the call process, the assistant's behavior, or the company's service+ - No more than a few sentences+ """+ )diff --git a/public_website/single.html.jinja b/public_website/single.html.jinjaindex 51bcaf7..0afb28e 100644--- a/public_website/single.html.jinja+++ b/public_website/single.html.jinja@@ -143,6 +143,39 @@ Claim ({{ call.initiate.phone_number }})</p></div>+ <!-- Analysis -->+ <div class="rounded-md lg:ring-1 ring-neutral-200/60 dark:ring-neutral-700/60">+ <h2 class="text-lg px-4 pt-4">🔎 Analysis</h2>++ {% if not call.synthesis %}+ <p class="p-4 text-neutral-600 dark:text-neutral-400">No analysis for the moment.</p>+ {% else %}+ <table class="table-auto w-full">+ <tbody>+ {%+ set details = [+ {+ 'title': 'Satisfaction',+ 'value': ('🔴' if call.synthesis.satisfaction == 'terrible' else '🟠' if call.synthesis.satisfaction == 'low' else '🟢' if call.synthesis.satisfaction == 'partial' else '❤️' if call.synthesis.satisfaction == 'high' else '⚪️' if call.synthesis.satisfaction == 'unknow' ) ~ ' (' ~ call.synthesis.satisfaction.value ~ ')'+ },+ {+ 'title': 'Improvement',+ 'value': call.synthesis.improvement_suggestions+ }+ ]+ %}+ <!-- Disable shadow to avoid overlapping with the table border -->+ {% for detail in details %}+ <tr {% if not loop.last %}class="border-b border-neutral-200/60 dark:border-neutral-700/60"{% endif %}>+ <td class="p-4 text-neutral-600 dark:text-neutral-400">{{ detail.title }}</td>+ <td class="p-4">{{ detail.value }}</td>+ </tr>+ {% endfor %}+ </tbody>+ </table>+ {% endif %}+ </div>+<!-- Details --><div class="rounded-md lg:ring-1 ring-neutral-200/60 dark:ring-neutral-700/60"><h2 class="text-lg px-4 pt-4">📁 Details</h2>