Class: Durable::Llm::Providers::Mistral::MistralChoice

Inherits:
Object
  • Object
show all
Defined in:
lib/durable/llm/providers/mistral.rb

Overview

Represents a single completion choice from Mistral AI

Contains the message content and finish reason for a completion choice.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(choice) ⇒ MistralChoice

Initializes a new choice object

Parameters:

  • choice (Hash)

    The raw choice data from the API response



289
290
291
292
# File 'lib/durable/llm/providers/mistral.rb', line 289

def initialize(choice)
  @message = MistralMessage.new(choice['message'])
  @finish_reason = choice['finish_reason']
end

Instance Attribute Details

#finish_reasonObject (readonly)

Returns the value of attribute finish_reason.



284
# File 'lib/durable/llm/providers/mistral.rb', line 284

attr_reader :message, :finish_reason

#messageMistralMessage (readonly)

Returns The message object for this choice.

Returns:



284
285
286
# File 'lib/durable/llm/providers/mistral.rb', line 284

def message
  @message
end

Instance Method Details

#to_sString

Returns the text content of the message

Returns:

  • (String)

    The message content



297
298
299
# File 'lib/durable/llm/providers/mistral.rb', line 297

def to_s
  @message.to_s
end