Azure-docs: Multi-Turn - Update API to add multi-turn prompts not working

Created on 2 Jun 2019  Â·  14Comments  Â·  Source: MicrosoftDocs/azure-docs

I want to add multi-turn prompts to an existing QnA kb by using API (patch) but it is not working. Below is an example JSON that I tried to send. I verified that both IDs existed. The page mentioned that adding multi-turn via API is possible - https://docs.microsoft.com/en-us/azure/cognitive-services/qnamaker/how-to/multiturn-conversation#display-order-supported-in-api

{
"update": {
"qnaList": [
{
"questions": {
"add": [
"What is your name?"
]
},
"answer": "I don't have a name.",
"id": 5,
"source": "qna_chitchat_the_professional.tsv",
"context": {
"isContextOnly": true,
"prompts": {
"add": [
{
"displayOrder": 0,
"qnaId": 14,
"qna": null,
"displayText": "Where are you?"
}
]
}
}
}
]
}
}


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Pri1 assigned-to-author cognitive-servicesvc in-progress product-question triaged

All 14 comments

@AngryVirginian Thanks for the feedback! We are currently investigating and will update you shortly.

@AngryVirginian Thanks, From the QnA Portal I am able to add the multi-turn prompts, but not from the Update API.

@AngryVirginian Thanks, I am able to update through API, Could you please try with the below JSON
{
"update": {
"qnaList": [
{
"questions": {
"add": [
"What is your name?"
]
},
"answer": "I don't have a name.",
"id": 5,
"source": "qna_chitchat_the_professional.tsv",
"context": {
"isContextOnly": true,
"promptsToAdd": [
{
"displayOrder": 0,
"qnaId": 14,
"qna": null,
"displayText": "Where are you?"
}
]
}
}
]
}
}
I hope this helps!

@ram-msft. Thanks. That works for adding new prompts. The JSON property name is "promptsToAdd" instead of prompts to add new prompt. However, I could not delete the prompts using the JSON below. How can remove or update an existing prompt?

{
"update": {
"qnaList": [
{
"questions": {
"add": [
"What is your name?"
]
},
"answer": "I don't have a name.",
"id": 5,
"source": "qna_chitchat_the_professional.tsv",
"context": {
"isContextOnly": true,
"promptsToRemove": [
{
"displayOrder": 0,
"qnaId": 14,
"qna": null,
"displayText": "Where are you?"
}
]
}
}
]
}
}

@AngryVirginian Thanks . Use the JSON property name "promptsToDelete".Can you please try with the following json to update the prompt.
{
"update": {
"qnaList": [
{
"questions": {
"add": [
"What is your name?"
]
},
"answer": "I don't have a name.",
"id": 5,
"source": "qna_chitchat_the_professional.tsv",
"context": {
"isContextOnly": true,
"promptsToAdd": [
{
"displayOrder": 0,
"qnaId": 14,
"qna": null,
"displayText": "Where are you dude?"
}
],
"promptsToDelete": [
14
]
}
}
]
}
}
I hope this helps!

@ram-msft That works. Please update the document in this page - https://docs.microsoft.com/en-us/rest/api/cognitiveservices/qnamaker/knowledgebase/update#context - "promptsToAdd" & "promptsToDelete" instead of just "prompts" and close the issue.

The document updation is in progress. @diberry Could you please update the document to "promptsToAdd" & "promptsToDelete" instead of just "prompts".

in-progess

This is a service issue as they manage the swagger file.

please-close

I am a beginner when it comes to programming so pardon my lack of knowledge.
I have an existing knowledge base and bot.
I have read several articles saying that for me to enable multi-turn to my bot I have to edit the code of my bot. Could someone give me a step-by-step of how to do so through the online code editor?

I appreciate the help in advance

@gus1818 - the online code editor will make it very difficult to debug your code. Are you able to develop offline? I'll look for code that shows step by step.

@diberry thank you for the help !
I tried to get my bot on the emulator but I was not able to connect successfully...
would you be able to explain how I can connect and existing bot to the emulator and then from there edit the code to allow for multi-turn?
I am very bad with coding so if you could please send step-by-step it would be very helpful.

Once again, thank you for the help!

@gus1818 - please post your bot emulator issues to their repo. Feel free to link the issue here on this issue. The level of functionality you are looking for is in this sample - you do need to understand the code to make it work. A step by step procedure won't be helpful if you don't understand what each step does programmatically.

@AngryVirginian We will now proceed to close this thread. If there are further questions regarding this matter, please tag me in your reply. We will gladly continue the discussion and we will reopen the issue.

Was this page helpful?
0 / 5 - 0 ratings