Class: LLM::Repl::Bar Private

Inherits:
Object
  • Object
show all
Defined in:
lib/llm/repl/bar.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

The LLM::Repl::Bar class renders a small progress bar for the REPL. It is used to show the remaining size of the model's context window in a compact form near the input line.

Constant Summary collapse

OCCUPIED =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Returns:

  • (String)
""
FREE =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Returns:

  • (String)
" "

Instance Method Summary collapse

Constructor Details

#initialize(used:, total:, width: 10) ⇒ LLM::Repl::Bar

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

  • used (Integer)
  • total (Integer)
  • width (Integer) (defaults to: 10)


24
25
26
27
# File 'lib/llm/repl/bar.rb', line 24

def initialize(used:, total:, width: 10)
  @width = width
  @label, @filled = remainder(used, total)
end

Instance Method Details

#to_sString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (String)


31
32
33
34
# File 'lib/llm/repl/bar.rb', line 31

def to_s
  bar = "#{OCCUPIED * filled}#{FREE * (width - filled)}"
  "#{bar}#{label}"
end