41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
# File 'lib/legion/data/models/llm/message.rb', line 41
def incident_flow
requests = incident_flow_requests
responses = incident_flow_responses(requests)
route_attempts = RouteAttempt.where(message_inference_request_id: requests.map(&:id))
.order(:message_inference_request_id, :attempt_no, :id)
.all
tool_calls = incident_flow_tool_calls(responses)
tool_call_attempts = ToolCallAttempt.where(tool_call_id: tool_calls.map(&:id))
.order(:tool_call_id, :attempt_no, :id)
.all
{
message: self,
conversation: conversation,
requests: requests,
route_attempts: route_attempts,
responses: responses,
response_messages: responses.filter_map(&:response_message),
tool_calls: tool_calls,
tool_call_attempts: tool_call_attempts,
result_messages: incident_flow_result_messages(responses, tool_calls)
}
end
|