@@ -20,7 +20,8 @@ namespace Microsoft.Extensions.AI.Evaluation.Safety;
2020
2121internal sealed class ContentSafetyChatClient : IChatClient
2222{
23- private const string Moniker = "Azure AI Foundry Evaluation" ;
23+ private const string ProviderName = "azure.ai.foundry" ;
24+ private const string ModelId = $ "{ ProviderName } .evaluation";
2425
2526 private readonly ContentSafetyService _service ;
2627 private readonly IChatClient ? _originalChatClient ;
@@ -35,38 +36,14 @@ public ContentSafetyChatClient(
3536
3637 ChatClientMetadata ? originalMetadata = _originalChatClient ? . GetService < ChatClientMetadata > ( ) ;
3738
38- string providerName ;
39- Uri ? providerUri = originalMetadata ? . ProviderUri ;
40-
41- if ( contentSafetyServiceConfiguration . IsHubBasedProject )
42- {
43- providerName =
44- $ "{ Moniker } (" +
45- $ "Subscription: { contentSafetyServiceConfiguration . SubscriptionId } , " +
46- $ "Resource Group: { contentSafetyServiceConfiguration . ResourceGroupName } , " +
47- $ "Project: { contentSafetyServiceConfiguration . ProjectName } )";
48- }
49- else
50- {
51- providerName = $ "{ Moniker } (Endpoint: { contentSafetyServiceConfiguration . Endpoint } )";
52- providerUri = contentSafetyServiceConfiguration . Endpoint ;
53- }
54-
39+ string providerName = ProviderName ;
5540 if ( originalMetadata ? . ProviderName is string originalProviderName &&
5641 ! string . IsNullOrWhiteSpace ( originalProviderName ) )
5742 {
5843 providerName = $ "{ providerName } ; { originalProviderName } ";
5944 }
6045
61- string modelId = Moniker ;
62-
63- if ( originalMetadata ? . DefaultModelId is string originalModelId &&
64- ! string . IsNullOrWhiteSpace ( originalModelId ) )
65- {
66- modelId = $ "{ modelId } ; { originalModelId } ";
67- }
68-
69- _metadata = new ChatClientMetadata ( providerName , providerUri , modelId ) ;
46+ _metadata = new ChatClientMetadata ( providerName , defaultModelId : ModelId ) ;
7047 }
7148
7249 public async Task < ChatResponse > GetResponseAsync (
@@ -88,7 +65,7 @@ await _service.AnnotateAsync(
8865
8966 return new ChatResponse ( new ChatMessage ( ChatRole . Assistant , annotationResult ) )
9067 {
91- ModelId = Moniker
68+ ModelId = ModelId
9269 } ;
9370 }
9471 else
@@ -121,7 +98,7 @@ await _service.AnnotateAsync(
12198
12299 yield return new ChatResponseUpdate ( ChatRole . Assistant , annotationResult )
123100 {
124- ModelId = Moniker
101+ ModelId = ModelId
125102 } ;
126103 }
127104 else
0 commit comments