Sdílet prostřednictvím


QuestionAnsweringClient.GetAnswersAsync Method

Definition

Overloads

GetAnswersAsync(Int32, QuestionAnsweringProject, AnswersOptions, CancellationToken)

Gets the specified QnA.

GetAnswersAsync(String, QuestionAnsweringProject, AnswersOptions, CancellationToken)

Answers the specified question using your knowledge base.

GetAnswersAsync(Int32, QuestionAnsweringProject, AnswersOptions, CancellationToken)

Source:
QuestionAnsweringClient.cs

Gets the specified QnA.

public virtual System.Threading.Tasks.Task<Azure.Response<Azure.AI.Language.QuestionAnswering.AnswersResult>> GetAnswersAsync (int qnaId, Azure.AI.Language.QuestionAnswering.QuestionAnsweringProject project, Azure.AI.Language.QuestionAnswering.AnswersOptions options = default, System.Threading.CancellationToken cancellationToken = default);
abstract member GetAnswersAsync : int * Azure.AI.Language.QuestionAnswering.QuestionAnsweringProject * Azure.AI.Language.QuestionAnswering.AnswersOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.AI.Language.QuestionAnswering.AnswersResult>>
override this.GetAnswersAsync : int * Azure.AI.Language.QuestionAnswering.QuestionAnsweringProject * Azure.AI.Language.QuestionAnswering.AnswersOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.AI.Language.QuestionAnswering.AnswersResult>>
Public Overridable Function GetAnswersAsync (qnaId As Integer, project As QuestionAnsweringProject, Optional options As AnswersOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of AnswersResult))

Parameters

qnaId
Int32

The exact QnA ID to fetch from the knowledge base.

options
AnswersOptions

Optional AnswersOptions with additional query options.

cancellationToken
CancellationToken

An optional CancellationToken to cancel the request.

Returns

An AnswersResult containing answers from the knowledge base to the specified question.

Exceptions

project is null.

The service returned an error. The exception contains details of the service error.

Applies to

GetAnswersAsync(String, QuestionAnsweringProject, AnswersOptions, CancellationToken)

Source:
QuestionAnsweringClient.cs

Answers the specified question using your knowledge base.

public virtual System.Threading.Tasks.Task<Azure.Response<Azure.AI.Language.QuestionAnswering.AnswersResult>> GetAnswersAsync (string question, Azure.AI.Language.QuestionAnswering.QuestionAnsweringProject project, Azure.AI.Language.QuestionAnswering.AnswersOptions options = default, System.Threading.CancellationToken cancellationToken = default);
abstract member GetAnswersAsync : string * Azure.AI.Language.QuestionAnswering.QuestionAnsweringProject * Azure.AI.Language.QuestionAnswering.AnswersOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.AI.Language.QuestionAnswering.AnswersResult>>
override this.GetAnswersAsync : string * Azure.AI.Language.QuestionAnswering.QuestionAnsweringProject * Azure.AI.Language.QuestionAnswering.AnswersOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.AI.Language.QuestionAnswering.AnswersResult>>
Public Overridable Function GetAnswersAsync (question As String, project As QuestionAnsweringProject, Optional options As AnswersOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of AnswersResult))

Parameters

question
String

The question to ask of the knowledge base.

options
AnswersOptions

Optional AnswersOptions with additional query options.

cancellationToken
CancellationToken

An optional CancellationToken to cancel the request.

Returns

An AnswersResult containing answers from the knowledge base to the specified question.

Exceptions

question is an empty string.

question or project is null.

The service returned an error. The exception contains details of the service error.

Applies to