Class: Cadenya::Types::ToolSpec

Inherits:
Object
  • Object
show all
Defined in:
lib/cadenya/types.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(description: nil, requires_approval: nil, parameters: nil, config: nil, llm_tool_name: nil) ⇒ ToolSpec

Returns a new instance of ToolSpec.



6398
6399
6400
6401
6402
6403
6404
# File 'lib/cadenya/types.rb', line 6398

def initialize(description: nil, requires_approval: nil, parameters: nil, config: nil, llm_tool_name: nil)
  @description = description
  @requires_approval = requires_approval
  @parameters = parameters
  @config = config
  @llm_tool_name = llm_tool_name
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



6396
6397
6398
# File 'lib/cadenya/types.rb', line 6396

def config
  @config
end

#descriptionObject (readonly)

Returns the value of attribute description.



6396
6397
6398
# File 'lib/cadenya/types.rb', line 6396

def description
  @description
end

#llm_tool_nameObject (readonly)

Returns the value of attribute llm_tool_name.



6396
6397
6398
# File 'lib/cadenya/types.rb', line 6396

def llm_tool_name
  @llm_tool_name
end

#parametersObject (readonly)

Returns the value of attribute parameters.



6396
6397
6398
# File 'lib/cadenya/types.rb', line 6396

def parameters
  @parameters
end

#requires_approvalObject (readonly)

Returns the value of attribute requires_approval.



6396
6397
6398
# File 'lib/cadenya/types.rb', line 6396

def requires_approval
  @requires_approval
end

Class Method Details

.from_json(data) ⇒ Object



6406
6407
6408
6409
6410
6411
6412
6413
6414
# File 'lib/cadenya/types.rb', line 6406

def self.from_json(data)
  new(
    description: data["description"],
    requires_approval: data["requiresApproval"],
    parameters: data["parameters"],
    config: data["config"].nil? ? nil : Types.decode_ToolSpec_Config(data["config"]),
    llm_tool_name: data["llmToolName"],
  )
end

Instance Method Details

#to_hObject



6416
6417
6418
6419
6420
6421
6422
6423
6424
# File 'lib/cadenya/types.rb', line 6416

def to_h
  {
    description: Util.plain(@description),
    requires_approval: Util.plain(@requires_approval),
    parameters: Util.plain(@parameters),
    config: Util.plain(@config),
    llm_tool_name: Util.plain(@llm_tool_name),
  }.reject { |_k, v| v.nil? }
end