Class: Legion::Extensions::Llm::ToolCall
- Inherits:
-
Object
- Object
- Legion::Extensions::Llm::ToolCall
- Defined in:
- lib/legion/extensions/llm/tool_call.rb
Overview
Represents a function call from an AI model to a Tool.
Instance Attribute Summary collapse
-
#arguments ⇒ Object
readonly
Returns the value of attribute arguments.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#index ⇒ Object
readonly
Returns the value of attribute index.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#thought_signature ⇒ Object
Returns the value of attribute thought_signature.
Instance Method Summary collapse
-
#initialize(id:, name:, arguments: {}, thought_signature: nil, index: nil) ⇒ ToolCall
constructor
index carries the provider's authoritative wire position (delta.tool_calls.index) so the StreamAccumulator can correlate interleaved argument fragments to the right parallel call by index rather than by recency.
- #to_h ⇒ Object
Constructor Details
#initialize(id:, name:, arguments: {}, thought_signature: nil, index: nil) ⇒ ToolCall
index carries the provider's authoritative wire position (delta.tool_calls.index) so the StreamAccumulator can correlate interleaved argument fragments to the right parallel call by index rather than by recency. nil for non-streaming/single-call paths.
15 16 17 18 19 20 21 |
# File 'lib/legion/extensions/llm/tool_call.rb', line 15 def initialize(id:, name:, arguments: {}, thought_signature: nil, index: nil) @id = id @name = name @arguments = arguments @thought_signature = thought_signature @index = index end |
Instance Attribute Details
#arguments ⇒ Object (readonly)
Returns the value of attribute arguments.
8 9 10 |
# File 'lib/legion/extensions/llm/tool_call.rb', line 8 def arguments @arguments end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
8 9 10 |
# File 'lib/legion/extensions/llm/tool_call.rb', line 8 def id @id end |
#index ⇒ Object (readonly)
Returns the value of attribute index.
8 9 10 |
# File 'lib/legion/extensions/llm/tool_call.rb', line 8 def index @index end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/legion/extensions/llm/tool_call.rb', line 8 def name @name end |
#thought_signature ⇒ Object
Returns the value of attribute thought_signature.
9 10 11 |
# File 'lib/legion/extensions/llm/tool_call.rb', line 9 def thought_signature @thought_signature end |
Instance Method Details
#to_h ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/legion/extensions/llm/tool_call.rb', line 23 def to_h { id: @id, name: @name, arguments: @arguments, thought_signature: @thought_signature }.compact end |