Class: LlmCostTracker::Generators::AddTokenUsageGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
ActiveRecord::Generators::Migration
Defined in:
lib/llm_cost_tracker/generators/llm_cost_tracker/add_token_usage_generator.rb

Constant Summary collapse

TOKEN_COLUMNS =
%w[
  cache_read_input_tokens
  cache_write_input_tokens
  cache_write_1h_input_tokens
  hidden_output_tokens
].freeze
COST_COLUMNS =
%w[
  cache_read_input_cost
  cache_write_input_cost
  cache_write_1h_input_cost
].freeze
COLUMN_NAMES =
(TOKEN_COLUMNS + COST_COLUMNS + %w[pricing_mode]).freeze

Instance Method Summary collapse

Instance Method Details

#create_migration_fileObject



28
29
30
31
32
33
# File 'lib/llm_cost_tracker/generators/llm_cost_tracker/add_token_usage_generator.rb', line 28

def create_migration_file
  migration_template(
    "add_token_usage_to_llm_api_calls.rb.erb",
    "db/migrate/add_token_usage_to_llm_api_calls.rb"
  )
end