Class: Envoy::ToolCall

Inherits:
ApplicationRecord show all
Defined in:
app/models/envoy/tool_call.rb

Instance Method Summary collapse

Instance Method Details

#outcomeObject

Derive a governance outcome from the persisted result, tolerant of how the result content was serialized. Returns :denied / :failed / :succeeded.



12
13
14
15
16
# File 'app/models/envoy/tool_call.rb', line 12

def outcome
  payload = parsed_result
  return :succeeded unless payload.is_a?(Hash) && payload["error"]
  payload["type"] == "forbidden" ? :denied : :failed
end

#result_messageObject

The tool-result message that answers this call (role "tool").



6
7
8
# File 'app/models/envoy/tool_call.rb', line 6

def result_message
  Envoy::Message.find_by(tool_call_id: id)
end