Class: LlmCostTracker::Pricing::Explanation

Inherits:
Data
  • Object
show all
Defined in:
lib/llm_cost_tracker/pricing/explainer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#effective_pricesObject (readonly)

Returns the value of attribute effective_prices

Returns:

  • (Object)

    the current value of effective_prices



8
9
10
# File 'lib/llm_cost_tracker/pricing/explainer.rb', line 8

def effective_prices
  @effective_prices
end

#matched_byObject (readonly)

Returns the value of attribute matched_by

Returns:

  • (Object)

    the current value of matched_by



8
9
10
# File 'lib/llm_cost_tracker/pricing/explainer.rb', line 8

def matched_by
  @matched_by
end

#matched_keyObject (readonly)

Returns the value of attribute matched_key

Returns:

  • (Object)

    the current value of matched_key



8
9
10
# File 'lib/llm_cost_tracker/pricing/explainer.rb', line 8

def matched_key
  @matched_key
end

#missing_price_keysObject (readonly)

Returns the value of attribute missing_price_keys

Returns:

  • (Object)

    the current value of missing_price_keys



8
9
10
# File 'lib/llm_cost_tracker/pricing/explainer.rb', line 8

def missing_price_keys
  @missing_price_keys
end

#modelObject (readonly)

Returns the value of attribute model

Returns:

  • (Object)

    the current value of model



8
9
10
# File 'lib/llm_cost_tracker/pricing/explainer.rb', line 8

def model
  @model
end

#pricesObject (readonly)

Returns the value of attribute prices

Returns:

  • (Object)

    the current value of prices



8
9
10
# File 'lib/llm_cost_tracker/pricing/explainer.rb', line 8

def prices
  @prices
end

#pricing_modeObject (readonly)

Returns the value of attribute pricing_mode

Returns:

  • (Object)

    the current value of pricing_mode



8
9
10
# File 'lib/llm_cost_tracker/pricing/explainer.rb', line 8

def pricing_mode
  @pricing_mode
end

#providerObject (readonly)

Returns the value of attribute provider

Returns:

  • (Object)

    the current value of provider



8
9
10
# File 'lib/llm_cost_tracker/pricing/explainer.rb', line 8

def provider
  @provider
end

#sourceObject (readonly)

Returns the value of attribute source

Returns:

  • (Object)

    the current value of source



8
9
10
# File 'lib/llm_cost_tracker/pricing/explainer.rb', line 8

def source
  @source
end

Instance Method Details

#complete?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/llm_cost_tracker/pricing/explainer.rb', line 23

def complete?
  matched? && missing_price_keys.empty?
end

#matched?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/llm_cost_tracker/pricing/explainer.rb', line 19

def matched?
  !prices.nil?
end

#messageObject



27
28
29
30
31
32
# File 'lib/llm_cost_tracker/pricing/explainer.rb', line 27

def message
  return "No price entry matched #{provider}/#{model}" unless matched?
  return "Matched #{matched_key} from #{source} via #{matched_by}" if complete?

  "Matched #{matched_key} from #{source} via #{matched_by}, but missing #{missing_price_keys.join(', ')}"
end