LohithGummi commited on
Commit
bb09f01
·
verified ·
1 Parent(s): b1f1901

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -150,12 +150,13 @@ def log_action(task, details):
150
  @tool
151
  def cancel_order(order_id, customer_id):
152
  """
 
153
  Logs the action of canceling an order.
154
  Args:
155
  order_id (int): The unique ID of the order to be canceled.
156
  customer_id (int): The unique ID of the customer requesting the cancellation.
157
  Returns:
158
- None: The function logs the action and does not return any value.
159
  """
160
  details = {
161
  "order_id": order_id,
@@ -350,13 +351,13 @@ def build_prompt(df):
350
  #### 1. **Cancel Order / Return Order / Get Refund**
351
  - Get necessary details and why customer wants to cancel.
352
  - Check cancellation fee, validity period, and amount for the product.
 
353
  - Check If the cancellation meets the criteria: i.e,
354
- if the order is within the validity period by checking days since purchase - use the days_since tool to calculate the number of days since delivery
355
  - if the product is not delivered yet then this step is not required and the cancellation fee doesn't apply.
356
- if the customer is okay with the cancellation fee - do not proceed to cancel if the customer is not okay with the cancellation fee
357
- - Call `cancel_order`.
358
- - Process a refund using `process_refund` (output as JSON). refund amount should be product price - cancellation fee.
359
- if it doesn't meet the criteria you do not have the clearance to process refund. defer to human while providing a reason to customer on why you cannot process it or why you are defering it to a human.
360
 
361
  #### 2. **Check Cancellation Fee**
362
  - Check the cancellation fee.
 
150
  @tool
151
  def cancel_order(order_id, customer_id):
152
  """
153
+ Cancels the order, processes refund and updates database.
154
  Logs the action of canceling an order.
155
  Args:
156
  order_id (int): The unique ID of the order to be canceled.
157
  customer_id (int): The unique ID of the customer requesting the cancellation.
158
  Returns:
159
+ str: If something fails this function will return a string stating what's wrong.
160
  """
161
  details = {
162
  "order_id": order_id,
 
351
  #### 1. **Cancel Order / Return Order / Get Refund**
352
  - Get necessary details and why customer wants to cancel.
353
  - Check cancellation fee, validity period, and amount for the product.
354
+ - if it doesn't meet the criteria you do not have the clearance to process refund or process return. defer to human while providing a reason to customer on why you cannot process it or why you are defering it to a human.
355
  - Check If the cancellation meets the criteria: i.e,
356
+ - if the order is within the validity period by checking days since purchase - use the days_since tool to calculate the number of days since delivery
357
  - if the product is not delivered yet then this step is not required and the cancellation fee doesn't apply.
358
+ - If the product is delivered, within the validity period and if the customer is okay with the cancellation fee cancel the order and process the refund.
359
+ - do not proceed to cancel if the customer is not okay with the cancellation fee
360
+ - Call `cancel_order` which will cancel the order and process the refund. refund amount should be product price - cancellation fee.
 
361
 
362
  #### 2. **Check Cancellation Fee**
363
  - Check the cancellation fee.