Class: Raif::Evals::LlmJudge

Inherits:
Task show all
Defined in:
app/models/raif/evals/llm_judge.rb

Constant Summary

Constants included from Concerns::LlmResponseParsing

Concerns::LlmResponseParsing::ASCII_CONTROL_CHARS

Instance Attribute Summary

Attributes inherited from Task

#files, #images

Instance Method Summary collapse

Methods inherited from Task

#build_prompt, #build_system_prompt, json_response_schema, #json_response_schema, #messages, prompt, #prompt_studio_task_attributes, #re_run, run, #run, #status, system_prompt

Methods included from Concerns::JsonSchemaDefinition

#schema_for_instance

Methods included from Concerns::LlmResponseParsing

#parse_html_response, #parse_json_response, #parsed_response

Methods included from Concerns::HasRuntimeDuration

#runtime_duration, #runtime_duration_seconds, #runtime_ended_at

Methods included from Concerns::HasAvailableModelTools

#available_model_tools_map

Methods included from Concerns::HasRequestedLanguage

#requested_language_name, #system_prompt_language_preference

Methods included from Concerns::HasLlm

#llm

Methods included from Concerns::HasPromptTemplates

#build_prompt, #build_system_prompt

Methods inherited from ApplicationRecord

table_name_prefix, where_json_not_blank

Instance Method Details

#default_llm_model_keyObject



53
54
55
# File 'app/models/raif/evals/llm_judge.rb', line 53

def default_llm_model_key
  Raif.config.evals_default_llm_judge_model_key || super
end

#judgment_confidenceObject



61
62
63
# File 'app/models/raif/evals/llm_judge.rb', line 61

def judgment_confidence
  parsed_response["confidence"] if completed?
end

#judgment_reasoningObject



57
58
59
# File 'app/models/raif/evals/llm_judge.rb', line 57

def judgment_reasoning
  parsed_response["reasoning"] if completed?
end

#low_confidence?Boolean

Returns:

  • (Boolean)


65
66
67
# File 'app/models/raif/evals/llm_judge.rb', line 65

def low_confidence?
  judgment_confidence && judgment_confidence < 0.5
end