Class: Crimson::Message::ToolCall
- Inherits:
-
Object
- Object
- Crimson::Message::ToolCall
- Defined in:
- lib/crimson/message.rb
Overview
Represents a tool/function call requested by the model.
Instance Attribute Summary collapse
- #arguments ⇒ String, Hash readonly
- #id ⇒ String, Hash readonly
- #name ⇒ String, Hash readonly
Instance Method Summary collapse
-
#initialize(id:, name:, arguments: {}) ⇒ ToolCall
constructor
A new instance of ToolCall.
-
#to_openai_h ⇒ Hash
OpenAI-compatible tool call representation.
Constructor Details
#initialize(id:, name:, arguments: {}) ⇒ ToolCall
Returns a new instance of ToolCall.
117 118 119 120 121 |
# File 'lib/crimson/message.rb', line 117 def initialize(id:, name:, arguments: {}) @id = id @name = name @arguments = arguments end |
Instance Attribute Details
#arguments ⇒ String, Hash (readonly)
112 113 114 |
# File 'lib/crimson/message.rb', line 112 def arguments @arguments end |
#id ⇒ String, Hash (readonly)
112 113 114 |
# File 'lib/crimson/message.rb', line 112 def id @id end |
#name ⇒ String, Hash (readonly)
112 113 114 |
# File 'lib/crimson/message.rb', line 112 def name @name end |
Instance Method Details
#to_openai_h ⇒ Hash
Returns OpenAI-compatible tool call representation.
124 125 126 127 128 129 130 131 132 133 |
# File 'lib/crimson/message.rb', line 124 def to_openai_h { id: @id, type: "function", function: { name: @name, arguments: JSON.generate(@arguments) } } end |