Class: Smith::Tool::ExecutionBatchSourceMetadata

Inherits:
Dry::Struct
  • Object
show all
Defined in:
lib/smith/tool/execution_batch_source_metadata.rb

Constant Summary collapse

MAX_NAME_BYTES =
256
MAX_METADATA_BYTES =
ArgumentSnapshot::MAX_BYTES

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeExecutionBatchSourceMetadata

Returns a new instance of ExecutionBatchSourceMetadata.



46
47
48
49
# File 'lib/smith/tool/execution_batch_source_metadata.rb', line 46

def initialize(...)
  super
  freeze
end

Class Method Details

.capture(key:, tool_call:) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/smith/tool/execution_batch_source_metadata.rb', line 30

def self.capture(key:, tool_call:)
  name, canonical_name = owned_name(tool_call.name)
  tool_call_id = owned_id(tool_call)
  thought_signature = owned_thought_signature(tool_call)
  new(
    key:,
    tool_call:,
    tool_call_id:,
    name:,
    canonical_name:,
    thought_signature:,
    metadata_byte_count: string_bytes(canonical_name) + string_bytes(tool_call_id) +
                         string_bytes(thought_signature)
  )
end

Instance Method Details

#to_source_callObject



51
52
53
54
55
56
# File 'lib/smith/tool/execution_batch_source_metadata.rb', line 51

def to_source_call
  ExecutionBatchSourceCall.new(
    **to_h,
    arguments: tool_call.arguments
  )
end