Method AnswerQuestionAsync
- Namespace
- MailFathom.Application.Retrieval.AskMail
- Assembly
- MailFathom.Application.dll
AnswerQuestionAsync(AskMailRequest, CancellationToken)
Answers one question from the mail within its scope.
public Task<AskMailResult> AnswerQuestionAsync(AskMailRequest request, CancellationToken cancellationToken)
Parameters
requestAskMailRequestWhat the caller asked.
cancellationTokenCancellationTokenPropagates caller cancellation, which ends the run and every provider call remaining in it.
Returns
- Task<AskMailResult>
The answer, the emails it was drawn from, and whether either had to be cut.
Remarks
The request is validated before the capability is read, so a deployment that answers questions and one that does not refuse a malformed question identically. The reverse order would let a caller learn which capabilities a server has by watching which of two refusals a broken request produces.
The period allowance is taken after the capability is read and before the run begins, which is the last point at which nothing has been spent. Taking it earlier would count a question a deployment was never going to answer against a ceiling on what it spends.
Nothing above that point is a run, which is why nothing above it is reported as one. A question this deployment does not serve and one the period has no allowance for both end before a model is reached, and recording either as a run that read no mail would put a refusal among the answers.
Exceptions
- ArgumentNullException
Thrown when
requestis null.- MailboxQueryFilterInvalidException
Thrown when the question is blank, longer than one carries, or carries a control character, or when the scope names more values than it accepts.
- MailAccountNotAccessibleException
Thrown when the request names an account this deployment does not serve.
- MailAnsweringUnavailableException
Thrown when this deployment answers no questions, or answers them and currently cannot.
- MailAnsweringBudgetExhaustedException
Thrown when the current period has spent what this deployment allows answering to cost, or when the run reached what one question may spend.
- ChatGenerationFailedException
Thrown when the run produced no answer, naming which kind of failure ended it.
- SensitiveContentScannerUnavailableException
Thrown when a switched-on scanner could not establish what the answer carries, which refuses the response rather than serving it unscanned.