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



12
13
14
# File 'app/models/raif/concerns/agent_inference_stats.rb', line 12

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

#total_costObject

Returns the total cost across all model completions



32
33
34
# File 'app/models/raif/concerns/agent_inference_stats.rb', line 32

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

#total_output_token_costObject

Returns the total cost of output tokens across all model completions



27
28
29
# File 'app/models/raif/concerns/agent_inference_stats.rb', line 27

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

#total_prompt_token_costObject

Returns the total cost of prompt tokens across all model completions



22
23
24
# File 'app/models/raif/concerns/agent_inference_stats.rb', line 22

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

#total_prompt_tokensObject

Returns the total number of prompt tokens across all model completions



7
8
9
# File 'app/models/raif/concerns/agent_inference_stats.rb', line 7

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

#total_tokens_sumObject

Returns the total number of tokens across all model completions



17
18
19
# File 'app/models/raif/concerns/agent_inference_stats.rb', line 17

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