Class: Kreator::ToolCall
- Inherits:
-
Object
- Object
- Kreator::ToolCall
- Defined in:
- lib/kreator/tool_call.rb
Instance Attribute Summary collapse
-
#arguments ⇒ Object
readonly
Returns the value of attribute arguments.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#raw_arguments ⇒ Object
readonly
Returns the value of attribute raw_arguments.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(id:, name:, arguments: {}, raw_arguments: nil, metadata: {}) ⇒ ToolCall
constructor
A new instance of ToolCall.
- #to_h ⇒ Object
Constructor Details
#initialize(id:, name:, arguments: {}, raw_arguments: nil, metadata: {}) ⇒ ToolCall
Returns a new instance of ToolCall.
7 8 9 10 11 12 13 |
# File 'lib/kreator/tool_call.rb', line 7 def initialize(id:, name:, arguments: {}, raw_arguments: nil, metadata: {}) @id = id.to_s @name = name.to_s @arguments = arguments || {} @raw_arguments = raw_arguments @metadata = || {} end |
Instance Attribute Details
#arguments ⇒ Object (readonly)
Returns the value of attribute arguments.
5 6 7 |
# File 'lib/kreator/tool_call.rb', line 5 def arguments @arguments end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/kreator/tool_call.rb', line 5 def id @id end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
5 6 7 |
# File 'lib/kreator/tool_call.rb', line 5 def @metadata end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/kreator/tool_call.rb', line 5 def name @name end |
#raw_arguments ⇒ Object (readonly)
Returns the value of attribute raw_arguments.
5 6 7 |
# File 'lib/kreator/tool_call.rb', line 5 def raw_arguments @raw_arguments end |
Class Method Details
.from_h(hash) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/kreator/tool_call.rb', line 15 def self.from_h(hash) new( id: hash.fetch("id", hash[:id]), name: hash.fetch("name", hash[:name]), arguments: hash.fetch("arguments", hash[:arguments] || {}), raw_arguments: hash.fetch("raw_arguments", hash[:raw_arguments] || nil), metadata: hash.fetch("metadata", hash[:metadata] || {}) ) end |
Instance Method Details
#to_h ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/kreator/tool_call.rb', line 25 def to_h { "id" => id, "name" => name, "arguments" => arguments, "raw_arguments" => raw_arguments, "metadata" => }.compact end |