Exception: PatientLLM::HaltError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/patient_llm/halt_error.rb

Overview

Raised by a tool handler to short-circuit the auto-execution loop. The content is delivered to the user callback as the final assistant message.

Examples:

PromptBuilder.register_tool("stop", description: "Stop") do |args|
  raise PatientLLM::HaltError.new(content: "Done!")
end

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(content: nil, message: "Tool halted execution") ⇒ HaltError

Returns a new instance of HaltError.

Parameters:

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

    The content for the final assistant message

  • message (String) (defaults to: "Tool halted execution")

    Optional error message (defaults to “Tool halted execution”)



18
19
20
21
# File 'lib/patient_llm/halt_error.rb', line 18

def initialize(content: nil, message: "Tool halted execution")
  @content = content
  super(message)
end

Instance Attribute Details

#contentString? (readonly)

Returns Content to surface as the assistant response.

Returns:

  • (String, nil)

    Content to surface as the assistant response



14
15
16
# File 'lib/patient_llm/halt_error.rb', line 14

def content
  @content
end