Class: HermesAgent::Client::Entities::ResponseUsage

Inherits:
HermesAgent::Client::Entity show all
Defined in:
lib/hermes_agent/client/entities/response.rb

Overview

The token usage reported for a Response (HermesAgent::Client::Entities::Response#usage). Note the Responses API uses different field names than chat completions: input_tokens/output_tokens rather than prompt_tokens/completion_tokens.

Instance Method Summary collapse

Methods inherited from HermesAgent::Client::Entity

#==, #[], #eql?, #hash, #to_h

Instance Method Details

#input_tokensInteger?

The number of tokens in the input.

Returns:

  • (Integer, nil)


20
21
22
# File 'lib/hermes_agent/client/entities/response.rb', line 20

def input_tokens
  self["input_tokens"]
end

#output_tokensInteger?

The number of tokens in the generated output.

Returns:

  • (Integer, nil)


28
29
30
# File 'lib/hermes_agent/client/entities/response.rb', line 28

def output_tokens
  self["output_tokens"]
end

#total_tokensInteger?

The total number of tokens used (input plus output).

Returns:

  • (Integer, nil)


36
37
38
# File 'lib/hermes_agent/client/entities/response.rb', line 36

def total_tokens
  self["total_tokens"]
end