Dela via


ChatConversationEvaluator.CanRenderAsync Method

Definition

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.

Applies to