Class: LlmCostTracker::Event

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#costObject (readonly)

Returns the value of attribute cost

Returns:

  • (Object)

    the current value of cost



4
5
6
# File 'lib/llm_cost_tracker/event.rb', line 4

def cost
  @cost
end

#input_tokensObject (readonly)

Returns the value of attribute input_tokens

Returns:

  • (Object)

    the current value of input_tokens



4
5
6
# File 'lib/llm_cost_tracker/event.rb', line 4

def input_tokens
  @input_tokens
end

#latency_msObject (readonly)

Returns the value of attribute latency_ms

Returns:

  • (Object)

    the current value of latency_ms



4
5
6
# File 'lib/llm_cost_tracker/event.rb', line 4

def latency_ms
  @latency_ms
end

#modelObject (readonly)

Returns the value of attribute model

Returns:

  • (Object)

    the current value of model



4
5
6
# File 'lib/llm_cost_tracker/event.rb', line 4

def model
  @model
end

#output_tokensObject (readonly)

Returns the value of attribute output_tokens

Returns:

  • (Object)

    the current value of output_tokens



4
5
6
# File 'lib/llm_cost_tracker/event.rb', line 4

def output_tokens
  @output_tokens
end

#providerObject (readonly)

Returns the value of attribute provider

Returns:

  • (Object)

    the current value of provider



4
5
6
# File 'lib/llm_cost_tracker/event.rb', line 4

def provider
  @provider
end

#tagsObject (readonly)

Returns the value of attribute tags

Returns:

  • (Object)

    the current value of tags



4
5
6
# File 'lib/llm_cost_tracker/event.rb', line 4

def tags
  @tags
end

#total_tokensObject (readonly)

Returns the value of attribute total_tokens

Returns:

  • (Object)

    the current value of total_tokens



4
5
6
# File 'lib/llm_cost_tracker/event.rb', line 4

def total_tokens
  @total_tokens
end

#tracked_atObject (readonly)

Returns the value of attribute tracked_at

Returns:

  • (Object)

    the current value of tracked_at



4
5
6
# File 'lib/llm_cost_tracker/event.rb', line 4

def tracked_at
  @tracked_at
end

Instance Method Details

#to_hObject



15
16
17
18
19
20
# File 'lib/llm_cost_tracker/event.rb', line 15

def to_h
  super.merge(
    cost: cost&.to_h,
    tags: tags ? tags.to_h : {}
  )
end