问题描述
是否可以将实体中的值传递给槽而无需表单或编写动作函数?
nlu.yml
nlu:
- intent: place_order
examples: |
- wanna [large](size) shoes for husky
- need a [small](size) [green](color) boots for pupps
- have [blue](color) socks
- would like to place an order
- lookup: size
examples: |
- small
-medium
-large
- synonym: small
examples: |
- small
- s
- tiny
- synonym: large
examples: |
- large
- l
- big
- lookup: color
examples: |
- white
- red
- green
域.yml
version: "2.0"
intents:
- greet
- goodbye
- affirm
- deny
- mood_great
- mood_unhappy
- bot_challenge
- place_order
entities:
- size
- color
slot:
size:
type: text
color:
type: text
responses:
utter_greet:
- text: "hey! can I assist you ?"
utter_order_list:
- text : "your order is {size} [color} boots. right?"
故事.yml
version: "2.0"
stories:
- story: place_order
steps:
- intent: greet
- action: utter_greet
- intent: place_order
- action: utter_order_list
调试输出:它识别 entity ,但该值未传递到插槽
嘿!我可以帮你吗? 您的输入 -> 我想为我的小狗订购大号蓝色鞋子
Received user message 'I would like to place an order for large blue shoes for my puppy' with intent '{'id': -2557752933293854887,'name': 'place_order','confidence': 0.9996021389961243}' and entities '[{'entity': 'size','start': 35,'end': 40,'confidence_entity': 0.9921159148216248,'value': 'large','extractor': 'DIETClassifier'},{'entity': 'color','start': 41,'end': 45,'confidence_entity': 0.9969255328178406,'value': 'blue','extractor': 'DIETClassifier'}]'
Failed to replace placeholders in response 'your order is {size} [color} boots. right?'. Tried to replace 'size' but Could not find a value for it. There is no slot with this name nor did you pass the value explicitly when calling the response. Return response without filling the response
解决方法
"slot" 是一个未知的关键字。你应该在域文件中写“slots”而不是“slot”,它会起作用。