class RubyLLM::Moderation::Result
A Result is the verdict for a single moderated input. Providers return results in different shapes. RubyLLM normalizes all of them into Result objects on Moderation#results.
result = RubyLLM.moderate("Some user input").results.first result.flagged? # => false result.categories # => [] result.category_scores["violence"] # => 0.0004
Attributes
The names of the categories flagged for this input, as an array of strings, empty when nothing was flagged.
The confidence scores for this input, as a hash of category name to a score between 0.0 and 1.0.
Public Instance Methods
Source
# File lib/ruby_llm/moderation.rb, line 48 def flagged? @flagged end
Returns true if this input was flagged as potentially harmful, false otherwise.