Class: RobotLab::ToolCallHookContext

Inherits:
HookContext show all
Defined in:
lib/robot_lab/hook_context.rb

Instance Attribute Summary collapse

Attributes inherited from HookContext

#event, #metadata

Instance Method Summary collapse

Methods inherited from HookContext

#ext, #local, #to_h, #with_namespace

Constructor Details

#initialize(tool:, tool_args:, robot: nil, tool_result: nil, tool_error: nil) ⇒ ToolCallHookContext

Returns a new instance of ToolCallHookContext.



77
78
79
80
81
82
83
84
85
# File 'lib/robot_lab/hook_context.rb', line 77

def initialize(tool:, tool_args:, robot: nil, tool_result: nil, tool_error: nil, **)
  super(event: :tool_call, **)
  @tool = tool
  @tool_name = tool.respond_to?(:name) ? tool.name : tool.class.name
  @tool_args = tool_args
  @robot = robot
  @tool_result = tool_result
  @tool_error = tool_error
end

Instance Attribute Details

#robotObject (readonly)

Returns the value of attribute robot.



74
75
76
# File 'lib/robot_lab/hook_context.rb', line 74

def robot
  @robot
end

#toolObject (readonly)

Returns the value of attribute tool.



74
75
76
# File 'lib/robot_lab/hook_context.rb', line 74

def tool
  @tool
end

#tool_argsObject (readonly)

Returns the value of attribute tool_args.



74
75
76
# File 'lib/robot_lab/hook_context.rb', line 74

def tool_args
  @tool_args
end

#tool_errorObject

Returns the value of attribute tool_error.



75
76
77
# File 'lib/robot_lab/hook_context.rb', line 75

def tool_error
  @tool_error
end

#tool_nameObject (readonly)

Returns the value of attribute tool_name.



74
75
76
# File 'lib/robot_lab/hook_context.rb', line 74

def tool_name
  @tool_name
end

#tool_resultObject

Returns the value of attribute tool_result.



75
76
77
# File 'lib/robot_lab/hook_context.rb', line 75

def tool_result
  @tool_result
end