Class: LlmCostTracker::Dashboard::DataQuality

Inherits:
Object
  • Object
show all
Defined in:
app/services/llm_cost_tracker/dashboard/data_quality.rb

Class Method Summary collapse

Class Method Details

.call(scope: LlmCostTracker::LlmApiCall.all) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'app/services/llm_cost_tracker/dashboard/data_quality.rb', line 31

def call(scope: LlmCostTracker::LlmApiCall.all)
  total = scope.count

  DataQualityStats.new(
    total_calls: total,
    unknown_pricing_count: scope.unknown_pricing.count,
    untagged_calls_count: total - scope.with_json_tags.count,
    **latency_stats(scope),
    **stream_stats(scope),
    **provider_response_id_stats(scope),
    **usage_stats(scope),
    unknown_pricing_by_model: unknown_pricing_by_model(scope)
  )
end