Class: Google::Genai::Types::GenerateContentResponse

Inherits:
Base
  • Object
show all
Defined in:
lib/google/genai/types.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ GenerateContentResponse

Returns a new instance of GenerateContentResponse.



63
64
65
66
# File 'lib/google/genai/types.rb', line 63

def initialize(attributes = {})
  super
  self.candidates = Array(self.candidates).map { |c| c.is_a?(Candidate) ? c : Candidate.new(c) }
end

Instance Attribute Details

#candidatesObject

Returns the value of attribute candidates.



61
62
63
# File 'lib/google/genai/types.rb', line 61

def candidates
  @candidates
end

Instance Method Details

#textObject



68
69
70
# File 'lib/google/genai/types.rb', line 68

def text
  candidates&.first&.content&.parts&.map(&:text)&.join
end