Class: Durable::Llm::Providers::OpenAI::OpenAIChoice
- Inherits:
-
Object
- Object
- Durable::Llm::Providers::OpenAI::OpenAIChoice
- Defined in:
- lib/durable/llm/providers/openai.rb
Overview
Represents a single choice in an OpenAI chat completion response.
Each choice contains a message with role and content, along with metadata like finish reason.
Instance Attribute Summary collapse
-
#finish_reason ⇒ Object
readonly
Returns the value of attribute finish_reason.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
Instance Method Summary collapse
-
#initialize(choice) ⇒ OpenAIChoice
constructor
A new instance of OpenAIChoice.
- #to_s ⇒ Object
Constructor Details
#initialize(choice) ⇒ OpenAIChoice
Returns a new instance of OpenAIChoice.
299 300 301 302 |
# File 'lib/durable/llm/providers/openai.rb', line 299 def initialize(choice) @message = OpenAIMessage.new(choice['message']) @finish_reason = choice['finish_reason'] end |
Instance Attribute Details
#finish_reason ⇒ Object (readonly)
Returns the value of attribute finish_reason.
297 298 299 |
# File 'lib/durable/llm/providers/openai.rb', line 297 def finish_reason @finish_reason end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
297 298 299 |
# File 'lib/durable/llm/providers/openai.rb', line 297 def @message end |
Instance Method Details
#to_s ⇒ Object
304 305 306 |
# File 'lib/durable/llm/providers/openai.rb', line 304 def to_s @message.to_s end |