Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -524,21 +524,21 @@ def _get_flow_config(self):
initial_functions = [
FlowsFunctionSchema(
name="user_available",
description="Call this function when the user confirms it's a good time to talk.",
description="Call this function when the user confirms that they are available to talk with clear affirmative responses.",
handler=self._user_available_handler,
properties={},
required=[],
),
FlowsFunctionSchema(
name="user_busy",
description="Call this function if the user says they are busy or it's not a good time to talk.",
description="Call this function when the user says they are busy or it's not a good time to talk.",
handler=self._user_busy_handler,
properties={},
required=[],
),
FlowsFunctionSchema(
name="cancel_order",
description="Call this function to cancel the user's order. If the user gives a reason for cancellation, pass it.",
description="Call this function if the customer explicitly asks to cancel the order. If the user gives a reason for cancellation, pass it.",
handler=self._deny_order_handler,
properties={
"reason": {
Expand All @@ -548,6 +548,13 @@ def _get_flow_config(self):
},
required=[],
),
FlowsFunctionSchema(
name="handle_unrelated_question",
description="Call this function if the user asks a question about anything other than confirming or cancelling the order, without confirming the order.",
handler=self._handle_unrelated_question_handler,
properties={},
required=[],
),
]

# Order verification functions - for main conversation flow
Expand All @@ -568,7 +575,7 @@ def _get_flow_config(self):
),
FlowsFunctionSchema(
name="cancel_order",
description="Call this function to cancel the user's order. If the user gives a reason for cancellation, pass it.",
description="Call this function if the customer explicitly asks to cancel the order. If the user gives a reason for cancellation, pass it.",
handler=self._deny_order_handler,
properties={
"reason": {
Expand Down Expand Up @@ -599,6 +606,13 @@ def _get_flow_config(self):
properties={},
required=[],
),
FlowsFunctionSchema(
name="user_busy",
description="Call this function when the user says they are busy or it's not a good time to talk.",
handler=self._user_busy_handler,
properties={},
required=[],
),
]

# Address update functions
Expand Down Expand Up @@ -631,6 +645,13 @@ def _get_flow_config(self):
properties={"locality": {"type": "string"}},
required=["locality"],
),
FlowsFunctionSchema(
name="handle_unrelated_question",
description="Call this function if the user asks a question about anything other than confirming or cancelling the order, without confirming the order.",
handler=self._handle_unrelated_question_handler,
properties={},
required=[],
),
]

return {
Expand Down Expand Up @@ -659,7 +680,7 @@ def _get_flow_config(self):
"task_messages": [
{
"role": "system",
"content": "The order is confirmed. Say: 'Thank you for confirming your order. Your order will be delivered soon. Have a good day'",
"content": "Thank you for confirming your order. Your order will be delivered soon. Have a good day.",
}
],
"post_actions": [
Expand All @@ -671,7 +692,7 @@ def _get_flow_config(self):
"task_messages": [
{
"role": "system",
"content": "The user confirmed the order but asked a question. Say: 'Thank you for confirming the order. I am here just to confirm your order, for any questions related to the order please refer to the website for more details. Have a good day.'",
"content": "Thank you for confirming the order. I am here just to confirm your order, for any questions related to the order please refer to the website for more details. Have a good day.",
}
],
"post_actions": [
Expand All @@ -683,7 +704,7 @@ def _get_flow_config(self):
"task_messages": [
{
"role": "system",
"content": "The order is cancelled. Say: 'I understand you don't want to proceed with this order. I am cancelling your order. Thank you for your time.'",
"content": "I understand you don't want to proceed with this order. I am cancelling your order. Thank you for your time.",
}
],
"post_actions": [
Expand All @@ -695,7 +716,7 @@ def _get_flow_config(self):
"task_messages": [
{
"role": "system",
"content": "The user is busy. Say: 'I understand. I will call you back later. Thank you for your time.'",
"content": "I understand. I will call you back later. Thank you for your time.",
}
],
"post_actions": [
Expand All @@ -707,7 +728,7 @@ def _get_flow_config(self):
"task_messages": [
{
"role": "system",
"content": f"The user asked an unrelated question. Say: 'I'm not able to help you with that right now, but you can find all the latest details on the {self.shop_name} website. Regarding your order, would you like to confirm it?'",
"content": f"I'm not able to help you with that right now, but you can find all the latest details on the {self.shop_name} website. Regarding your order, would you like to confirm it?",
}
],
"functions": order_functions,
Expand Down