Class: Aigen::Google::SafetySettings
- Inherits:
-
Object
- Object
- Aigen::Google::SafetySettings
- Defined in:
- lib/aigen/google/safety_settings.rb
Overview
SafetySettings configures content filtering for the Gemini API. Provides constants for harm categories and thresholds, with sensible defaults.
Constant Summary collapse
- HARM_CATEGORY_HATE_SPEECH =
Harm category constants
"HARM_CATEGORY_HATE_SPEECH"- HARM_CATEGORY_DANGEROUS_CONTENT =
"HARM_CATEGORY_DANGEROUS_CONTENT"- HARM_CATEGORY_HARASSMENT =
"HARM_CATEGORY_HARASSMENT"- HARM_CATEGORY_SEXUALLY_EXPLICIT =
"HARM_CATEGORY_SEXUALLY_EXPLICIT"- BLOCK_NONE =
Threshold constants
"BLOCK_NONE"- BLOCK_LOW_AND_ABOVE =
"BLOCK_LOW_AND_ABOVE"- BLOCK_MEDIUM_AND_ABOVE =
"BLOCK_MEDIUM_AND_ABOVE"- BLOCK_ONLY_HIGH =
"BLOCK_ONLY_HIGH"
Class Method Summary collapse
-
.default ⇒ Array<Hash>
Returns default safety settings with BLOCK_MEDIUM_AND_ABOVE for all categories.
Instance Method Summary collapse
-
#initialize(settings) ⇒ SafetySettings
constructor
Initializes a SafetySettings instance with an array of settings.
-
#to_h ⇒ Array<Hash>
Serializes the safety settings to Gemini API format.
Constructor Details
#initialize(settings) ⇒ SafetySettings
Initializes a SafetySettings instance with an array of settings.
60 61 62 |
# File 'lib/aigen/google/safety_settings.rb', line 60 def initialize(settings) @settings = settings end |
Class Method Details
.default ⇒ Array<Hash>
Returns default safety settings with BLOCK_MEDIUM_AND_ABOVE for all categories.
42 43 44 45 46 47 48 49 |
# File 'lib/aigen/google/safety_settings.rb', line 42 def self.default [ {category: HARM_CATEGORY_HATE_SPEECH, threshold: BLOCK_MEDIUM_AND_ABOVE}, {category: HARM_CATEGORY_DANGEROUS_CONTENT, threshold: BLOCK_MEDIUM_AND_ABOVE}, {category: HARM_CATEGORY_HARASSMENT, threshold: BLOCK_MEDIUM_AND_ABOVE}, {category: HARM_CATEGORY_SEXUALLY_EXPLICIT, threshold: BLOCK_MEDIUM_AND_ABOVE} ] end |
Instance Method Details
#to_h ⇒ Array<Hash>
Serializes the safety settings to Gemini API format.
73 74 75 |
# File 'lib/aigen/google/safety_settings.rb', line 73 def to_h @settings end |