Class ContentMaker (1.15.0)

public class ContentMaker

Helper class to create content.

Inheritance

java.lang.Object > ContentMaker

Static Methods

forRole(String role)

public static ContentMaker.ContentMakerForRole forRole(String role)

Creates a ContentMakerForRole for a given role.

Parameter
Name Description
role String

Currently accepted role values are: "user", "model". No need to call forRole for the "user" role since it's the default role.

Returns
Type Description
ContentMaker.ContentMakerForRole

fromMultiModalData(Object[] multiModalData)

public static Content fromMultiModalData(Object[] multiModalData)

Creates a content from an array of Objects, assuming the role is "user".

The resulting content can contain multiple com.google.cloud.vertexai.api.Parts. Each element in the array becomes one part.

To create a non-text modality content for any other

Parameter
Name Description
multiModalData Object[]

an array which contains the actual payload of each part. The element could be either a single String or a Part. When it's a single string, it's converted to a com.google.cloud.vertexai.api.Part that has the Text field set.

Returns
Type Description
Content

fromString(String text)

public static Content fromString(String text)

Creates a content from a string, assuming the role is "user".

The resulting content will contain one single com.google.cloud.vertexai.api.Part with its text field set.

To create a text content for "model", use `ContentMaker.forRole("model").fromString(text);

Parameter
Name Description
text String
Returns
Type Description
Content

Constructors

ContentMaker()

public ContentMaker()