Class: OmniAI::Embed::Usage

Inherits:
Object
  • Object
show all
Defined in:
lib/omniai/embed/usage.rb

Overview

Token usage returned by the API.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(prompt_tokens:, total_tokens:) ⇒ Usage

Returns a new instance of Usage.

Parameters:

  • prompt_tokens

    Integer

  • total_tokens

    Integer



15
16
17
18
# File 'lib/omniai/embed/usage.rb', line 15

def initialize(prompt_tokens:, total_tokens:)
  @prompt_tokens = prompt_tokens
  @total_tokens = total_tokens
end

Instance Attribute Details

#prompt_tokensInteger

Returns:

  • (Integer)


8
9
10
# File 'lib/omniai/embed/usage.rb', line 8

def prompt_tokens
  @prompt_tokens
end

#total_tokensInteger

Returns:

  • (Integer)


11
12
13
# File 'lib/omniai/embed/usage.rb', line 11

def total_tokens
  @total_tokens
end

Instance Method Details

#inspectString

Returns:

  • (String)


21
22
23
# File 'lib/omniai/embed/usage.rb', line 21

def inspect
  "#<#{self.class.name} prompt_tokens=#{@prompt_tokens} total_tokens=#{@total_tokens}>"
end