Class: LittleGhost::Subagents::ControlTool

Inherits:
Tool
  • Object
show all
Defined in:
lib/little_ghost/subagents/control_tool.rb

Overview

:nodoc:

Constant Summary

Constants inherited from Tool

Tool::UNSET_RESULT_VALUE

Instance Attribute Summary

Attributes inherited from Tool

#context

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Tool

#agent, available?, available_if, #call, #close, define, description, exclusive, #exclusive?, #execute, #initialize, input_schema, #model, #run, #runtime, #sandbox, specification, tool_name, #tool_name, #workspace

Methods included from LittleGhost::Support::ClassAttributes

#class_attribute, included

Constructor Details

This class inherits a constructor from LittleGhost::Tool

Class Method Details

.framework_prompts(description:, schema: {}, manager: nil) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/little_ghost/subagents/control_tool.rb', line 11

def framework_prompts(description:, schema: {}, manager: nil)
  self.framework_description_reference = description
  self.framework_schema_references = schema.freeze
  self.framework_prompt_manager = manager
  renderer = FrameworkPrompts.new
  self.description(renderer.render_reference(description))
  resolved_schema = schema.reduce(input_schema) do |value, (path, reference)|
    replace_schema_value(value, Array(path), renderer.render_reference(reference))
  end
  input_schema(resolved_schema)
end

Instance Method Details

#descriptionObject



34
35
36
# File 'lib/little_ghost/subagents/control_tool.rb', line 34

def description
  render_reference(self.class.framework_description_reference)
end

#input_schemaObject



38
39
40
41
42
# File 'lib/little_ghost/subagents/control_tool.rb', line 38

def input_schema
  self.class.framework_schema_references.reduce(self.class.input_schema) do |schema, (path, reference)|
    replace(schema, Array(path), render_reference(reference))
  end.freeze
end

#specificationObject



44
# File 'lib/little_ghost/subagents/control_tool.rb', line 44

def specification = {name: tool_name, description:, input_schema:}.freeze