Class: Rixie::LLM::ToolCall
- Inherits:
-
Object
- Object
- Rixie::LLM::ToolCall
- Defined in:
- lib/rixie/llm/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.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(id:, name:, arguments:) ⇒ ToolCall
constructor
A new instance of ToolCall.
- #to_openai_wire ⇒ Object
Constructor Details
#initialize(id:, name:, arguments:) ⇒ ToolCall
Returns a new instance of ToolCall.
10 11 12 13 14 |
# File 'lib/rixie/llm/tool_call.rb', line 10 def initialize(id:, name:, arguments:) @id = id @name = name @arguments = arguments end |
Instance Attribute Details
#arguments ⇒ Object (readonly)
Returns the value of attribute arguments.
8 9 10 |
# File 'lib/rixie/llm/tool_call.rb', line 8 def arguments @arguments end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
8 9 10 |
# File 'lib/rixie/llm/tool_call.rb', line 8 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/rixie/llm/tool_call.rb', line 8 def name @name end |
Class Method Details
.from_openai_wire(raw) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/rixie/llm/tool_call.rb', line 16 def self.from_openai_wire(raw) new( id: raw["id"], name: raw["function"]["name"], arguments: JSON.parse(raw["function"]["arguments"]) ) end |
Instance Method Details
#to_openai_wire ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/rixie/llm/tool_call.rb', line 24 def to_openai_wire { "id" => @id, "type" => "function", "function" => { "name" => @name, "arguments" => JSON.generate(@arguments) } } end |