From bb270882b935b36e9ec9bb0d26fa205096217dcd Mon Sep 17 00:00:00 2001 From: Shyam Namboodiripad Date: Tue, 20 May 2025 19:01:26 -0700 Subject: [PATCH] Exclude provider URI from cache key computation by default --- .../Storage/AzureStorageReportingConfiguration.cs | 7 +++++++ .../CSharp/ReportingConfiguration.cs | 6 ------ .../CSharp/Storage/DiskBasedReportingConfiguration.cs | 7 +++++++ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/Libraries/Microsoft.Extensions.AI.Evaluation.Reporting.Azure/Storage/AzureStorageReportingConfiguration.cs b/src/Libraries/Microsoft.Extensions.AI.Evaluation.Reporting.Azure/Storage/AzureStorageReportingConfiguration.cs index fafd8639b34..3131fc1c5d9 100644 --- a/src/Libraries/Microsoft.Extensions.AI.Evaluation.Reporting.Azure/Storage/AzureStorageReportingConfiguration.cs +++ b/src/Libraries/Microsoft.Extensions.AI.Evaluation.Reporting.Azure/Storage/AzureStorageReportingConfiguration.cs @@ -59,6 +59,13 @@ public static class AzureStorageReportingConfiguration /// A that persists s to Azure Storage /// and also uses Azure Storage to cache AI responses. /// + /// + /// Note that when is set to , the cache keys used + /// for the cached responses are not guaranteed to be stable across releases of the library. In other words, when + /// you update your code to reference a newer version of the library, it is possible that old cached responses + /// (persisted to the cache using older versions of the library) will no longer be used - instead new responses + /// will be fetched from the LLM and added to the cache for use in subsequent executions. + /// #pragma warning disable S107 // Methods should not have too many parameters public static ReportingConfiguration Create( DataLakeDirectoryClient client, diff --git a/src/Libraries/Microsoft.Extensions.AI.Evaluation.Reporting/CSharp/ReportingConfiguration.cs b/src/Libraries/Microsoft.Extensions.AI.Evaluation.Reporting/CSharp/ReportingConfiguration.cs index 130586de930..2f6613bbcbc 100644 --- a/src/Libraries/Microsoft.Extensions.AI.Evaluation.Reporting/CSharp/ReportingConfiguration.cs +++ b/src/Libraries/Microsoft.Extensions.AI.Evaluation.Reporting/CSharp/ReportingConfiguration.cs @@ -274,12 +274,6 @@ private static IEnumerable GetCachingKeysForChatClient(IChatClient chatC yield return providerName!; } - Uri? providerUri = metadata?.ProviderUri; - if (providerUri is not null) - { - yield return providerUri.AbsoluteUri; - } - string? modelId = metadata?.DefaultModelId; if (!string.IsNullOrWhiteSpace(modelId)) { diff --git a/src/Libraries/Microsoft.Extensions.AI.Evaluation.Reporting/CSharp/Storage/DiskBasedReportingConfiguration.cs b/src/Libraries/Microsoft.Extensions.AI.Evaluation.Reporting/CSharp/Storage/DiskBasedReportingConfiguration.cs index e967fdd1db9..10350446229 100644 --- a/src/Libraries/Microsoft.Extensions.AI.Evaluation.Reporting/CSharp/Storage/DiskBasedReportingConfiguration.cs +++ b/src/Libraries/Microsoft.Extensions.AI.Evaluation.Reporting/CSharp/Storage/DiskBasedReportingConfiguration.cs @@ -59,6 +59,13 @@ public static class DiskBasedReportingConfiguration /// A that persists s to disk and also uses the /// disk to cache AI responses. /// + /// + /// Note that when is set to , the cache keys used + /// for the cached responses are not guaranteed to be stable across releases of the library. In other words, when + /// you update your code to reference a newer version of the library, it is possible that old cached responses + /// (persisted to the cache using older versions of the library) will no longer be used - instead new responses + /// will be fetched from the LLM and added to the cache for use in subsequent executions. + /// #pragma warning disable S107 // Methods should not have too many parameters public static ReportingConfiguration Create( string storageRootPath,