Content

public final class Content


Represents content sent to and received from the model.

Content is composed of a one or more heterogeneous parts that can be represent data in different formats, like text or images.

Summary

Nested types

public final class Content.Builder

Builder class to facilitate constructing complex Content objects.

Public fields

final @NonNull List<@NonNull Part>

An ordered list of Part that constitute this content.

final String

The producer of the content.

Public constructors

Content(String role, @NonNull List<@NonNull Part> parts)

Public methods

final @NonNull Content
copy(String role, @NonNull List<@NonNull Part> parts)

Returns a copy of this object, with the provided parameters overwriting the originals.

Public fields

parts

public final @NonNull List<@NonNull Partparts

An ordered list of Part that constitute this content.

role

public final String role

The producer of the content. Must be either "user" or "model". By default, it's "user".

Public constructors

Content

public Content(String role, @NonNull List<@NonNull Part> parts)
Parameters
String role

The producer of the content. Must be either "user" or "model". By default, it's "user".

@NonNull List<@NonNull Part> parts

An ordered list of Part that constitute this content.

Public methods

copy

public final @NonNull Content copy(String role, @NonNull List<@NonNull Part> parts)

Returns a copy of this object, with the provided parameters overwriting the originals.