Class: OpenaiChatgpt::Usage

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

Overview

Usage object

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(obj) ⇒ Usage

Returns a new instance of Usage.



8
9
10
11
12
# File 'lib/openai_chatgpt/usage.rb', line 8

def initialize(obj)
  @prompt_tokens = obj.prompt_tokens
  @completion_tokens = obj.completion_tokens
  @total_tokens = obj.total_tokens
end

Instance Attribute Details

#completion_tokensObject (readonly)

Returns the value of attribute completion_tokens.



6
7
8
# File 'lib/openai_chatgpt/usage.rb', line 6

def completion_tokens
  @completion_tokens
end

#prompt_tokensObject (readonly)

Returns the value of attribute prompt_tokens.



6
7
8
# File 'lib/openai_chatgpt/usage.rb', line 6

def prompt_tokens
  @prompt_tokens
end

#total_tokensObject (readonly)

Returns the value of attribute total_tokens.



6
7
8
# File 'lib/openai_chatgpt/usage.rb', line 6

def total_tokens
  @total_tokens
end