Class: Google::Genai::Types::Content
- Defined in:
- lib/google/genai/types.rb
Instance Attribute Summary collapse
-
#parts ⇒ Object
Returns the value of attribute parts.
-
#role ⇒ Object
Returns the value of attribute role.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Content
constructor
A new instance of Content.
- #to_h ⇒ Object
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
#parts ⇒ Object
Returns the value of attribute parts.
45 46 47 |
# File 'lib/google/genai/types.rb', line 45 def parts @parts end |
#role ⇒ Object
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_h ⇒ Object
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 |