Module: OllamaChat::Utils::ValueFormatter
- Included in:
- Chat, FollowChat, MessageList, Tools::Concern
- Defined in:
- lib/ollama_chat/utils/value_formatter.rb
Overview
Module to format values for user consumption.
Instance Method Summary collapse
-
#format_bytes(bytes) ⇒ String
Formats a byte value into a human‑readable string with units.
-
#format_tokens(tokens) ⇒ String
Formats a token count into a human‑readable string with units.
Instance Method Details
#format_bytes(bytes) ⇒ String
Formats a byte value into a human‑readable string with units
7 8 9 |
# File 'lib/ollama_chat/utils/value_formatter.rb', line 7 def format_bytes(bytes) Tins::Unit.format(bytes, unit: ?B, prefix: :iec_uc, format: '%.1f %U') end |
#format_tokens(tokens) ⇒ String
Formats a token count into a human‑readable string with units
15 16 17 |
# File 'lib/ollama_chat/utils/value_formatter.rb', line 15 def format_tokens(tokens) Tins::Unit.format(tokens, unit: ?T, prefix: :si_uc, format: '%.1f %U') end |