How to use the @azure/cognitiveservices-qnamaker-runtime.QnAMakerRuntimeClient function in @azure/cognitiveservices-qnamaker-runtime

To help you get started, we’ve selected a few @azure/cognitiveservices-qnamaker-runtime examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Azure-Samples / cognitive-services-quickstart-code / javascript / QnAMaker / sdk / qnamaker_quickstart.js View on Github external
const creds = new msRest.ApiKeyCredentials({ inHeader: { 'Ocp-Apim-Subscription-Key': subscription_key } });
    const qnaMakerClient = new qnamaker.QnAMakerClient(creds, endpoint);
    const knowledgeBaseClient = new qnamaker.Knowledgebase(qnaMakerClient);
    // 

    const knowledgeBaseID = await createKnowledgeBase(qnaMakerClient, knowledgeBaseClient);
    await updateKnowledgeBase(qnaMakerClient, knowledgeBaseClient, knowledgeBaseID);
    await publishKnowledgeBase(knowledgeBaseClient, knowledgeBaseID);
    await downloadKnowledgeBase(knowledgeBaseClient, knowledgeBaseID)
    const primaryQueryRuntimeKey = await getEndpointKeys(qnaMakerClient);

    await listKnowledgeBasesInResource(knowledgeBaseClient)

    // 
    const queryRutimeCredentials = new msRest.ApiKeyCredentials({ inHeader: { 'Authorization': 'EndpointKey ' + primaryQueryRuntimeKey } });
    const runtimeClient = new qnamaker_runtime.QnAMakerRuntimeClient(queryRutimeCredentials, runtime_endpoint);
    // 

    await generateAnswer(runtimeClient, primaryQueryRuntimeKey, knowledgeBaseID)
    await deleteKnowledgeBase(knowledgeBaseClient, knowledgeBaseID)
}
// 

@azure/cognitiveservices-qnamaker-runtime

QnAMakerRuntimeClient Library with typescript type definitions for node.js and browser.

MIT
Latest version published 4 years ago

Package Health Score

62 / 100
Full package analysis

Popular @azure/cognitiveservices-qnamaker-runtime functions