31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'app/services/llm_cost_tracker/dashboard/data_quality.rb', line 31
def call(scope: LlmCostTracker::LlmApiCall.all)
model = scope.klass
aggregates = DataQualityAggregate.call(scope: scope)
total = aggregates.fetch(:total_calls).to_i
DataQualityStats.new(
total_calls: total,
unknown_pricing_count: aggregates.fetch(:unknown_pricing_count).to_i,
untagged_calls_count: total - aggregates.fetch(:tagged_calls_count).to_i,
**latency_stats(aggregates, model:),
**stream_stats(aggregates, model:),
**provider_response_id_stats(aggregates, model:),
**usage_stats(aggregates, model:),
unknown_pricing_by_model: unknown_pricing_by_model(scope)
)
end
|