Skip to content

[AI Evaluation] MEAI.Evaluation.Reporting includes provider URI in cache key, breaking usage in team scenarios #6468

@SteveSandersonMS

Description

@SteveSandersonMS

Description

Is there an important reason for ReportingConfiguration.cs's GetCachingKeysForChatClient to explicitly include the ChatClientMetadata.ProviderUri value in the cache key?

The scenario I'm concerned with is:

  • A team wants to store the cache in source control so that each developer doesn't have to invoke and wait for a huge number of LLM calls when running evaluation or integration tests. On each run, they will only have to wait for the LLM calls whose inputs they have modified in their code change.
  • Likewise in CI, the team doesn't want to set AI service credentials at all, but will rely on all the LLM calls being resolved from the source controlled cache. They will (correctly) get test failures if anyone fails to update the cache with their PRs, which is good.
  • However, each developer on the team has their own separate Azure OpenAI deployments and hence must each configure a different endpoint. And the CI server doesn't have any endpoint to configure.

Including the endpoint URL in the cache key means you'll never get any cache hits in this scenario, and it isn't possible to use this technique to verify integration tests in CI.

Proposal: don't include the ProviderUri in the cache key, or at least provide an easy way to opt out from this.

If I'm misunderstanding the intended use case for the cache, please let me know. But I think being able to store it in source control is likely the most valuable usage pattern.

Reproduction Steps

var reportingConfig = DiskBasedReportingConfiguration.Create(
    "some/path", [], new ChatConfiguration(myChatClient));
var scenarioRun = await reportingConfig.CreateScenarioRunAsync("SomeName");
var chatClient = scenarioRun.ChatConfiguration!.ChatClient;
var result = await chatClient.GetResponseAsync("What's 1+1?");

Expected behavior

Cache entry should not vary by myChatClient.GetService<ChatClientMetadata>().ProviderUri

Actual behavior

... but it does.

Regression?

No response

Known Workarounds

Technically you could create a custom IChatClient wrapper that hides the ChatClientMetadata from MEAI.Evaluations but that is harmful in other ways.

Configuration

No response

Other information

No response

Metadata

Metadata

Labels

area-aiMicrosoft.Extensions.AI librariesbugThis issue describes a behavior which is not expected - a bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions