User Profile
ChristianGross
Copper Contributor
Joined Jan 04, 2019
User Widgets
Recent Discussions
QnA Maker API - How to programatically delete structured QnA files?
Hello all, I am working on a programmatic solution to feed QnAs into QnA Maker. In order to do so, I use the API to provide structured data, as outlined here https://docs.microsoft.com/en-us/azure/cognitive-services/qnamaker/concepts/data-sources-supported#structured-data-format-through-import The reason is, I cannot use files nor urls and thus leave these fields blank when submitting my data. The input I being used looks like {"id":<Integer>, "answer":"<Textual Content>", "questions":["<Textual Content>"], "metadata":[]} As it turns out, I cannot provide any URLs, as the repositories are on premise and cannot be accessed by QnA Maker. Now, my observation is that I cannot programatically delete my documents using the "id" which I provided in the initial submission. Actually, it appears that QnA Maker replaces my "id" by some internal counting which starts from 0 for fresh KBs. Thus, it turns out that I can delete my Q&As if I just guess these ids. My questions therefore are: Is the above observation correct? A hint pointing at the documentation on how these ids which are needed for deleting would be helpful. If yes, are there any thoughts of extending the behavior toward a fallback approach, i.e., only if no "id" is given, this counting starting from 0 is used? In the meantime, is there a way to programtically retrieve this internal "id" from QnA Maker, ideally as part of the success response? Thank you!4.9KViews0likes6CommentsRe: QnA Maker API - How to programatically delete structured QnA files?
Hi Dhina, the thing is that { "delete": { "sources": [ "Custom Editorial" ] } } in your above JSON empties the entire source. Thus, not only document 3001 is deleted but in my tests also document 3002. Thank you and best regards Christian4.7KViews0likes2CommentsRe: QnA Maker API - How to programatically delete structured QnA files?
Hi Dhina, I tried to reproduce your suggestion. I submitted your JSON but the Ids got ignored again. What I did is I used the patch snippet from https://docs.microsoft.com/en-us/azure/cognitive-services/qnamaker/quickstarts/java#Update to submit your JSON. If I download the knowledge base, I receive the following { "qnaDocuments": [ { "id": 188, "answer": "You can change the default message if you use the QnAMakerDialog. See this for details: https://docs.botframework.com/en-us/azure-bot-service/templates/qnamaker/#navtitle", "source": "Custom Editorial", "questions": [ "How can I change the default message from QnA Maker?" ], "metadata": [], "alternateQuestionClusters": [], "changeStatus": "Update", "kbId": "..." }, { "id": 189, "answer": "You can use our REST apis to manage your KB. See here for details: https://westus.dev.cognitive.microsoft.com/docs/services/58994a073d9e04097c7ba6fe/operations/58994a0...", "source": "Custom Editorial", "questions": [ "How do I programmatically update my KB?" ], "metadata": [], "alternateQuestionClusters": [], "changeStatus": "Update", "kbId": "..." } ] } As you see, the ids 188 and 189 rather than 3001 and 3002. Is there anything obvious what I can do wrong at client side to have the Ids not be used within the QnA Maker? Best regards Christian4.7KViews0likes4Comments
Recent Blog Articles
No content to show