Class: LlmCostTracker::Report::Formatter
- Inherits:
-
Object
- Object
- LlmCostTracker::Report::Formatter
- Defined in:
- lib/llm_cost_tracker/report/formatter.rb
Constant Summary collapse
- TOP_LIMIT =
5- NAME_COLUMN_WIDTH =
28- TOP_CALL_COLUMN_WIDTH =
32
Instance Method Summary collapse
-
#initialize(data) ⇒ Formatter
constructor
A new instance of Formatter.
- #to_s ⇒ Object
Constructor Details
#initialize(data) ⇒ Formatter
Returns a new instance of Formatter.
10 11 12 |
# File 'lib/llm_cost_tracker/report/formatter.rb', line 10 def initialize(data) @data = data end |
Instance Method Details
#to_s ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/llm_cost_tracker/report/formatter.rb', line 14 def to_s lines = ["LLM Cost Report (last #{@data.days} days)", ""] append_summary(lines) append_cost_section(lines, "By provider", @data.cost_by_provider) append_cost_section(lines, "By model", @data.cost_by_model) append_tag_sections(lines) append_top_calls(lines) lines.join("\n") end |