Module: Raif::Concerns::AgentInferenceStats

Extended by:
ActiveSupport::Concern
Included in:
Agent
Defined in:
app/models/raif/concerns/agent_inference_stats.rb

Instance Method Summary collapse

Instance Method Details

#total_completion_tokensObject

Returns the total number of completion tokens across all model completions



19
20
21
# File 'app/models/raif/concerns/agent_inference_stats.rb', line 19

def total_completion_tokens
  @total_completion_tokens ||= raif_inference_cost_events.sum(:completion_tokens)
end

#total_costObject

Returns the total cost across all model completions



39
40
41
# File 'app/models/raif/concerns/agent_inference_stats.rb', line 39

def total_cost
  @total_cost ||= raif_inference_cost_events.sum(:total_cost)
end

#total_output_token_costObject

Returns the total cost of output tokens across all model completions



34
35
36
# File 'app/models/raif/concerns/agent_inference_stats.rb', line 34

def total_output_token_cost
  @total_output_token_cost ||= raif_inference_cost_events.sum(:output_token_cost)
end

#total_prompt_token_costObject

Returns the total cost of prompt tokens across all model completions



29
30
31
# File 'app/models/raif/concerns/agent_inference_stats.rb', line 29

def total_prompt_token_cost
  @total_prompt_token_cost ||= raif_inference_cost_events.sum(:prompt_token_cost)
end

#total_prompt_tokensObject

Returns the total number of prompt tokens across all model completions



14
15
16
# File 'app/models/raif/concerns/agent_inference_stats.rb', line 14

def total_prompt_tokens
  @total_prompt_tokens ||= raif_inference_cost_events.sum(:prompt_tokens)
end

#total_tokens_sumObject

Returns the total number of tokens across all model completions



24
25
26
# File 'app/models/raif/concerns/agent_inference_stats.rb', line 24

def total_tokens_sum
  @total_tokens_sum ||= raif_inference_cost_events.sum(:total_tokens)
end