Class: Durable::Llm::Providers::Xai::XaiChoice
- Inherits:
-
Object
- Object
- Durable::Llm::Providers::Xai::XaiChoice
- Defined in:
- lib/durable/llm/providers/xai.rb
Overview
Represents a single choice in an xAI response.
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) ⇒ XaiChoice
constructor
Initializes the choice with message and finish reason.
-
#to_s ⇒ String
Converts the choice to a string by returning the message content.
Constructor Details
#initialize(choice) ⇒ XaiChoice
Initializes the choice with message and finish reason.
239 240 241 242 |
# File 'lib/durable/llm/providers/xai.rb', line 239 def initialize(choice) @message = XaiMessage.new(choice['message']) @finish_reason = choice['finish_reason'] end |
Instance Attribute Details
#finish_reason ⇒ Object (readonly)
Returns the value of attribute finish_reason.
234 235 236 |
# File 'lib/durable/llm/providers/xai.rb', line 234 def finish_reason @finish_reason end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
234 235 236 |
# File 'lib/durable/llm/providers/xai.rb', line 234 def @message end |
Instance Method Details
#to_s ⇒ String
Converts the choice to a string by returning the message content.
247 248 249 |
# File 'lib/durable/llm/providers/xai.rb', line 247 def to_s @message.to_s end |