Class: Durable::Llm::Providers::Google::GoogleResponse

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

Overview

Response object for Google Generative AI API responses.

Wraps the raw response and provides a consistent interface for accessing candidate content and metadata.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ GoogleResponse

Returns a new instance of GoogleResponse.



220
221
222
# File 'lib/durable/llm/providers/google.rb', line 220

def initialize(response)
  @raw_response = response
end

Instance Attribute Details

#raw_responseObject (readonly)

Returns the value of attribute raw_response.



218
219
220
# File 'lib/durable/llm/providers/google.rb', line 218

def raw_response
  @raw_response
end

Instance Method Details

#choicesObject



224
225
226
# File 'lib/durable/llm/providers/google.rb', line 224

def choices
  [GoogleChoice.new(@raw_response['candidates']&.first)]
end

#to_sObject



228
229
230
# File 'lib/durable/llm/providers/google.rb', line 228

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