Class: LlmCostTracker::Dashboard::ProviderBreakdown
- Inherits:
-
Object
- Object
- LlmCostTracker::Dashboard::ProviderBreakdown
- Defined in:
- app/services/llm_cost_tracker/dashboard/provider_breakdown.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(scope:) ⇒ ProviderBreakdown
constructor
A new instance of ProviderBreakdown.
- #rows ⇒ Object
Constructor Details
#initialize(scope:) ⇒ ProviderBreakdown
Returns a new instance of ProviderBreakdown.
10 11 12 |
# File 'app/services/llm_cost_tracker/dashboard/provider_breakdown.rb', line 10 def initialize(scope:) @scope = scope end |
Class Method Details
.call(scope: LlmCostTracker::Ledger::Call.all) ⇒ Object
6 7 8 |
# File 'app/services/llm_cost_tracker/dashboard/provider_breakdown.rb', line 6 def self.call(scope: LlmCostTracker::Ledger::Call.all) new(scope: scope).rows end |
Instance Method Details
#rows ⇒ Object
14 15 16 17 18 19 |
# File 'app/services/llm_cost_tracker/dashboard/provider_breakdown.rb', line 14 def rows scope .group(:provider) .select(selects) .order(Arel.sql("total_cost DESC, calls DESC")) end |