Class: Conductor::Workflow::Llm::ToolSpec

Inherits:
Object
  • Object
show all
Defined in:
lib/conductor/workflow/llm/tool_spec.rb

Overview

ToolSpec defines a tool specification for LLM function calling

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, type: 'SIMPLE', description: nil, config_params: nil, integration_names: nil, input_schema: nil, output_schema: nil) ⇒ ToolSpec

Returns a new instance of ToolSpec.

Parameters:

  • name (String)

    Tool name

  • type (String) (defaults to: 'SIMPLE')

    Tool type (default: 'SIMPLE')

  • description (String, nil) (defaults to: nil)

    Tool description

  • config_params (Hash, nil) (defaults to: nil)

    Configuration parameters

  • integration_names (Hash<String,String>, nil) (defaults to: nil)

    Integration name mappings

  • input_schema (Hash, nil) (defaults to: nil)

    JSON schema for inputs

  • output_schema (Hash, nil) (defaults to: nil)

    JSON schema for outputs



18
19
20
21
22
23
24
25
26
27
# File 'lib/conductor/workflow/llm/tool_spec.rb', line 18

def initialize(name:, type: 'SIMPLE', description: nil, config_params: nil,
               integration_names: nil, input_schema: nil, output_schema: nil)
  @name = name
  @type = type
  @description = description
  @config_params = config_params
  @integration_names = integration_names
  @input_schema = input_schema
  @output_schema = output_schema
end

Instance Attribute Details

#config_paramsObject

Returns the value of attribute config_params.



8
9
10
# File 'lib/conductor/workflow/llm/tool_spec.rb', line 8

def config_params
  @config_params
end

#descriptionObject

Returns the value of attribute description.



8
9
10
# File 'lib/conductor/workflow/llm/tool_spec.rb', line 8

def description
  @description
end

#input_schemaObject

Returns the value of attribute input_schema.



8
9
10
# File 'lib/conductor/workflow/llm/tool_spec.rb', line 8

def input_schema
  @input_schema
end

#integration_namesObject

Returns the value of attribute integration_names.



8
9
10
# File 'lib/conductor/workflow/llm/tool_spec.rb', line 8

def integration_names
  @integration_names
end

#nameObject

Returns the value of attribute name.



8
9
10
# File 'lib/conductor/workflow/llm/tool_spec.rb', line 8

def name
  @name
end

#output_schemaObject

Returns the value of attribute output_schema.



8
9
10
# File 'lib/conductor/workflow/llm/tool_spec.rb', line 8

def output_schema
  @output_schema
end

#typeObject

Returns the value of attribute type.



8
9
10
# File 'lib/conductor/workflow/llm/tool_spec.rb', line 8

def type
  @type
end

Instance Method Details

#to_hHash

Convert to hash for serialization

Returns:

  • (Hash)

    The tool spec as a hash with camelCase keys



31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/conductor/workflow/llm/tool_spec.rb', line 31

def to_h
  result = {
    'name' => @name,
    'type' => @type
  }
  result['description'] = @description if @description
  result['configParams'] = @config_params if @config_params
  result['integrationNames'] = @integration_names if @integration_names
  result['inputSchema'] = @input_schema if @input_schema
  result['outputSchema'] = @output_schema if @output_schema
  result
end