Class Content

java.lang.Object
com.google.genai.JsonSerializable
com.google.genai.types.Content

public abstract class Content extends JsonSerializable
Contains the multi-part content of a message.
  • Constructor Details

    • Content

      public Content()
  • Method Details

    • parts

      public abstract Optional<List<Part>> parts()
      List of parts that constitute a single message. Each part may have a different IANA MIME type.
    • role

      public abstract Optional<String> role()
      Optional. The producer of the content. Must be either 'user' or 'model'. Useful to set for multi-turn conversations, otherwise can be left blank or unset. If role is not specified, SDK will determine the role.
    • builder

      public static Content.Builder builder()
      Instantiates a builder for Content.
    • toBuilder

      public abstract Content.Builder toBuilder()
      Creates a builder with the same values as this instance.
    • fromJson

      public static Content fromJson(String jsonString)
      Deserializes a JSON string to a Content object.