QuestionAnsweringClient.GetAnswersFromText Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| Name | Description |
|---|---|
| GetAnswersFromText(AnswersFromTextOptions, CancellationToken) |
Answers the specified question using the provided text in the body. |
| GetAnswersFromText(RequestContent, RequestContext) |
[Protocol Method] Answers the specified question using the provided text in the body.
|
| GetAnswersFromText(String, IEnumerable<TextDocument>, String, CancellationToken) |
Answers the specified question using the provided text documents (synchronous, with TextDocument collection). |
| GetAnswersFromText(String, IEnumerable<String>, String, CancellationToken) |
Answers the specified question using the provided text documents (synchronous). |
GetAnswersFromText(AnswersFromTextOptions, CancellationToken)
- Source:
- QuestionAnsweringClient.cs
Answers the specified question using the provided text in the body.
public virtual Azure.Response<Azure.AI.Language.QuestionAnswering.Inference.AnswersFromTextResult> GetAnswersFromText(Azure.AI.Language.QuestionAnswering.Inference.AnswersFromTextOptions textQueryOptions, System.Threading.CancellationToken cancellationToken = default);
abstract member GetAnswersFromText : Azure.AI.Language.QuestionAnswering.Inference.AnswersFromTextOptions * System.Threading.CancellationToken -> Azure.Response<Azure.AI.Language.QuestionAnswering.Inference.AnswersFromTextResult>
override this.GetAnswersFromText : Azure.AI.Language.QuestionAnswering.Inference.AnswersFromTextOptions * System.Threading.CancellationToken -> Azure.Response<Azure.AI.Language.QuestionAnswering.Inference.AnswersFromTextResult>
Public Overridable Function GetAnswersFromText (textQueryOptions As AnswersFromTextOptions, Optional cancellationToken As CancellationToken = Nothing) As Response(Of AnswersFromTextResult)
Parameters
- textQueryOptions
- AnswersFromTextOptions
Post body of the request.
- cancellationToken
- CancellationToken
The cancellation token to use.
Returns
Exceptions
textQueryOptions is null.
Applies to
GetAnswersFromText(RequestContent, RequestContext)
- Source:
- QuestionAnsweringClient.cs
[Protocol Method] Answers the specified question using the provided text in the body.
- This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
- Please try the simpler GetAnswersFromText(AnswersFromTextOptions, CancellationToken) convenience overload with strongly typed models first.
public virtual Azure.Response GetAnswersFromText(Azure.Core.RequestContent content, Azure.RequestContext context = default);
abstract member GetAnswersFromText : Azure.Core.RequestContent * Azure.RequestContext -> Azure.Response
override this.GetAnswersFromText : Azure.Core.RequestContent * Azure.RequestContext -> Azure.Response
Public Overridable Function GetAnswersFromText (content As RequestContent, Optional context As RequestContext = Nothing) As Response
Parameters
- content
- RequestContent
The content to send as the body of the request.
- context
- RequestContext
The request context, which can override default behaviors of the client pipeline on a per-call basis.
Returns
The response returned from the service.
Exceptions
content is null.
Service returned a non-success status code.
Applies to
GetAnswersFromText(String, IEnumerable<TextDocument>, String, CancellationToken)
- Source:
- QuestionAnsweringClient.cs
Answers the specified question using the provided text documents (synchronous, with TextDocument collection).
public virtual Azure.Response<Azure.AI.Language.QuestionAnswering.Inference.AnswersFromTextResult> GetAnswersFromText(string question, System.Collections.Generic.IEnumerable<Azure.AI.Language.QuestionAnswering.Inference.TextDocument> textDocuments, string language = default, System.Threading.CancellationToken cancellationToken = default);
abstract member GetAnswersFromText : string * seq<Azure.AI.Language.QuestionAnswering.Inference.TextDocument> * string * System.Threading.CancellationToken -> Azure.Response<Azure.AI.Language.QuestionAnswering.Inference.AnswersFromTextResult>
override this.GetAnswersFromText : string * seq<Azure.AI.Language.QuestionAnswering.Inference.TextDocument> * string * System.Threading.CancellationToken -> Azure.Response<Azure.AI.Language.QuestionAnswering.Inference.AnswersFromTextResult>
Public Overridable Function GetAnswersFromText (question As String, textDocuments As IEnumerable(Of TextDocument), Optional language As String = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Response(Of AnswersFromTextResult)
Parameters
- question
- String
The question to answer.
- textDocuments
- IEnumerable<TextDocument>
A collection of TextDocument to query.
- language
- String
The language of the text documents. This is the BCP-47 representation of a language. For example, use "en" for English, "es" for Spanish, etc. If not set, uses DefaultLanguage as the default, which falls back to the service default "en" when not configured.
- cancellationToken
- CancellationToken
An optional CancellationToken to cancel the request.
Returns
AnswersFromTextResult containing answers to the question.
Exceptions
question or textDocuments is null.
The service returned an error. The exception contains details of the service error.
Applies to
GetAnswersFromText(String, IEnumerable<String>, String, CancellationToken)
- Source:
- QuestionAnsweringClient.cs
Answers the specified question using the provided text documents (synchronous).
public virtual Azure.Response<Azure.AI.Language.QuestionAnswering.Inference.AnswersFromTextResult> GetAnswersFromText(string question, System.Collections.Generic.IEnumerable<string> textDocuments, string language = default, System.Threading.CancellationToken cancellationToken = default);
abstract member GetAnswersFromText : string * seq<string> * string * System.Threading.CancellationToken -> Azure.Response<Azure.AI.Language.QuestionAnswering.Inference.AnswersFromTextResult>
override this.GetAnswersFromText : string * seq<string> * string * System.Threading.CancellationToken -> Azure.Response<Azure.AI.Language.QuestionAnswering.Inference.AnswersFromTextResult>
Public Overridable Function GetAnswersFromText (question As String, textDocuments As IEnumerable(Of String), Optional language As String = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Response(Of AnswersFromTextResult)
Parameters
- question
- String
The question to answer.
- textDocuments
- IEnumerable<String>
The text documents to query.
- language
- String
The language of the text documents. This is the BCP-47 representation of a language. For example, use "en" for English, "es" for Spanish, etc. If not set, uses DefaultLanguage as the default, which falls back to the service default "en" when not configured.
- cancellationToken
- CancellationToken
An optional CancellationToken to cancel the request.
Returns
AnswersFromTextResult containing answers to the question.
Exceptions
question or textDocuments is null.
The service returned an error. The exception contains details of the service error.