Skip to content

Commit 8ea542c

Browse files
Remove unused API in Safety package (#6439)
This change ensures that we will have just one way to create a ChatConfiguration for the Safety evaluators. The removed API was also confusing because it could mislead callers into thinking that the returned IChatClient can be used like any other general purpose LLM endpoint when in fact it is pretty specialized and only intended for internal use within the Safety evaluators.
1 parent dec7e30 commit 8ea542c

File tree

1 file changed

+4
-29
lines changed

1 file changed

+4
-29
lines changed

src/Libraries/Microsoft.Extensions.AI.Evaluation.Safety/ContentSafetyServiceConfigurationExtensions.cs

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -40,37 +40,12 @@ public static ChatConfiguration ToChatConfiguration(
4040
#pragma warning disable CA2000 // Dispose objects before they go out of scope.
4141
// We can't dispose newChatClient here because it is returned to the caller.
4242

43-
var newChatClient = contentSafetyServiceConfiguration.ToIChatClient(originalChatConfiguration?.ChatClient);
43+
var newChatClient =
44+
new ContentSafetyChatClient(
45+
contentSafetyServiceConfiguration,
46+
originalChatClient: originalChatConfiguration?.ChatClient);
4447
#pragma warning restore CA2000
4548

4649
return new ChatConfiguration(newChatClient);
4750
}
48-
49-
/// <summary>
50-
/// Returns an <see cref="IChatClient"/> that can be used to communicate with the Azure AI Foundry Evaluation
51-
/// service for performing content safety evaluations.
52-
/// </summary>
53-
/// <param name="contentSafetyServiceConfiguration">
54-
/// An object that specifies configuration parameters such as the Azure AI project that should be used, and the
55-
/// credentials that should be used, when communicating with the Azure AI Foundry Evaluation service to perform
56-
/// content safety evaluations.
57-
/// </param>
58-
/// <param name="originalChatClient">
59-
/// The original <see cref="IChatClient"/>, if any. If specified, the returned
60-
/// <see cref="IChatClient"/> will be a wrapper around <paramref name="originalChatClient"/> that can be used both
61-
/// to communicate with the AI model that <paramref name="originalChatClient"/> is configured to communicate with,
62-
/// as well as to communicate with the Azure AI Foundry Evaluation service.
63-
/// </param>
64-
/// <returns>
65-
/// A <see cref="ChatConfiguration"/> that can be used to communicate with the Azure AI Foundry Evaluation service
66-
/// for performing content safety evaluations.
67-
/// </returns>
68-
public static IChatClient ToIChatClient(
69-
this ContentSafetyServiceConfiguration contentSafetyServiceConfiguration,
70-
IChatClient? originalChatClient = null)
71-
{
72-
_ = Throw.IfNull(contentSafetyServiceConfiguration);
73-
74-
return new ContentSafetyChatClient(contentSafetyServiceConfiguration, originalChatClient);
75-
}
7651
}

0 commit comments

Comments
 (0)