Class: Google::Genai::Types::Content

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Content

Returns a new instance of Content.



47
48
49
50
# File 'lib/google/genai/types.rb', line 47

def initialize(attributes = {})
  super
  self.parts = Array(self.parts).map { |p| p.is_a?(Part) ? p : Part.new(p) }
end

Instance Attribute Details

#partsObject

Returns the value of attribute parts.



45
46
47
# File 'lib/google/genai/types.rb', line 45

def parts
  @parts
end

#roleObject

Returns the value of attribute role.



45
46
47
# File 'lib/google/genai/types.rb', line 45

def role
  @role
end

Instance Method Details

#to_hObject



52
53
54
55
56
57
# File 'lib/google/genai/types.rb', line 52

def to_h
  {
    role: role,
    parts: parts.map(&:to_h)
  }
end