Class: Assistant::TechnicalSupport::CaseReplayConversation
- Inherits:
-
Object
- Object
- Assistant::TechnicalSupport::CaseReplayConversation
- Defined in:
- app/services/assistant/technical_support/case_replay_conversation.rb
Overview
Runs the observable episode through Sunny and returns the persisted tool trace
plus separately selected replay and hidden-outcome facts for grading.
Defined Under Namespace
Classes: Result
Class Method Summary collapse
-
.call(**attributes) ⇒ Result
Replay conversation outcome.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(chat_runner:, account:, support_case:, episode:, events:, tool_services:) ⇒ CaseReplayConversation
constructor
A new instance of CaseReplayConversation.
Constructor Details
#initialize(chat_runner:, account:, support_case:, episode:, events:, tool_services:) ⇒ CaseReplayConversation
Returns a new instance of CaseReplayConversation.
36 37 38 39 40 41 42 43 |
# File 'app/services/assistant/technical_support/case_replay_conversation.rb', line 36 def initialize(chat_runner:, account:, support_case:, episode:, events:, tool_services:) @chat_runner = chat_runner @account = account @support_case = support_case @episode = episode @events = Array(events) @tool_services = tool_services end |
Class Method Details
.call(**attributes) ⇒ Result
Returns replay conversation outcome.
31 32 33 |
# File 'app/services/assistant/technical_support/case_replay_conversation.rb', line 31 def call(**attributes) new(**attributes).call end |
Instance Method Details
#call ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'app/services/assistant/technical_support/case_replay_conversation.rb', line 45 def call run = chat_runner.call( account:, support_case:, prompts: prompts, tool_services: ) Result.new( conversation_id: run.conversation_id, answer: run.answer.to_s, tool_trace: normalize_tool_trace(run.tool_trace), system_prompt_trace: normalize_system_prompt_trace(run.system_prompt_trace), replay_facts: replay_events.map { |event| event_fact(event) }, outcome_facts: outcome_events.map { |event| event_fact(event) } ) end |