Skip to content

Commit 12cd578

Browse files
Neehar DuvvuriNeehar Duvvuri
authored andcommitted
run black formatter
1 parent 8388003 commit 12cd578

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

sdk/evaluation/azure-ai-evaluation/azure/ai/evaluation/_evaluate/_evaluate.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1205,15 +1205,17 @@ def emit_eval_result_events_to_app_insights(app_insights_config: AppInsightsConf
12051205
# Configure OpenTelemetry logging with anonymized Resource attributes
12061206
from opentelemetry.sdk.resources import Resource
12071207
from opentelemetry.semconv.resource import ResourceAttributes
1208-
1208+
12091209
# Create a resource with minimal attributes to prevent sensitive data collection
12101210
# SERVICE_INSTANCE_ID maps to cloud_RoleInstance in Azure Monitor and prevents
12111211
# Azure Monitor from auto-detecting the device hostname
1212-
anonymized_resource = Resource.create({
1213-
ResourceAttributes.SERVICE_NAME: "unknown",
1214-
ResourceAttributes.SERVICE_INSTANCE_ID: "unknown",
1215-
})
1216-
1212+
anonymized_resource = Resource.create(
1213+
{
1214+
ResourceAttributes.SERVICE_NAME: "unknown",
1215+
ResourceAttributes.SERVICE_INSTANCE_ID: "unknown",
1216+
}
1217+
)
1218+
12171219
logger_provider = LoggerProvider(resource=anonymized_resource)
12181220
_logs.set_logger_provider(logger_provider)
12191221

@@ -1226,10 +1228,10 @@ def emit_eval_result_events_to_app_insights(app_insights_config: AppInsightsConf
12261228
# Create a logger from OUR configured logger_provider (not the global one)
12271229
# This ensures the logger uses our anonymized resource
12281230
otel_logger = logger_provider.get_logger(__name__)
1229-
1231+
12301232
# Initialize base log attributes with extra_attributes if present, otherwise empty dict
12311233
base_log_attributes = app_insights_config.get("extra_attributes", {})
1232-
1234+
12331235
# Add AppInsights config attributes with proper semantic convention mappings
12341236
if "run_type" in app_insights_config:
12351237
base_log_attributes["gen_ai.evaluation.azure_ai_type"] = str(app_insights_config["run_type"])
@@ -1243,7 +1245,7 @@ def emit_eval_result_events_to_app_insights(app_insights_config: AppInsightsConf
12431245
for result in results:
12441246
# Create a copy of base attributes for this result's events
12451247
log_attributes = base_log_attributes.copy()
1246-
1248+
12471249
_log_events_to_app_insights(
12481250
otel_logger=otel_logger,
12491251
events=result["results"],

sdk/evaluation/azure-ai-evaluation/tests/unittests/test_built_in_evaluator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def test_similarity_evaluator_keys(self, mock_model_config):
8686
"similarity_finish_reason",
8787
"similarity_model",
8888
"similarity_sample_input",
89-
"similarity_sample_output",
89+
"similarity_sample_output",
9090
}
9191

9292
def test_retrieval_evaluator_keys(self, mock_model_config):

0 commit comments

Comments
 (0)