Class: Smith::Tool::ExecutionBatchRequests

Inherits:
Object
  • Object
show all
Extended by:
Dry::Initializer
Defined in:
lib/smith/tool/execution_batch_requests.rb

Constant Summary collapse

MAX_NODES =
ArgumentSnapshot::MAX_NODES
MAX_BYTES =
ArgumentSnapshot::MAX_BYTES
MAX_CALLS =
ExecutionBatchCollection::MAX_CALLS

Instance Method Summary collapse

Instance Method Details

#callObject

Raises:



18
19
20
21
22
23
24
25
26
# File 'lib/smith/tool/execution_batch_requests.rb', line 18

def call
  raise Error, "tool batch exceeds #{MAX_CALLS} Smith tool calls" if targets.length > MAX_CALLS

  totals = [0, 0]
  targets.each_with_object({}.compare_by_identity) do |(tool_call, tool), requests|
    append_request!(requests, tool_call, tool, totals)
  end
    .freeze
end