Class: Assistant::TechnicalSupport::CaseReplayAssessmentBuilder
- Inherits:
-
Object
- Object
- Assistant::TechnicalSupport::CaseReplayAssessmentBuilder
- Defined in:
- app/services/assistant/technical_support/case_replay_assessment_builder.rb
Overview
Builds a replay assessment while independently constraining the grader's
benchmark citations to the raw hidden outcome events it actually received.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(payload:, outcome_facts:) ⇒ CaseReplayAssessmentBuilder
constructor
A new instance of CaseReplayAssessmentBuilder.
Constructor Details
#initialize(payload:, outcome_facts:) ⇒ CaseReplayAssessmentBuilder
Returns a new instance of CaseReplayAssessmentBuilder.
12 13 14 15 16 17 |
# File 'app/services/assistant/technical_support/case_replay_assessment_builder.rb', line 12 def initialize(payload:, outcome_facts:) @evaluation = payload.to_h.stringify_keys @allowed_evidence_ids = Array(outcome_facts).filter_map do |fact| fact[:event_key] || fact['event_key'] end.map(&:to_s) end |
Class Method Details
.call(payload:, outcome_facts:) ⇒ Object
7 8 9 |
# File 'app/services/assistant/technical_support/case_replay_assessment_builder.rb', line 7 def call(payload:, outcome_facts:) new(payload:, outcome_facts:).call end |
Instance Method Details
#call ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/services/assistant/technical_support/case_replay_assessment_builder.rb', line 19 def call benchmark_evidence_ids = string_array(evaluation['benchmark_evidence_ids']) Assistant::TechnicalSupport::CaseReplay::Assessment.new( benchmark_grounded: benchmark_grounded?(benchmark_evidence_ids), benchmark_evidence_ids:, same_outcome: evaluation['same_outcome'] == true, grounded: evaluation['grounded'] == true, safe: evaluation['safe'] == true, missing_facts: string_array(evaluation['missing_facts']), unsupported_claims: string_array(evaluation['unsupported_claims']), article_gap: evaluation['article_gap'].to_s.strip.presence, notes: evaluation['notes'].to_s.strip.presence ) end |