Safety specification. There are two use cases: 1. when only safetySpec.enable is set, the BLOCK_LOW_AND_ABOVE threshold will be applied for all categories. 2. when safetySpec.enable is set and some safetySettings are set, only specified safetySettings 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-06-27 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eSafetySpec\u003c/code\u003e feature allows enabling safety filtering on answer responses, with a default setting of \u003ccode\u003efalse\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eWhen \u003ccode\u003esafetySpec.enable\u003c/code\u003e is true, you can configure specific \u003ccode\u003esafetySettings\u003c/code\u003e or default to \u003ccode\u003eBLOCK_LOW_AND_ABOVE\u003c/code\u003e for all categories.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eSafetySetting\u003c/code\u003e allows specifying a \u003ccode\u003ecategory\u003c/code\u003e of harm and setting a \u003ccode\u003ethreshold\u003c/code\u003e for blocking.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eHarmBlockThreshold\u003c/code\u003e defines levels of probability for blocking, ranging from \u003ccode\u003eBLOCK_LOW_AND_ABOVE\u003c/code\u003e to \u003ccode\u003eBLOCK_ONLY_HIGH\u003c/code\u003e, with options to block none (\u003ccode\u003eBLOCK_NONE\u003c/code\u003e) or disable the filter entirely (\u003ccode\u003eOFF\u003c/code\u003e).\u003c/p\u003e\n"]]],[],null,["# SafetySpec\n\n- [JSON representation](#SCHEMA_REPRESENTATION)\n- [SafetySetting](#SafetySetting)\n - [JSON representation](#SafetySetting.SCHEMA_REPRESENTATION)\n- [HarmBlockThreshold](#HarmBlockThreshold)\n\nSafety specification. There are two use cases: 1. when only safetySpec.enable is set, the BLOCK_LOW_AND_ABOVE threshold will be applied for all categories. 2. when safetySpec.enable is set and some safetySettings are set, only specified safetySettings are applied.\n\nSafetySetting\n-------------\n\nSafety settings.\n\nHarmBlockThreshold\n------------------\n\nProbability-based thresholds levels for blocking."]]