他们对api.ai中触发的跟进事件数量有任何限制吗? [英] Is their any limit on number of followup event triggered in api.ai?

查看:64
本文介绍了他们对api.ai中触发的跟进事件数量有任何限制吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用多个后续事件来解决我的案例的对话流5秒响应时间限制。在用户输入之后,机器人必须使用api获取一些数据,目前大约需要20到25秒。

I am trying to solve the dialog flow 5 sec response time limit for my case using multiple followup events. After the user input, the bot has to fetch some data using an api, which is currently taking around 20-25 sec.

这是我的python webhook代码:

This is my python webhook code:

def makeWebhookResult(req):
flag = 0 
if req.get("queryResult").get("action")=="status":
    time.sleep(3.5)
    if flag == 0:

        return{
            "followupEventInput": {
            "name": "ContinueEvent1",
            "parameters": {
                "Status":"201"
                }
            }
        }
    else:
        return{
            "fulfillmentText":"This works",
    }
elif req.get("queryResult").get("action")=="status1":
    if flag == 0:
        time.sleep(3.5)

        return{
            "followupEventInput": {
            "name": "ContinueEvent2",
            "parameters": {
                "Status":"202"
                }
            }
        }
    else:
        return{
            "fulfillmentText":"This works in the last loop",
    }
elif req.get("queryResult").get("action")=="status2":
    time.sleep(3.5)
    if flag == 0:
        return{
            "followupEventInput": {
            "name": "ContinueEvent3",
            "parameters": {
                "Status":"203"
                }
            }
        }
    else:
        return{
            "fulfillmentText":"This works in the last loop",
    }
elif req.get("queryResult").get("action")=="status3":
    time.sleep(3.5)
    if flag == 0:
        return{
            "followupEventInput": {
            "name": "ContinueEvent4",
            "parameters": {
                "Status":"204"
                }
            }
        }
    else:
        return{
            "fulfillmentText":"This works in the last loop",
    }
elif req.get("queryResult").get("action")=="status4":
    time.sleep(3.5)
    if flag == 0:
        return{
            "followupEventInput": {
            "name": "ContinueEvent2",
            "parameters": {
                "Status":"205"
                }
            }
        }
    else:
        return{
            "fulfillmentText":"This works in the last loop",
    }



elif req.get("queryResult").get("action") == 'Check_vendor:
    time.sleep(3.5)
    '''
    Here i will call my api and get the response and set the flag variable.

    '''
    return{
        "followupEventInput": {
        "name": "ContinueEvent",
        "parameters": {
            "Status":"200"
        }

这里我的主要意图是 Check_vendor ,这将命中我的api并获取参数。因此,要参与api.ai,我会触发一个后续事件,作为响应,它将触发另一个后续事件。

Here my Main intent is 'Check_vendor', Which will hit my api and get the parameter. So to engage the api.ai I trigger a followup event which in response will hit another follow-up event.

直到 ContinueEvent2,我的后续事件都在进行。但是,在该对话流没有触发ContinueEvent3之后,它以ContinueEvent2的响应进行响应。

Till ''ContinueEvent2'' my followup events are working. But after that dialogflow doesn't trigger the ContinueEvent3, it responds with the response of ContinueEvent2.

因此,跟进事件的数量没有限制吗?

So is there any limit on the number of Followup event ?

在执行此操作时,我遇到了两个参数:

While doing this I came across 2 parameters:

"diagnosticInfo": {
  "accumulated_webhook_latency_ms": 11598,
  "webhook_latency_ms": 3777
},

这是什么?

谢谢您

推荐答案

最近,我有一个类似的用例,其中我必须处理由dialogflow的webhook请求触发的工作流,然后将结果发送回去。该工作流程的执行几乎耗时40-50秒。我还使用了完全相同的方法,即通过使用followUpEventInput再次再次调用意图。
我发现最多可以召集3个跟进事件。因此,我们最多可以将请求处理到 15秒(每个请求5秒* 3个请求)。
没有太多相关的文档。因此,更好的是,我们找出其他一些解决方案,也许使用插槽填充或任何其他逻辑。

Recently, i have similar use case where i had to process a workflow triggered by webhook request from dialogflow and send back the result. The execution of this workflow almost took 40-50 sec. I have also use the exact same approach of calling intent again-n-again by employ followUpEventInput. I figure out that at max we can call 3 follow up event. So, at max we can engage our request to 15 sec (5 sec per request * 3 request). There is not much documentation related to it. So, better we figure out some other solution maybe using slot-filling or any other logic.

这篇关于他们对api.ai中触发的跟进事件数量有任何限制吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆