gpt4 book ai didi

node.js - 在 botbuilder 中使用 api.ai 意图

转载 作者:太空宇宙 更新时间:2023-11-04 02:05:13 26 4
gpt4 key购买 nike

API.ai 的预构建包可让您轻松获得长长的意图列表。目前,我正在尝试利用他们的 smalltalk 包,该包有大约 100 个意图,并对每个意图做出响应。

我正在使用api-ai-recognizer包来监听意图。这很好用,但现在我必须匹配这些意图,以便我可以定义对话框(这只不过是使用实现)。这就是我遇到麻烦的地方。

intents = IntentDialog({recognizers: [apiairecognizer(CLIENT_TOKEN)]})
intents.matches('smalltalk', smalltalk_handler) // No luck
intents.matches(/smalltalk/, smalltalk_handler) // No luck
intents.onDefault(default_handler)

在default_handler中我捕获了args:

{"score":1,
"intent":"smalltalk.greetings.how_are_you",
"entities": [
{
"entity":"Lovely, thanks.",
"type":"fulfillment",
"startIndex":-1,
"endIndex":-1,
"score":1
},
{
"entity":false,
"type":"actionIncomplete",
"startIndex":-1,
"endIndex":-1,
"score":1
}
]}

根据 matches 的文档,这是有道理的作品。但这确实意味着我不知道如何实际使用完整的意图列表,而不显式复制每个意图。

只是为了澄清,如果我使用确切的意图:

intents.matches('smalltalk.greetings.how_are_you', smalltalk_handler)

我收到了很好的回复:非常好,谢谢。

有什么建议吗?

最佳答案

到目前为止,我唯一想到的就是修改 api-ai-recognizer ,以便每当遇到它的版本时,它只会返回 smalltalk 作为意图。这样,意图对话框只需要识别一个意图。因为它们的处理方式相同,所以此时并不重要。

关于node.js - 在 botbuilder 中使用 api.ai 意图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44580128/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com