in source/services/lex-bot/order_pizza/intent.py [0:0]
def create_order_pizza_intent(bot_id, locale_id):
bot_language = os.environ.get("botLanguage")
intent_response = create_intent(bot_id, locale_id)
logger.info(intent_response)
# Extract intent_id
intent_id = intent_response["intentId"]
# Create custom slot types (pizzaType, pizzaSize, and pizzaCrust)
slot_type_id_pizza_type = create_pizza_slot_type(
"PizzaType", bot_language, bot_id, locale_id
)
slot_type_id_pizza_size = create_pizza_slot_type(
"PizzaSize", bot_language, bot_id, locale_id
)
slot_type_id_pizza_crust = create_pizza_slot_type(
"PizzaCrust", bot_language, bot_id, locale_id
)
# Create slots pizza type, size, crust and count
pizza_type_slot_id = create_slot(
"type", slot_type_id_pizza_type, bot_id, locale_id, intent_id
)
pizza_size_slot_id = create_slot(
"size", slot_type_id_pizza_size, bot_id, locale_id, intent_id
)
pizza_crust_slot_id = create_slot(
"crust", slot_type_id_pizza_crust, bot_id, locale_id, intent_id
)
pizza_count_slot_id = create_slot(
"count", "AMAZON.Number", bot_id, locale_id, intent_id
)
slot_ids = [
pizza_type_slot_id,
pizza_size_slot_id,
pizza_crust_slot_id,
pizza_count_slot_id,
]
# Update intent to prioritize order of slots in which they get asked in the conversation flow
update_order_intent(intent_id, bot_id, locale_id, slot_ids)