Class: Assistant::TechnicalSupport::CaseReplayResultBuilder
- Inherits:
-
Object
- Object
- Assistant::TechnicalSupport::CaseReplayResultBuilder
- Defined in:
- app/services/assistant/technical_support/case_replay_result_builder.rb
Overview
Grades a completed Sunny conversation, verifies citations and benchmark
provenance, and builds the immutable replay result.
Constant Summary collapse
- MAX_ARTICLE_REVIEW_PROPOSALS =
1
Class Method Summary collapse
-
.call(**attributes) ⇒ Assistant::TechnicalSupport::CaseReplay::Result
The immutable replay result.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(support_case:, episode:, stream:, conversation:, analyzer:) ⇒ CaseReplayResultBuilder
constructor
A new instance of CaseReplayResultBuilder.
Constructor Details
#initialize(support_case:, episode:, stream:, conversation:, analyzer:) ⇒ CaseReplayResultBuilder
Returns a new instance of CaseReplayResultBuilder.
21 22 23 24 25 26 27 |
# File 'app/services/assistant/technical_support/case_replay_result_builder.rb', line 21 def initialize(support_case:, episode:, stream:, conversation:, analyzer:) @support_case = support_case @episode = episode @stream = stream @conversation = conversation @analyzer = analyzer end |
Class Method Details
.call(**attributes) ⇒ Assistant::TechnicalSupport::CaseReplay::Result
Returns the immutable replay result.
16 17 18 |
# File 'app/services/assistant/technical_support/case_replay_result_builder.rb', line 16 def call(**attributes) new(**attributes).call end |
Instance Method Details
#call ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'app/services/assistant/technical_support/case_replay_result_builder.rb', line 29 def call assessment = assessment_for(conversation) evidence = Assistant::TechnicalSupport::CaseReplayEvidence.new(tool_trace: conversation.tool_trace) citation_urls = evidence.urls_in(conversation.answer) citations_grounded = evidence.citations_grounded?(citation_urls) status = replay_status(assessment, citations_grounded:) Assistant::TechnicalSupport::CaseReplay::Result.new( status:, support_case_id: support_case.id, case_number: support_case.case_number, conversation_id: conversation.conversation_id, episode:, assessment:, citation_urls:, citations_grounded:, article_review_proposals: proposals_for(status, evidence, assessment, citation_urls:), error: benchmark_error(assessment), **stream_attributes ) end |