Class: LLM::Shell::Formatter
- Inherits:
-
Object
- Object
- LLM::Shell::Formatter
- Includes:
- Command::Utils
- Defined in:
- lib/llm/shell/formatter.rb
Constant Summary collapse
- FormatError =
Class.new(RuntimeError)
Instance Method Summary collapse
-
#initialize(messages) ⇒ Formatter
constructor
A new instance of Formatter.
-
#format!(role) ⇒ Object
Constructor Details
#initialize(messages) ⇒ Formatter
Returns a new instance of Formatter.
8 9 10 |
# File 'lib/llm/shell/formatter.rb', line 8 def initialize() @messages = .reject(&:tool_call?) end |
Instance Method Details
#format!(role) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/llm/shell/formatter.rb', line 12 def format!(role) case role when :user then format_user() when :assistant then format_assistant() else raise FormatError.new("#{role} is not known") end end |