Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const main = async () => {
//
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);
//
const main = async () => {
//
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)