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

#provider_response_idObject (readonly)

Returns the value of attribute provider_response_id

Returns:

  • (Object)

    the current value of provider_response_id



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

def provider_response_id
  @provider_response_id
end

#streamObject (readonly)

Returns the value of attribute stream

Returns:

  • (Object)

    the current value of stream



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

def stream
  @stream
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

#usage_sourceObject (readonly)

Returns the value of attribute usage_source

Returns:

  • (Object)

    the current value of usage_source



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

def usage_source
  @usage_source
end

Instance Method Details

#to_hObject



18
19
20
21
22
23
# File 'lib/llm_cost_tracker/event.rb', line 18

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