// Copyright (c) Microsoft. All rights reserved.
using System.Collections;
using Azure.AI.ContentSafety;
namespace ContentSafety.Exceptions;
///
/// Exception which is thrown when offensive content is detected in user prompt or documents.
/// More information here: https://learn.microsoft.com/en-us/azure/ai-services/content-safety/quickstart-text#interpret-the-api-response
///
public class TextModerationException : Exception
{
///
/// Analysis result for categories.
/// More information here: https://learn.microsoft.com/en-us/azure/ai-services/content-safety/concepts/harm-categories
///
public Dictionary CategoriesAnalysis { get; init; }
///
/// Dictionary with additional details of exception.
///
public override IDictionary Data => new Dictionary()
{
["categoriesAnalysis"] = this.CategoriesAnalysis.ToDictionary(k => k.Key.ToString(), v => v.Value),
};
public TextModerationException()
{
}
public TextModerationException(string? message) : base(message)
{
}
public TextModerationException(string? message, Exception? innerException) : base(message, innerException)
{
}
}