Class: RubricLLM::Metrics::Relevance
- Defined in:
- lib/rubric_llm/metrics/relevance.rb
Constant Summary collapse
- SYSTEM_PROMPT =
<<~PROMPT You are an evaluation judge. Assess whether the answer is relevant to the question. A relevant answer directly addresses what was asked. Respond with JSON only: { "score": <float 0.0-1.0>, "reasoning": "<brief explanation>" } PROMPT
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from RubricLLM::Metrics::Base
Instance Method Details
#call(question:, answer:) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/rubric_llm/metrics/relevance.rb', line 17 def call(question:, answer:, **) user_prompt = <<~PROMPT Question: #{question} Answer: #{answer} Evaluate how relevant the answer is to the question. PROMPT result = judge_eval(system_prompt: SYSTEM_PROMPT, user_prompt:) normalize(result) end |