@@ -20,7 +20,8 @@ namespace Microsoft.Extensions.AI.Evaluation.Safety;
20
20
21
21
internal sealed class ContentSafetyChatClient : IChatClient
22
22
{
23
- private const string Moniker = "Azure AI Foundry Evaluation" ;
23
+ private const string ProviderName = "azure.ai.foundry" ;
24
+ private const string ModelId = $ "{ ProviderName } .evaluation";
24
25
25
26
private readonly ContentSafetyService _service ;
26
27
private readonly IChatClient ? _originalChatClient ;
@@ -35,38 +36,14 @@ public ContentSafetyChatClient(
35
36
36
37
ChatClientMetadata ? originalMetadata = _originalChatClient ? . GetService < ChatClientMetadata > ( ) ;
37
38
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 ;
55
40
if ( originalMetadata ? . ProviderName is string originalProviderName &&
56
41
! string . IsNullOrWhiteSpace ( originalProviderName ) )
57
42
{
58
43
providerName = $ "{ providerName } ; { originalProviderName } ";
59
44
}
60
45
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 ) ;
70
47
}
71
48
72
49
public async Task < ChatResponse > GetResponseAsync (
@@ -88,7 +65,7 @@ await _service.AnnotateAsync(
88
65
89
66
return new ChatResponse ( new ChatMessage ( ChatRole . Assistant , annotationResult ) )
90
67
{
91
- ModelId = Moniker
68
+ ModelId = ModelId
92
69
} ;
93
70
}
94
71
else
@@ -121,7 +98,7 @@ await _service.AnnotateAsync(
121
98
122
99
yield return new ChatResponseUpdate ( ChatRole . Assistant , annotationResult )
123
100
{
124
- ModelId = Moniker
101
+ ModelId = ModelId
125
102
} ;
126
103
}
127
104
else
0 commit comments