BotBuilder-Samples icon indicating copy to clipboard operation
BotBuilder-Samples copied to clipboard

QnAPrompting sample does not deserialize metadata tags correctly

Open kds-snyder opened this issue 7 years ago • 5 comments

Sample information

  1. Sample type: \samples\experimental\qnamaker-prompting
  2. Sample language: dotnetcore
  3. Sample name: QnAPrompting

Describe the bug

When the QnA KB is queried with a question where the answer contains metadata tags, the metadata in the result returned by QnAService.QueryQnAServiceAsync is null. This is because in QnAResult.cs, Metadata is defined with { get; } instead of { get; set; }.

To Reproduce

Steps to reproduce the behavior:

  1. Go to the QnA KB being used for testing
  2. Add a metadata tag to one of the question-answer pairs
  3. Click Save and train
  4. Click the Publish tab, and then click Publish
  5. Run the QnAPrompting sample, and set a breakpoint in QnAService.QueryQnAServiceAsync at the line containing return result.Answers;
  6. Start the emulator and connect it to the QnAPrompting bot
  7. In the emulator, enter the question where you added a metadata tag
  8. At the breakpoint, examine Metadata in result.Answers. You will see that it is null for all answers, including the answer that has a metadata tag

Expected behavior

For the answer that has a metadata tag, Metadata should contain the metadata tag name and value.

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

This bug can be fixed by modifying QnAResult.cs at the line where Metadata is defined, to change {get; } to {get; set; }

[bug]

kds-snyder avatar Aug 19 '19 17:08 kds-snyder

Hey @rokulka , can you look at this customer issue? Thanks.

axelsrz avatar Aug 19 '19 18:08 axelsrz

@rokulka wanted to chime in that I was able to repro what @kds-snyder reported and adding screen shots for context


Running qnamaker-prompting sample as is

My KB - Q&A pairs with metadata

image

Breakpoint to view qnaResult in QnADialog.cs.

  • Metadata is null for all results returned from generateAnswer API call image

Updating QnAResult.cs

  • Updated to public QnAMetadata[] Metadata { get; set; }

Breakpoint again to view qnaResult in QnADialog.cs with being able to set Metadata

image

  • Metadata for an answer without Metadata is now []
  • For answers with Metadata, results now properly show Metadata[]

Zerryth avatar Aug 19 '19 21:08 Zerryth

I'm looking into it.

rokulka avatar Aug 20 '19 18:08 rokulka

Hi @kds-snyder : Thanks again for reporting. Let us know if this doesn't address your issue.

daveta avatar Aug 30 '19 19:08 daveta

@axelsrz, @rokulka, @Zerryth, @trojenguri, @daveta, thanks for your quick resolution of this issue.

kds-snyder avatar Sep 05 '19 16:09 kds-snyder