GenerateAnswer call to query the knowledgebase.
POST {RuntimeEndpoint}/qnamaker/knowledgebases/{kbId}/generateAnswer URI Parameters Name In Required Type Description kbId path Truestring
Knowledgebase id.
RuntimeEndpoint path Truestring
QnA Maker App Service endpoint (for example: https://{qnaservice-hostname}.azurewebsites.net).
Request Header Name Required Type Description Authorization Truestring
Request Body Name Type Description contextContext
Context object with previous QnA's information.
isTestboolean
Query against the test index.
qnaIdstring
Exact qnaId to fetch from the knowledgebase, this field takes priority over question.
questionstring
User question to query against the knowledge base.
rankerTypestring
Optional field. Set to 'QuestionOnly' for using a question only Ranker.
scoreThresholdnumber
Threshold for answers returned based on score.
strictFiltersMetadataDTO[]
Find only answers that contain these metadata.
strictFiltersCompoundOperationTypeStrictFiltersCompoundOperationType
Optional field. Set to OR for using OR as Operation for Strict Filters.
topinteger (int32)
Max number of answers to be returned for the question.
userIdstring
Unique identifier for the user. Optional parameter for telemetry. For more information, refer Analytics and Telemetry.
Responses Name Type Description 200 OKQnASearchResultList
GenerateAnswer call response.
Other Status CodesErrorResponse
Error response.
Security AuthorizationType: apiKey In: header
Examples Successful query Sample request HTTP POST {RuntimeEndpoint}/qnamaker/knowledgebases/9d091697-fb8c-4ed5-9ac0-35bf8273bfff/generateAnswer { "question": "qna maker and luis", "top": 6, "isTest": true, "scoreThreshold": 20, "strictFilters": [ { "name": "category", "value": "api" } ], "userId": "sd53lsY=" } Sample response Status code: 200 { "answers": [ { "score": 28.54820341616869, "id": 20, "answer": "There is no direct integration of LUIS with QnA Maker. But, in your bot code, you can use LUIS and QnA Maker together.", "source": "Custom Editorial", "questions": [ "How can I integrate LUIS with QnA Maker?" ], "metadata": [ { "name": "category", "value": "api" } ] } ] } Definitions Name Description ContextContext of a QnA
ErrorThe error object. As per Microsoft One API guidelines - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses.
ErrorCodeTypeOne of a server-defined set of error codes.
ErrorResponseError response. As per Microsoft One API guidelines - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses.
InnerErrorModelAn object containing more specific information about the error. As per Microsoft One API guidelines - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses.
MetadataDTOName - value pair of metadata.
PromptDTOPrompt for an answer.
QnaQnADTO - Either QnaId or QnADTO needs to be present in a PromptDTO object
QnASearchResultRepresents Search Result.
QnASearchResultListRepresents List of Question Answers.
QueryDTOPOST body schema to query the knowledgebase.
StrictFiltersCompoundOperationTypeOptional field. Set to OR for using OR as Operation for Strict Filters.
Context ObjectContext of a QnA
Name Type Description isContextOnlyboolean
To mark if a prompt is relevant only with a previous question or not. true - Do not include this QnA as search result for queries without context false - ignores context and includes this QnA in search result
promptsPromptDTO[]
List of prompts associated with the answer.
Error ObjectThe error object. As per Microsoft One API guidelines - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses.
Name Type Description codeErrorCodeType
One of a server-defined set of error codes.
detailsError[]
An array of details about specific errors that led to this reported error.
innerErrorInnerErrorModel
An object containing more specific information than the current object about the error.
messagestring
A human-readable representation of the error.
targetstring
The target of the error.
ErrorCodeType EnumerationOne of a server-defined set of error codes.
Value Description BadArgument Forbidden NotFound KbNotFound Unauthorized Unspecified EndpointKeysError QuotaExceeded QnaRuntimeError SKULimitExceeded OperationNotFound ServiceError ValidationFailure ExtractionFailure ErrorResponse ObjectError response. As per Microsoft One API guidelines - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses.
Name Type Description errorError
The error object.
InnerErrorModel ObjectAn object containing more specific information about the error. As per Microsoft One API guidelines - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses.
Name Type Description codestring
A more specific error code than was provided by the containing error.
innerErrorInnerErrorModel
An object containing more specific information than the current object about the error.
MetadataDTO ObjectName - value pair of metadata.
Name Type Description namestring
minLength: 1maxLength: 100Metadata name.
valuestring
minLength: 1maxLength: 500Metadata value.
PromptDTO ObjectPrompt for an answer.
Name Type Description displayOrderinteger (int32)
Index of the prompt - used in ordering of the prompts
displayTextstring
maxLength: 200Text displayed to represent a follow up question prompt
qnaQna
QnADTO - Either QnaId or QnADTO needs to be present in a PromptDTO object
qnaIdinteger (int32)
Qna id corresponding to the prompt - if QnaId is present, QnADTO object is ignored.
Qna ObjectQnADTO - Either QnaId or QnADTO needs to be present in a PromptDTO object
Name Type Description answerstring
minLength: 1maxLength: 25000Answer text
contextContext
Context of a QnA
idinteger (int32)
Unique id for the Q-A.
metadataMetadataDTO[]
List of metadata associated with the answer.
questionsstring[]
List of questions associated with the answer.
sourcestring
maxLength: 300Source from which Q-A was indexed. eg. https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs
QnASearchResult ObjectRepresents Search Result.
Name Type Description answerstring
Answer.
contextContext
Context object of the QnA
idinteger (int32)
Id of the QnA result.
metadataMetadataDTO[]
List of metadata.
questionsstring[]
List of questions.
scorenumber
Search result score.
sourcestring
Source of QnA result.
QnASearchResultList ObjectRepresents List of Question Answers.
Name Type Description answersQnASearchResult[]
Represents Search Result list.
QueryDTO ObjectPOST body schema to query the knowledgebase.
Name Type Description contextContext
Context object with previous QnA's information.
isTestboolean
Query against the test index.
qnaIdstring
Exact qnaId to fetch from the knowledgebase, this field takes priority over question.
questionstring
User question to query against the knowledge base.
rankerTypestring
Optional field. Set to 'QuestionOnly' for using a question only Ranker.
scoreThresholdnumber
Threshold for answers returned based on score.
strictFiltersMetadataDTO[]
Find only answers that contain these metadata.
strictFiltersCompoundOperationTypeStrictFiltersCompoundOperationType
Optional field. Set to OR for using OR as Operation for Strict Filters.
topinteger (int32)
Max number of answers to be returned for the question.
userIdstring
Unique identifier for the user. Optional parameter for telemetry. For more information, refer Analytics and Telemetry.
StrictFiltersCompoundOperationType EnumerationOptional field. Set to OR for using OR as Operation for Strict Filters.
Value Description AND OR