mirror of
https://github.com/temporal-community/temporal-ai-agent.git
synced 2026-03-16 06:28:08 +01:00
ecommerce installable
This commit is contained in:
@@ -18,9 +18,9 @@ from .fin.get_account_balances import get_account_balance
|
||||
from .fin.move_money import move_money
|
||||
from .fin.submit_loan_application import submit_loan_application
|
||||
|
||||
from .ecommerce.get_order import get_order
|
||||
from .ecommerce.track_package import track_package
|
||||
from .ecommerce.list_orders import list_orders
|
||||
# from .ecommerce.get_order import get_order
|
||||
# from .ecommerce.track_package import track_package
|
||||
# from .ecommerce.list_orders import list_orders
|
||||
|
||||
from .give_hint import give_hint
|
||||
from .guess_location import guess_location
|
||||
@@ -61,12 +61,6 @@ def get_handler(tool_name: str):
|
||||
return move_money
|
||||
if tool_name == "FinCheckAccountSubmitLoanApproval":
|
||||
return submit_loan_application
|
||||
if tool_name == "GetOrder":
|
||||
return get_order
|
||||
if tool_name == "TrackPackage":
|
||||
return track_package
|
||||
if tool_name == "ListOrders":
|
||||
return list_orders
|
||||
if tool_name == "GiveHint":
|
||||
return give_hint
|
||||
if tool_name == "GuessLocation":
|
||||
|
||||
@@ -1,81 +0,0 @@
|
||||
{
|
||||
"orders": [
|
||||
{
|
||||
"id": "100",
|
||||
"summary": "Lawyer Books",
|
||||
"email": "matt.murdock@nelsonmurdock.com",
|
||||
"status": "cancelled",
|
||||
"order_date": "2025-03-30",
|
||||
"last_update": "2025-04-01"
|
||||
},
|
||||
{
|
||||
"id": "101",
|
||||
"summary": "Bonking Sticks",
|
||||
"email": "matt.murdock@nelsonmurdock.com",
|
||||
"status": "paid",
|
||||
"order_date": "2025-04-01",
|
||||
"last_order_update": "2025-04-01"
|
||||
},
|
||||
{
|
||||
"id": "102",
|
||||
"summary": "Red Sunglasses",
|
||||
"email": "matt.murdock@nelsonmurdock.com",
|
||||
"status": "shipped",
|
||||
"order_date": "2025-04-01",
|
||||
"last_order_update": "2025-04-01",
|
||||
"tracking_id": "UPS67890"
|
||||
},
|
||||
{
|
||||
"id": "200",
|
||||
"summary": "Paper",
|
||||
"email": "foggy.nelson@nelsonmurdock.com",
|
||||
"status": "shipped",
|
||||
"order_date": "2025-04-03",
|
||||
"last_update": "2025-04-06",
|
||||
"tracking_id": "USPS12345"
|
||||
},
|
||||
{
|
||||
"id": "300",
|
||||
"summary": "Chemistry Books",
|
||||
"email": "heisenberg@blue-meth.com",
|
||||
"status": "shipped",
|
||||
"order_date": "2025-03-30",
|
||||
"last_update": "2025-04-06",
|
||||
"tracking_id": "USPS12345"
|
||||
},
|
||||
{
|
||||
"id": "301",
|
||||
"summary": "Book: Being a Cool Bro",
|
||||
"email": "heisenberg@blue-meth.com",
|
||||
"status": "cancelled",
|
||||
"order_date": "2025-04-01",
|
||||
"last_update": "2025-04-02"
|
||||
},
|
||||
{
|
||||
"id": "302",
|
||||
"summary": "Black Hat",
|
||||
"email": "heisenberg@blue-meth.com",
|
||||
"status": "delivered",
|
||||
"order_date": "2025-04-01",
|
||||
"last_update": "2025-04-06",
|
||||
"tracking_id": "UPS67890"
|
||||
},
|
||||
{
|
||||
"id": "400",
|
||||
"summary": "Giant Graphic Hoodie",
|
||||
"email": "jessenotpinkman@blue-meth.com",
|
||||
"status": "shipped",
|
||||
"order_date": "2025-04-03",
|
||||
"last_update": "2025-04-09",
|
||||
"tracking_id": "UPS67890"
|
||||
},
|
||||
{
|
||||
"id": "401",
|
||||
"summary": "Giant Pants",
|
||||
"email": "jessenotpinkman@blue-meth.com",
|
||||
"status": "processing",
|
||||
"order_date": "2025-04-03",
|
||||
"last_update": "2025-04-09"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,158 +0,0 @@
|
||||
{
|
||||
"packages": [
|
||||
{
|
||||
"TrackingNumber": "USPS12345",
|
||||
"Delivered": false,
|
||||
"Carrier": "USPS",
|
||||
"ServiceType": "USPS Ground Advantage<SUP>™</SUP>",
|
||||
"PickupDate": "",
|
||||
"ScheduledDeliveryDate": "April 14, 2025",
|
||||
"ScheduledDeliveryDateInDateTimeFromat": "2025-04-14T00:00:00",
|
||||
"StatusCode": "In Transit from Origin Processing",
|
||||
"Status": "Departed Post Office",
|
||||
"StatusSummary": "Your item has left our acceptance facility and is in transit to a sorting facility on April 10, 2025 at 7:06 am in IRON RIDGE, WI 53035.",
|
||||
"Message": "",
|
||||
"DeliveredDateTime": "",
|
||||
"DeliveredDateTimeInDateTimeFormat": null,
|
||||
"SignatureName": "",
|
||||
"DestinationCity": "CITY",
|
||||
"DestinationState": "ST",
|
||||
"DestinationZip": "12345",
|
||||
"DestinationCountry": null,
|
||||
"EventDate": "2025-04-10T07:06:00",
|
||||
"TrackingDetails": [
|
||||
{
|
||||
"EventDateTime": "April 10, 2025 7:06 am",
|
||||
"Event": "Departed Post Office",
|
||||
"EventAddress": "IRON RIDGE WI 53035",
|
||||
"State": "WI",
|
||||
"City": "IRON RIDGE",
|
||||
"Zip": "53035",
|
||||
"EventDateTimeInDateTimeFormat": "2025-04-10T07:06:00"
|
||||
},
|
||||
{
|
||||
"EventDateTime": "April 9, 2025 11:29 am",
|
||||
"Event": "USPS picked up item",
|
||||
"EventAddress": "IRON RIDGE WI 53035",
|
||||
"State": "WI",
|
||||
"City": "IRON RIDGE",
|
||||
"Zip": "53035",
|
||||
"EventDateTimeInDateTimeFormat": "2025-04-09T11:29:00"
|
||||
},
|
||||
{
|
||||
"EventDateTime": "April 7, 2025 6:29 am",
|
||||
"Event": "Shipping Label Created, USPS Awaiting Item",
|
||||
"EventAddress": "IRON RIDGE WI 53035",
|
||||
"State": "WI",
|
||||
"City": "IRON RIDGE",
|
||||
"Zip": "53035",
|
||||
"EventDateTimeInDateTimeFormat": "2025-04-07T06:29:00"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"TrackingNumber": "UPS67890",
|
||||
"Delivered": true,
|
||||
"Carrier": "UPS",
|
||||
"ServiceType": "UPS Ground Saver®",
|
||||
"PickupDate": "",
|
||||
"ScheduledDeliveryDate": "",
|
||||
"ScheduledDeliveryDateInDateTimeFromat": null,
|
||||
"StatusCode": "D",
|
||||
"Status": "DELIVERED",
|
||||
"StatusSummary": "DELIVERED",
|
||||
"Message": "",
|
||||
"DeliveredDateTime": "20250415 154315",
|
||||
"DeliveredDateTimeInDateTimeFormat": "2025-04-15T15:43:15",
|
||||
"SignatureName": "",
|
||||
"DestinationCity": "CHICAGO",
|
||||
"DestinationState": "IL",
|
||||
"DestinationZip": "",
|
||||
"DestinationCountry": "US",
|
||||
"EventDate": "2025-04-15T15:43:15",
|
||||
"TrackingDetails": [
|
||||
{
|
||||
"EventDateTime": "20250415 154315",
|
||||
"Event": "DELIVERED ",
|
||||
"EventAddress": "CHICAGO IL US",
|
||||
"State": "IL",
|
||||
"City": "CHICAGO",
|
||||
"Zip": null,
|
||||
"EventDateTimeInDateTimeFormat": "2025-04-15T15:43:15"
|
||||
},
|
||||
{
|
||||
"EventDateTime": "20250415 090938",
|
||||
"Event": "Out For Delivery Today",
|
||||
"EventAddress": "Chicago IL US",
|
||||
"State": "IL",
|
||||
"City": "Chicago",
|
||||
"Zip": null,
|
||||
"EventDateTimeInDateTimeFormat": "2025-04-15T09:09:38"
|
||||
},
|
||||
{
|
||||
"EventDateTime": "20250415 074141",
|
||||
"Event": "Loaded on Delivery Vehicle ",
|
||||
"EventAddress": "Chicago IL US",
|
||||
"State": "IL",
|
||||
"City": "Chicago",
|
||||
"Zip": null,
|
||||
"EventDateTimeInDateTimeFormat": "2025-04-15T07:41:41"
|
||||
},
|
||||
{
|
||||
"EventDateTime": "20250415 032200",
|
||||
"Event": "Arrived at Facility",
|
||||
"EventAddress": "Chicago IL US",
|
||||
"State": "IL",
|
||||
"City": "Chicago",
|
||||
"Zip": null,
|
||||
"EventDateTimeInDateTimeFormat": "2025-04-15T03:22:00"
|
||||
},
|
||||
{
|
||||
"EventDateTime": "20250414 223000",
|
||||
"Event": "Departed from Facility",
|
||||
"EventAddress": "Hodgkins IL US",
|
||||
"State": "IL",
|
||||
"City": "Hodgkins",
|
||||
"Zip": null,
|
||||
"EventDateTimeInDateTimeFormat": "2025-04-14T22:30:00"
|
||||
},
|
||||
{
|
||||
"EventDateTime": "20250414 002700",
|
||||
"Event": "Arrived at Facility",
|
||||
"EventAddress": "Hodgkins IL US",
|
||||
"State": "IL",
|
||||
"City": "Hodgkins",
|
||||
"Zip": null,
|
||||
"EventDateTimeInDateTimeFormat": "2025-04-14T00:27:00"
|
||||
},
|
||||
{
|
||||
"EventDateTime": "20250410 211700",
|
||||
"Event": "Departed from Facility",
|
||||
"EventAddress": "Las Vegas NV US",
|
||||
"State": "NV",
|
||||
"City": "Las Vegas",
|
||||
"Zip": null,
|
||||
"EventDateTimeInDateTimeFormat": "2025-04-10T21:17:00"
|
||||
},
|
||||
{
|
||||
"EventDateTime": "20250410 132625",
|
||||
"Event": "Arrived at Facility",
|
||||
"EventAddress": "Las Vegas NV US",
|
||||
"State": "NV",
|
||||
"City": "Las Vegas",
|
||||
"Zip": null,
|
||||
"EventDateTimeInDateTimeFormat": "2025-04-10T13:26:25"
|
||||
},
|
||||
{
|
||||
"EventDateTime": "20250409 100659",
|
||||
"Event": "Shipper created a label, UPS has not received the package yet. ",
|
||||
"EventAddress": " US",
|
||||
"State": null,
|
||||
"City": null,
|
||||
"Zip": null,
|
||||
"EventDateTimeInDateTimeFormat": "2025-04-09T10:06:59"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
from pathlib import Path
|
||||
import json
|
||||
|
||||
# this is made to demonstrate functionality but it could just as durably be an API call
|
||||
# called as part of a temporal activity with automatic retries
|
||||
def get_order(args: dict) -> dict:
|
||||
|
||||
order_id = args.get("order_id")
|
||||
|
||||
file_path = Path(__file__).resolve().parent.parent / "data" / "customer_order_data.json"
|
||||
if not file_path.exists():
|
||||
return {"error": "Data file not found."}
|
||||
|
||||
with open(file_path, "r") as file:
|
||||
data = json.load(file)
|
||||
order_list = data["orders"]
|
||||
|
||||
for order in order_list:
|
||||
if order["id"] == order_id:
|
||||
return order
|
||||
|
||||
return_msg = "Order " + order_id + " not found."
|
||||
return {"error": return_msg}
|
||||
@@ -1,30 +0,0 @@
|
||||
from pathlib import Path
|
||||
import json
|
||||
|
||||
def sorting(e):
|
||||
return e['order_date']
|
||||
|
||||
def list_orders(args: dict) -> dict:
|
||||
|
||||
email_address = args.get("email_address")
|
||||
|
||||
file_path = Path(__file__).resolve().parent.parent / "data" / "customer_order_data.json"
|
||||
if not file_path.exists():
|
||||
return {"error": "Data file not found."}
|
||||
|
||||
with open(file_path, "r") as file:
|
||||
data = json.load(file)
|
||||
order_list = data["orders"]
|
||||
|
||||
rtn_order_list = []
|
||||
for order in order_list:
|
||||
if order["email"] == email_address:
|
||||
rtn_order_list.append(order)
|
||||
|
||||
if len(rtn_order_list) > 0:
|
||||
rtn_order_list.sort(key=sorting)
|
||||
return {"orders": rtn_order_list}
|
||||
else:
|
||||
return_msg = "No orders for customer " + email_address + " found."
|
||||
return {"error": return_msg}
|
||||
|
||||
@@ -1,144 +0,0 @@
|
||||
import http
|
||||
import os
|
||||
import json
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
#Send back dummy data in the correct format - to use the real API, 1) change this to be track_package_fake and 2) change the below track_package_real to be track_package
|
||||
def track_package(args: dict) -> dict:
|
||||
|
||||
tracking_id = args.get("tracking_id")
|
||||
file_path = Path(__file__).resolve().parent.parent / "data" / "dummy_tracking_data.json"
|
||||
if not file_path.exists():
|
||||
return {"error": "Data file not found."}
|
||||
|
||||
with open(file_path, "r") as file:
|
||||
data = json.load(file)
|
||||
package_list = data["packages"]
|
||||
|
||||
for package in package_list:
|
||||
if package["TrackingNumber"] == tracking_id:
|
||||
scheduled_delivery_date = package["ScheduledDeliveryDate"]
|
||||
carrier = package["Carrier"]
|
||||
status_summary = package["StatusSummary"]
|
||||
tracking_details = package.get("TrackingDetails", [])
|
||||
last_tracking_update = ""
|
||||
if tracking_details and tracking_details is not None and tracking_details[0] is not None:
|
||||
last_tracking_update = tracking_details[0]["EventDateTimeInDateTimeFormat"]
|
||||
|
||||
tracking_link = ""
|
||||
if carrier == "USPS":
|
||||
tracking_link = f"https://tools.usps.com/go/TrackConfirmAction?qtc_tLabels1={tracking_id}"
|
||||
elif carrier == "UPS":
|
||||
tracking_link = f"https://www.ups.com/track?track=yes&trackNums={tracking_id}"
|
||||
|
||||
return {
|
||||
"scheduled_delivery_date": scheduled_delivery_date,
|
||||
"carrier": carrier,
|
||||
"status_summary": status_summary,
|
||||
"tracking_link": tracking_link,
|
||||
"last_tracking_update": last_tracking_update
|
||||
}
|
||||
|
||||
return_msg = "Package not found with tracking info " + tracking_id
|
||||
return {"error": return_msg}
|
||||
|
||||
'''Format of response:
|
||||
{
|
||||
"TrackingNumber": "",
|
||||
"Delivered": false,
|
||||
"Carrier": "USPS",
|
||||
"ServiceType": "USPS Ground Advantage<SUP>™</SUP>",
|
||||
"PickupDate": "",
|
||||
"ScheduledDeliveryDate": "April 14, 2025",
|
||||
"ScheduledDeliveryDateInDateTimeFromat": "2025-04-14T00:00:00",
|
||||
"StatusCode": "In Transit from Origin Processing",
|
||||
"Status": "Departed Post Office",
|
||||
"StatusSummary": "Your item has left our acceptance facility and is in transit to a sorting facility on April 10, 2025 at 7:06 am in IRON RIDGE, WI 53035.",
|
||||
"Message": "",
|
||||
"DeliveredDateTime": "",
|
||||
"DeliveredDateTimeInDateTimeFormat": null,
|
||||
"SignatureName": "",
|
||||
"DestinationCity": "CITY",
|
||||
"DestinationState": "ST",
|
||||
"DestinationZip": "12345",
|
||||
"DestinationCountry": null,
|
||||
"EventDate": "2025-04-10T07:06:00",
|
||||
"TrackingDetails": [
|
||||
{
|
||||
"EventDateTime": "April 10, 2025 7:06 am",
|
||||
"Event": "Departed Post Office",
|
||||
"EventAddress": "IRON RIDGE WI 53035",
|
||||
"State": "WI",
|
||||
"City": "IRON RIDGE",
|
||||
"Zip": "53035",
|
||||
"EventDateTimeInDateTimeFormat": "2025-04-10T07:06:00"
|
||||
},
|
||||
{
|
||||
"EventDateTime": "April 9, 2025 11:29 am",
|
||||
"Event": "USPS picked up item",
|
||||
"EventAddress": "IRON RIDGE WI 53035",
|
||||
"State": "WI",
|
||||
"City": "IRON RIDGE",
|
||||
"Zip": "53035",
|
||||
"EventDateTimeInDateTimeFormat": "2025-04-09T11:29:00"
|
||||
},
|
||||
{
|
||||
"EventDateTime": "April 7, 2025 6:29 am",
|
||||
"Event": "Shipping Label Created, USPS Awaiting Item",
|
||||
"EventAddress": "IRON RIDGE WI 53035",
|
||||
"State": "WI",
|
||||
"City": "IRON RIDGE",
|
||||
"Zip": "53035",
|
||||
"EventDateTimeInDateTimeFormat": "2025-04-07T06:29:00"
|
||||
}
|
||||
]
|
||||
}
|
||||
'''
|
||||
def track_package_real(args: dict) -> dict:
|
||||
|
||||
tracking_id = args.get("tracking_id")
|
||||
|
||||
api_key = os.getenv("RAPIDAPI_KEY")
|
||||
api_host = os.getenv("RAPIDAPI_HOST_PACKAGE", "trackingpackage.p.rapidapi.com")
|
||||
|
||||
conn = http.client.HTTPSConnection(api_host)
|
||||
headers = {
|
||||
"x-rapidapi-key": api_key,
|
||||
"x-rapidapi-host": api_host,
|
||||
"Authorization": "Basic Ym9sZGNoYXQ6TGZYfm0zY2d1QzkuKz9SLw==",
|
||||
}
|
||||
|
||||
path = f"/TrackingPackage?trackingNumber={tracking_id}"
|
||||
|
||||
conn.request("GET", path, headers=headers)
|
||||
res = conn.getresponse()
|
||||
data = res.read()
|
||||
data_decoded = data.decode("utf-8")
|
||||
conn.close()
|
||||
|
||||
try:
|
||||
json_data = json.loads(data_decoded)
|
||||
except json.JSONDecodeError:
|
||||
return {"error": "Invalid JSON response"}
|
||||
|
||||
scheduled_delivery_date = json_data["ScheduledDeliveryDate"]
|
||||
carrier = json_data["Carrier"]
|
||||
status_summary = json_data["StatusSummary"]
|
||||
tracking_details = json_data.get("TrackingDetails", [])
|
||||
last_tracking_update = ""
|
||||
if tracking_details and tracking_details is not None and tracking_details[0] is not None:
|
||||
last_tracking_update = tracking_details[0]["EventDateTimeInDateTimeFormat"]
|
||||
tracking_link = ""
|
||||
if carrier == "USPS":
|
||||
tracking_link = f"https://tools.usps.com/go/TrackConfirmAction?qtc_tLabels1={tracking_id}"
|
||||
elif carrier == "UPS":
|
||||
tracking_link = f"https://www.ups.com/track?track=yes&trackNums={tracking_id}"
|
||||
|
||||
return {
|
||||
"scheduled_delivery_date": scheduled_delivery_date,
|
||||
"carrier": carrier,
|
||||
"status_summary": status_summary,
|
||||
"tracking_link": tracking_link,
|
||||
"last_tracking_update": last_tracking_update
|
||||
}
|
||||
@@ -380,80 +380,6 @@ goal_fin_loan_application = AgentGoal(
|
||||
),
|
||||
)
|
||||
|
||||
# ----- E-Commerce Goals ---
|
||||
# this tool checks account balances, and uses ./data/customer_account_data.json as dummy data
|
||||
goal_ecomm_order_status = AgentGoal(
|
||||
id="goal_ecomm_order_status",
|
||||
category_tag="ecommerce",
|
||||
agent_name="Check Order Status",
|
||||
agent_friendly_description="Check the status of your order.",
|
||||
tools=[
|
||||
tool_registry.ecomm_get_order,
|
||||
tool_registry.ecomm_track_package,
|
||||
],
|
||||
description="The user wants to learn the status of a specific order. If the status is 'shipped' or 'delivered', they might want to get the package tracking information. To assist with that goal, help the user gather args for these tools in order: "
|
||||
"1. GetOrder: get information about an order"
|
||||
"2. TrackPackage: provide tracking information for the package. This tool is optional and should only be offered if the status is 'shipped' OR 'delivered' - otherwise, skip this tool and do not mention it to the user.",
|
||||
starter_prompt=starter_prompt_generic,
|
||||
example_conversation_history="\n ".join(
|
||||
[
|
||||
"user: I'd like to know the status of my order",
|
||||
"agent: Sure! I can help you out with that. May I have your order number?",
|
||||
"user: 102 ",
|
||||
"user_confirmed_tool_run: <user clicks confirm on GetOrderStatus tool>",
|
||||
"tool_result: { 'id': '102', 'summary': 'Red Sunglasses', 'email': 'matt.murdock@nelsonmurdock.com', 'status': 'shipped', 'order_date': '2025-04-01', 'last_order_update': '2025-04-06', 'tracking_id': '039813852990618' }",
|
||||
"agent: Your order 'Red Sunglasses,' placed April 1, 2025, was shipped on April 6, 2025. Would you like to see the tracking inforation?",
|
||||
"user: Yes",
|
||||
"user_confirmed_tool_run: <user clicks confirm on TrackPackage tool>",
|
||||
"tool_result: { 'scheduled_delivery_date': 'April 30, 2025', 'carrier': 'USPS', 'status_summary': 'Your item has left our acceptance facility and is in transit to a sorting facility on April 10, 2025 at 7:06 am in IRON RIDGE, WI 53035.', 'tracking_link': 'https://tools.usps.com/go/TrackConfirmAction?qtc_tLabels1=12345','last_tracking_update': '2025-03-22T16:14:48'}",
|
||||
"agent: Your package is scheduled to be delivered on April 30, 2025 via USPS. Here is the most recent status from them regarding your package, updated as of March 22: \n"
|
||||
"Your item has left our acceptance facility and is in transit to a sorting facility on April 10, 2025 at 7:06 am in IRON RIDGE, WI 53035. \n"
|
||||
"You can find the full tracking details here: tracking_link !",
|
||||
]
|
||||
),
|
||||
)
|
||||
|
||||
goal_ecomm_list_orders = AgentGoal(
|
||||
id="goal_ecomm_list_orders",
|
||||
category_tag="ecommerce",
|
||||
agent_name="List All Orders",
|
||||
agent_friendly_description="List all orders for a user.",
|
||||
tools=[
|
||||
tool_registry.ecomm_list_orders,
|
||||
tool_registry.ecomm_get_order,
|
||||
tool_registry.ecomm_track_package,
|
||||
],
|
||||
description="The user wants to see all of their orders. They may want more details about specific orders, and if the status of an order is 'shipped' or 'delivered', they might want to get the package tracking information. To assist with that goal, help the user gather args for this tool: "
|
||||
"1. ListOrders: list orders for a user"
|
||||
" and then offer the following tools, in a loop, until the user indicates they are done:"
|
||||
"2. GetOrder: get information about an order. This tool is optional."
|
||||
"3. TrackPackage: provide tracking information for the package. This tool is optional and should only be offered if the status is 'shipped' OR 'delivered' - otherwise, skip this tool and do not mention it to the user.",
|
||||
starter_prompt=starter_prompt_generic,
|
||||
example_conversation_history="\n ".join(
|
||||
[
|
||||
"user: I'd like to see all of my orders.",
|
||||
"agent: Sure! I can help you out with that. May I have your email address?",
|
||||
"user: email is bob.johnson@emailzzz.com ",
|
||||
"user_confirmed_tool_run: <user clicks confirm on ListOrders tool>",
|
||||
"tool_result: a list of orders including [{'id': '102', 'summary': 'Red Sunglasses', 'email': 'matt.murdock@nelsonmurdock.com', 'status': 'shipped', 'order_date': '2025-04-01', 'last_order_update': '2025-04-06', 'tracking_id': '039813852990618' }, { 'id': '103', 'summary': 'Blue Sunglasses', 'email': 'matt.murdock@nelsonmurdock.com', 'status': 'paid', 'order_date': '2025-04-03', 'last_order_update': '2025-04-07' }]",
|
||||
"agent: Your orders are as follows: \n",
|
||||
"1. Red Sunglasses, ordered 4/1/2025 \n",
|
||||
"2. Blue Sunglasses, ordered 4/3/2025 \n",
|
||||
"Would you like more information about any of your orders?"
|
||||
"user: Yes, the Red Sunglasses",
|
||||
"agent: Your order 'Red Sunglasses,' placed April 1, 2025, was shipped on April 6, 2025. Would you like to see the tracking inforation?",
|
||||
"user: Yes",
|
||||
"user_confirmed_tool_run: <user clicks confirm on TrackPackage tool>",
|
||||
"tool_result: { 'scheduled_delivery_date': 'April 30, 2025', 'carrier': 'USPS', 'status_summary': 'Your item has left our acceptance facility and is in transit to a sorting facility on April 10, 2025 at 7:06 am in IRON RIDGE, WI 53035.', 'tracking_link': 'https://tools.usps.com/go/TrackConfirmAction?qtc_tLabels1=12345','last_tracking_update': '2025-03-22T16:14:48'}",
|
||||
"agent: Your package is scheduled to be delivered on April 30, 2025 via USPS. Here is the most recent status from them regarding your package \n, updated as of March 22: \n"
|
||||
"Your item has left our acceptance facility and is in transit to a sorting facility on April 10, 2025 at 7:06 am in IRON RIDGE, WI 53035. \n"
|
||||
"You can find the full tracking details here: tracking_link ! \n"
|
||||
"Would you like more information about any of your other orders?",
|
||||
"user: No" "agent: Thanks, and have a great day!",
|
||||
]
|
||||
),
|
||||
)
|
||||
|
||||
# Add the goals to a list for more generic processing, like listing available agents
|
||||
goal_list: List[AgentGoal] = []
|
||||
goal_list.append(goal_choose_agent_type)
|
||||
@@ -466,8 +392,6 @@ goal_list.append(goal_hr_check_paycheck_bank_integration_status)
|
||||
goal_list.append(goal_fin_check_account_balances)
|
||||
goal_list.append(goal_fin_move_money)
|
||||
goal_list.append(goal_fin_loan_application)
|
||||
goal_list.append(goal_ecomm_list_orders)
|
||||
goal_list.append(goal_ecomm_order_status)
|
||||
|
||||
|
||||
# for multi-goal, just set list agents as the last tool
|
||||
|
||||
@@ -355,45 +355,3 @@ financial_submit_loan_approval = ToolDefinition(
|
||||
),
|
||||
],
|
||||
)
|
||||
|
||||
# ----- ECommerce Use Case Tools -----
|
||||
ecomm_list_orders = ToolDefinition(
|
||||
name="ListOrders",
|
||||
description="Get all orders for a certain email address.",
|
||||
arguments=[
|
||||
ToolArgument(
|
||||
name="email_address",
|
||||
type="string",
|
||||
description="Email address of user by which to find orders",
|
||||
),
|
||||
],
|
||||
)
|
||||
|
||||
ecomm_get_order = ToolDefinition(
|
||||
name="GetOrder",
|
||||
description="Get infromation about an order by order ID.",
|
||||
arguments=[
|
||||
ToolArgument(
|
||||
name="order_id",
|
||||
type="string",
|
||||
description="ID of order to determine status of",
|
||||
),
|
||||
],
|
||||
)
|
||||
|
||||
ecomm_track_package = ToolDefinition(
|
||||
name="TrackPackage",
|
||||
description="Get tracking information for a package by shipping provider and tracking ID",
|
||||
arguments=[
|
||||
ToolArgument(
|
||||
name="tracking_id",
|
||||
type="string",
|
||||
description="ID of package to track",
|
||||
),
|
||||
ToolArgument(
|
||||
name="userConfirmation",
|
||||
type="string",
|
||||
description="Indication of user's desire to get package tracking information",
|
||||
),
|
||||
],
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user