public class ContentMaker extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
ContentMaker.ContentMakerForRole
Helper class to create content for a given role.
|
| Constructor and Description |
|---|
ContentMaker() |
| Modifier and Type | Method and Description |
|---|---|
static ContentMaker.ContentMakerForRole |
forRole(String role)
Creates a ContentMakerForRole for a given role.
|
static Content |
fromMultiModalData(Object... multiModalData)
Creates a content from an array of Objects, assuming the role is "user".
|
static Content |
fromString(String text)
Creates a content from a string, assuming the role is "user".
|
public static ContentMaker.ContentMakerForRole forRole(String role)
role - Currently accepted role values are: "user", "model". No need to call forRole for
the "user" role since it's the default role.public static Content fromString(String text)
The resulting content will contain one single Part
with its text field set.
To create a text content for "model", use `ContentMaker.forRole("model").fromString(text);
public static Content fromMultiModalData(Object... multiModalData)
The resulting content can contain multiple Parts. Each
element in the array becomes one part.
To create a non-text modality content for any other
multiModalData - 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
Part that has the Text field set.Copyright © 2024 Google LLC. All rights reserved.