Giter Club home page Giter Club logo

Comments (7)

jangidms avatar jangidms commented on June 20, 2024

Hi @amendlik Thanks for reporting this
We'll look into this and get back to you

from qnabot-on-aws.

amendlik avatar amendlik commented on June 20, 2024

Hello @jangidms - any updates on this? I can work on the fix if you can point me in the right direction.

from qnabot-on-aws.

jangidms avatar jangidms commented on June 20, 2024

Hi @amendlik
I looked into this scenario and I see that currently Document Chaining is not supported when using intent & slots. It is working as expected.
When processing request with QnaIntent, QnABot injects qid in the request (Link to Request Parsing Code)
When evaluating conditional chaining, QnABot updates the question in the request to chaining question (Conditional Chaining Code)
But since request also has qid field, that takes precedence over question when making OpenSearch request (OpenSearch Request logic)

You could try to customize QnABot as per your use case, or open a new enhancement request which we'll add to our backlog

from qnabot-on-aws.

amendlik avatar amendlik commented on June 20, 2024

@bobpskier I've been testing a solution that just deletes qid from the structure by adding this code to evaluateConditionalChaining()

    if(req.hasOwnProperty('qid')) {
        delete req['qid'];
    }

It's working fine so far. I have not encountered any negative effects.

from qnabot-on-aws.

bobpskier avatar bobpskier commented on June 20, 2024

@amendlik I'd probably implement something similar in evaluateConditionalChaining.js starting at line 100

if (next_q) {
        req.question = next_q;
        if (next_q.toLowerCase().startsWith('qid::')) {
            _.set(req,'qid', next_q.substr(5));
        } else {
            _.set(req,'qid', undefined);
        }
        [req, res, hit2, errors] = await getHit(req, res);
    }

This updates req.qid to be the actual target qid of the chaining config if it is specified as a "qid::" or removes qid if not specified in that format.

The intent/slot mechanism is not a good citizen in the word of QnABot chaining. It looks like it can only be used in the first qid that kicks off a series of chained qids. If in the middle of the chain of questions, a qid is specified that also uses intents/slots, the chaining mechanism will skip right over asking to resolve the slot values. The intent/slot mechanism only works at the beginning of the chain when Lex can call QnABot fulfillment using a DialogCodeHook with the intent/slots as the context.

If you want to conditionally ask for values in one of more qids via chaining, it is better to use ElicitResponse bots as they support the concept of chaining.

from qnabot-on-aws.

amendlik avatar amendlik commented on June 20, 2024

This fix is working well for us. @bobpskier, do you want to upstream that, or would you like me to do it?

from qnabot-on-aws.

fhoueto-amz avatar fhoueto-amz commented on June 20, 2024

@amendlik can you please submit a PR if you want us to consider as improvementÉ
Closing this

from qnabot-on-aws.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.