ChatConversationEvaluator.CanRenderAsync 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.
Determines if there is sufficient tokenBudget
remaining to render the
supplied message
as part of the evaluation prompt that this IEvaluator uses.
protected:
virtual System::Threading::Tasks::ValueTask<ValueTuple<bool, int>> CanRenderAsync(Microsoft::Extensions::AI::ChatMessage ^ message, int tokenBudget, Microsoft::Extensions::AI::Evaluation::ChatConfiguration ^ chatConfiguration, System::Threading::CancellationToken cancellationToken);
protected virtual System.Threading.Tasks.ValueTask<(bool canRender, int remainingTokenBudget)> CanRenderAsync(Microsoft.Extensions.AI.ChatMessage message, int tokenBudget, Microsoft.Extensions.AI.Evaluation.ChatConfiguration chatConfiguration, System.Threading.CancellationToken cancellationToken);
abstract member CanRenderAsync : Microsoft.Extensions.AI.ChatMessage * int * Microsoft.Extensions.AI.Evaluation.ChatConfiguration * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<ValueTuple<bool, int>>
override this.CanRenderAsync : Microsoft.Extensions.AI.ChatMessage * int * Microsoft.Extensions.AI.Evaluation.ChatConfiguration * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<ValueTuple<bool, int>>
Protected Overridable Function CanRenderAsync (message As ChatMessage, tokenBudget As Integer, chatConfiguration As ChatConfiguration, cancellationToken As CancellationToken) As ValueTask(Of ValueTuple(Of Boolean, Integer))
Parameters
- message
- ChatMessage
A message that is part of the conversation history for the response being evaluated and that is to be rendered as part of the evaluation prompt.
- tokenBudget
- Int32
The number of tokens available for the rendering additional content as part of the evaluation prompt.
- chatConfiguration
- ChatConfiguration
A ChatConfiguration that specifies the IChatClient and the IEvaluationTokenCounter that this IEvaluator uses to perform the evaluation.
- cancellationToken
- CancellationToken
A CancellationToken that can cancel the operation.
Returns
A tuple containing a bool
indicating whether there is sufficient
tokenBudget
remaining to render the supplied message
as part of the
evaluation prompt, and an int
containing the remaining token budget that would be available
once this message
is rendered.