Class: OpenaiChatgpt::Choice

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

Overview

@note: This class is the choice response object.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(obj) ⇒ Choice

Returns a new instance of Choice.



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

def initialize(obj)
  @content = obj.message.content
  @index = obj.index
  @role = obj.message.role
end

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



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

def content
  @content
end

#indexObject (readonly)

Returns the value of attribute index.



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

def index
  @index
end

#roleObject (readonly)

Returns the value of attribute role.



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

def role
  @role
end