Exception: Collavre::ApprovalPendingError
- Inherits:
-
StandardError
- Object
- StandardError
- Collavre::ApprovalPendingError
- Defined in:
- app/errors/collavre/approval_pending_error.rb
Instance Attribute Summary collapse
-
#task ⇒ Object
readonly
Returns the value of attribute task.
-
#tool_call ⇒ Object
readonly
Returns the value of attribute tool_call.
Instance Method Summary collapse
-
#initialize(message = "Tool execution requires approval", tool_call: nil, task: nil) ⇒ ApprovalPendingError
constructor
A new instance of ApprovalPendingError.
- #to_h ⇒ Object
- #tool_arguments ⇒ Object
- #tool_call_id ⇒ Object
- #tool_name ⇒ Object
Constructor Details
#initialize(message = "Tool execution requires approval", tool_call: nil, task: nil) ⇒ ApprovalPendingError
Returns a new instance of ApprovalPendingError.
7 8 9 10 11 |
# File 'app/errors/collavre/approval_pending_error.rb', line 7 def initialize( = "Tool execution requires approval", tool_call: nil, task: nil) @tool_call = tool_call @task = task super() end |
Instance Attribute Details
#task ⇒ Object (readonly)
Returns the value of attribute task.
5 6 7 |
# File 'app/errors/collavre/approval_pending_error.rb', line 5 def task @task end |
#tool_call ⇒ Object (readonly)
Returns the value of attribute tool_call.
5 6 7 |
# File 'app/errors/collavre/approval_pending_error.rb', line 5 def tool_call @tool_call end |
Instance Method Details
#to_h ⇒ Object
45 46 47 48 49 50 51 52 |
# File 'app/errors/collavre/approval_pending_error.rb', line 45 def to_h { tool_name: tool_name, tool_call_id: tool_call_id, arguments: tool_arguments, task_id: task&.id } end |
#tool_arguments ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/errors/collavre/approval_pending_error.rb', line 23 def tool_arguments return {} unless tool_call if tool_call.respond_to?(:arguments) tool_call.arguments elsif tool_call.is_a?(Hash) tool_call["arguments"] || tool_call[:arguments] || {} else {} end end |
#tool_call_id ⇒ Object
35 36 37 38 39 40 41 42 43 |
# File 'app/errors/collavre/approval_pending_error.rb', line 35 def tool_call_id return nil unless tool_call if tool_call.respond_to?(:id) tool_call.id elsif tool_call.is_a?(Hash) tool_call["id"] || tool_call[:id] end end |
#tool_name ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'app/errors/collavre/approval_pending_error.rb', line 13 def tool_name return nil unless tool_call if tool_call.respond_to?(:name) tool_call.name elsif tool_call.is_a?(Hash) tool_call["name"] || tool_call[:name] end end |