Class: Durable::Llm::Providers::Cohere::CohereStreamResponse

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

Overview

Response object for streaming Cohere chat chunks.

Wraps individual chunks from the Server-Sent Events stream.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parsed) ⇒ CohereStreamResponse

Returns a new instance of CohereStreamResponse.



203
204
205
# File 'lib/durable/llm/providers/cohere.rb', line 203

def initialize(parsed)
  @choices = [CohereStreamChoice.new(parsed['delta'])]
end

Instance Attribute Details

#choicesObject (readonly)

Returns the value of attribute choices.



201
202
203
# File 'lib/durable/llm/providers/cohere.rb', line 201

def choices
  @choices
end

Instance Method Details

#to_sObject



207
208
209
# File 'lib/durable/llm/providers/cohere.rb', line 207

def to_s
  @choices.map(&:to_s).join(' ')
end