1- from concierge .core import workflow , stage , task , State
1+ from concierge .core import State , stage , task , workflow
22
33
44@stage (name = "restaurants" )
55class RestaurantsStage :
66 @task (description = "Search restaurants by cuisine" )
77 def search_restaurants (self , state : State , cuisine : str , location : str ) -> dict :
88 return {"restaurants" : []}
9-
9+
1010 @task (description = "Filter by rating or delivery time" )
1111 def filter_restaurants (self , state : State , min_rating : float ) -> dict :
1212 return {"filtered" : []}
@@ -17,11 +17,11 @@ class MenuStage:
1717 @task (description = "View restaurant menu" )
1818 def view_menu (self , state : State , restaurant_id : str ) -> dict :
1919 return {"menu_items" : []}
20-
20+
2121 @task (description = "Add item to order" )
2222 def add_item (self , state : State , item_id : str , quantity : int ) -> dict :
2323 return {"order_size" : 1 }
24-
24+
2525 @task (description = "Customize item" )
2626 def customize_item (self , state : State , item_id : str , modifications : list ) -> dict :
2727 return {"customized" : True }
@@ -32,7 +32,7 @@ class CartStage:
3232 @task (description = "Review order and total" )
3333 def review_order (self , state : State ) -> dict :
3434 return {"total" : 0 , "items" : []}
35-
35+
3636 @task (description = "Apply promo code" )
3737 def apply_promo (self , state : State , code : str ) -> dict :
3838 return {"discount" : 0 }
@@ -43,7 +43,7 @@ class CheckoutStage:
4343 @task (description = "Set delivery instructions" )
4444 def set_instructions (self , state : State , instructions : str ) -> dict :
4545 return {"saved" : True }
46-
46+
4747 @task (description = "Place order" )
4848 def place_order (self , state : State ) -> dict :
4949 return {"order_id" : "DD123" , "eta" : 30 }
@@ -55,11 +55,5 @@ class FoodDeliveryWorkflow:
5555 menu = MenuStage
5656 cart = CartStage
5757 checkout = CheckoutStage
58-
59- transitions = {
60- restaurants : [menu ],
61- menu : [cart , restaurants ],
62- cart : [checkout , menu ],
63- checkout : []
64- }
6558
59+ transitions = {restaurants : [menu ], menu : [cart , restaurants ], cart : [checkout , menu ], checkout : []}
0 commit comments