Skip to content

[API Proposal]: Expose evaluator chain of thought as structured data on EvaluationMetric #7805

Open

Description

@kxs-ccarley

Background and motivation

The quality evaluators in Microsoft.Extensions.AI.Evaluation.Quality ask the judge model for (chain of thought), (reason) and (score). Reason and Value are first-class properties on the metric. The chain of thought is only available as an Informational diagnostic, prefixed with a hardcoded English label (EvaluationMetricExtensions.cs#L76-L80):

We show evaluation results to end users in a localized product, and we instruct the judge to answer in the user's language. The chain of thought comes back localized, but the only way to get it is to string-match the English label. That breaks silently if the wording changes, and it mixes developer diagnostics with user-facing content.

API Proposal

Store the parsed chain of thought in EvaluationMetric.Metadata under a documented

public static class EvaluationMetricMetadataKeys
{
    public const string ChainOfThought = "evaluation-chain-of-thought";
}

API Usage

if (metric.Metadata?.TryGetValue(EvaluationMetricMetadataKeys.ChainOfThought, out string? cot) == true)
{
    ShowReasoning(cot);
}

Alternative Designs

Perhaps:

  • A dedicated string? ChainOfThought property on EvaluationMetric.
  • Expose the label as a public constant so callers can strip it reliably.

Risks

Minimal

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    api-suggestionEarly API idea and discussion, it is NOT ready for implementationarea-ai-evalMicrosoft.Extensions.AI.Evaluation and relateduntriaged

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions