Class: LlmCostTracker::PriceSync::RawPrice

Inherits:
Data
  • Object
show all
Defined in:
lib/llm_cost_tracker/price_sync/raw_price.rb,
lib/llm_cost_tracker/price_sync/raw_price.rb

Constant Summary collapse

PRICE_FIELDS =
%w[input output cached_input cache_read_input cache_creation_input].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cache_creation_inputObject (readonly)

Returns the value of attribute cache_creation_input

Returns:

  • (Object)

    the current value of cache_creation_input



5
6
7
# File 'lib/llm_cost_tracker/price_sync/raw_price.rb', line 5

def cache_creation_input
  @cache_creation_input
end

#cache_read_inputObject (readonly)

Returns the value of attribute cache_read_input

Returns:

  • (Object)

    the current value of cache_read_input



5
6
7
# File 'lib/llm_cost_tracker/price_sync/raw_price.rb', line 5

def cache_read_input
  @cache_read_input
end

#cached_inputObject (readonly)

Returns the value of attribute cached_input

Returns:

  • (Object)

    the current value of cached_input



5
6
7
# File 'lib/llm_cost_tracker/price_sync/raw_price.rb', line 5

def cached_input
  @cached_input
end

#fetched_atObject (readonly)

Returns the value of attribute fetched_at

Returns:

  • (Object)

    the current value of fetched_at



5
6
7
# File 'lib/llm_cost_tracker/price_sync/raw_price.rb', line 5

def fetched_at
  @fetched_at
end

#inputObject (readonly)

Returns the value of attribute input

Returns:

  • (Object)

    the current value of input



5
6
7
# File 'lib/llm_cost_tracker/price_sync/raw_price.rb', line 5

def input
  @input
end

#modelObject (readonly)

Returns the value of attribute model

Returns:

  • (Object)

    the current value of model



5
6
7
# File 'lib/llm_cost_tracker/price_sync/raw_price.rb', line 5

def model
  @model
end

#outputObject (readonly)

Returns the value of attribute output

Returns:

  • (Object)

    the current value of output



5
6
7
# File 'lib/llm_cost_tracker/price_sync/raw_price.rb', line 5

def output
  @output
end

#providerObject (readonly)

Returns the value of attribute provider

Returns:

  • (Object)

    the current value of provider



5
6
7
# File 'lib/llm_cost_tracker/price_sync/raw_price.rb', line 5

def provider
  @provider
end

#sourceObject (readonly)

Returns the value of attribute source

Returns:

  • (Object)

    the current value of source



5
6
7
# File 'lib/llm_cost_tracker/price_sync/raw_price.rb', line 5

def source
  @source
end

#source_versionObject (readonly)

Returns the value of attribute source_version

Returns:

  • (Object)

    the current value of source_version



5
6
7
# File 'lib/llm_cost_tracker/price_sync/raw_price.rb', line 5

def source_version
  @source_version
end

Instance Method Details

#to_registry_entry(today:) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/llm_cost_tracker/price_sync/raw_price.rb', line 21

def to_registry_entry(today:)
  {
    "input" => input,
    "output" => output,
    "cached_input" => cached_input,
    "cache_read_input" => cache_read_input,
    "cache_creation_input" => cache_creation_input,
    "_source" => source.to_s,
    "_source_version" => source_version,
    "_fetched_at" => fetched_at || today.iso8601
  }.compact
end