Chatbot - How to recognize and handle multiple requests with single response











up vote
2
down vote

favorite












This must be a common issue but I can't find any sources discussing it. There are a lot on the opposite (sending multiple responses to single request).



There's a common human-to-human chat style where personA quickly sends a second message to add to or correct their first message. That is frequently attempted to be used with a chatbot too, for example:




Bot: Where should we deliver the pizza?

User: 123 main street sprnigfelid

User: springfield

Bot: (response to input #1 )

Bot: (response to input #2 )




Now the problem is if the bot is smart enough to recognize misspellings or open enough to accept them from the first input. The convo would play out like this:




User: 123 main street sprnigfeld

User: springfield

Bot: OK, 123 Main St., Springfield. What state is that in?

Bot: Got it, I will deliver to 123 Main St., Springfield, Springfield. Is that location correct?




There are so many other situations and ways the bot can mistake these multiple rapid inputs and the double responses leave user's wondering what went wrong and confused about where in the conversation they stand.



So has anyone attempted handling of this?



I'm seeking general guidance for an approach, but in case someone has a specific answer, I'm using a PHP Proxy between the User and a Lex bot. I use this Proxy to validate and parse incoming messages before passing them to Lex. I also store session information. One thing I've tried was storing an input_count #, to try to detect if a new input came in before sending the first response.



However, it seems that PHP might be queuing the second input until the first is finished, so there is never a change to my input_count #. So even when the user sends many quick inputs, my bot responds to each one.










share|improve this question
























  • What about adding sometime wait time for next message before sending it to Lex? In the meantime you will have two messages, so you can send them to Lex as one message
    – Damian Dziaduch
    Nov 9 at 11:19










  • Thanks for the suggestion. I'm concerned that will delay all responses, waiting for a second input that might not come. Also, it would probably have the same effect as what I'm doing now which fails because input#2 does not begin to be processed until input#1 is finished. I'm not entirely sure that's what is happening but from my tests, that appears to be the case.
    – Jay A. Little
    Nov 10 at 2:47















up vote
2
down vote

favorite












This must be a common issue but I can't find any sources discussing it. There are a lot on the opposite (sending multiple responses to single request).



There's a common human-to-human chat style where personA quickly sends a second message to add to or correct their first message. That is frequently attempted to be used with a chatbot too, for example:




Bot: Where should we deliver the pizza?

User: 123 main street sprnigfelid

User: springfield

Bot: (response to input #1 )

Bot: (response to input #2 )




Now the problem is if the bot is smart enough to recognize misspellings or open enough to accept them from the first input. The convo would play out like this:




User: 123 main street sprnigfeld

User: springfield

Bot: OK, 123 Main St., Springfield. What state is that in?

Bot: Got it, I will deliver to 123 Main St., Springfield, Springfield. Is that location correct?




There are so many other situations and ways the bot can mistake these multiple rapid inputs and the double responses leave user's wondering what went wrong and confused about where in the conversation they stand.



So has anyone attempted handling of this?



I'm seeking general guidance for an approach, but in case someone has a specific answer, I'm using a PHP Proxy between the User and a Lex bot. I use this Proxy to validate and parse incoming messages before passing them to Lex. I also store session information. One thing I've tried was storing an input_count #, to try to detect if a new input came in before sending the first response.



However, it seems that PHP might be queuing the second input until the first is finished, so there is never a change to my input_count #. So even when the user sends many quick inputs, my bot responds to each one.










share|improve this question
























  • What about adding sometime wait time for next message before sending it to Lex? In the meantime you will have two messages, so you can send them to Lex as one message
    – Damian Dziaduch
    Nov 9 at 11:19










  • Thanks for the suggestion. I'm concerned that will delay all responses, waiting for a second input that might not come. Also, it would probably have the same effect as what I'm doing now which fails because input#2 does not begin to be processed until input#1 is finished. I'm not entirely sure that's what is happening but from my tests, that appears to be the case.
    – Jay A. Little
    Nov 10 at 2:47













up vote
2
down vote

favorite









up vote
2
down vote

favorite











This must be a common issue but I can't find any sources discussing it. There are a lot on the opposite (sending multiple responses to single request).



There's a common human-to-human chat style where personA quickly sends a second message to add to or correct their first message. That is frequently attempted to be used with a chatbot too, for example:




Bot: Where should we deliver the pizza?

User: 123 main street sprnigfelid

User: springfield

Bot: (response to input #1 )

Bot: (response to input #2 )




Now the problem is if the bot is smart enough to recognize misspellings or open enough to accept them from the first input. The convo would play out like this:




User: 123 main street sprnigfeld

User: springfield

Bot: OK, 123 Main St., Springfield. What state is that in?

Bot: Got it, I will deliver to 123 Main St., Springfield, Springfield. Is that location correct?




There are so many other situations and ways the bot can mistake these multiple rapid inputs and the double responses leave user's wondering what went wrong and confused about where in the conversation they stand.



So has anyone attempted handling of this?



I'm seeking general guidance for an approach, but in case someone has a specific answer, I'm using a PHP Proxy between the User and a Lex bot. I use this Proxy to validate and parse incoming messages before passing them to Lex. I also store session information. One thing I've tried was storing an input_count #, to try to detect if a new input came in before sending the first response.



However, it seems that PHP might be queuing the second input until the first is finished, so there is never a change to my input_count #. So even when the user sends many quick inputs, my bot responds to each one.










share|improve this question















This must be a common issue but I can't find any sources discussing it. There are a lot on the opposite (sending multiple responses to single request).



There's a common human-to-human chat style where personA quickly sends a second message to add to or correct their first message. That is frequently attempted to be used with a chatbot too, for example:




Bot: Where should we deliver the pizza?

User: 123 main street sprnigfelid

User: springfield

Bot: (response to input #1 )

Bot: (response to input #2 )




Now the problem is if the bot is smart enough to recognize misspellings or open enough to accept them from the first input. The convo would play out like this:




User: 123 main street sprnigfeld

User: springfield

Bot: OK, 123 Main St., Springfield. What state is that in?

Bot: Got it, I will deliver to 123 Main St., Springfield, Springfield. Is that location correct?




There are so many other situations and ways the bot can mistake these multiple rapid inputs and the double responses leave user's wondering what went wrong and confused about where in the conversation they stand.



So has anyone attempted handling of this?



I'm seeking general guidance for an approach, but in case someone has a specific answer, I'm using a PHP Proxy between the User and a Lex bot. I use this Proxy to validate and parse incoming messages before passing them to Lex. I also store session information. One thing I've tried was storing an input_count #, to try to detect if a new input came in before sending the first response.



However, it seems that PHP might be queuing the second input until the first is finished, so there is never a change to my input_count #. So even when the user sends many quick inputs, my bot responds to each one.







php artificial-intelligence chatbot






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 9 at 15:35









marvinIsSacul

36116




36116










asked Nov 9 at 11:14









Jay A. Little

1,3021418




1,3021418












  • What about adding sometime wait time for next message before sending it to Lex? In the meantime you will have two messages, so you can send them to Lex as one message
    – Damian Dziaduch
    Nov 9 at 11:19










  • Thanks for the suggestion. I'm concerned that will delay all responses, waiting for a second input that might not come. Also, it would probably have the same effect as what I'm doing now which fails because input#2 does not begin to be processed until input#1 is finished. I'm not entirely sure that's what is happening but from my tests, that appears to be the case.
    – Jay A. Little
    Nov 10 at 2:47


















  • What about adding sometime wait time for next message before sending it to Lex? In the meantime you will have two messages, so you can send them to Lex as one message
    – Damian Dziaduch
    Nov 9 at 11:19










  • Thanks for the suggestion. I'm concerned that will delay all responses, waiting for a second input that might not come. Also, it would probably have the same effect as what I'm doing now which fails because input#2 does not begin to be processed until input#1 is finished. I'm not entirely sure that's what is happening but from my tests, that appears to be the case.
    – Jay A. Little
    Nov 10 at 2:47
















What about adding sometime wait time for next message before sending it to Lex? In the meantime you will have two messages, so you can send them to Lex as one message
– Damian Dziaduch
Nov 9 at 11:19




What about adding sometime wait time for next message before sending it to Lex? In the meantime you will have two messages, so you can send them to Lex as one message
– Damian Dziaduch
Nov 9 at 11:19












Thanks for the suggestion. I'm concerned that will delay all responses, waiting for a second input that might not come. Also, it would probably have the same effect as what I'm doing now which fails because input#2 does not begin to be processed until input#1 is finished. I'm not entirely sure that's what is happening but from my tests, that appears to be the case.
– Jay A. Little
Nov 10 at 2:47




Thanks for the suggestion. I'm concerned that will delay all responses, waiting for a second input that might not come. Also, it would probably have the same effect as what I'm doing now which fails because input#2 does not begin to be processed until input#1 is finished. I'm not entirely sure that's what is happening but from my tests, that appears to be the case.
– Jay A. Little
Nov 10 at 2:47












1 Answer
1






active

oldest

votes

















up vote
1
down vote













Current systems for chatbot development do not have mechanisms (or at least explicit mechanisms) to handle these kinds of situations (correct me if I am wrong). It is usually rule based Q/A. Also agree that dealying the input to the chatbot is not a good general solution. What you could do though is to create some wrapper that would check for this scenario. It could work as follows:



Bot: Where should we deliver the pizza?  
User: 123 main street sprnigfelid (you send first input to chatbot)
User: springfield (you send second input to chatbot, you make a note that two inputs were sent before first answer)
Bot: (response to input #1 ) (you receive answer, but you know there was a second input, you wait for second answer)
Bot: (response to input #2 ) (you compare the answers from the chatbot - are they the same?)


The tricky bit is comparing the answers if they are "the same" - if you know the chatbot is responding with the address you could compare the address. You could also detect if the user is fixing a typo right away by comparing the two input messages - if that is the case you could try skipping the second input to the bot altogether and using the context of the conversation from the first answer for continuing the conversation (this is possible with most of the chatbot toolkits).



In general, I think this is not the main issue one usually has when users are communicating with chatbots. In this particular example the chatbot gives two answers but I would say the user got it right and is not confused - I think this is the main goal of the chatbot.






share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53224666%2fchatbot-how-to-recognize-and-handle-multiple-requests-with-single-response%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote













    Current systems for chatbot development do not have mechanisms (or at least explicit mechanisms) to handle these kinds of situations (correct me if I am wrong). It is usually rule based Q/A. Also agree that dealying the input to the chatbot is not a good general solution. What you could do though is to create some wrapper that would check for this scenario. It could work as follows:



    Bot: Where should we deliver the pizza?  
    User: 123 main street sprnigfelid (you send first input to chatbot)
    User: springfield (you send second input to chatbot, you make a note that two inputs were sent before first answer)
    Bot: (response to input #1 ) (you receive answer, but you know there was a second input, you wait for second answer)
    Bot: (response to input #2 ) (you compare the answers from the chatbot - are they the same?)


    The tricky bit is comparing the answers if they are "the same" - if you know the chatbot is responding with the address you could compare the address. You could also detect if the user is fixing a typo right away by comparing the two input messages - if that is the case you could try skipping the second input to the bot altogether and using the context of the conversation from the first answer for continuing the conversation (this is possible with most of the chatbot toolkits).



    In general, I think this is not the main issue one usually has when users are communicating with chatbots. In this particular example the chatbot gives two answers but I would say the user got it right and is not confused - I think this is the main goal of the chatbot.






    share|improve this answer

























      up vote
      1
      down vote













      Current systems for chatbot development do not have mechanisms (or at least explicit mechanisms) to handle these kinds of situations (correct me if I am wrong). It is usually rule based Q/A. Also agree that dealying the input to the chatbot is not a good general solution. What you could do though is to create some wrapper that would check for this scenario. It could work as follows:



      Bot: Where should we deliver the pizza?  
      User: 123 main street sprnigfelid (you send first input to chatbot)
      User: springfield (you send second input to chatbot, you make a note that two inputs were sent before first answer)
      Bot: (response to input #1 ) (you receive answer, but you know there was a second input, you wait for second answer)
      Bot: (response to input #2 ) (you compare the answers from the chatbot - are they the same?)


      The tricky bit is comparing the answers if they are "the same" - if you know the chatbot is responding with the address you could compare the address. You could also detect if the user is fixing a typo right away by comparing the two input messages - if that is the case you could try skipping the second input to the bot altogether and using the context of the conversation from the first answer for continuing the conversation (this is possible with most of the chatbot toolkits).



      In general, I think this is not the main issue one usually has when users are communicating with chatbots. In this particular example the chatbot gives two answers but I would say the user got it right and is not confused - I think this is the main goal of the chatbot.






      share|improve this answer























        up vote
        1
        down vote










        up vote
        1
        down vote









        Current systems for chatbot development do not have mechanisms (or at least explicit mechanisms) to handle these kinds of situations (correct me if I am wrong). It is usually rule based Q/A. Also agree that dealying the input to the chatbot is not a good general solution. What you could do though is to create some wrapper that would check for this scenario. It could work as follows:



        Bot: Where should we deliver the pizza?  
        User: 123 main street sprnigfelid (you send first input to chatbot)
        User: springfield (you send second input to chatbot, you make a note that two inputs were sent before first answer)
        Bot: (response to input #1 ) (you receive answer, but you know there was a second input, you wait for second answer)
        Bot: (response to input #2 ) (you compare the answers from the chatbot - are they the same?)


        The tricky bit is comparing the answers if they are "the same" - if you know the chatbot is responding with the address you could compare the address. You could also detect if the user is fixing a typo right away by comparing the two input messages - if that is the case you could try skipping the second input to the bot altogether and using the context of the conversation from the first answer for continuing the conversation (this is possible with most of the chatbot toolkits).



        In general, I think this is not the main issue one usually has when users are communicating with chatbots. In this particular example the chatbot gives two answers but I would say the user got it right and is not confused - I think this is the main goal of the chatbot.






        share|improve this answer












        Current systems for chatbot development do not have mechanisms (or at least explicit mechanisms) to handle these kinds of situations (correct me if I am wrong). It is usually rule based Q/A. Also agree that dealying the input to the chatbot is not a good general solution. What you could do though is to create some wrapper that would check for this scenario. It could work as follows:



        Bot: Where should we deliver the pizza?  
        User: 123 main street sprnigfelid (you send first input to chatbot)
        User: springfield (you send second input to chatbot, you make a note that two inputs were sent before first answer)
        Bot: (response to input #1 ) (you receive answer, but you know there was a second input, you wait for second answer)
        Bot: (response to input #2 ) (you compare the answers from the chatbot - are they the same?)


        The tricky bit is comparing the answers if they are "the same" - if you know the chatbot is responding with the address you could compare the address. You could also detect if the user is fixing a typo right away by comparing the two input messages - if that is the case you could try skipping the second input to the bot altogether and using the context of the conversation from the first answer for continuing the conversation (this is possible with most of the chatbot toolkits).



        In general, I think this is not the main issue one usually has when users are communicating with chatbots. In this particular example the chatbot gives two answers but I would say the user got it right and is not confused - I think this is the main goal of the chatbot.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 12 at 11:45









        Michal Bida

        1,003322




        1,003322






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53224666%2fchatbot-how-to-recognize-and-handle-multiple-requests-with-single-response%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            這個網誌中的熱門文章

            Xamarin.form Move up view when keyboard appear

            Post-Redirect-Get with Spring WebFlux and Thymeleaf

            Anylogic : not able to use stopDelay()