Class: Conductor::Workflow::Llm::ToolCall

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

Overview

ToolCall represents a tool invocation in an LLM conversation

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, task_reference_name: nil, integration_names: nil, type: 'SIMPLE', input_parameters: nil, output: nil) ⇒ ToolCall

Returns a new instance of ToolCall.

Parameters:

  • name (String)

    Tool name

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

    Task reference name

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

    Integration name mappings

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

    Tool type (default: 'SIMPLE')

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

    Input parameters for the tool

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

    Expected output



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

def initialize(name:, task_reference_name: nil, integration_names: nil,
               type: 'SIMPLE', input_parameters: nil, output: nil)
  @name = name
  @task_reference_name = task_reference_name
  @integration_names = integration_names
  @type = type
  @input_parameters = input_parameters
  @output = output
end

Instance Attribute Details

#input_parametersObject

Returns the value of attribute input_parameters.



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

def input_parameters
  @input_parameters
end

#integration_namesObject

Returns the value of attribute integration_names.



8
9
10
# File 'lib/conductor/workflow/llm/tool_call.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_call.rb', line 8

def name
  @name
end

#outputObject

Returns the value of attribute output.



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

def output
  @output
end

#task_reference_nameObject

Returns the value of attribute task_reference_name.



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

def task_reference_name
  @task_reference_name
end

#typeObject

Returns the value of attribute type.



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

def type
  @type
end

Instance Method Details

#to_hHash

Convert to hash for serialization

Returns:

  • (Hash)

    The tool call as a hash with camelCase keys



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/conductor/workflow/llm/tool_call.rb', line 29

def to_h
  result = {
    'name' => @name,
    'type' => @type
  }
  result['taskReferenceName'] = @task_reference_name if @task_reference_name
  result['integrationNames'] = @integration_names if @integration_names
  result['inputParameters'] = @input_parameters if @input_parameters
  result['output'] = @output if @output
  result
end