class RubyLLM::RequestShape::ToolRound
A ToolRound describes a model turn that called tools and the results the request sends back before the next model turn: how many of each, and whether they pair up the way the provider matches them.
round.turn # => 1 round.calls # => 2 round.results # => 1 round.paired? # => false round.to_s # => "tool round at #1: 2 calls, 1 result, not paired"
Attributes
The number of tool calls in the round.
The number of tool results sent back for the round.
The index of the turn that made the calls.
Public Class Methods
# File lib/ruby_llm/request_shape/tool_round.rb, line 29 def initialize(turn:, calls:, results:, paired:) @turn = turn @calls = calls @results = results @paired = paired end
Creates a round at turn with the number of calls and results, and whether they are paired.
Public Instance Methods
Source
# File lib/ruby_llm/request_shape/tool_round.rb, line 38 def paired? @paired end
Returns whether every call has its result, matched the way the provider matches them: by call id, or by position and tool name.
Source
# File lib/ruby_llm/request_shape/tool_round.rb, line 49 def to_h { turn: turn, calls: calls, results: results, paired: paired? } end
Returns the round as a Hash with its turn, counts, and pairing.
Source
# File lib/ruby_llm/request_shape/tool_round.rb, line 43 def to_s "tool round at ##{turn}: #{counted(calls, 'call')}, #{counted(results, 'result')}, " \ "#{paired? ? 'paired' : 'not paired'}" end
Returns the round in words.