Class: OmniAI::Chat::Choice
- Inherits:
-
Object
- Object
- OmniAI::Chat::Choice
- Defined in:
- lib/omniai/chat/choice.rb
Overview
A choice returned by the API.
Instance Attribute Summary collapse
-
#delta ⇒ Object
Returns the value of attribute delta.
-
#index ⇒ Object
Returns the value of attribute index.
-
#message ⇒ Object
Returns the value of attribute message.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(index:, delta:, message:) ⇒ Choice
constructor
A new instance of Choice.
Constructor Details
#initialize(index:, delta:, message:) ⇒ Choice
Returns a new instance of Choice.
20 21 22 23 24 |
# File 'lib/omniai/chat/choice.rb', line 20 def initialize(index:, delta:, message:) @index = index @delta = delta @message = end |
Instance Attribute Details
#delta ⇒ Object
Returns the value of attribute delta.
7 8 9 |
# File 'lib/omniai/chat/choice.rb', line 7 def delta @delta end |
#index ⇒ Object
Returns the value of attribute index.
7 8 9 |
# File 'lib/omniai/chat/choice.rb', line 7 def index @index end |
#message ⇒ Object
Returns the value of attribute message.
7 8 9 |
# File 'lib/omniai/chat/choice.rb', line 7 def @message end |
Class Method Details
.for(data:) ⇒ OmniAI::Chat::Choice
11 12 13 14 15 16 17 |
# File 'lib/omniai/chat/choice.rb', line 11 def self.for(data:) index = data['index'] delta = Delta.for(data: data['delta']) if data['delta'] = Message.for(data: data['message']) if data['message'] new(index:, delta:, message:) end |