class RubyLLM::Judgment
The typed answers to a set of questions, with model identity and accounting. Obtain one through RubyLLM.judge or Judge.judge.
judgment[:urgent].probability judgment[:department].choice judgment[:frustration].score
Attributes
Returns the answers keyed by their declared String or Symbol names.
Returns the actual model ID reported by the provider.
Returns the original provider response.
Public Instance Methods
Source
# File lib/ruby_llm/judgment.rb, line 34 def [](name) answers[@answer_keys[name.to_s]] end
Returns the named answer, accepting a String or Symbol, or nil if absent.
Source
# File lib/ruby_llm/judgment.rb, line 54 def cost return ruby_llm_usage_cost unless ruby_llm_usage_entries.empty? Cost.new(tokens:, model: @model_info) end
Returns cost across all provider attempts, preserving unknown amounts.
Source
# File lib/ruby_llm/judgment.rb, line 44 def each(&) answers.each(&) end
Yields each question name and answer, or returns an Enumerator.
Source
# File lib/ruby_llm/judgment.rb, line 39 def fetch(name) answers.fetch(@answer_keys.fetch(name.to_s)) end
Returns the named answer or raises KeyError if it is absent.
Source
# File lib/ruby_llm/judgment.rb, line 61 def to_h { model:, answers: answers.transform_values(&:to_h), tokens: tokens.to_h, cost: cost.to_h } end
Returns the model, typed answers, token usage, and cost as a Hash.
Source
# File lib/ruby_llm/judgment.rb, line 49 def tokens ruby_llm_usage_entries.empty? ? @tokens : ruby_llm_usage_tokens end
Returns token usage across all provider attempts.