Class: Intelligence::MessageContent::ToolResult

Inherits:
Base
  • Object
show all
Defined in:
lib/intelligence/message_content/tool_result.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Intelligence::MessageContent::Base

Instance Attribute Details

#tool_call_idObject (readonly)

Returns the value of attribute tool_call_id.



12
13
14
# File 'lib/intelligence/message_content/tool_result.rb', line 12

def tool_call_id
  @tool_call_id
end

#tool_nameObject (readonly)

Returns the value of attribute tool_name.



13
14
15
# File 'lib/intelligence/message_content/tool_result.rb', line 13

def tool_name
  @tool_name
end

#tool_resultObject (readonly)

Returns the value of attribute tool_result.



14
15
16
# File 'lib/intelligence/message_content/tool_result.rb', line 14

def tool_result
  @tool_result
end

Instance Method Details

#to_hObject



21
22
23
24
25
26
27
28
# File 'lib/intelligence/message_content/tool_result.rb', line 21

def to_h
  { 
    type:             :tool_result, 
    tool_call_id:     tool_call_id, 
    tool_name:        tool_name, 
    tool_result:      tool_result 
  }.compact
end

#valid?Boolean

Returns:

  • (Boolean)


16
17
18
19
# File 'lib/intelligence/message_content/tool_result.rb', line 16

def valid?
  tool_call_id && !tool_call_id.empty? &&
  tool_name && !tool_name.empty?
end