Skip to content

Commit 85678c0

Browse files
Exclude provider URI from cache key computation by default (#6473)
Fixes #6468
1 parent 4d33003 commit 85678c0

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

src/Libraries/Microsoft.Extensions.AI.Evaluation.Reporting.Azure/Storage/AzureStorageReportingConfiguration.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ public static class AzureStorageReportingConfiguration
5959
/// A <see cref="ReportingConfiguration"/> that persists <see cref="ScenarioRunResult"/>s to Azure Storage
6060
/// and also uses Azure Storage to cache AI responses.
6161
/// </returns>
62+
/// <remarks>
63+
/// Note that when <paramref name="enableResponseCaching"/> is set to <see langword="true"/>, the cache keys used
64+
/// for the cached responses are not guaranteed to be stable across releases of the library. In other words, when
65+
/// you update your code to reference a newer version of the library, it is possible that old cached responses
66+
/// (persisted to the cache using older versions of the library) will no longer be used - instead new responses
67+
/// will be fetched from the LLM and added to the cache for use in subsequent executions.
68+
/// </remarks>
6269
#pragma warning disable S107 // Methods should not have too many parameters
6370
public static ReportingConfiguration Create(
6471
DataLakeDirectoryClient client,

src/Libraries/Microsoft.Extensions.AI.Evaluation.Reporting/CSharp/ReportingConfiguration.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -274,12 +274,6 @@ private static IEnumerable<string> GetCachingKeysForChatClient(IChatClient chatC
274274
yield return providerName!;
275275
}
276276

277-
Uri? providerUri = metadata?.ProviderUri;
278-
if (providerUri is not null)
279-
{
280-
yield return providerUri.AbsoluteUri;
281-
}
282-
283277
string? modelId = metadata?.DefaultModelId;
284278
if (!string.IsNullOrWhiteSpace(modelId))
285279
{

src/Libraries/Microsoft.Extensions.AI.Evaluation.Reporting/CSharp/Storage/DiskBasedReportingConfiguration.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ public static class DiskBasedReportingConfiguration
5959
/// A <see cref="ReportingConfiguration"/> that persists <see cref="ScenarioRunResult"/>s to disk and also uses the
6060
/// disk to cache AI responses.
6161
/// </returns>
62+
/// <remarks>
63+
/// Note that when <paramref name="enableResponseCaching"/> is set to <see langword="true"/>, the cache keys used
64+
/// for the cached responses are not guaranteed to be stable across releases of the library. In other words, when
65+
/// you update your code to reference a newer version of the library, it is possible that old cached responses
66+
/// (persisted to the cache using older versions of the library) will no longer be used - instead new responses
67+
/// will be fetched from the LLM and added to the cache for use in subsequent executions.
68+
/// </remarks>
6269
#pragma warning disable S107 // Methods should not have too many parameters
6370
public static ReportingConfiguration Create(
6471
string storageRootPath,

0 commit comments

Comments
 (0)