9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/llm_cost_tracker/report.rb', line 9
def generate(days: Data::DEFAULT_DAYS, now: Time.now.utc, tag_breakdowns: nil)
report_data = Data.build(
days: days,
now: now,
tag_breakdowns: tag_breakdowns,
breakdown_limit: Formatter::TOP_LIMIT
)
Formatter.new(report_data).to_s
rescue LoadError => e
"Unable to build LLM cost report: ActiveRecord storage is unavailable (#{e.message})"
rescue StandardError => e
"Unable to build LLM cost report: #{e.class}: #{e.message}"
end
|