diff --git a/Directory.Packages.props b/Directory.Packages.props index 620d2d57dad..76c6d5f4a16 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -102,7 +102,7 @@ - + diff --git a/eng/Versions.props b/eng/Versions.props index b4305da9776..3eeed805756 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -41,8 +41,8 @@ 11.0.0-beta.25457.1 11.0.0-beta.25457.1 - 9.9.0 - 9.9.0-preview.1.25458.4 + 9.9.1 + 9.9.1-preview.1.25474.6 9.9.0 9.9.0 9.9.0 diff --git a/playground/GitHubModelsEndToEnd/GitHubModelsEndToEnd.WebStory/Program.cs b/playground/GitHubModelsEndToEnd/GitHubModelsEndToEnd.WebStory/Program.cs index 8d472616f68..1e019a25635 100644 --- a/playground/GitHubModelsEndToEnd/GitHubModelsEndToEnd.WebStory/Program.cs +++ b/playground/GitHubModelsEndToEnd/GitHubModelsEndToEnd.WebStory/Program.cs @@ -8,7 +8,7 @@ builder.AddServiceDefaults(); -builder.AddAzureChatCompletionsClient("chat", settings => settings.EnableSensitiveTelemetryData = true) +builder.AddAzureChatCompletionsClient("chat") .AddChatClient() .UseFunctionInvocation(); diff --git a/src/Components/Aspire.Azure.AI.Inference/Aspire.Azure.AI.Inference.csproj b/src/Components/Aspire.Azure.AI.Inference/Aspire.Azure.AI.Inference.csproj index 298f6deefd2..1845c9398b7 100644 --- a/src/Components/Aspire.Azure.AI.Inference/Aspire.Azure.AI.Inference.csproj +++ b/src/Components/Aspire.Azure.AI.Inference/Aspire.Azure.AI.Inference.csproj @@ -13,6 +13,7 @@ + diff --git a/src/Components/Aspire.Azure.AI.Inference/ChatCompletionsClientSettings.cs b/src/Components/Aspire.Azure.AI.Inference/ChatCompletionsClientSettings.cs index 56794af9b24..e9f0a355c21 100644 --- a/src/Components/Aspire.Azure.AI.Inference/ChatCompletionsClientSettings.cs +++ b/src/Components/Aspire.Azure.AI.Inference/ChatCompletionsClientSettings.cs @@ -68,13 +68,16 @@ public sealed class ChatCompletionsClientSettings : IConnectionStringSettings /// /// if potentially sensitive information should be included in telemetry; /// if telemetry shouldn't include raw inputs and outputs. - /// The default value is . + /// The default value is , unless the OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT + /// environment variable is set to "true" (case-insensitive). /// /// /// By default, telemetry includes metadata, such as token counts, but not raw inputs /// and outputs, such as message content, function call arguments, and function call results. + /// The default value can be overridden by setting the OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT + /// environment variable to "true". Explicitly setting this property will override the environment variable. /// - public bool EnableSensitiveTelemetryData { get; set; } + public bool EnableSensitiveTelemetryData { get; set; } = TelemetryHelpers.EnableSensitiveDataDefault; /// /// Parses a connection string and populates the settings properties. diff --git a/src/Components/Aspire.Azure.AI.OpenAI/Aspire.Azure.AI.OpenAI.csproj b/src/Components/Aspire.Azure.AI.OpenAI/Aspire.Azure.AI.OpenAI.csproj index 979b678061e..914f194dc47 100644 --- a/src/Components/Aspire.Azure.AI.OpenAI/Aspire.Azure.AI.OpenAI.csproj +++ b/src/Components/Aspire.Azure.AI.OpenAI/Aspire.Azure.AI.OpenAI.csproj @@ -14,6 +14,7 @@ + diff --git a/src/Components/Aspire.Azure.AI.OpenAI/AzureOpenAISettings.cs b/src/Components/Aspire.Azure.AI.OpenAI/AzureOpenAISettings.cs index 7139088c1b8..9567af410d1 100644 --- a/src/Components/Aspire.Azure.AI.OpenAI/AzureOpenAISettings.cs +++ b/src/Components/Aspire.Azure.AI.OpenAI/AzureOpenAISettings.cs @@ -67,13 +67,16 @@ public sealed class AzureOpenAISettings : IConnectionStringSettings /// /// if potentially sensitive information should be included in telemetry; /// if telemetry shouldn't include raw inputs and outputs. - /// The default value is . + /// The default value is , unless the OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT + /// environment variable is set to "true" (case-insensitive). /// /// /// By default, telemetry includes metadata, such as token counts, but not raw inputs /// and outputs, such as message content, function call arguments, and function call results. + /// The default value can be overridden by setting the OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT + /// environment variable to "true". Explicitly setting this property will override the environment variable. /// - public bool EnableSensitiveTelemetryData { get; set; } + public bool EnableSensitiveTelemetryData { get; set; } = TelemetryHelpers.EnableSensitiveDataDefault; void IConnectionStringSettings.ParseConnectionString(string? connectionString) { diff --git a/src/Components/Common/AITelemetryHelpers.cs b/src/Components/Common/AITelemetryHelpers.cs new file mode 100644 index 00000000000..acc378786dc --- /dev/null +++ b/src/Components/Common/AITelemetryHelpers.cs @@ -0,0 +1,16 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace Aspire; + +internal static class TelemetryHelpers +{ + /// Gets a value indicating whether the OpenTelemetry clients should enable their EnableSensitiveData property's by default. + /// + /// Defaults to false. May be overridden by setting the OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT environment variable to "true". + /// Mirrors Microsoft.Extensions.AI default: https://github.com/dotnet/extensions/blob/c4e57fb1e6b8403a527ea3cd737f1146dcbc1f31/src/Libraries/Microsoft.Extensions.AI/TelemetryHelpers.cs#L14 + /// + public static bool EnableSensitiveDataDefault { get; } = + Environment.GetEnvironmentVariable("OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT") is string envVar && + string.Equals(envVar, "true", StringComparison.OrdinalIgnoreCase); +}