Skip to content

CanRenderAsync should not have a ref parameter #5895

@stephentoub

Description

@stephentoub

ChatConversationEvaluator has this method:

    protected virtual ValueTask<bool> CanRenderAsync(
        ChatMessage message,
        ref int tokenBudget,
        ChatConfiguration chatConfiguration,
        CancellationToken cancellationToken)

That ref int tokenBudget parameter is problematic. An override of this method can't implement this asynchronously while still correctly handling updating that parameter, as it can only be updated as part of the synchronous invocation of the method.

cc: @shyamnamboodiripad, @peterwald

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-ai-evalMicrosoft.Extensions.AI.Evaluation and related

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions