Package com.google.genai.types
Class Content
-
- All Implemented Interfaces:
public abstract class Content extends JsonSerializable
Contains the multi-part content of a message.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public abstract classContent.BuilderBuilder for Content.
-
Field Summary
Fields Modifier and Type Field Description public final static StringMAX_READ_LENGTH_PROPERTY
-
Constructor Summary
Constructors Constructor Description Content()
-
Method Summary
Modifier and Type Method Description abstract Optional<List<Part>>parts()List of parts that constitute a single message. abstract Optional<String>role()Optional. static Content.Builderbuilder()Instantiates a builder for Content. abstract Content.BuildertoBuilder()Creates a builder with the same values as this instance. static ContentfromJson(String jsonString)Deserializes a JSON string to a Content object. static ContentfromParts(Array<Part> parts)Constructs a Content from parts, assuming the role is "user". Stringtext()Returns the concatenation of all text parts in this content. -
Methods inherited from class com.google.genai.JsonSerializable
fromJsonNode, fromJsonString, objectMapper, setMaxReadLength, stringToJsonNode, toJson, toJsonNode, toJsonString -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
parts
abstract Optional<List<Part>> parts()
List of parts that constitute a single message. Each part may have a different IANA MIME type.
-
role
abstract Optional<String> role()
Optional. The producer of the content. Must be either 'user' or 'model'. If not set, the service will default to 'user'.
-
builder
static Content.Builder builder()
Instantiates a builder for Content.
-
toBuilder
abstract Content.Builder toBuilder()
Creates a builder with the same values as this instance.
-
fromParts
static Content fromParts(Array<Part> parts)
Constructs a Content from parts, assuming the role is "user".
-
-
-
-