Exception: LittleGhost::ToolError

Inherits:
Error
  • Object
show all
Defined in:
lib/little_ghost/errors.rb

Overview

Base class for expected failures while executing a Tool. Its message may be returned to the model, so it must be safe to disclose.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = nil, framework_prompt: nil) ⇒ ToolError

Creates a safe Tool failure from application prose or a framework prompt reference.



79
80
81
82
83
84
85
86
87
# File 'lib/little_ghost/errors.rb', line 79

def initialize(message = nil, framework_prompt: nil)
  reference = framework_prompt
  if !reference && defined?(FrameworkPrompts::Reference) && message.is_a?(FrameworkPrompts::Reference)
    reference = message
  end
  @framework_prompt = reference
  message = FrameworkPrompts.new.render_reference(reference) if reference
  super(message)
end

Instance Attribute Details

#framework_promptObject (readonly)

:nodoc:



76
77
78
# File 'lib/little_ghost/errors.rb', line 76

def framework_prompt
  @framework_prompt
end