Exception: Phronomy::Agent::ToolCallIntercepted Private

Inherits:
StandardError
  • Object
show all
Defined in:
lib/phronomy/agent/tool_call_intercepted.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Normal control-transfer signal raised before RubyLLM executes a Tool Call.

RubyLLM >= 1.15 guarantees that the complete assistant message has already been added to Chat#messages before before_tool_call runs. Keeping that message here allows Phronomy to persist the complete Provider outcome even though the RubyLLM call itself unwinds through this exception.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tool_calls, assistant_message: nil, assistant_outcome: nil, llm_call_id: nil) ⇒ ToolCallIntercepted

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of ToolCallIntercepted.



15
16
17
18
19
20
21
22
# File 'lib/phronomy/agent/tool_call_intercepted.rb', line 15

def initialize(tool_calls, assistant_message: nil, assistant_outcome: nil, llm_call_id: nil)
  @tool_calls = Array(tool_calls).freeze
  @assistant_message = assistant_message
  @assistant_outcome = assistant_outcome || ProviderCallOutcome.capture(assistant_message)
  @llm_call_id = llm_call_id&.to_s&.freeze
  names = @tool_calls.map(&:name).join(", ")
  super("Tool call intercepted: #{names}")
end

Instance Attribute Details

#assistant_messageObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



13
14
15
# File 'lib/phronomy/agent/tool_call_intercepted.rb', line 13

def assistant_message
  @assistant_message
end

#assistant_outcomeObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



13
14
15
# File 'lib/phronomy/agent/tool_call_intercepted.rb', line 13

def assistant_outcome
  @assistant_outcome
end

#llm_call_idObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



13
14
15
# File 'lib/phronomy/agent/tool_call_intercepted.rb', line 13

def llm_call_id
  @llm_call_id
end

#tool_callsObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



13
14
15
# File 'lib/phronomy/agent/tool_call_intercepted.rb', line 13

def tool_calls
  @tool_calls
end

Instance Method Details

#tool_callObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



24
25
26
# File 'lib/phronomy/agent/tool_call_intercepted.rb', line 24

def tool_call
  @tool_calls.first
end