Skip to content
This repository has been archived by the owner on May 5, 2023. It is now read-only.

[AutoPR cognitiveservices/data-plane/QnAMaker] Adding API For QnAMaker v4.0 #4115

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions lib/services/cognitiveServices/qnamaker/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2018 Microsoft

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
41 changes: 41 additions & 0 deletions lib/services/cognitiveServices/qnamaker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
uid: azure-cognitiveservices-qnamaker
summary: *content

---
**This SDK will be deprecated next year and will be replaced by a new TypeScript-based isomorphic SDK (found at https://github.com/Azure/azure-sdk-for-js) which works on Node.js and browsers.**
## Microsoft Azure SDK for Node.js - QnAMakerClient
This project provides a Node.js package for accessing Azure. Right now it supports:
- **Node.js version 6.x.x or higher**

### Features


### How to Install

```bash
npm install azure-cognitiveservices-qnamaker
```

### How to use

#### Authentication, client creation and getKeys endpoint as an example.

```javascript
const msRest = require("ms-rest");
const QnAMakerClient = require("azure-cognitiveservices-qnamaker");
const token = "<access_token>";
const creds = new msRest.TokenCredentials(token);
const subscriptionId = "<Subscription_Id>";
const client = new QnAMakerClient(creds, subscriptionId);
client.endpoint.getKeys().then((result) => {
console.log("The result is:");
console.log(result);
}).catch((err) => {
console.log('An error occurred:');
console.dir(err, {depth: null, colors: true});
});

### Related projects

- [Microsoft Azure SDK for Node.js](https://github.com/Azure/azure-sdk-for-node)
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/

'use strict';

/**
* Collection of words that are synonyms.
*
*/
class AlterationsDTO {
/**
* Create a AlterationsDTO.
* @property {array} alterations Words that are synonymous with each other.
*/
constructor() {
}

/**
* Defines the metadata of AlterationsDTO
*
* @returns {object} metadata of AlterationsDTO
*
*/
mapper() {
return {
required: false,
serializedName: 'AlterationsDTO',
type: {
name: 'Composite',
className: 'AlterationsDTO',
modelProperties: {
alterations: {
required: true,
serializedName: 'alterations',
type: {
name: 'Sequence',
element: {
required: false,
serializedName: 'StringElementType',
type: {
name: 'String'
}
}
}
}
}
}
};
}
}

module.exports = AlterationsDTO;
104 changes: 104 additions & 0 deletions lib/services/cognitiveServices/qnamaker/lib/models/createKbDTO.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/

'use strict';

/**
* Post body schema for CreateKb operation.
*
*/
class CreateKbDTO {
/**
* Create a CreateKbDTO.
* @property {string} name Friendly name for the knowledgebase.
* @property {array} [qnaList] List of Q-A (QnADTO) to be added to the
* knowledgebase. Q-A Ids are assigned by the service and should be omitted.
* @property {array} [urls] List of URLs to be used for extracting Q-A.
* @property {array} [files] List of files from which to Extract Q-A.
*/
constructor() {
}

/**
* Defines the metadata of CreateKbDTO
*
* @returns {object} metadata of CreateKbDTO
*
*/
mapper() {
return {
required: false,
serializedName: 'CreateKbDTO',
type: {
name: 'Composite',
className: 'CreateKbDTO',
modelProperties: {
name: {
required: true,
serializedName: 'name',
constraints: {
MaxLength: 100,
MinLength: 1
},
type: {
name: 'String'
}
},
qnaList: {
required: false,
serializedName: 'qnaList',
type: {
name: 'Sequence',
element: {
required: false,
serializedName: 'QnADTOElementType',
type: {
name: 'Composite',
className: 'QnADTO'
}
}
}
},
urls: {
required: false,
serializedName: 'urls',
type: {
name: 'Sequence',
element: {
required: false,
serializedName: 'StringElementType',
type: {
name: 'String'
}
}
}
},
files: {
required: false,
serializedName: 'files',
type: {
name: 'Sequence',
element: {
required: false,
serializedName: 'FileDTOElementType',
type: {
name: 'Composite',
className: 'FileDTO'
}
}
}
}
}
}
};
}
}

module.exports = CreateKbDTO;
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/

'use strict';

/**
* Input to create KB.
*
*/
class CreateKbInputDTO {
/**
* Create a CreateKbInputDTO.
* @property {array} [qnaList] List of QNA to be added to the index. Ids are
* generated by the service and should be omitted.
* @property {array} [urls] List of URLs to be added to knowledgebase.
* @property {array} [files] List of files to be added to knowledgebase.
*/
constructor() {
}

/**
* Defines the metadata of CreateKbInputDTO
*
* @returns {object} metadata of CreateKbInputDTO
*
*/
mapper() {
return {
required: false,
serializedName: 'CreateKbInputDTO',
type: {
name: 'Composite',
className: 'CreateKbInputDTO',
modelProperties: {
qnaList: {
required: false,
serializedName: 'qnaList',
type: {
name: 'Sequence',
element: {
required: false,
serializedName: 'QnADTOElementType',
type: {
name: 'Composite',
className: 'QnADTO'
}
}
}
},
urls: {
required: false,
serializedName: 'urls',
type: {
name: 'Sequence',
element: {
required: false,
serializedName: 'StringElementType',
type: {
name: 'String'
}
}
}
},
files: {
required: false,
serializedName: 'files',
type: {
name: 'Sequence',
element: {
required: false,
serializedName: 'FileDTOElementType',
type: {
name: 'Composite',
className: 'FileDTO'
}
}
}
}
}
}
};
}
}

module.exports = CreateKbInputDTO;
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/

'use strict';

/**
* PATCH body schema of Delete Operation in UpdateKb
*
*/
class DeleteKbContentsDTO {
/**
* Create a DeleteKbContentsDTO.
* @property {array} [ids] List of Qna Ids to be deleted
* @property {array} [sources] List of sources to be deleted from
* knowledgebase.
*/
constructor() {
}

/**
* Defines the metadata of DeleteKbContentsDTO
*
* @returns {object} metadata of DeleteKbContentsDTO
*
*/
mapper() {
return {
required: false,
serializedName: 'DeleteKbContentsDTO',
type: {
name: 'Composite',
className: 'DeleteKbContentsDTO',
modelProperties: {
ids: {
required: false,
serializedName: 'ids',
type: {
name: 'Sequence',
element: {
required: false,
serializedName: 'NumberElementType',
type: {
name: 'Number'
}
}
}
},
sources: {
required: false,
serializedName: 'sources',
type: {
name: 'Sequence',
element: {
required: false,
serializedName: 'StringElementType',
type: {
name: 'String'
}
}
}
}
}
}
};
}
}

module.exports = DeleteKbContentsDTO;
Loading