Spaces:
Runtime error
Runtime error
add email if
Browse files- functions.py +13 -6
functions.py
CHANGED
@@ -17,12 +17,19 @@ def call_function(messages, function_call):
|
|
17 |
function_call["arguments"]
|
18 |
)
|
19 |
print("Looking up order status")
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
except Exception as e:
|
27 |
# print(parsed_output)
|
28 |
print(f"Function execution failed")
|
|
|
17 |
function_call["arguments"]
|
18 |
)
|
19 |
print("Looking up order status")
|
20 |
+
if parsed_output["email_address"] == "[email protected]" or parsed_output["email_address"] == "[email protected]":
|
21 |
+
results = get_lookup_order_status(parsed_output["email_address"], parsed_output["order_number"])
|
22 |
+
return {
|
23 |
+
"role": "function",
|
24 |
+
"name": function_call["name"],
|
25 |
+
"content": str(results),
|
26 |
+
}
|
27 |
+
else:
|
28 |
+
return {
|
29 |
+
"role": "function",
|
30 |
+
"name": function_call["name"],
|
31 |
+
"content": "I'm sorry we couldn't find any orders with that information, please have the customer double check their input."
|
32 |
+
}
|
33 |
except Exception as e:
|
34 |
# print(parsed_output)
|
35 |
print(f"Function execution failed")
|