GenerateAnswerUtils Class

  • java.lang.Object
    • com.microsoft.bot.ai.qna.utils.GenerateAnswerUtils

public class GenerateAnswerUtils

Helper class for Generate Answer API.

Constructor Summary

Constructor Description
GenerateAnswerUtils(QnAMakerEndpoint withEndpoint, QnAMakerOptions withOptions)

Initializes a new instance of the GenerateAnswerUtils class.

Method Summary

Modifier and Type Method and Description
java.util.concurrent.CompletableFuture<QueryResult[]> getAnswers(TurnContext turnContext, Activity messageActivity, QnAMakerOptions withOptions)

Generates an answer from the knowledge base.

java.util.concurrent.CompletableFuture<QueryResults> getAnswersRaw(TurnContext turnContext, Activity messageActivity, QnAMakerOptions withOptions)

Generates an answer from the knowledge base.

QnAMakerOptions getOptions()

Gets qnA Maker options.

void setOptions(QnAMakerOptions withOptions)

Sets qnA Maker options.

Methods inherited from java.lang.Object

java.lang.Object.clone java.lang.Object.equals java.lang.Object.finalize java.lang.Object.getClass java.lang.Object.hashCode java.lang.Object.notify java.lang.Object.notifyAll java.lang.Object.toString java.lang.Object.wait java.lang.Object.wait java.lang.Object.wait

Constructor Details

GenerateAnswerUtils

public GenerateAnswerUtils(QnAMakerEndpoint withEndpoint, QnAMakerOptions withOptions)

Initializes a new instance of the GenerateAnswerUtils class.

Parameters:

withEndpoint - QnA Maker endpoint details.
withOptions - QnA Maker options.

Method Details

getAnswers


public CompletableFuture getAnswers(TurnContext turnContext, Activity messageActivity, QnAMakerOptions withOptions)

Generates an answer from the knowledge base.

Parameters:

turnContext - The Turn Context that contains the user question to be queried against your knowledge base.
messageActivity - Message activity of the turn context.
withOptions - The options for the QnA Maker knowledge base. If null, constructor option is used for this instance.

Returns:

A list of answers for the user query, sorted in decreasing order of ranking score.

Throws:

java.io.IOException - IOException

getAnswersRaw

public CompletableFuture getAnswersRaw(TurnContext turnContext, Activity messageActivity, QnAMakerOptions withOptions)

Generates an answer from the knowledge base.

Parameters:

turnContext - The Turn Context that contains the user question to be queried against your knowledge base.
messageActivity - Message activity of the turn context.
withOptions - The options for the QnA Maker knowledge base. If null, constructor option is used for this instance.

Returns:

A list of answers for the user query, sorted in decreasing order of ranking score.

getOptions

public QnAMakerOptions getOptions()

Gets qnA Maker options.

Returns:

The options for QnAMaker.

setOptions

public void setOptions(QnAMakerOptions withOptions)

Sets qnA Maker options.

Parameters:

withOptions - The options for QnAMaker.

Applies to