public sealed class AnswerQueryRequest.Types.SafetySpec : IMessage<AnswerQueryRequest.Types.SafetySpec>, IEquatable<AnswerQueryRequest.Types.SafetySpec>, IDeepCloneable<AnswerQueryRequest.Types.SafetySpec>, IBufferMessage, IMessage
Reference documentation and code samples for the Discovery Engine v1 API class AnswerQueryRequest.Types.SafetySpec.
Safety specification.
There are two use cases:
when only safety_spec.enable is set, the BLOCK_LOW_AND_ABOVE threshold
will be applied for all categories.
when safety_spec.enable is set and some safety_settings are set, only
specified safety_settings are applied.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 UTC."],[[["\u003cp\u003eThe latest version of the \u003ccode\u003eAnswerQueryRequest.Types.SafetySpec\u003c/code\u003e class in the Discovery Engine v1 API is 1.6.0.\u003c/p\u003e\n"],["\u003cp\u003eThis class, \u003ccode\u003eAnswerQueryRequest.Types.SafetySpec\u003c/code\u003e, is designed for safety specifications within the Discovery Engine v1 API, inheriting from \u003ccode\u003eobject\u003c/code\u003e and implementing several interfaces like \u003ccode\u003eIMessage\u003c/code\u003e, \u003ccode\u003eIEquatable\u003c/code\u003e, and \u003ccode\u003eIDeepCloneable\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe class \u003ccode\u003eAnswerQueryRequest.Types.SafetySpec\u003c/code\u003e provides constructors for creating new instances, including a parameterless constructor and one that takes another \u003ccode\u003eSafetySpec\u003c/code\u003e object.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eEnable\u003c/code\u003e property, a boolean, controls the safety filtering for answer responses and is set to false by default.\u003c/p\u003e\n"],["\u003cp\u003eThere are multiple documented versions of this class, starting from version 1.0.0-beta06 up to 1.6.0, which is the latest version available.\u003c/p\u003e\n"]]],[],null,["# Discovery Engine v1 API - Class AnswerQueryRequest.Types.SafetySpec (1.9.0)\n\nVersion latestkeyboard_arrow_down\n\n- [1.9.0 (latest)](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1/latest/Google.Cloud.DiscoveryEngine.V1.AnswerQueryRequest.Types.SafetySpec)\n- [1.8.0](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1/1.8.0/Google.Cloud.DiscoveryEngine.V1.AnswerQueryRequest.Types.SafetySpec)\n- [1.7.0](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1/1.7.0/Google.Cloud.DiscoveryEngine.V1.AnswerQueryRequest.Types.SafetySpec)\n- [1.6.0](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1/1.6.0/Google.Cloud.DiscoveryEngine.V1.AnswerQueryRequest.Types.SafetySpec)\n- [1.5.0](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1/1.5.0/Google.Cloud.DiscoveryEngine.V1.AnswerQueryRequest.Types.SafetySpec)\n- [1.4.0](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1/1.4.0/Google.Cloud.DiscoveryEngine.V1.AnswerQueryRequest.Types.SafetySpec)\n- [1.3.0](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1/1.3.0/Google.Cloud.DiscoveryEngine.V1.AnswerQueryRequest.Types.SafetySpec)\n- [1.2.0](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1/1.2.0/Google.Cloud.DiscoveryEngine.V1.AnswerQueryRequest.Types.SafetySpec)\n- [1.1.0](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1/1.1.0/Google.Cloud.DiscoveryEngine.V1.AnswerQueryRequest.Types.SafetySpec)\n- [1.0.0-beta06](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1/1.0.0-beta06/Google.Cloud.DiscoveryEngine.V1.AnswerQueryRequest.Types.SafetySpec) \n\n public sealed class AnswerQueryRequest.Types.SafetySpec : IMessage\u003cAnswerQueryRequest.Types.SafetySpec\u003e, IEquatable\u003cAnswerQueryRequest.Types.SafetySpec\u003e, IDeepCloneable\u003cAnswerQueryRequest.Types.SafetySpec\u003e, IBufferMessage, IMessage\n\nReference documentation and code samples for the Discovery Engine v1 API class AnswerQueryRequest.Types.SafetySpec.\n\nSafety specification.\nThere are two use cases:\n\n1. when only safety_spec.enable is set, the BLOCK_LOW_AND_ABOVE threshold will be applied for all categories.\n2. when safety_spec.enable is set and some safety_settings are set, only specified safety_settings are applied. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e AnswerQueryRequest.Types.SafetySpec \n\nImplements\n----------\n\n[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[AnswerQueryRequest](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1/latest/Google.Cloud.DiscoveryEngine.V1.AnswerQueryRequest)[Types](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1/latest/Google.Cloud.DiscoveryEngine.V1.AnswerQueryRequest.Types)[SafetySpec](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1/latest/Google.Cloud.DiscoveryEngine.V1.AnswerQueryRequest.Types.SafetySpec), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[AnswerQueryRequest](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1/latest/Google.Cloud.DiscoveryEngine.V1.AnswerQueryRequest)[Types](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1/latest/Google.Cloud.DiscoveryEngine.V1.AnswerQueryRequest.Types)[SafetySpec](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1/latest/Google.Cloud.DiscoveryEngine.V1.AnswerQueryRequest.Types.SafetySpec), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[AnswerQueryRequest](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1/latest/Google.Cloud.DiscoveryEngine.V1.AnswerQueryRequest)[Types](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1/latest/Google.Cloud.DiscoveryEngine.V1.AnswerQueryRequest.Types)[SafetySpec](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1/latest/Google.Cloud.DiscoveryEngine.V1.AnswerQueryRequest.Types.SafetySpec), [IBufferMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IBufferMessage.html), [IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage.html) \n\nInherited Members\n-----------------\n\n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\nNamespace\n---------\n\n[Google.Cloud.DiscoveryEngine.V1](/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1/latest/Google.Cloud.DiscoveryEngine.V1)\n\nAssembly\n--------\n\nGoogle.Cloud.DiscoveryEngine.V1.dll\n\nConstructors\n------------\n\n### SafetySpec()\n\n public SafetySpec()\n\n### SafetySpec(SafetySpec)\n\n public SafetySpec(AnswerQueryRequest.Types.SafetySpec other)\n\nProperties\n----------\n\n### Enable\n\n public bool Enable { get; set; }\n\nEnable the safety filtering on the answer response. It is false by\ndefault.\n\n### SafetySettings\n\n public RepeatedField\u003cAnswerQueryRequest.Types.SafetySpec.Types.SafetySetting\u003e SafetySettings { get; }\n\nOptional. Safety settings.\nThis settings are effective only when the safety_spec.enable is true."]]